/* Ghoti website — hand-written CSS, no build step.
   Theme: dark by default. <html data-theme="light"> switches to the light
   palette; the toggle in site.js sets it and remembers the choice. */

:root {
  color-scheme: dark;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --maxw: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 64px;

  /* dark palette (default) */
  --bg: #07080d;
  --bg-elev: #0e1119;
  --bg-sunk: #0a0c13;
  --text: #eceef4;
  --text-muted: #a3aabb;
  --text-faint: #7d8497;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #2dd4bf;
  --accent-2: #a78bfa;
  --accent-text: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.10);
  --danger: #f87171;
  --ok: #4ade80;
  --glow-1: rgba(45, 212, 191, 0.20);
  --glow-2: rgba(139, 92, 246, 0.22);
  --grid-line: rgba(255, 255, 255, 0.045);
  --code-bg: #0b0e16;
  --code-text: #e6e9f2;
  --code-muted: #8a93a8;
  --code-accent: #5eead4;
  --code-key: #c4b5fd;
  --code-str: #fcd34d;
  --code-err: #fca5a5;
  --code-async: #93c5fd;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 60px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(7, 8, 13, 0.68);
  --chart-bar: #11a99a;
}


:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f8fb;
  --bg-elev: #ffffff;
  --bg-sunk: #eef0f5;
  --text: #0c0f17;
  --text-muted: #4a5163;
  --text-faint: #6b7286;
  --border: rgba(12, 15, 23, 0.10);
  --border-strong: rgba(12, 15, 23, 0.18);
  --accent: #0d9488;
  --accent-2: #6d28d9;
  --accent-text: #0f766e;
  --accent-soft: rgba(13, 148, 136, 0.10);
  --warn: #b45309;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --danger: #b91c1c;
  --ok: #15803d;
  --glow-1: rgba(45, 212, 191, 0.28);
  --glow-2: rgba(139, 92, 246, 0.22);
  --grid-line: rgba(12, 15, 23, 0.06);
  --code-bg: #0f1320;
  --code-text: #e6e9f2;
  --code-muted: #8a93a8;
  --code-accent: #5eead4;
  --code-key: #c4b5fd;
  --code-str: #fcd34d;
  --code-err: #fca5a5;
  --code-async: #93c5fd;
  --shadow: 0 1px 2px rgba(12, 15, 23, 0.06), 0 8px 30px rgba(12, 15, 23, 0.06);
  --header-bg: rgba(247, 248, 251, 0.72);
  --chart-bar: #0d9488;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent-soft); }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--bg-elev); color: var(--text); padding: 8px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; gap: 16px; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; letter-spacing: -0.01em; font-size: 17px; }
.brand img { width: 28px; height: 28px; flex: none; image-rendering: auto; }
.brand .ver { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; color: var(--text-faint); border: 1px solid var(--border); padding: 1px 7px; border-radius: 999px; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.nav a {
  color: var(--text-muted); text-decoration: none; font-size: 14.5px; font-weight: 500;
  padding: 7px 12px; border-radius: 999px; transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); background: var(--accent-soft); }
