/* ThinRouter — scrollytelling presentation. Dark-only.
   Tokens copied from ../styles.css (dark block) so this page can diverge
   from the marketing site without touching it. */

:root {
  --font-heading: 'Archivo', system-ui, sans-serif;
  --font-body: 'Archivo', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --maxw: 1120px;

  --bg: #0c0c0e;
  --surface: #141417;
  --surface-2: #1c1c21;
  --surface-3: #232329;
  --text: #ececee;
  --text-dim: #96969c;
  --text-faint: #63636a;
  --divider: color-mix(in srgb, #ececee 12%, transparent);
  --divider-strong: color-mix(in srgb, #ececee 22%, transparent);
  --accent: #ec3013;
  --accent-soft: color-mix(in srgb, #ec3013 16%, transparent);
  --warn: #e6a90a;
  --danger: #ff4436;
  --sem-1: #2c6b68; --sem-2: #1f9184; --sem-3: #16b39a; --sem-4: #3ad6b2; --sem-5: #7bf0d6;
  --window-shadow: 0 24px 60px -30px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: #fff; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--font-mono); }
.dim { color: var(--text-dim); }
.accent { color: var(--accent); }

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 14px;
}
h1, h2, h3 { font-family: var(--font-heading); letter-spacing: -0.02em; line-height: 1.08; margin: 0; }
h1 { font-size: clamp(38px, 6vw, 72px); font-weight: 900; }
h1 em, h2 em { font-style: normal; color: var(--accent); }
h2 { font-size: clamp(28px, 4vw, 44px); font-weight: 800; }
h3 { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.lead { color: var(--text-dim); font-size: clamp(16px, 1.6vw, 19px); max-width: 62ch; }
.lead b { color: var(--text); font-weight: 600; }

/* ── progress bar ─────────────────────────────────────── */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; background: transparent; }
.progress i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

/* ── nav ──────────────────────────────────────────────── */
.nav { position: fixed; top: 2px; left: 0; right: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--divider); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.brand svg { display: block; color: var(--text); }
.wordmark { display: inline-flex; align-items: baseline; font-family: var(--font-heading); letter-spacing: -0.02em; }
.wm-thin { font-weight: 300; }
.wm-slash { color: var(--accent); font-weight: 400; padding: 0 1px; }
.wm-router { font-weight: 800; }
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-links a { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); }
.nav-links a:hover { color: var(--text); }
.audio-btn {
  font-size: 12px; background: none; border: 1px solid var(--divider-strong);
  color: var(--text-dim); padding: 6px 12px; cursor: pointer;
}
.audio-btn:hover { color: var(--text); border-color: var(--text); }
.audio-btn.on { color: var(--accent); border-color: var(--accent); }
html:not(.js) .audio-btn { display: none; }

/* ── scenes ───────────────────────────────────────────── */
.scene { min-height: 100vh; display: flex; align-items: center; padding: 120px 0; }
.scene > .wrap { width: 100%; }

.scene-title { text-align: center; position: relative; }
.scene-title .lead { margin: 22px auto 0; }
.scene-title .kicker { margin-bottom: 22px; }
.scroll-cue { position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--text-faint); letter-spacing: .16em; text-transform: uppercase; line-height: 1.9; }

/* ── scene 1 · cost chart ─────────────────────────────── */
.chart-fig { margin: 48px 0 0; }
.chart-readout { font-size: clamp(26px, 3.4vw, 40px); font-weight: 700; margin-bottom: 18px; }
.chart-readout .dim { font-size: .55em; font-weight: 400; }
.cost-chart { width: 100%; max-width: 760px; height: auto; }
.cost-chart .axis { stroke: var(--divider-strong); stroke-width: 1; }
.cost-chart .tick { fill: var(--text-faint); font-family: var(--font-mono); font-size: 12px; }
.cost-line { stroke: var(--sem-3); stroke-width: 3; }
.cost-dot { fill: var(--accent); }
.chart-fig figcaption { margin-top: 12px; font-size: 12px; }

/* ── scene 2 · subscriptions ──────────────────────────── */
.sub-stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 48px 0 0; }
.sub-card {
  background: var(--surface); border: 1px solid var(--divider-strong); padding: 18px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.sub-card b { font-size: 16px; }
.sub-card .mono { font-size: 12px; color: var(--text-dim); }
.sub-card .price { color: var(--text); font-weight: 700; font-size: 15px; margin-top: 8px; }
.sub-total { margin-top: 26px; font-size: clamp(22px, 3vw, 32px); font-weight: 700; }
.sub-total .dim { font-size: .5em; font-weight: 400; }
.bubbles { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.bubble {
  font-size: 14px; color: var(--text-dim); background: var(--surface-2);
  border: 1px solid var(--divider); padding: 8px 14px; border-radius: 16px 16px 16px 4px;
}

/* ── scene 3 · converge ───────────────────────────────── */
.converge { display: grid; grid-template-columns: 1fr 120px 1fr; align-items: center; gap: 0; margin-top: 48px; }
.req-col { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.req-chip {
  font-family: var(--font-mono); font-size: 13px; background: var(--surface-2);
  border: 1px solid var(--divider-strong); padding: 8px 14px; white-space: nowrap;
}
.req-chip[data-w="3"] { border-color: var(--accent); }
.converge-wires { width: 100%; height: 200px; }
.converge-wires path { stroke: var(--divider-strong); stroke-width: 1.5; fill: none; }
.frontier-box {
  justify-self: start; background: var(--surface); border: 1px solid var(--accent);
  padding: 26px 30px; display: flex; flex-direction: column; gap: 4px; font-size: 16px;
}
.frontier-box .price-tag { color: var(--accent); font-weight: 700; font-size: 22px; letter-spacing: .1em; }
.frontier-box .dim { font-size: 12px; }

/* ── scene 4 · idle gpu ───────────────────────────────── */
.runtime-card { background: var(--surface); border: 1px solid var(--divider-strong); padding: 24px 26px; max-width: 560px; margin-top: 48px; }
.rt-head { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); }
.rt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sem-3); display: inline-block; }
.rt-status { margin-left: auto; color: var(--text-faint); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; }
.runtime-card ul { list-style: none; margin: 18px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.runtime-card li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--divider); padding-bottom: 8px; }
.util-row { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-dim); }
.util-bar { flex: 1; height: 8px; background: var(--surface-3); overflow: hidden; }
.util-bar i { display: block; height: 100%; width: 0%; background: var(--sem-3); }

