/* ═══════════════════ Supra - design system ═══════════════════
   Instrument Sans for the site's existing typography · League Spartan only for
   treatments that previously used a monospace face.
   Palette: near-black stage, off-white ink, bright signal orange. */

:root {
  --bg: #000000;
  --bg-soft: #0a0a0c;
  --card: #101014;
  --card-2: #16161b;
  --ink: #f5f5f7;
  --mut: #a3a3ab;      /* 5.9:1 on black - body-muted */
  --mut-2: #8b8b93;    /* 4.6:1 - labels, cites, disclosures */
  --mut-3: #70707a;    /* 3.2:1 - decorative marks only, never load-bearing text */
  --accent: #E8420A;
  --good: #37c871;
  --warn: #f0a52c;
  --line: rgba(255, 255, 255, 0.09);
  --line-soft: rgba(255, 255, 255, 0.05);
  /* semantic surfaces that flip with the theme */
  --on-ink: #000;                      /* text on an ink-filled chip/button */
  --ink-strong: #fff;                  /* hover of an ink-filled button */
  --nav-scrim: rgba(0, 0, 0, 0.72);    /* frosted nav on scroll */
  --panel-scrim: rgba(0, 0, 0, 0.55);  /* HUD panels over the stage */
  --panel-scrim-2: rgba(0, 0, 0, 0.5);
  --cap-shadow: rgba(0, 0, 0, 0.7);    /* halo behind caption text over the 3D */
  --stage-1: #0a0d13;                  /* stage gradient behind the transparent canvas */
  --stage-2: #050607;
  --stage-glow: rgba(232, 66, 10, 0.05);
  --disp: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --brand: "League Spartan", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: var(--brand);
  --story-len: 2400vh; /* 8 chapters x 300vh: unhurried, cinematic, long analysis dwell */
  color-scheme: dark;
}

/* ─────────────── light theme ─────────────── */
:root[data-theme="light"] {
  --bg: #f4f4f2;
  --bg-soft: #eaeae7;
  --card: #ffffff;
  --card-2: #f3f3f0;
  --ink: #14141a;
  --mut: #52525b;      /* dark-on-light body-muted */
  --mut-2: #64646d;
  --mut-3: #9a9aa3;
  --accent: #d43a08;   /* deeper orange so it holds contrast on white */
  --good: #1f9d57;
  --warn: #b7791b;
  --line: rgba(0, 0, 0, 0.12);
  --line-soft: rgba(0, 0, 0, 0.06);
  --on-ink: #f4f4f2;
  --ink-strong: #000;
  --nav-scrim: rgba(244, 244, 242, 0.82);
  --panel-scrim: rgba(255, 255, 255, 0.72);
  --panel-scrim-2: rgba(255, 255, 255, 0.66);
  --cap-shadow: rgba(244, 244, 242, 0.82);
  --stage-1: #eef0ee;
  --stage-2: #e2e4e1;
  --stage-glow: rgba(212, 58, 8, 0.06);
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* anchor scrolling is handled in JS: smooth for short hops, instant for long jumps */
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--disp);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.mono, code, pre, kbd, samp { font-family: var(--brand); }
.dot {
  display: inline-block;
  width: 0.16em;
  height: 0.16em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: baseline;
  margin-left: 0.04em;
}
.accent { color: var(--accent); }
.good { color: var(--good); }
.warn { color: var(--warn); }
em { font-style: normal; }

/* ─────────────── nav ─────────────── */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 34px;
  padding: 0 clamp(20px, 4vw, 56px);
  height: 64px;
  border-bottom: 1px solid transparent;
  transition: background 0.35s, border-color 0.35s;
}
.nav.scrolled {
  background: var(--nav-scrim);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line-soft);
}
.nav-logo {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 21px;
  /* Match the hero lockup tracking so the mark reads identically everywhere. */
  letter-spacing: -0.055em;
}
.nav-links {
  display: flex;
  gap: 22px;
  margin-left: auto;
}
.nav-links a {
  font-size: 13.5px;
  color: var(--mut);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 99px;
  transition: border-color 0.2s, background 0.2s;
}
.nav-cta:hover { border-color: var(--accent); background: rgba(232, 66, 10, 0.08); }
.nav-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--mut);
  background: transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.nav-theme:hover { color: var(--ink); border-color: var(--mut-2); }