.nav a[aria-current="page"], .nav a.active { color: var(--text); }
.nav .gh { display: inline-flex; align-items: center; gap: 6px; }
.nav .gh svg { width: 17px; height: 17px; flex: none; }
.theme-toggle {
  display: none; /* shown by JS */
  align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-left: 4px;
  border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.js .theme-toggle { display: inline-flex; }
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .moon { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: block; }
@media (max-width: 520px) {
  .brand .ver { display: none; }
  .nav a { padding: 7px 8px; font-size: 14px; }
  .nav .gh span { display: none; }
  .theme-toggle { width: 34px; height: 34px; }
}
@media (max-width: 370px) { .brand > span { display: none; } .site-header .container { gap: 8px; } .nav a { padding: 6px 6px; font-size: 13.5px; } .theme-toggle { margin-left: 2px; } }

/* ---------- buttons, pills, badges ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px;
  font-weight: 600; font-size: 15px; text-decoration: none; line-height: 1.2;
  border: 1px solid transparent; transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  color: #041311;
  background: linear-gradient(135deg, #5eead4, #2dd4bf 45%, #a78bfa);
  box-shadow: 0 8px 30px -8px rgba(45, 212, 191, .55), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 36px -8px rgba(45, 212, 191, .7), inset 0 1px 0 rgba(255,255,255,.35); text-decoration: none; }
.btn-ghost { color: var(--text); background: var(--bg-elev); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { .btn:hover { transform: none; } }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: color-mix(in srgb, var(--bg-elev) 70%, transparent);
  color: var(--text-muted); font-size: 13px; text-decoration: none;
}
.pill b { font-weight: 600; color: var(--text); background: var(--accent-soft); color: var(--accent-text); padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.pill:hover { border-color: var(--accent); text-decoration: none; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 9px; border-radius: 999px; border: 1px solid; vertical-align: middle; text-transform: uppercase;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge-exp { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.badge-plan { color: var(--text-faint); border-color: var(--border-strong); }

/* ---------- hero ---------- */
.hero { position: relative; padding: clamp(56px, 10vw, 120px) 0 clamp(48px, 7vw, 88px); isolation: isolate; }
.hero-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.hero-bg::before {
  content: ""; position: absolute; inset: -20% -10% auto -10%; height: 120%;
  background:
    radial-gradient(40% 45% at 22% 30%, var(--glow-1), transparent 70%),
    radial-gradient(38% 42% at 78% 22%, var(--glow-2), transparent 70%),
    radial-gradient(30% 30% at 55% 70%, color-mix(in srgb, var(--glow-1) 60%, transparent), transparent 70%);
  filter: blur(10px);
  animation: drift 18s ease-in-out infinite alternate;
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(70% 60% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 30%, #000 30%, transparent 75%);
}
@keyframes drift { from { transform: translate3d(-2%, -1%, 0) scale(1); } to { transform: translate3d(2%, 2%, 0) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .hero-bg::before { animation: none; } }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); align-items: center; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }
.hero h1 {
  font-size: clamp(40px, 6.4vw, 76px); line-height: 1.02; letter-spacing: -0.045em; font-weight: 700;
  margin: 22px 0 20px;
}
.grad {
  background: linear-gradient(120deg, var(--text) 10%, var(--accent) 55%, var(--accent-2) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { font-size: clamp(17px, 1.6vw, 19.5px); color: var(--text-muted); max-width: 36em; margin: 0 0 30px; }
.hero .lede strong { color: var(--text); font-weight: 600; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 28px; color: var(--text-faint); font-size: 13.5px; font-family: var(--font-mono); }
.hero-meta span::before { content: "✓ "; color: var(--accent); }

/* ---------- terminal / code ---------- */
.window {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--code-bg); color: var(--code-text);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.2);
}
.window::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.06), transparent 30%);
}
.window-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.07); font-family: var(--font-mono); font-size: 12px; color: var(--code-muted); }
.window-bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a3f4f; display: inline-block; }
.window-bar i:nth-child(1) { background: #ff5f57; } .window-bar i:nth-child(2) { background: #febc2e; } .window-bar i:nth-child(3) { background: #28c840; }
.window-bar .title { margin-left: 8px; }
.window-tabs { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .window-tabs { grid-template-columns: 1fr; } }
.window-tabs > div + div { border-left: 1px solid rgba(255,255,255,.07); }
@media (max-width: 640px) { .window-tabs > div + div { border-left: 0; border-top: 1px solid rgba(255,255,255,.07); } }
.pane-label { font-family: var(--font-mono); font-size: 11.5px; color: var(--code-muted); padding: 12px 18px 0; text-transform: uppercase; letter-spacing: .06em; }

pre, code { font-family: var(--font-mono); }
code { font-size: .9em; background: var(--bg-sunk); border: 1px solid var(--border); padding: .1em .38em; border-radius: 6px; overflow-wrap: anywhere; }
pre {
  position: relative;
  margin: 0 0 1.4em; padding: 16px 18px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-text);
  border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.7; tab-size: 2;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; }
