/* Kroma documentation: one static page, no framework, no external assets. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f5f4f1;
  --surface-strong: #ebe8e2;
  --text: #1a1917;
  --muted: #4d4a45;
  --border: #d6d2ca;
  --link: #8a2d1f;
  --link-hover: #5e1d13;
  --focus: #1f5fbf;
  --note-bg: #eef3fb;
  --note-border: #2f5d9e;
  --warn-bg: #fdf1e7;
  --warn-border: #a4470b;
  --code-bg: #f1efeb;
  --radius: 6px;
  --sidebar: 280px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --surface: #1f1e1b;
    --surface-strong: #2a2825;
    --text: #f2efe9;
    --muted: #c7c2b8;
    --border: #3d3a35;
    --link: #f0a58f;
    --link-hover: #ffc9b8;
    --focus: #8ab4f8;
    --note-bg: #17233a;
    --note-border: #7ea6e0;
    --warn-bg: #36200f;
    --warn-border: #f0a060;
    --code-bg: #26241f;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--link-hover);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 8px 14px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 12px;
  color: var(--bg);
}

/* ---------- Page header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 16px 24px;
}

.site-header__eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: 1.2;
}

.site-header__lead {
  max-width: 70ch;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.0625rem;
}

.site-header__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.button {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  background: var(--muted);
  border-color: var(--muted);
  color: var(--bg);
}

.button--outline {
  background: transparent;
  color: var(--text);
}

.button--outline:hover {
  background: var(--surface-strong);
  color: var(--text);
  border-color: var(--text);
}

/* ---------- Layout ---------- */

.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
}

main {
  min-width: 0;
  max-width: 78ch;
  padding-bottom: 64px;
}

@media (min-width: 1000px) {
  .layout {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    gap: 48px;
    padding: 0 24px;
  }
}

/* ---------- Table of contents ---------- */

.toc {
  margin: 20px 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.toc > summary {
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
}

.toc nav {
  padding: 0 16px 16px;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc ol ol {
  margin: 2px 0 6px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 5px 0;
  color: var(--text);
  line-height: 1.35;
  text-decoration: none;
}

.toc > nav > ol > li > a {
  font-weight: 600;
}

.toc ol ol a {
  color: var(--muted);
  font-size: 0.9375rem;
}

.toc a:hover {
  color: var(--link);
  text-decoration: underline;
}

@media (min-width: 1000px) {
  .toc {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    margin: 0;
    padding: 24px 0;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    overscroll-behavior: contain;
  }

  .toc > summary {
    display: none;
  }

  .toc nav {
    padding: 0 8px 0 0;
  }

  .toc__title {
    display: block;
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
}

@media (max-width: 999px) {
  .toc__title {
    display: none;
  }
}

/* ---------- Content ---------- */

section {
  padding-top: 8px;
}

h2,
h3,
h4 {
  position: relative;
  line-height: 1.3;
  scroll-margin-top: 16px;
}

h2 {
  margin: 56px 0 16px;
  padding-top: 24px;
  border-top: 2px solid var(--border);
  font-size: 1.625rem;
}

section:first-of-type > h2 {
  margin-top: 32px;
}

h3 {
  margin: 36px 0 12px;
  font-size: 1.25rem;
}

h4 {
  margin: 28px 0 8px;
  font-size: 1.0625rem;
}

[id] {
  scroll-margin-top: 16px;
}

p,
ul,
ol,
dl,
table {
  margin: 0 0 16px;
}

ul,
ol {
  padding-left: 1.4em;
}

li + li {
  margin-top: 4px;
}

.anchor {
  margin-left: 8px;
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
}

h2:hover .anchor,
h3:hover .anchor,
h4:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .anchor {
    opacity: 0.6;
  }
}

.ui {
  font-weight: 650;
}

.path {
  font-weight: 600;
  white-space: normal;
}

code,
kbd {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 0.9em;
}

pre {
  margin: 0 0 16px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  font-size: 0.9375rem;
  line-height: 1.5;
}

pre code {
  padding: 0;
  background: none;
}

dl dt {
  margin-top: 14px;
  font-weight: 700;
}

dl dd {
  margin: 4px 0 0;
}

/* Tables scroll on their own on small screens, the page never does. */
.table-wrap {
  margin: 0 0 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

caption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: left;
}

th,
td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

thead th {
  border-top: 0;
  background: var(--surface);
  font-size: 0.875rem;
  white-space: nowrap;
}

tbody th {
  font-weight: 650;
}

/* ---------- Callouts ---------- */

.callout {
  margin: 0 0 20px;
  padding: 14px 16px;
  border-left: 4px solid var(--note-border);
  border-radius: var(--radius);
  background: var(--note-bg);
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout__title {
  margin: 0 0 6px;
  font-weight: 700;
}

.callout--warning {
  border-left-color: var(--warn-border);
  background: var(--warn-bg);
}

/* ---------- FAQ ---------- */

.faq {
  margin: 0 0 20px;
}

.faq details {
  border-bottom: 1px solid var(--border);
}

.faq details:first-child {
  border-top: 1px solid var(--border);
}

.faq summary {
  padding: 14px 0;
  font-weight: 650;
  cursor: pointer;
}

.faq details > :not(summary) {
  margin-left: 18px;
}

.faq details[open] {
  padding-bottom: 8px;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9375rem;
}

.site-footer__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 16px 32px;
}

.site-footer p {
  margin: 0 0 6px;
}

/* ---------- Print ---------- */

@media print {
  .toc,
  .skip-link,
  .anchor,
  .site-header__links {
    display: none !important;
  }

  .layout {
    display: block;
  }

  main {
    max-width: none;
  }

  .faq details > :not(summary) {
    display: block;
  }

  a {
    color: inherit;
  }
}