.nav-theme svg { width: 16px; height: 16px; display: block; }
.nav-theme .ico-moon { display: none; }
.nav-theme .ico-sun { display: block; }
:root[data-theme="light"] .nav-theme .ico-sun { display: none; }
:root[data-theme="light"] .nav-theme .ico-moon { display: block; }

/* ─────────────── buttons ─────────────── */
.btn {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 99px;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--ink-strong); }
.btn-ghost { border: 1px solid var(--line); color: var(--mut); }
.btn-ghost:hover { border-color: var(--mut-2); color: var(--ink); }
.btn-mini {
  font-size: 12.5px;
  padding: 8px 16px;
  background: var(--ink);
  color: var(--on-ink);
  cursor: default;
}
.arrow-d { display: inline-block; transition: transform 0.25s; }
.btn-ghost:hover .arrow-d { transform: translateY(3px); }

/* subtle mono link under the hero CTAs: opens the locally installed app */
.hero-local {
  margin-top: 16px;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--mut-2);
}
.hero-local a { color: var(--mut-2); border-bottom: 1px solid var(--line); }
.hero-local a:hover { color: var(--ink); }

/* ─────────────── hero ─────────────── */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 96px 20px 60px;
  position: relative;
}
.hero-eyebrow {
  font-size: 13px;
  letter-spacing: 0.42em;
  color: var(--mut-2);
  margin-bottom: 22px;
}
.hero-title {
  font-family: var(--disp);
  font-size: clamp(84px, 16vw, 210px);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 0.95;
}
.hero-tagline {
  margin-top: 26px;
  font-size: clamp(19px, 2.6vw, 28px);
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.hero-sub {
  margin-top: 16px;
  max-width: 620px;
  font-size: 16.5px;
  color: var(--mut);
}
.hero-ctas {
  margin-top: 40px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.hero-ctas .legal-download.is-recommended {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.hero-scrollcue {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 52px;
  overflow: hidden;
}
.hero-scrollcue span {
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--mut-2), transparent);
  animation: cue 2.1s ease-in-out infinite;
}
@keyframes cue {
  0% { transform: translateY(-100%); }
  60%, 100% { transform: translateY(100%); }
}

/* ─────────────── scroll story ─────────────── */
.story { height: var(--story-len); position: relative; }
.story-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.story-skip {
  position: absolute;
  right: clamp(14px, 3vw, 32px);
  bottom: 20px;
  z-index: 5;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--mut-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 7px 14px;
  background: var(--panel-scrim-2);
  backdrop-filter: blur(8px);
}
.story-skip:hover { color: var(--ink); border-color: var(--mut-2); }
/* auto-play control, the mirror of .story-skip on the left edge */
.story-play {
  position: absolute;
  left: clamp(14px, 3vw, 32px);
  bottom: 20px;
  z-index: 5;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--mut-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 7px 14px;
  background: var(--panel-scrim-2);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.story-play:hover { color: var(--ink); border-color: var(--mut-2); }
.story-play.is-playing { color: var(--accent); border-color: rgba(232, 66, 10, 0.55); }
/* WebGL unavailable: hide 3D-only controls, let captions carry the story */
.no-webgl .lens-switch,
.no-webgl .cad-frame,
.no-webgl .spec-card,
.no-webgl .vig-canvas { display: none; }
.no-webgl #caps { position: static; height: auto; margin: 0 auto; max-width: 720px; }
.no-webgl .cap { position: relative; opacity: 1 !important; transform: none !important; }

/* full-bleed 3D stage: the model fills the whole pinned viewport */
.story-stage {
  background:
    radial-gradient(120% 90% at 50% 12%, var(--stage-glow), transparent 62%),
    linear-gradient(180deg, var(--stage-1), var(--stage-2));
}
#cad-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* lens switcher (top-center, segmented pill) */
.lens-switch {
  position: absolute;
  top: clamp(74px, 9.5vh, 98px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--panel-scrim);
  backdrop-filter: blur(12px);
  /* six lenses do not fit a phone in one row: keep the single pill and let it
     scroll sideways rather than wrap into a broken second row. */
  max-width: min(92vw, 780px);
  overflow-x: auto;
  scrollbar-width: none;
}
.lens-switch::-webkit-scrollbar { display: none; }
.lens-btn { flex: 0 0 auto; }
.lens-btn {
  font-family: var(--mono);
  font-size: clamp(10.5px, 1.1vw, 11.5px);
  letter-spacing: 0.1em;
  color: var(--mut-2);
  padding: 7px clamp(11px, 1.4vw, 17px);
  border-radius: 99px;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}
.lens-btn:hover { color: var(--ink); }
.lens-btn.is-active { color: var(--on-ink); background: var(--ink); }

/* interaction hint, bottom-centre of the stage */
.stage-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--mut-2);
  padding: 6px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  background: var(--panel-scrim-2);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

/* pain -> solved comparison */
.pain-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  max-width: 980px;
  margin: 42px auto 0;
}
.pain-col-head {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--mut-2);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.pain-col-head.is-supra { color: var(--accent); }
.pain-row-old, .pain-row-new {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.45;
}
.pain-row-old { background: var(--card); color: var(--mut); }
.pain-row-new { background: var(--card-2); color: var(--ink); border: 1px solid var(--line-soft); }
.pain-x { color: var(--mut-3); font-size: 11px; letter-spacing: 0; }
.pain-c { color: var(--good); font-size: 11px; letter-spacing: 0; }
@media (max-width: 760px) {
  .pain-grid { grid-template-columns: 1fr; }
  .pain-col-head.is-supra { margin-top: 16px; }
}