.window pre { border: 0; border-radius: 0; margin: 0; background: transparent; padding: 14px 18px 18px; }
pre .k { color: var(--code-key); }          /* yaml key / command */
pre .s { color: var(--code-str); }          /* string / value */
pre .c { color: var(--code-muted); font-style: italic; } /* comment */
pre .p { color: var(--code-muted); user-select: none; } /* prompt marker */
pre .in { color: var(--code-text); }        /* sent by client */
pre .v { color: var(--code-accent); }       /* value response */
pre .e { color: var(--code-err); }          /* error response */
pre .a { color: var(--code-async); }        /* async event */
pre[data-lang]::after {
  content: attr(data-lang); position: absolute; top: 8px; right: 12px;
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--code-muted);
}
.js pre[data-lang]::after { display: none; }
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  font: 600 11.5px/1 var(--font-sans); color: var(--code-muted);
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  padding: 6px 9px; border-radius: 7px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }
.copy-btn:hover { color: var(--code-text); }

/* ---------- sections ---------- */
.section { padding: clamp(56px, 8vw, 104px) 0; position: relative; }
.section-head { max-width: 720px; margin-bottom: clamp(28px, 4vw, 48px); }
.eyebrow { font-family: var(--font-mono); font-size: 12.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent-text); margin: 0 0 14px; }
.section h2, .h2 { font-size: clamp(30px, 4vw, 46px); line-height: 1.08; letter-spacing: -0.035em; margin: 0 0 16px; font-weight: 700; }
.section-head p { color: var(--text-muted); font-size: 17.5px; margin: 0; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); border: 0; margin: 0; }

/* bento cards */
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.bento .card:nth-child(1) { grid-column: span 4; }
.bento .card:nth-child(2) { grid-column: span 2; }
.bento .card:nth-child(3) { grid-column: span 2; }
.bento .card:nth-child(4) { grid-column: span 4; }
@media (max-width: 900px) { .bento { grid-template-columns: minmax(0, 1fr); } .bento .card:nth-child(n) { grid-column: auto; } }

.card {
  position: relative; display: flex; flex-direction: column;
  padding: 26px; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-elev) 92%, transparent), var(--bg-elev));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden; isolation: isolate;
  transition: border-color .25s, transform .25s;
}
.card::before {
  content: ""; position: absolute; z-index: -1; inset: -1px; border-radius: inherit; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), var(--accent-soft), transparent 45%);
}
.card:hover { border-color: var(--border-strong); }
.card:hover::before { opacity: 1; }
.card h3 { font-size: 21px; letter-spacing: -0.02em; line-height: 1.25; margin: 14px 0 8px; }
.card p { color: var(--text-muted); margin: 0 0 14px; }
.card .kind { display: flex; flex-wrap: wrap; gap: 6px; }
.card .kind code { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; font-size: 12.5px; }
.card .caveat { font-size: 14px; color: var(--text-faint); border-top: 1px dashed var(--border-strong); padding-top: 12px; margin-top: auto; }
.card .more { margin-top: 14px; font-weight: 600; font-size: 14.5px; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.card .more:hover { text-decoration: underline; }
.card .icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.card .icon svg { width: 22px; height: 22px; }
.card .viz { margin: 4px 0 18px; }

/* mini visualisations inside cards */
.meter { display: flex; gap: 4px; align-items: flex-end; height: 54px; }
.meter span { flex: 1; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 30%, transparent)); opacity: .85; }
.meter span.off { background: var(--border-strong); opacity: .6; }
.lease { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 13px; }
.lease .bar { flex: 1; height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.lease .bar i { display: block; height: 100%; width: 68%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); animation: lease 6s linear infinite; }
@keyframes lease { from { width: 100%; } to { width: 0%; } }
@media (prefers-reduced-motion: reduce) { .lease .bar i { animation: none; } }
.counter { font-family: var(--font-mono); font-size: 34px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.counter small { font-size: 13px; color: var(--text-faint); font-weight: 500; margin-left: 8px; }
.fanout { display: grid; grid-template-columns: auto 1fr; gap: 12px 18px; align-items: center; }
.fanout .src { font-family: var(--font-mono); font-size: 12.5px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg-sunk); white-space: nowrap; }
.fanout .dst { display: flex; flex-wrap: wrap; gap: 8px; }
.fanout .dst span { font-family: var(--font-mono); font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); }
.fanout .dst span.hit { border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent-text); background: var(--accent-soft); }