/* ── centerpiece · pinned router ──────────────────────── */
.pin-scene { padding: 0; display: block; }
.pin-stage { min-height: 100vh; display: flex; align-items: center; padding: 100px 0 60px; }
.router-heads { position: relative; min-height: 210px; margin-bottom: 34px; }
.router-head { position: absolute; inset: 0; }
.router-head .lead { margin-top: 12px; }
html.js .router-head { opacity: 0; }
html.js .router-head#head-a { opacity: 1; }

.diagram { position: relative; display: grid; grid-template-columns: 150px 1fr 1.25fr; gap: 28px; align-items: center; }
.d-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }

.d-left { display: flex; flex-direction: column; gap: 10px; }
.harness-chip { font-size: 12px; background: var(--surface-2); border: 1px solid var(--divider-strong); padding: 7px 10px; text-align: center; }

.d-mid { display: flex; flex-direction: column; gap: 12px; }
.providers { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.prov-chip { font-size: 11px; background: var(--surface-3); border: 1px solid var(--divider); padding: 4px 9px; color: var(--text-dim); }
.router-box { background: var(--surface); border: 1px solid var(--accent); padding: 20px 22px; text-align: center; }
.rb-name { font-size: 20px; margin-bottom: 4px; }
.rb-catalog { font-size: 11px; color: var(--text-dim); margin-bottom: 16px; }
.meter-track { position: relative; display: flex; height: 10px; }
.meter-track .seg { display: block; height: 100%; }
.seg.s1 { width: 27%; background: var(--sem-1); }
.seg.s2 { width: 27%; background: var(--sem-2); }
.seg.s3 { width: 28%; background: var(--sem-4); }
.seg.s4 { width: 18%; background: var(--sem-5); }
.needle { position: absolute; top: -4px; bottom: -4px; left: 0%; width: 2px; background: var(--text); }
.meter-marks { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-faint); margin-top: 5px; }
.rb-score { margin-top: 14px; font-size: 13px; color: var(--text-dim); }
.rb-score b { color: var(--text); font-size: 22px; }

.d-right { display: flex; flex-direction: column; gap: 12px; position: relative; }
.lane { background: var(--surface); border: 1px solid var(--divider-strong); padding: 12px 14px; }
.lane-head { display: flex; align-items: baseline; gap: 10px; font-size: 12px; }
.lane-name { font-weight: 700; color: var(--text); }
.lane-range { font-size: 11px; }
.strategy-chip { margin-left: auto; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--divider-strong); padding: 2px 7px; color: var(--text-dim); }
.lane-models { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.model-chip { font-size: 11px; background: var(--surface-2); border: 1px solid var(--divider); padding: 4px 8px; white-space: nowrap; }
.model-chip em { font-style: normal; }
.tag-local { color: var(--sem-4); }
.tag-price { color: var(--accent); }
.model-chip.limited { color: var(--text-faint); text-decoration: line-through; border-color: var(--warn); }
.model-chip.limited::after { content: " rate-limited"; text-decoration: none; color: var(--warn); font-size: 10px; }
.model-chip.routed { border-color: var(--accent); background: var(--accent-soft); }
.lane.active { border-color: var(--sem-3); }
.smartfill { align-self: flex-end; font-size: 11px; background: none; border: 1px solid var(--sem-3); color: var(--sem-3); padding: 5px 10px; cursor: default; }

.req-dot { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); top: 0; left: 0; opacity: 0; z-index: 5; }
.verdict-stamp { position: absolute; font-size: 12px; font-weight: 700; color: var(--sem-4); opacity: 0; z-index: 5; }