/* live analysis readout: names the feature the animation is demonstrating */
.sim-label {
  position: absolute;
  top: clamp(118px, 15vh, 150px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 15px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--panel-scrim);
  backdrop-filter: blur(10px);
  font-size: 11px;
  letter-spacing: 0.17em;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.sim-label.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sim-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sim-c, var(--accent));
  box-shadow: 0 0 9px var(--sim-c, var(--accent));
}

/* stage progress (top-left) */
.story-progress {
  position: absolute;
  top: clamp(80px, 10vh, 104px);
  left: clamp(18px, 4vw, 56px);
  z-index: 4;
  font-size: 12.5px;
  letter-spacing: 0.28em;
  color: var(--mut-2);
}

/* captions, crossfaded by scroll, lower-left.
   Scoped to #caps: the capabilities section also uses .caps/.cap. */
#caps {
  position: absolute;
  left: clamp(18px, 4vw, 56px);
  bottom: clamp(64px, 12vh, 128px);
  width: min(520px, 74vw);
  height: 220px;
  z-index: 4;
  pointer-events: none;
}
#caps .cap {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  opacity: 0;
  will-change: opacity, transform;
}
#caps .cap-eyebrow {
  font-size: 12.5px;
  letter-spacing: 0.34em;
  color: var(--accent);
  margin-bottom: 14px;
}
#caps .cap h2 {
  font-size: clamp(30px, 4.4vw, 60px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
  text-shadow: 0 2px 34px var(--cap-shadow);
}
#caps .cap p {
  margin-top: 14px;
  max-width: 460px;
  font-size: clamp(14.5px, 1.6vw, 16.5px);
  color: var(--mut);
  text-shadow: 0 1px 18px var(--cap-shadow);
}

/* technical title-block overlay */
.cad-frame { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.cad-tl {
  position: absolute;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--mut-2);
}
.tl-top-l { top: clamp(104px, 13vh, 132px); left: clamp(18px, 4vw, 56px); }
.tl-top-r { top: clamp(80px, 10vh, 104px); right: clamp(18px, 4vw, 56px); }
#cad-mode { color: var(--accent); }
.cad-title {
  position: absolute;
  bottom: clamp(58px, 9vh, 92px);
  right: clamp(18px, 4vw, 56px);
  width: min(300px, 66vw);
  border-top: 1px solid var(--line);
  padding-top: 8px;
  background: linear-gradient(180deg, rgba(5, 6, 7, 0), rgba(5, 6, 7, 0.4));
}
.ct-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--ink);
  padding: 1.5px 0;
}
.ct-row.dim { color: var(--mut-2); }
.cad-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  letter-spacing: 0.2em;
  color: var(--mut-2);
  transition: opacity 0.5s;
}
.cad-loading.hidden { opacity: 0; pointer-events: none; }