/* slot grid visual */
.slot-panel { position: relative; }
.slot-grid { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 5px; padding: 22px; }
.slot-grid i { aspect-ratio: 1; border-radius: 4px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.04); }
.slot-grid i.t { background: #2dd4bf; box-shadow: 0 0 14px rgba(45,212,191,.55); }
.slot-grid i.m { background: #a78bfa; box-shadow: 0 0 14px rgba(167,139,250,.5); }
.slot-grid i.n { background: #fcd34d; box-shadow: 0 0 14px rgba(252,211,77,.45); }
.slot-grid i.b { background: #93c5fd; box-shadow: 0 0 14px rgba(147,197,253,.5); }
.slot-grid i.pulse { animation: pulse 3.2s ease-in-out infinite; }
.slot-grid i.pulse:nth-child(3n) { animation-delay: .8s; } .slot-grid i.pulse:nth-child(4n) { animation-delay: 1.6s; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .slot-grid i.pulse { animation: none; } }
.slot-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 0 22px 20px; font-family: var(--font-mono); font-size: 12px; color: var(--code-muted); }
.slot-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; background: var(--c); vertical-align: -1px; }

/* demo section */
.demo { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 20px; align-items: start; }
@media (max-width: 960px) { .demo { grid-template-columns: minmax(0, 1fr); } }
.demo-notes { margin-top: 18px; display: grid; gap: 10px; }
.demo-notes p { margin: 0; color: var(--text-muted); font-size: 14.5px; padding-left: 14px; border-left: 2px solid var(--border-strong); }
.demo-notes code { font-size: 12.5px; }

/* routes */
.routes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.route { text-decoration: none; color: var(--text); }
.route:hover { text-decoration: none; transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .route:hover { transform: none; } }
.route h3 { display: flex; align-items: center; justify-content: space-between; }
.route h3 span { color: var(--accent-text); transition: transform .2s; }
.route:hover h3 span { transform: translateX(4px); }
.route ul { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 4px; color: var(--text-muted); font-size: 14.5px; }
.route li::before { content: "→ "; color: var(--text-faint); }

/* cta band */
.cta-band {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: 28px; padding: clamp(32px, 6vw, 64px);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  text-align: center;
}
.cta-band::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(60% 90% at 50% 0%, var(--glow-1), transparent 70%), radial-gradient(40% 60% at 90% 100%, var(--glow-2), transparent 70%);
}
.cta-band h2 { margin-bottom: 12px; }
.cta-band p { color: var(--text-muted); margin: 0 auto 26px; max-width: 34em; }
.cta-band .cta-row { justify-content: center; }
.cta-band pre { text-align: left; max-width: 640px; margin: 0 auto 26px; }

/* reveal on scroll — only hidden when JS is present */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .reveal.d1 { transition-delay: .08s; } .js .reveal.d2 { transition-delay: .16s; } .js .reveal.d3 { transition-delay: .24s; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0 48px; margin-top: 40px; color: var(--text-faint); font-size: 14px; }
.site-footer .cols { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 28px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.site-footer nav div { display: grid; gap: 6px; align-content: start; }
.site-footer nav b { color: var(--text-muted); font-weight: 600; font-size: 13px; }
.site-footer a { color: var(--text-faint); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.site-footer .fine { margin-top: 28px; }

/* ---------- docs layout ---------- */
.docs-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr) 210px; gap: 44px; align-items: start; padding-top: 36px; }
@media (max-width: 1180px) { .docs-shell { grid-template-columns: 232px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 860px) { .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; } }

.sidebar { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; padding-bottom: 24px; }
.sidebar .m-nav { display: none; }
.sidebar .group { margin-bottom: 22px; }
.sidebar .group-title { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .09em; color: var(--text-faint); margin: 0 0 8px 10px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.sidebar a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 8px; color: var(--text-muted); text-decoration: none; font-size: 14.5px; }
.sidebar a:hover { color: var(--text); background: var(--accent-soft); }
.sidebar a[aria-current="page"] { color: var(--accent-text); background: var(--accent-soft); font-weight: 600; }
.sidebar .tag { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 999px; padding: 0 6px; }
@media (max-width: 860px) {
  .sidebar { position: static; max-height: none; overflow: visible; padding: 0; }
  .sidebar .d-nav { display: none; }
  .sidebar .m-nav { display: block; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
  .sidebar .m-nav > summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; font-size: 15px; list-style: none; }
  .sidebar .m-nav > summary::-webkit-details-marker { display: none; }
  .sidebar .m-nav > summary span { color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; }
  .sidebar .m-nav > summary b { font-weight: 600; }
  .sidebar .m-nav > summary::after { content: "▾"; margin-left: auto; color: var(--text-faint); transition: transform .2s; }
  .sidebar .m-nav[open] > summary::after { transform: rotate(180deg); }
  .sidebar .m-nav > .groups { padding: 4px 8px 12px; }
}

.toc { position: sticky; top: calc(var(--header-h) + 24px); font-size: 13.5px; max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; }
.toc p { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .09em; color: var(--text-faint); margin: 0 0 10px; }
.toc ul { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 1px solid var(--border); display: grid; gap: 6px; }
.toc a { color: var(--text-muted); text-decoration: none; display: block; line-height: 1.4; }
.toc a:hover, .toc a.active { color: var(--accent-text); }

/* ---------- prose ---------- */
.prose { min-width: 0; max-width: 780px; padding-bottom: 40px; }
.prose .crumbs { font-size: 13.5px; color: var(--text-faint); margin-bottom: 10px; }
.prose .crumbs a { color: var(--text-faint); text-decoration: none; }
.prose .crumbs a:hover { color: var(--text); }
.prose h1 { font-size: clamp(32px, 4.4vw, 44px); line-height: 1.1; letter-spacing: -0.035em; margin: 0 0 14px; }
.prose .lead { font-size: 18.5px; color: var(--text-muted); margin: 0 0 30px; }
.prose h2, .prose h3 { overflow-wrap: anywhere; }
.prose h2 { font-size: 26px; letter-spacing: -0.025em; line-height: 1.25; margin: 48px 0 14px; padding-top: 4px; }
.prose h3 { font-size: 19.5px; letter-spacing: -0.015em; margin: 32px 0 10px; }
.prose h4 { font-size: 16px; margin: 24px 0 8px; }
.prose h2 .anchor, .prose h3 .anchor { margin-left: 8px; color: var(--text-faint); text-decoration: none; opacity: 0; font-weight: 400; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose li { margin: .3em 0; }
.prose li > p { margin: 0; }
.prose strong { font-weight: 650; }
.prose hr { border: 0; height: 1px; background: var(--border); margin: 40px 0; }
.prose img { border-radius: var(--radius); }

.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.prose th, .prose td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { font-weight: 650; font-size: 13px; color: var(--text-muted); background: var(--bg-sunk); white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }
.prose td.wrap code { white-space: normal; }

.callout { margin: 0 0 1.4em; padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elev); border-left: 3px solid var(--accent); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout .title { display: block; font-weight: 650; margin-bottom: 4px; }
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.danger { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
.pager a { display: block; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); background: var(--bg-elev); }
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--text-faint); font-size: 12.5px; }
.pager .next { text-align: right; grid-column: 2; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: auto; } }