/* static fallback (no JS): show final state */
html:not(.js) .req-dot, html:not(.js) .verdict-stamp { display: none; }
html:not(.js) .router-head { position: static; margin-bottom: 26px; }

/* ── scrubbed video ───────────────────────────────────── */
#live .pin-stage { flex-direction: column; justify-content: center; }
.video-window { max-width: min(1120px, calc((100vh - 300px) * 1.6)); margin-left: auto; margin-right: auto; margin-top: 30px; }
.video-window video { display: block; width: 100%; height: auto; }
@media (max-width: 760px) {
  #live .pin-stage { padding: 40px 0; min-height: 0; }
}

/* ── windows (screenshots) ────────────────────────────── */
.window { margin-top: 44px; border: 1px solid var(--divider-strong); background: var(--surface); box-shadow: var(--window-shadow); }
.window-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--divider); background: var(--surface-2); }
.window-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--divider-strong); display: block; }
.window-bar .url { margin-left: 12px; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.window img { display: block; width: 100%; height: auto; }

/* ── scene 8 · receipts ───────────────────────────────── */
.receipt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 48px; }
.receipt-grid p { color: var(--text-dim); font-size: 15px; max-width: 52ch; }
.receipt-grid .window { margin-top: 22px; }

/* ── scene 9 · cta ────────────────────────────────────── */
.scene-cta { text-align: center; }
.scene-cta .lead { margin: 22px auto 0; }
.cta-row { display: flex; gap: 14px; justify-content: center; margin-top: 38px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 14px; padding: 13px 22px; border: 1px solid var(--divider-strong); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost:hover { border-color: var(--text); }

.foot { border-top: 1px solid var(--divider); padding: 26px 0; font-size: 12px; }

/* ── video-export mode (html.render, set by ?render) ──── */
/* hide web-only chrome; show the endcard URL instead of clickable CTAs */
.render-endcard { display: none; }
html.render .audio-btn,
html.render .cta-row { display: none; }
html.render .render-endcard {
  display: block; margin-top: 38px;
  font-size: clamp(26px, 3.2vw, 44px); font-weight: 700; letter-spacing: -0.01em;
}

/* ── reveal defaults (JS only) ────────────────────────── */
html.js .reveal-up { opacity: 0; transform: translateY(28px); }

/* ── scene dot rail ───────────────────────────────────── */
.dot-rail {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 14px; z-index: 40;
}
.dot-rail-dot {
  position: relative; background: none; border: 0; padding: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: flex-end;
}
.dot-rail-dot i {
  width: 8px; height: 8px; border-radius: 50%; display: block;
  background: var(--divider-strong); transition: background .25s, transform .25s;
}
.dot-rail-dot.active i { background: var(--accent); transform: scale(1.4); }
.dot-rail-dot span {
  position: absolute; right: 22px; white-space: nowrap;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--divider); padding: 3px 8px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.dot-rail-dot:hover span, .dot-rail-dot:focus-visible span { opacity: 1; }
@media (max-width: 900px) { .dot-rail { display: none; } }

/* ── responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
  .receipt-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .scene { padding: 90px 0; min-height: 0; }
  .converge { grid-template-columns: 1fr; gap: 18px; }
  .converge-wires { display: none; }
  .diagram { grid-template-columns: 1fr; gap: 22px; }
  .d-left { flex-direction: row; flex-wrap: wrap; }
  .router-heads { min-height: 0; margin-bottom: 22px; }
  .router-head { position: static; margin-bottom: 22px; }
  html.js .router-head { opacity: 1; }
  .pin-stage { padding: 90px 0 40px; }
}

/* ── reduced motion: everything static & visible ──────── */
/* (html.force-motion is set by ?motion in the URL to preview animations) */
@media (prefers-reduced-motion: reduce) {
  html:not(.force-motion) { scroll-behavior: auto; }
  html.js:not(.force-motion) .router-head { position: static; opacity: 1; margin-bottom: 22px; }
  html.js:not(.force-motion) .reveal-up { opacity: 1; transform: none; }
  html:not(.force-motion) .req-dot, html:not(.force-motion) .verdict-stamp,
  html:not(.force-motion) .scroll-cue, html:not(.force-motion) .progress { display: none; }
}