/* click-to-inspect spec card (top-right, below the grid label) */
.spec-card {
  position: absolute;
  top: clamp(130px, 16vh, 168px);
  right: clamp(18px, 4vw, 56px);
  z-index: 6;
  width: min(280px, 74vw);
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 9, 11, 0.86);
  backdrop-filter: blur(12px);
}
.spec-card[hidden] { display: none; }
.spec-close {
  position: absolute;
  top: 8px; right: 10px;
  border: 0; background: transparent;
  color: var(--mut-2); font-size: 18px; line-height: 1;
  cursor: pointer;
}
.spec-close:hover { color: var(--ink); }
.spec-role {
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--ink); font-family: var(--disp);
}
.spec-name {
  font-size: 10.5px; letter-spacing: 0.16em;
  color: var(--accent); margin: 3px 0 12px;
}
.spec-rows { display: grid; gap: 7px; }
.spec-rows .sr {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 11px; letter-spacing: 0.04em;
  padding-bottom: 6px; border-bottom: 1px solid var(--line-soft);
}
.spec-rows .sr:last-child { border-bottom: 0; padding-bottom: 0; }
.spec-rows .sr .k { color: var(--mut-2); }
.spec-rows .sr .v { color: var(--ink); text-align: right; }
.spec-rows .sr .v.good { color: var(--good); }

/* stage rail (bottom-center) */
.story-rail {
  position: absolute;
  left: 0; right: 0;
  bottom: 26px;
  z-index: 4;
  display: flex;
  gap: 8px;
  justify-content: center;
}
.story-rail { pointer-events: auto; }
.rail-seg {
  cursor: pointer;
  width: clamp(22px, 4vw, 46px);
  height: 2px;
  background: var(--line);
  position: relative;
  overflow: hidden;
  border-radius: 2px;
}
.rail-seg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(var(--fill, 0));
  transform-origin: left;
}

/* ─────────────── shared sections ─────────────── */
.section {
  padding: clamp(90px, 12vw, 150px) clamp(20px, 6vw, 80px);
  max-width: 1280px;
  margin: 0 auto;
}
.section-head { max-width: 780px; margin-bottom: clamp(40px, 6vw, 72px); }
.kicker {
  font-size: 12.5px;
  letter-spacing: 0.3em;
  color: var(--mut-2);
  text-transform: uppercase;
  margin-bottom: 18px;
}
.h-xl {
  font-size: clamp(38px, 5.6vw, 76px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
}
.lead {
  margin-top: 20px;
  font-size: clamp(16px, 1.8vw, 19px);
  color: var(--mut);
  max-width: 640px;
}

/* reveals */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.6, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.reveal.in { opacity: 1; transform: none; }

/* ─────────────── interactive vignettes ─────────────── */
.vignettes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 3vw, 40px);
}
.vig {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-soft);
}
.vig-canvas {
  position: relative;
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(120% 90% at 50% 20%, var(--stage-glow), transparent 60%),
    linear-gradient(180deg, var(--stage-1), var(--stage-2));
  border-bottom: 1px solid var(--line);
}
.vig-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.vig-body { padding: 22px clamp(20px, 2.4vw, 26px) 26px; }
.vig-body h3 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.vig-body > p { margin-top: 8px; color: var(--mut); font-size: 14.5px; max-width: 46ch; }
.vig-toggle {
  display: inline-flex; gap: 3px; margin-top: 16px;
  padding: 4px; border: 1px solid var(--line); border-radius: 99px;
}
.vig-toggle button {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em;
  color: var(--mut-2); padding: 6px 15px; border: 0; background: transparent;
  border-radius: 99px; cursor: pointer; transition: color 0.2s, background 0.2s;
}
.vig-toggle button:hover { color: var(--ink); }
.vig-toggle button.is-active { color: var(--on-ink); background: var(--ink); }
.vig-readout {
  display: flex; align-items: baseline; gap: 10px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px; letter-spacing: 0.08em;
}
.vig-readout .k { color: var(--mut-2); }
.vig-readout .v { color: var(--ink); font-size: 19px; margin-left: auto; font-family: var(--mono); }
.vig-readout .s { color: var(--mut-3); font-size: 11px; }
.vig input[type="range"] { width: 100%; margin-top: 18px; accent-color: var(--accent); cursor: ew-resize; }
.vig-scale {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--mut-2); letter-spacing: 0.14em; margin-top: 7px;
}
@media (max-width: 900px) { .vignettes { grid-template-columns: 1fr; } }