.page-meta { margin-top: 40px; font-size: 13.5px; color: var(--text-faint); }

/* doc landing cards */
.doc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; margin: 0 0 1.6em; }
.doc-cards a { display: block; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); text-decoration: none; }
.doc-cards a:hover { border-color: var(--accent); }
.doc-cards b { display: block; margin-bottom: 2px; }
.doc-cards span { color: var(--text-muted); font-size: 14px; }

/* ---------- blog ---------- */
.blog-head { padding: clamp(48px, 8vw, 88px) 0 20px; }
.blog-head h1 { font-size: clamp(36px, 5vw, 56px); letter-spacing: -0.04em; line-height: 1.05; margin: 0 0 12px; }
.blog-head p { color: var(--text-muted); max-width: 40em; font-size: 17.5px; margin: 0; }
.post-list { display: grid; gap: 16px; padding: 20px 0 40px; }
.post-card { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elev); text-decoration: none; color: var(--text); }
.post-card:hover { border-color: var(--accent); }
@media (max-width: 640px) { .post-card { grid-template-columns: 1fr; gap: 8px; } }
.post-card time { font-family: var(--font-mono); font-size: 13px; color: var(--text-faint); }
.post-card h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.02em; line-height: 1.3; }
.post-card p { margin: 0; color: var(--text-muted); }
.post { max-width: 760px; margin: 0 auto; padding: clamp(40px, 7vw, 72px) 0 40px; }
.post header { margin-bottom: 36px; }
.post header h1 { font-size: clamp(32px, 5vw, 50px); }
.post .meta { font-family: var(--font-mono); font-size: 13px; color: var(--text-faint); display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* 404 */
.notfound { text-align: center; padding: clamp(80px, 14vw, 160px) 0; }
.notfound .code { font-family: var(--font-mono); font-size: clamp(64px, 14vw, 140px); font-weight: 700; letter-spacing: -0.05em; line-height: 1; }
.notfound p { color: var(--text-muted); }
.notfound .cta-row { justify-content: center; margin-top: 24px; }
.card .more-row { display: flex; flex-wrap: wrap; gap: 0 22px; }

/* ---------- benchmarks ---------- */
.bench-hero h1 { max-width: 15em; }
.bench-hero .lede { max-width: 44em; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 36px; }
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .stats { grid-template-columns: minmax(0, 1fr); } }
.stat { padding: 22px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: color-mix(in srgb, var(--bg-elev) 85%, transparent); backdrop-filter: blur(6px); }
.stat-value { margin: 0 0 6px; white-space: nowrap; font-size: clamp(30px, 3vw, 40px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; color: var(--text); }
.stat-value span { font-size: .42em; font-weight: 600; letter-spacing: 0; color: var(--accent-text); }
.stat-label { margin: 0 0 8px; font-weight: 600; font-size: 15px; line-height: 1.4; }
.stat-note { margin: 0; color: var(--text-faint); font-size: 13.5px; line-height: 1.5; }

.setup { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: center; }
@media (max-width: 860px) { .setup { grid-template-columns: minmax(0, 1fr); } .setup-link span { transform: rotate(0); } }
.setup .card h3 { font-family: var(--font-mono); margin-top: 0; }
.setup .card .eyebrow { margin-bottom: 6px; }
.setup-link { text-align: center; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint); }
.setup-link span { display: inline-block; padding: 8px 14px; border: 1px dashed var(--border-strong); border-radius: 999px; }
.method { margin: 28px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px 28px; }
.method li { color: var(--text-muted); font-size: 15px; padding-left: 16px; border-left: 2px solid var(--border-strong); }
.method strong { color: var(--text); }

