/* Colour roles, type and page layout. Chart colours follow the validated palette. */
:root {
  color-scheme: light;
  --label-0: #2a78d6; --label-1: #eb6834; --label-2: #1baf7a; --label-3: #c98500; --label-4: #e87ba4; --label-5: #6250d6; --label-6: #e34948; --label-7: #0f9db3; --label-8: #7f9f12; --label-9: #b04fbd;
  --surface-0: #f6f5f2; --surface-1: #fcfcfb; --surface-2: #efeeea; --line: #dddcd6;
  --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #6f6e68;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #8e4ec6;
  --accent: #256abf; --on-accent: #ffffff; --good: #0a7a4a; --bad: #c7322f; --warn: #a06400;
  --seq-low: #e3eefb; --seq-high: #104281; --seq-ink-high: #ffffff; --img-filter: none; --img-border: var(--line); --pad-ink: #000000; --pad-paper: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --label-0: #3987e5; --label-1: #d95926; --label-2: #199e70; --label-3: #c98500; --label-4: #d0628d; --label-5: #8a7bea; --label-6: #e34948; --label-7: #1a9db1; --label-8: #7f9c20; --label-9: #c05fc7;
    --surface-0: #121211; --surface-1: #1a1a19; --surface-2: #262624; --line: #383835;
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #9c9b91;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #a06ee0;
    --accent: #6da7ec; --on-accent: #0b0b0b; --good: #4cc38a; --bad: #f07a78; --warn: #e0a83c;
    --seq-low: #1f2a38; --seq-high: #9ec5f4; --seq-ink-high: #0b0b0b; --pad-ink: #ffffff; --pad-paper: #0d0d0c; --img-filter: invert(1); --img-border: #c7c7ca;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --label-0: #3987e5; --label-1: #d95926; --label-2: #199e70; --label-3: #c98500; --label-4: #d0628d; --label-5: #8a7bea; --label-6: #e34948; --label-7: #1a9db1; --label-8: #7f9c20; --label-9: #c05fc7;
  --surface-0: #121211; --surface-1: #1a1a19; --surface-2: #262624; --line: #383835;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #9c9b91;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #a06ee0;
  --accent: #6da7ec; --on-accent: #0b0b0b; --good: #4cc38a; --bad: #f07a78; --warn: #e0a83c;
  --seq-low: #1f2a38; --seq-high: #9ec5f4; --seq-ink-high: #0b0b0b; --pad-ink: #ffffff; --pad-paper: #0d0d0c; --img-filter: invert(1); --img-border: #c7c7ca;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--surface-0); color: var(--text-primary);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh;
}
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 650; }
h1 { font-size: 30px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin-bottom: 12px; }
h3 { font-size: 14px; margin: 14px 0 6px; }
p { margin: 0 0 10px; }
a { color: var(--accent); }
.card a { overflow-wrap: anywhere; }   /* long URLs wrap inside a card on a phone */
code { font: 13px ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

#nav {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 16px;
  background: var(--surface-1); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; font-size: 18px; font-weight: 700; color: var(--text-primary); text-decoration: none; }
.brand-icon { width: 28px; height: 28px; border-radius: 6px; margin-right: 8px; }
.brand span { color: var(--text-muted); font-weight: 500; margin-left: 6px; }
.nav-group { margin-bottom: 16px; }
.nav-title { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 6px; }
#nav nav a { display: block; padding: 6px 10px; border-radius: 7px; color: var(--text-secondary); text-decoration: none; font-size: 14px; }
#nav nav a:hover { background: var(--surface-2); }
#nav nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.nav-foot { margin-top: auto; }
.frozen-note { margin: 0; padding: 8px 10px; border-radius: 7px; background: var(--surface-2); color: var(--text-secondary); font-size: 12.5px; line-height: 1.45; }
.frozen-note code { font-size: 12px; }

main { padding: 34px clamp(16px, 4vw, 48px) 64px; max-width: 2000px; width: 100%; }
.page-head { margin-bottom: 22px; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.lede { font-size: 16px; color: var(--text-secondary); max-width: 74ch; margin-top: 8px; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid.side { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); }

@media (max-width: 860px) {
  body { display: block; }
  #nav { position: static; height: auto; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); gap: 8px; }
  #nav nav { display: flex; gap: 12px; overflow-x: auto; }
  .nav-group { display: flex; gap: 4px; align-items: center; margin: 0; flex: none; }
  .nav-title { display: none; }
  #nav nav a { white-space: nowrap; }
  .grid.side { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 25px; }
}