/* stage on phones: declutter so captions and the lens switch never collide */
@media (max-width: 720px) {
  .story-progress { display: none; }   /* the rail conveys progress */
  .stage-hint { display: none; }       /* bottom edge belongs to play + skip */
  .cad-title { display: none; }        /* decorative title-block off */
  .tl-top-r { display: none; }
  .tl-top-l { top: 126px; }            /* mode chip clears the lens switch */
  #caps {
    bottom: clamp(74px, 13vh, 116px);
    width: min(560px, 86vw);
    height: 210px;
  }
  .cap h2 { font-size: clamp(26px, 8vw, 40px); }
  .lens-btn { padding: 7px clamp(12px, 3.6vw, 18px); }
}

/* ─────────────── loop ─────────────── */
.loop-steps { list-style: none; max-width: 860px; }
.loop-steps li {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px 26px;
  padding: 30px 0;
  border-top: 1px solid var(--line-soft);
  align-items: start;
}
.step-n {
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.1em;
  padding-top: 4px;
}
.loop-steps h3 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.loop-steps p {
  grid-column: 2;
  color: var(--mut);
  font-size: 15px;
  max-width: 560px;
}

/* ─────────────── capabilities ─────────────── */
.caps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.cap {
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 24px 22px;
  transition: border-color 0.25s, background 0.25s, opacity 0.7s, transform 0.7s;
}
.cap:hover { border-color: rgba(232, 66, 10, 0.45); background: var(--card); }
.cap h3 {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 9px;
}
.cap p { font-size: 13.8px; color: var(--mut); line-height: 1.55; }

/* ─────────────── test lab (wind tunnel) ─────────────── */
.testlab-wrap {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 18%, var(--stage-glow), transparent 60%),
    linear-gradient(180deg, var(--stage-1), var(--stage-2));
}
#testlab-canvas,
#pcb-canvas,
#arch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.testlab-hud {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  min-width: 190px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-scrim);
  backdrop-filter: blur(10px);
  font-size: 11px;
  pointer-events: none;
}
.testlab-hud .th-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 0;
}
.testlab-hud .k { color: var(--mut-2); letter-spacing: 0.14em; }
.testlab-hud .v { color: var(--ink); font-variant-numeric: tabular-nums; }
/* Cp colourbar legend: suction (cyan, -1) to stagnation (brand orange, +1). */
.th-cbar-row { display: flex; align-items: center; gap: 7px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
.th-cbar { flex: 1; height: 7px; border-radius: 4px; background: linear-gradient(90deg, #49c6f5, #b8bdc6, #E8420A); }
.th-end { font-style: normal; color: var(--mut-2); font-size: 9.5px; }
/* Air-speed control strip (interactive, so not aria-hidden). */
.testlab-ctrl {
  position: absolute; left: 14px; bottom: 14px; z-index: 2;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  max-width: calc(100% - 28px);
  padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-scrim); backdrop-filter: blur(10px); font-size: 11px;
}
.testlab-ctrl label { color: var(--mut-2); letter-spacing: 0.14em; }
.testlab-ctrl input[type="range"] { width: 132px; accent-color: var(--accent); cursor: ew-resize; }
.testlab-note { color: var(--mut-2); }
/* PCB stage stepper (reuses the test-lab control strip). */
.pcb-stages { display: flex; gap: 4px; flex-wrap: wrap; }
.pcb-stages button {
  font: inherit; font-size: 10.5px; letter-spacing: 0.05em; color: var(--mut-2);
  background: transparent; border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 8px; cursor: pointer; transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.pcb-stages button:hover { color: var(--ink); }
.pcb-stages button.is-active { color: var(--on-ink); background: var(--ink); border-color: var(--ink); }
@media (max-width: 620px) {
  .testlab-hud { min-width: 148px; padding: 9px 11px; font-size: 10px; }
  .testlab-ctrl { font-size: 10px; gap: 7px; padding: 7px 10px; }
  .testlab-ctrl input[type="range"] { width: 96px; }
}

/* ─────────────── freecad ─────────────── */
.fc-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.fc-col {
  border-top: 2px solid var(--accent);
  padding-top: 22px;
}
.fc-badge {
  font-size: 11.5px;
  letter-spacing: 0.26em;
  color: var(--accent);
  margin-bottom: 12px;
}
.fc-col h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.fc-col p { font-size: 14.5px; color: var(--mut); }

/* ─────────────── layers ─────────────── */
.layer-rows { max-width: 900px; }
.layer-row {
  display: grid;
  grid-template-columns: 64px 170px 1fr;
  gap: 20px;
  padding: 26px 0;
  border-top: 1px solid var(--line-soft);
  align-items: baseline;
}
.layer-n { font-size: 13px; color: var(--mut-3); letter-spacing: 0.12em; }
.layer-row h3 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.layer-row p { color: var(--mut); font-size: 14.5px; }

/* ─────────────── review / diff ─────────────── */
.diff-card {
  max-width: 620px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
}
.diff-head {
  font-size: 13px;
  color: var(--mut);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
}
.diff-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.diff-row > span:first-child { color: var(--mut); }
.diff-row .mono { font-size: 13px; }
.diff-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  font-size: 13px;
}
.diff-note {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--mut-2);
}

/* ─────────────── honesty ─────────────── */
.honesty-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  max-width: 980px;
}
.h-col {
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 26px 26px;
}
.h-col h3 {
  font-size: 13px;
  letter-spacing: 0.24em;
  margin-bottom: 16px;
}
.h-col ul { list-style: none; }
.h-col li {
  padding: 10px 0 10px 22px;
  border-top: 1px solid var(--line-soft);
  color: var(--mut);
  font-size: 14.5px;
  position: relative;
}
.h-col li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--mut-3);
}