.charts-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .charts-2 { grid-template-columns: minmax(0, 1fr); } }
.chart { margin: 0; }
.chart figcaption h3 { margin: 0 0 2px; font-size: 17px; }
.chart figcaption p { margin: 0 0 18px; font-size: 13.5px; color: var(--text-faint); }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 148px minmax(0, 1fr) 76px; gap: 12px; align-items: center; font-size: 13.5px; }
@media (max-width: 520px) {
  .bar-row { grid-template-columns: minmax(0, 1fr) 64px; grid-template-areas: "label label" "track value"; gap: 2px 8px; font-size: 12.5px; }
  .bar-row .bar-label { grid-area: label; }
  .bar-row .bar-track { grid-area: track; }
  .bar-row .bar-value { grid-area: value; }
  .bar-row.axis { grid-template-areas: "track value"; }
  .bar-row.axis > span:first-child { display: none; }
  .bar-row.axis .ticks { grid-area: track; }
  .bar-row.axis .bar-unit { grid-area: value; }
}
.bar-label { font-family: var(--font-mono); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track {
  position: relative; height: 22px; display: flex; align-items: center;
  background-image: linear-gradient(to right, var(--border) 1px, transparent 1px);
  background-size: calc(100% / (var(--ticks) - 1) - 0.01px) 100%;
  border-right: 1px solid var(--border);
}
.bar { display: block; height: 12px; border-radius: 0 4px 4px 0; background: var(--chart-bar); transform-origin: left; }
.js .reveal .bar { transform: scaleX(0); transition: transform .9s cubic-bezier(.2,.7,.2,1) .15s; }
.js .reveal.is-visible .bar { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) { .js .reveal .bar { transform: none; transition: none; } }
.bar-row:hover .bar { filter: brightness(1.12); }
.bar-row:hover .bar-label, .bar-row:hover .bar-value { color: var(--text); }
.bar-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text); text-align: right; }
.bar-row.axis { margin-top: 2px; }
.ticks { position: relative; height: 16px; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ticks span:first-child { transform: none; }
.ticks span:last-child { transform: translateX(-100%); }
.bar-unit { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); text-align: right; }

table.num { width: 100%; border-collapse: collapse; font-size: 14px; }
table.num th, table.num td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.num th { font-size: 12.5px; font-weight: 650; color: var(--text-muted); background: var(--bg-sunk); }
table.num th:first-child, table.num td:first-child { text-align: left; font-family: var(--font-mono); font-size: 13px; }
table.num tr:last-child td { border-bottom: 0; }
.fine-print { color: var(--text-faint); font-size: 13.5px; margin: 10px 0 0; }
.scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 10px 28px; margin-top: 18px; }
.scenarios p { margin: 0; color: var(--text-muted); font-size: 14px; }
.scenarios code { font-size: 12.5px; }
.inside { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 32px; align-items: center; }
.inside .section-head { margin-bottom: 0; }
.inside .section-head p + p { margin-top: 12px; }
@media (max-width: 960px) { .inside { grid-template-columns: minmax(0, 1fr); } }
.checks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .checks { grid-template-columns: minmax(0, 1fr); } }
.checks h3 { margin-top: 0; display: flex; align-items: center; gap: 10px; }
.checks h3::before { content: "✓"; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 13px; color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }

/* homepage performance strip */
.perf { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: center; }
@media (max-width: 960px) { .perf { grid-template-columns: minmax(0, 1fr); } }
.perf .stats { margin-top: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .perf .stats { grid-template-columns: minmax(0, 1fr); } }