/* ─────────────── proof ─────────────── */
.quotes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.quotes blockquote {
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 26px;
}
.quotes p {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.4;
}
.quotes cite {
  display: block;
  margin-top: 16px;
  font-style: normal;
  font-size: 11.5px;
  letter-spacing: 0.22em;
  color: var(--mut-2);
}
.proof-note {
  margin-bottom: 26px;
  font-size: 13px;
  color: var(--mut-2);
  letter-spacing: 0.04em;
  max-width: 640px;
}

/* ─────────────── access / footer ─────────────── */
.access { text-align: center; }
.access .lead { margin-left: auto; margin-right: auto; }
.access .hero-ctas { justify-content: center; }
.access-alt {
  margin-top: 26px;
  font-size: 13px;
  color: var(--mut-2);
  line-height: 2;
}
.access-alt a { color: var(--mut); border-bottom: 1px solid var(--line); }
.access-alt a:hover { color: var(--ink); }

/* Explicit clickwrap. The download URL lives in data, never in href, so a
   normal click, keyboard activation, or open-in-new-tab cannot skip review. */
.legal-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: min(880px, calc(100vh - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(0,0,0,.55);
}
.legal-dialog::backdrop { background: rgba(5,4,3,.82); backdrop-filter: blur(8px); }
.legal-card { position: relative; padding: clamp(24px,5vw,44px); overflow-y: auto; }
.legal-card h2 { margin: 8px 36px 12px 0; font-size: clamp(24px,4vw,36px); line-height: 1.08; }
.legal-card > p { color: var(--mut); line-height: 1.65; }
.legal-kicker { color: var(--accent); font-size: 11px; letter-spacing: .13em; }
.legal-close { position:absolute; right:18px; top:16px; width:40px; height:40px; border:0; border-radius:50%; background:var(--card-2); color:var(--ink); font-size:25px; cursor:pointer; }
.legal-critical { margin:20px 0; padding:15px 17px; border:1px solid color-mix(in srgb,var(--accent) 42%,var(--line)); border-left:4px solid var(--accent); border-radius:8px; background:color-mix(in srgb,var(--accent) 7%,var(--card)); color:var(--mut); line-height:1.55; }
.legal-critical strong { color:var(--ink); }
.legal-check { display:grid; grid-template-columns:22px 1fr; gap:12px; margin:12px 0; padding:14px; border:1px solid var(--line-soft); border-radius:9px; color:var(--mut); font-size:13px; line-height:1.55; cursor:pointer; text-align:left; }
.legal-check:has(input:checked) { border-color:color-mix(in srgb,var(--accent) 56%,var(--line)); background:color-mix(in srgb,var(--accent) 5%,var(--card)); }
.legal-check input { width:18px; height:18px; margin:2px 0 0; accent-color:var(--accent); }
.legal-check a { color:var(--ink); text-decoration:underline; text-underline-offset:3px; }
.legal-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:12px; margin-top:24px; }
.legal-actions .btn:disabled { opacity:.38; cursor:not-allowed; transform:none; }
.legal-version { margin:16px 0 0; text-align:right; font-size:10px; color:var(--mut-3); }