/* homepage: how it works */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; counter-reset: none; }
@media (max-width: 900px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.steps .card h3 { margin-top: 12px; }
.steps .card p { margin-bottom: 0; }
.step-num { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-family: var(--font-mono); font-weight: 700; color: var(--accent-text); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }

/* homepage: transcript legend */
.legend-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.legend-row span { font-size: 13.5px; color: var(--text-muted); padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-elev); }
.legend-row b { font-family: var(--font-mono); color: var(--accent-text); }
.legend-row code { font-size: 12px; }
.demo-notes b { color: var(--text); font-weight: 600; }

/* homepage: the test server in perspective */
.machine { margin-top: 28px; padding: 22px 24px; border-radius: var(--radius-lg); border: 1px dashed var(--border-strong); }
.machine-title { margin: 0 0 14px; font-family: var(--font-mono); font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); }
.machine-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 28px; }
@media (max-width: 700px) { .machine-grid { grid-template-columns: minmax(0, 1fr); } }
.machine-value { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.machine-label { margin: 0 0 4px; font-weight: 600; font-size: 14.5px; color: var(--text-muted); }
.machine-note { margin: 0; font-size: 13.5px; color: var(--text-faint); }

/* homepage: animated transcript */
.demo-toggle {
  margin-left: auto; font: 600 11.5px/1 var(--font-sans); color: var(--code-muted);
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
}
.demo-toggle:hover { color: var(--code-text); }
.is-animated .demo-line { display: inline; }
.is-animated .demo-line.arrive > span:last-child { animation: arrive .7s ease-out; border-radius: 3px; }
@keyframes arrive { from { background: rgba(94, 234, 212, .22); } to { background: transparent; } }
.is-animated .demo-line.typing > span:last-child::after { content: "▍"; color: var(--code-accent); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.demo-notes p { transition: border-color .3s, background .3s, color .3s; border-radius: 0 8px 8px 0; }
.demo-notes p.is-active { border-left-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* homepage: hero tagline */
.home-hero h1 { font-size: clamp(36px, 5.2vw, 64px); }
.tagline { font-size: clamp(18px, 1.8vw, 22px); font-weight: 600; color: var(--text); margin: 0 0 14px; letter-spacing: -0.01em; }

/* homepage: evidence strip */
.evidence { padding: 0 0 clamp(24px, 4vw, 48px); margin-top: -12px; }
.evidence-strip {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 24px; align-items: center;
  padding: 18px 24px; border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%), var(--bg-elev);
  color: var(--text-muted); text-decoration: none; transition: border-color .2s, transform .2s;
}
.evidence-strip:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { .evidence-strip:hover { transform: none; } }
.evidence-figure { font-size: clamp(26px, 3vw, 34px); font-weight: 700; letter-spacing: -0.03em; color: var(--text); white-space: nowrap; }
.evidence-figure small { font-size: .5em; font-weight: 600; letter-spacing: 0; color: var(--accent-text); }
.evidence-text { font-size: 15px; line-height: 1.5; }
.evidence-text b { color: var(--text); font-weight: 600; }
.evidence-link { font-weight: 600; font-size: 14.5px; color: var(--accent-text); white-space: nowrap; }
@media (max-width: 860px) { .evidence-strip { grid-template-columns: minmax(0, 1fr); } }

/* homepage: learning entrance */
.learn-link {
  display: grid; gap: 4px; margin-top: 20px; padding: 18px 22px; border-radius: var(--radius-lg);
  border: 1px dashed var(--border-strong); color: var(--text-muted); text-decoration: none;
  transition: border-color .2s, background .2s;
}
.learn-link:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.learn-kicker { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-text); }
.learn-title { font-size: 18px; font-weight: 650; color: var(--text); letter-spacing: -0.01em; }
.learn-desc { font-size: 14.5px; }
.home-hero .hero-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
@media (max-width: 960px) { .home-hero .hero-grid { grid-template-columns: minmax(0, 1fr); } }
.home-hero h1 { font-size: clamp(36px, 4.6vw, 58px); }
.cta-band .cta-step { margin: -8px auto 12px; font-size: 15px; }
.cta-band pre + .cta-step + pre { margin-bottom: 26px; }