/* local-install quickstart (runs on the user's machine) */
.quickstart {
  margin: 34px auto 0;
  max-width: 560px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 20px 24px;
}
.quickstart-title {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--mut-2);
  margin-bottom: 14px;
}
.quickstart-steps {
  list-style: none;
  display: grid;
  gap: 11px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--mut);
}
.quickstart-steps .qs-n { color: var(--accent); margin-right: 10px; }
.quickstart-steps code {
  font-family: var(--mono);
  color: var(--ink);
  background: var(--card-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}
.quickstart-steps a { color: var(--mut); border-bottom: 1px solid var(--line); }
.quickstart-steps a:hover { color: var(--ink); }

.footer {
  border-top: 1px solid var(--line-soft);
  padding: 44px clamp(20px, 6vw, 80px);
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}
.footer p { font-size: 12.5px; color: var(--mut-2); }
.footer p a { color: var(--mut-2); }
.footer p a:hover { color: var(--ink); }
.footer-credit {
  flex-basis: 100%;
  margin-top: 14px;
  font-size: 10.5px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: var(--mut-3);
}
.footer-credit a { color: var(--mut-3); text-decoration: underline; text-underline-offset: 2px; }
.footer-credit a:hover { color: var(--mut); }
.footer-links {
  margin-left: auto;
  display: flex;
  gap: 22px;
  font-size: 12.5px;
}
.footer-links a { color: var(--mut-2); }
.footer-links a:hover { color: var(--ink); }

/* ─────────────── responsive ─────────────── */
@media (max-width: 960px) {
  :root { --story-len: 2600vh; } /* 8 x 325vh on smaller screens */
  /* keep section links reachable: slim secondary bar under the main nav */
  .nav { flex-wrap: wrap; height: auto; padding-top: 12px; padding-bottom: 10px; row-gap: 10px; }
  .nav-cta { margin-left: auto; }
  .nav-links {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    gap: 16px;
    margin-left: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links a { font-size: 12px; white-space: nowrap; }
  .story-grid {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 18px;
    padding-top: 96px;
  }
  #story-chapters { min-height: 260px; }
  .chapter p { font-size: 14.5px; }
  .story-panel { height: 58vh; }
  .cad { flex: 1 1 auto; }
  .terminal { flex: 0 0 auto; height: 118px; }
  .caps-grid, .fc-cols, .quotes { grid-template-columns: 1fr 1fr; }
  .layer-row { grid-template-columns: 48px 1fr; }
  .layer-row p { grid-column: 2; }
  .honesty-cols { grid-template-columns: 1fr; }
}

/* short viewports (landscape phones, small windows): compact the pinned stage
   so the terminal - the story's payload - always fits inside the clip box */
@media (max-height: 620px) {
  .story-grid { padding-top: 58px; gap: 12px; grid-template-columns: minmax(300px, 40%) 1fr; }
  .story-progress { margin-bottom: 12px; }
  #story-chapters { min-height: 150px; }
  .chapter h2 { font-size: 22px; }
  .chapter p { display: none; }
  .terminal { display: none; } /* keep the 3D model as the sole payload */
  .cad { flex: 1 1 100%; }
  .story-panel { height: calc(100svh - 120px); }
  .story-rail { padding-bottom: 12px; }
}
@media (max-width: 620px) {
  .caps-grid, .fc-cols, .quotes { grid-template-columns: 1fr; }
  .loop-steps li { grid-template-columns: 52px 1fr; }
  .hero-title { font-size: clamp(64px, 22vw, 110px); }
}

/* ─────────────── reduced motion ─────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-scrollcue, .tl .caret { animation: none; }
  .panel-card, .cap, .btn, .arrow-d { transition: none; }
}

/* ── pressure colourbar ────────────────────────────────────────────────────
   A CFD picture without a scale is decoration: the reader cannot tell a deep
   suction peak from a rendering choice. This is the legend for the solved Cp
   field, and its stops are the same ones cpColor() uses in cad/f1solved.js.
   It appears only while that field is on screen. */
.cpbar {
  position: absolute;
  left: 50%;
  bottom: clamp(78px, 11vh, 116px);
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--panel-scrim);
  backdrop-filter: blur(6px);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-2);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.cpbar.show { opacity: 1; }
.cpbar-title { font-weight: 700; color: var(--text); }
/* the ramp, left to right: deep blue suction through green free stream to red
   stagnation, matching CP_LO = -3.5 .. CP_HI = +1.0 */
.cpbar-ramp {
  width: clamp(96px, 22vw, 190px);
  height: 8px;
  border-radius: 99px;
  /* Stops match cad/f1solved.js STOPS exactly. The bar is LINEAR in Cp from
     -3.5 to +1.0, so green (Cp = 0, undisturbed air) belongs at 77.8 percent,
     not at the middle. */
  background: linear-gradient(90deg,
    rgb(33, 51, 217) 0%,
    rgb(26, 184, 235) 38.9%,
    rgb(41, 199, 89) 77.8%,
    rgb(245, 209, 41) 90%,
    rgb(224, 33, 26) 100%);
}
.cpbar-ticks {
  display: flex;
  justify-content: space-between;
  width: clamp(96px, 22vw, 190px);
  margin-left: -8px;
  font-size: 9.5px;
  color: var(--text-3);
}
.cpbar-ticks b { font-weight: 500; }
.cpbar-note { color: var(--text-3); }
/* On a phone the ticks and the caveat do not fit beside the ramp, and a
   colourbar that wraps into three lines is worse than a smaller one. */
@media (max-width: 620px) {
  .cpbar { gap: 7px; padding: 5px 10px; font-size: 9.5px; }
  .cpbar-ticks, .cpbar-note { display: none; }
}

/* ─────────────── phones ───────────────────────────────────────────────────
   Measured on a real 390x844 viewport, not guessed from breakpoints. The page
   itself does not overflow at that width, so what follows is about what a
   finger and an eye need: every control was under the 44px touch minimum (lens
   buttons 28px tall, theme toggle 34, story controls 31 and 33, the demo
   toggles 26 and 27), and a lot of the readout text sat between 9.5 and 11.5px
   where 12 is the floor.

   All of it keys off WIDTH rather than `pointer: coarse`. Coarse-pointer was
   the first attempt and it silently did nothing, because plenty of browsers
   (including the headless one this was measured in) report a fine pointer at a
   phone width. A media query that quietly matches nothing is worse than none:
   it reads as covered. */
@media (max-width: 620px) {
  /* Touch targets. Height from padding, so a label that wraps grows the control
     instead of overflowing it. */
  .lens-btn,
  .story-play, .story-skip,
  .vig-toggle button,
  .pcb-stages button {
    min-height: 44px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .nav-theme { width: 44px; height: 44px; }
  .nav-logo, .nav-cta { min-height: 44px; display: inline-flex; align-items: center; }

  /* Nothing under 12px. These are readouts people are meant to read, not
     decoration: the thermal rows, the test-lab controls and the demo toggles
     are the labels that say what the animation is showing. */
  .lens-btn,
  .story-play, .story-skip,
  .cad-loading, .stage-hint,
  .cpbar, .cpbar-title, .cpbar-note,
  .vig-toggle button, .pcb-stages button,
  .vig-readout .s, .vig-scale span,
  .th-row .k, .th-row .v, .th-cbar-row .k, .th-end,
  .testlab-ctrl label, .testlab-note, .testlab-note span,
  .spec-rows .sr .k, .spec-rows .sr .v,
  .pain-x, .pain-c, .fc-badge, cite.mono, .quickstart-title {
    font-size: 12px;
  }

  .spec-card { max-width: calc(100vw - 24px); }

  /* The lens strip scrolls sideways by design (six lenses never fit a phone in
     one row). A silent scroller is a hidden feature, so fade the trailing edge
     to say there is more, and let the OS do momentum scrolling. */
  .lens-switch {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 88%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 88%, transparent 100%);
  }
  .lens-btn { scroll-snap-align: center; }

  /* The interaction hint names a mouse. On a phone it is wrong twice: there is
     no hover, and "drag to orbit" fights the page's own vertical scroll. */
  .stage-hint { display: none; }
}
