/* OD-LAYOUT-PRIMITIVES v1 — structure only: display, flex/grid, overflow, wrapping, ratio.
   Put this @layer first; product CSS outside the layer always wins. */
@layer od-layout {
  :where(.od-stack,.od-row,.od-row-top,.od-cluster,.od-grid,.od-field,.od-stat,.od-cell,.od-tile) > :where(*) { min-width: 0; }
  .od-stack   { display: flex; flex-direction: column; gap: var(--od-gap, 8px); }
  .od-row     { display: flex; align-items: center; gap: var(--od-gap, 8px); }
  .od-row-top { display: flex; align-items: flex-start; gap: var(--od-gap, 8px); }
  .od-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--od-gap, 8px); }
  .od-fill    { flex: 1 1 0; min-width: 0; }
  .od-fixed   { flex: none; }
  .od-grid    { display: grid; gap: var(--od-gap, 12px); grid-template-columns: repeat(var(--od-cols, 3), minmax(0, 1fr)); }
  .od-stat, .od-field, .od-cell { display: grid; gap: var(--od-gap, 2px); }
  :where(.od-stat,.od-field,.od-cell) > :where(*) { display: block; }
  .od-tile { display: grid; grid-template-rows: auto 1fr; }
  :where(.od-tile) > :where(*) { display: block; }
  .od-media { display: block; width: 100%; height: auto; aspect-ratio: var(--od-ratio, auto); }
  .od-media-cover { object-fit: cover; }
  .od-truncate { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .od-clamp-2, .od-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .od-clamp-2 { -webkit-line-clamp: 2; }
  .od-clamp-3 { -webkit-line-clamp: 3; }
  .od-lines-2 { min-height: calc(2 * 1.4em); }
  .od-nowrap  { white-space: nowrap; }
  .od-keep    { word-break: keep-all; overflow-wrap: anywhere; }
  .od-screen { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
  .od-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
  .od-rail { display: flex; gap: var(--od-gap, 8px); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
             padding-inline: var(--od-rail-pad, 16px); scroll-padding-inline: var(--od-rail-pad, 16px); }
  .od-rail::-webkit-scrollbar { display: none; }
  :where(.od-rail) > :where(*) { flex: none; scroll-snap-align: start; }
  :where(.od-rail) > :where(:last-child) { margin-inline-end: var(--od-rail-pad, 16px); }
  .od-spacer { flex: none; visibility: hidden; pointer-events: none; }
  .od-touch  { min-width: 44px; min-height: 44px; }
}
/* /OD-LAYOUT-PRIMITIVES v1 */

/* ---------- Design tokens (Design Spec 4.0.0 · one world, sharp, borderless) ---------- */
:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --ink: #0F1419;
  --ink-muted: #4A5563;
  --line: #DDE1E6;
  --box-muted: #E4E7EB;
  --accent: #0B6E4F;
  --accent-hover: #085A40;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3F1EB;
  --signal: #B42318;
  --signal-soft: #FDECEA;
  --dark: #0F1419;
  --dark-raised: #1A222B;
  --dark-line: #2C3743;
  --dark-text: #F4F5F7;
  --dark-muted: #A9B2BD;
  --dark-accent: #5FD3A3;
  --dark-signal: #FF8A80;
  --tier-mid-bg: #FFF4C2;
  --tier-mid-ink: #5C4A00;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fs-xs: 14px;
  --fs-sm: 15px;
  --fs-base: 17px;
  --fs-md: 20px;
  --fs-lg: clamp(22px, 1.4vw + 14px, 26px);
  --fs-xl: clamp(26px, 2vw + 16px, 34px);
  --fs-2xl: clamp(32px, 3vw + 16px, 48px);
  --fs-3xl: clamp(36px, 4vw + 16px, 60px);

  --box-bg: var(--bg);
  --panel-pad: clamp(28px, 4vw, 56px);
  --gutter: clamp(16px, 5vw, 64px);
  --thread-space: 0px;
  --header-h: 64px;

  --dur-fast: 150ms;
  --dur: 250ms;
  --dur-enter: 400ms;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --ease-in: cubic-bezier(.5, 0, .75, 0);
  --shadow-panel: 0 24px 64px -24px rgba(15, 20, 25, .45);
  --shadow-pop: 0 12px 32px -12px rgba(15, 20, 25, .3);
}
@media (min-width: 1024px) { :root { --thread-space: 96px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 3px); }
body { margin: 0; background: var(--dark); color: var(--ink); font-family: var(--font-body); font-size: var(--fs-base); line-height: 1.7; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.08; letter-spacing: -0.025em; margin: 0; text-wrap: balance; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); line-height: 1.2; }
h1:focus, h2:focus { outline: none; }
[hidden] { display: none !important; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.on-dark :focus-visible { outline-color: var(--dark-accent); }
.skip-link { position: absolute; left: 16px; top: -80px; z-index: 100; background: var(--ink); color: #fff; padding: 12px 16px; text-decoration: none; transition: top var(--dur-fast) var(--ease-out); }
.skip-link:focus { top: 16px; }
.mono { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.stack-lg { display: grid; gap: 24px; align-content: start; }
.stack-md { display: grid; gap: 16px; align-content: start; }
.kicker { display: block; font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.on-dark .kicker { color: var(--dark-accent); }
.lead { font-size: var(--fs-md); line-height: 1.6; color: var(--ink-muted); max-width: 48ch; }
.on-dark .lead { color: var(--dark-muted); }
.micro { font-size: var(--fs-sm); color: var(--ink-muted); }
.statement { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-2xl); line-height: 1.08; letter-spacing: -0.025em; color: var(--accent); max-width: 16ch; text-wrap: balance; }
.arrow { color: var(--accent); font-weight: 500; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 14px 28px; border: 0; font-weight: 600; font-size: var(--fs-base); line-height: 1.2; text-decoration: none; white-space: nowrap; transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-sm { min-height: 44px; padding: 10px 18px; font-size: var(--fs-sm); }
.btn-block { width: 100%; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { cursor: progress; opacity: .85; }
@media (hover: hover) { .btn-primary:hover { background: var(--accent-hover); } }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--accent); font-weight: 600; text-decoration: none; }
@media (hover: hover) { .link-arrow:hover { text-decoration: underline; text-underline-offset: 4px; } }
.next { justify-self: start; display: inline-flex; align-items: center; gap: 16px; min-height: 48px; margin-top: 8px; padding: 0; border: 0; background: none; font-weight: 600; color: var(--ink); }
.next .icon { width: 48px; height: 48px; padding: 14px; background: var(--box-muted); transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur) var(--ease-out); }
.on-dark .next { color: var(--dark-text); }
.on-dark .next .icon { background: var(--dark-raised); }
@media (hover: hover) { .next:hover .icon { background: var(--accent); color: #fff; transform: translateY(3px); } }

/* ---------- The world: live 3D canvas, with chained stills as fallback ---------- */
.stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--dark); }
.world { position: fixed; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 600ms var(--ease-out); }
.webgl-on .world { opacity: 1; }
.webgl-on .stills { display: none; }
.plate { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 64% 50%; opacity: 0; transform-origin: 70% 60%; will-change: opacity, transform; }
.plate.is-base { opacity: 1; }
@media (max-width: 767px) { .plate { object-position: 74% 50%; } }

/* ---------- Header + progress ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(244, 245, 247, .94); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); }
.header-inner { display: flex; align-items: center; gap: 16px; height: var(--header-h); padding-inline: var(--gutter); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; flex: none; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.now-reading { flex: 1 1 0; min-width: 0; display: flex; justify-content: center; align-items: baseline; gap: 12px; font-size: var(--fs-sm); color: var(--ink-muted); white-space: nowrap; overflow: hidden; }
.now-reading [data-now-label] { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.header-cta { flex: none; }
.progress { height: 3px; background: var(--box-muted); }
.progress > span { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
@media (max-width: 639px) {
  .brand-name, .now-reading [data-now-label] { display: none; }
  .now-reading { justify-content: flex-start; }
}

/* ---------- The thread: the data line as chapter navigation ---------- */
.thread { display: none; }
@media (min-width: 1024px) {
  .thread { display: block; position: fixed; z-index: 40; left: 40px; top: calc(var(--header-h) + 48px); bottom: 48px; width: 16px; }
  .thread-track { position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: rgba(154, 162, 173, .55); }
  .thread-fill { position: absolute; inset: 0; background: var(--dark-accent); box-shadow: 0 0 12px rgba(95, 211, 163, .7); transform-origin: top; transform: scaleY(0); }
  .thread ol { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between; }
  .thread a { position: relative; display: flex; align-items: center; width: 16px; height: 16px; text-decoration: none; }
  .thread a::before { content: ""; position: absolute; inset: -14px; }
  .t-dot { width: 10px; height: 10px; margin-left: 3px; background: #9AA2AD; transition: transform var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out); }
  .thread a.is-done .t-dot { background: var(--dark-accent); }
  .thread a[aria-current="step"] .t-dot { background: var(--dark-accent); transform: scale(1.6); box-shadow: 0 0 10px rgba(95, 211, 163, .8); }
  .t-label { position: absolute; left: 28px; padding: 4px 10px; background: var(--surface); color: var(--ink); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; box-shadow: var(--shadow-pop); opacity: 0; transform: translateX(-4px); pointer-events: none; transition: opacity var(--dur-fast) var(--ease-in), transform var(--dur-fast) var(--ease-in); }
  .thread a:focus-visible .t-label, .thread a:hover .t-label { opacity: 1; transform: none; transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out); }
}

/* ---------- Chapters, beats, floating panels ---------- */
main { position: relative; z-index: 1; }
.chapter { scroll-margin-top: calc(var(--header-h) + 3px); }
.beat { min-height: 150svh; display: flex; align-items: center; padding: 40svh var(--gutter) 30svh calc(var(--gutter) + var(--thread-space)); }
.beat-open { min-height: calc(100svh - var(--header-h)); padding-top: clamp(32px, 8svh, 96px); padding-bottom: 40svh; align-items: flex-start; }
.beat-end { padding-bottom: 12svh; }
.panel { width: 100%; max-width: 580px; display: grid; gap: 24px; align-content: start; padding: var(--panel-pad); box-shadow: var(--shadow-panel); }
.panel-wide { max-width: 920px; }
/* proof keeps the standard column so the cost-per-sale station stays visible to its right; screenshots sit side by side */
.panel-light { background: rgba(255, 255, 255, var(--panel-alpha)); color: var(--ink); --box-bg: var(--bg); }
.panel-dark { background: rgba(15, 20, 25, var(--panel-alpha)); color: var(--dark-text); --box-bg: var(--dark-raised); }
/* panels let the 3D world show through; the blur keeps text readable, alpha stays high enough for 4.5:1 contrast */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel-light, .panel-dark { --panel-alpha: 0.78; -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(1.15); backdrop-filter: blur(var(--panel-blur)) saturate(1.15); }
}
.beat-open .panel { max-width: 680px; }
@media (max-width: 767px) {
  /* phones: the scene owns the top of the screen, panels start just below it */
  .beat { min-height: 120svh; padding-top: 60svh; padding-bottom: 20svh; }
  .beat-open { min-height: auto; padding-top: 38svh; padding-bottom: 50svh; }
  .panel { box-shadow: none; }
  /* phones: panels are frosted so the scene keeps moving behind the text; alpha stays high enough for 4.5:1 text contrast */
  .panel-light { background: rgba(255, 255, 255, var(--panel-alpha-mobile)); }
  .panel-dark { background: rgba(15, 20, 25, var(--panel-alpha-mobile)); }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .panel-light, .panel-dark { --panel-alpha-mobile: 0.72; -webkit-backdrop-filter: blur(var(--panel-blur-mobile)) saturate(1.15); backdrop-filter: blur(var(--panel-blur-mobile)) saturate(1.15); }
  }
}
:root { --panel-alpha: 0.92; --panel-blur: 8px; --panel-alpha-mobile: 0.9; --panel-blur-mobile: 10px; }

/* Panels arrive from the line: rise + fade */
.js .reveal { opacity: 0; transform: translateY(32px); transition: opacity var(--dur-enter) var(--ease-out), transform var(--dur-enter) var(--ease-out); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- 01 Opening form ---------- */
.url-form { display: grid; gap: 16px; }
.url-row { display: grid; gap: 8px; }
@media (min-width: 560px) { .url-row { grid-template-columns: minmax(0, 1fr) auto; } }

/* ---------- 02 Gap ---------- */
.gap-chart { margin: 0; display: grid; gap: 24px; padding: 24px; background: var(--box-bg); }
.gap-row { display: grid; gap: 10px; }
.gap-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; color: var(--dark-muted); font-size: var(--fs-sm); }
.gap-val { font-family: var(--font-mono); font-weight: 500; font-size: var(--fs-xl); white-space: nowrap; }
.gap-val.bad { color: var(--dark-signal); }
.gap-val.good { color: var(--dark-accent); }
.gap-bar { height: 14px; background: var(--dark-line); }
.gap-bar > span { display: block; height: 100%; transform-origin: left; transform: scaleX(0); transition: transform var(--dur-enter) var(--ease-out); }
.gap-bar.reported > span { width: 100%; background: repeating-linear-gradient(135deg, var(--dark-signal) 0 6px, #E0685E 6px 12px); transition-delay: 300ms; }
.gap-bar.real > span { width: 10%; background: var(--dark-accent); transition-delay: 650ms; }
.is-visible .gap-bar > span { transform: scaleX(1); }
.gap-chart figcaption { font-size: var(--fs-xs); color: var(--dark-muted); }
.symptoms, .handoffs { display: grid; }
.symptoms li, .handoffs li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; padding-block: 14px; border-top: 1px solid var(--dark-line); }
.symptoms .mono { color: var(--dark-signal); font-size: var(--fs-xs); padding-top: 4px; }
.handoffs .mono { color: var(--dark-signal); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; padding-top: 4px; }

/* ---------- 04 Method services ---------- */
.services { display: grid; gap: 8px; }
.svc-toggle { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 12px 16px; border: 0; background: var(--box-bg); font-weight: 600; text-align: left; transition: background-color var(--dur-fast) var(--ease-out); }
.svc-toggle .icon { transition: transform var(--dur) var(--ease-out); }
.svc-toggle[aria-expanded="true"] { background: var(--ink); color: #fff; }
.svc-toggle[aria-expanded="true"] .icon { transform: rotate(45deg); }
@media (hover: hover) { .svc-toggle[aria-expanded="false"]:hover { background: var(--box-muted); } }
.svc-body { display: grid; gap: 8px; padding: 16px; background: var(--box-bg); font-size: var(--fs-sm); color: var(--ink-muted); animation: drop var(--dur) var(--ease-out); }
.svc-body li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 10px; }
.svc-body li::before { content: ""; width: 6px; height: 6px; margin-top: 10px; background: var(--accent); }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- 05 Proof ---------- */
.cps-pair { display: grid; gap: 12px; }
@media (min-width: 560px) { .cps-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cps { display: grid; gap: 12px; padding: 28px; }
.cps > span { display: block; }
.cps.before { background: var(--signal-soft); }
.cps.after { background: var(--accent-soft); }
.cps-label { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-muted); text-transform: uppercase; letter-spacing: .06em; }
.cps-value { font-family: var(--font-mono); font-weight: 500; font-size: clamp(28px, 2.6vw + 12px, 42px); line-height: 1.1; white-space: nowrap; }
.cps.before .cps-value { color: var(--signal); }
.cps.after .cps-value { color: var(--accent); }
.changes { display: grid; }
.changes li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding-block: 16px; border-top: 1px solid var(--line); }
.changes .mono { font-size: var(--fs-xs); color: var(--accent); text-transform: uppercase; letter-spacing: .06em; padding-top: 4px; }
.footnote { color: var(--ink-muted); font-size: var(--fs-sm); max-width: 68ch; }

/* ---------- 06 Check: tabs, quiz, calculator ---------- */
.tabs { display: grid; }
.tablist { display: flex; flex-wrap: wrap; gap: 4px; }
.tab { min-height: 52px; padding: 12px 24px; border: 0; background: var(--box-muted); font-weight: 600; transition: background-color var(--dur-fast) var(--ease-out); }
.tab[aria-selected="true"] { background: var(--bg); box-shadow: inset 0 3px 0 var(--accent); }
@media (hover: hover) { .tab[aria-selected="false"]:hover { background: #D6DADF; } }
.tabpanel { padding: clamp(20px, 3vw, 40px); background: var(--bg); display: grid; gap: clamp(24px, 3vw, 40px); animation: drop var(--dur) var(--ease-out); }
@media (min-width: 1024px) {
  .panel-quiz { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
  .panel-roas { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
}
.quiz { display: grid; }
.quiz li { display: grid; gap: 12px; padding-block: 14px; border-bottom: 1px solid var(--line); }
@media (min-width: 640px) { .quiz li { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; } }
.quiz li:first-child { padding-top: 0; }
.seg { display: flex; gap: 4px; }
.seg button { min-width: 72px; min-height: 44px; padding: 8px 16px; border: 0; background: var(--surface); font-weight: 600; font-size: var(--fs-sm); transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
@media (hover: hover) { .seg button[aria-pressed="false"]:hover { background: var(--box-muted); } }
.quiz-result { display: grid; gap: 16px; align-content: start; padding: 28px; background: var(--surface); }
.score { display: flex; align-items: baseline; gap: 6px; }
.score .big { font-size: clamp(56px, 7vw, 88px); line-height: 1; }
.score .of { font-size: var(--fs-lg); color: var(--ink-muted); }
.tier { justify-self: start; font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; padding: 6px 12px; background: var(--box-muted); }
.tier.good { background: var(--accent-soft); color: var(--accent-hover); }
.tier.mid { background: var(--tier-mid-bg); color: var(--tier-mid-ink); }
.tier.bad { background: var(--signal-soft); color: var(--signal); }
.calc-inputs { display: grid; gap: 24px; }
@media (min-width: 560px) { .calc-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.calc .micro { margin-top: 24px; }
.calc-out { display: grid; gap: 16px; align-content: start; padding: 28px; background: var(--dark); color: var(--dark-text); }
/* check: while the 3D world runs, its status board already shows the score and the break-even ROAS, so the panel
   keeps only the inputs and stays narrow enough for the board to show beside it. The results stay in the
   document for screen readers (they are live regions) and reappear when the world is off. */
.panel-check { max-width: 640px; }
.scene-hint { display: none; }
.webgl-on .scene-hint { display: block; }
.webgl-on .panel-check .panel-quiz, .webgl-on .panel-check .panel-roas { grid-template-columns: minmax(0, 1fr); }
.webgl-on .panel-check .quiz-result { padding: 0; background: none; }
.webgl-on .panel-check .quiz-result > :not([data-quiz-cta]),
.webgl-on .panel-check .calc-out { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* phones: the check panel is taller than the space under the scene, so it becomes a fixed-height sheet that
   scrolls inside itself. The page stays at the station's rest, the status board keeps the top of the screen,
   and every answer or input is seen landing on the board while the questions scroll underneath. */
@media (max-width: 767px) {
  .webgl-on .panel-check {
    max-height: calc(42svh - 12px); /* rests at 58% of the screen (data-rest-top in index.html) */
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    scroll-padding-block: 24px;
  }
  .webgl-on .panel-check .scene-hint { position: sticky; top: calc(-1 * var(--panel-pad)); z-index: 1; margin-inline: calc(-1 * var(--panel-pad)); padding: 8px var(--panel-pad); background: rgba(255, 255, 255, 0.94); }
}
.out-label { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--dark-muted); text-transform: uppercase; letter-spacing: .06em; }
.out-value { font-size: clamp(56px, 7vw, 88px); line-height: 1; color: var(--dark-accent); white-space: nowrap; }
.out-value.is-neg { font-size: clamp(26px, 3vw, 34px); color: var(--dark-signal); white-space: normal; font-family: var(--font-display); }
.out-sub { color: var(--dark-muted); font-size: var(--fs-sm); }
.out-sub .mono { color: var(--dark-text); }

/* ---------- 07 Timeline ---------- */
.timeline { --fill: 0; position: relative; display: grid; gap: 4px; }
.timeline::before, .timeline::after { content: ""; position: absolute; left: 23px; top: 24px; bottom: 24px; width: 2px; background: var(--line); }
.timeline::after { background: var(--accent); transform-origin: top; transform: scaleY(var(--fill)); transition: transform 500ms var(--ease-out); }
.timeline li { position: relative; z-index: 1; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 20px; padding-block: 14px; }
.t-num { width: 48px; height: 48px; display: grid; place-items: center; background: var(--box-muted); font-size: var(--fs-sm); transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out); }
.timeline li.is-reached .t-num { background: var(--accent); color: #fff; }
.timeline h3 { font-size: var(--fs-md); margin-bottom: 4px; padding-top: 10px; }
.timeline p { color: var(--ink-muted); }
/* desktop: beats marked data-rest="below" (Measure, How we work) rest under their station, centred and wide,
   so the whole station stays in view above the panel */
@media (min-width: 768px) {
  .beat-below { justify-content: center; padding-left: var(--gutter); }
  .panel-below { max-width: 1120px; gap: 20px; }
  .panel-process .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
  .panel-process .timeline::before, .panel-process .timeline::after { display: none; }
}
@media (min-width: 1024px) {
  .panel-process .timeline { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .panel-process .timeline::before, .panel-process .timeline::after { display: block; top: 23px; bottom: auto; left: 24px; right: calc((100% - 96px) / 4 - 24px); width: auto; height: 2px; }
  .panel-process .timeline::after { transform-origin: left; transform: scaleX(var(--fill)); }
  .panel-process .timeline li { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-block: 0; }
  .panel-process .timeline h3 { padding-top: 0; }
}
/* Measure below its station: the message on the left, the service and next step on the right, to keep the panel short */
@media (min-width: 1024px) {
  .panel-measure { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); column-gap: 48px; align-items: start; }
  .panel-measure > :not(.services, .next) { grid-column: 1; }
  .panel-measure > .services { grid-column: 2; grid-row: 1 / span 3; }
  .panel-measure > .next { grid-column: 2; justify-self: start; }
}

/* ---------- 08 Fit & about ---------- */
.fit { display: grid; gap: 12px; }
@media (min-width: 768px) { .fit { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fit-col { display: grid; gap: 20px; align-content: start; padding: 28px; background: var(--box-bg); }
.fit-col.no { background: var(--box-muted); }
.fit-col h3 { font-size: var(--fs-md); }
.ticks { display: grid; gap: 14px; }
.ticks li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; }
.ticks .icon { margin-top: 4px; }
.yes .ticks .icon { color: var(--accent); }
.no .ticks .icon { color: var(--signal); }
.about { display: grid; gap: 32px; align-items: center; padding-top: 8px; }
@media (min-width: 768px) { .about { grid-template-columns: 200px minmax(0, 1fr); } }
.monogram { position: relative; aspect-ratio: 4 / 5; max-width: 200px; display: grid; place-items: center; background: var(--ink); color: var(--dark-text); font-family: var(--font-display); font-size: clamp(48px, 5vw, 72px); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
/* the story's data line under the initials */
.monogram::after { content: ""; position: absolute; left: 24px; right: 24px; bottom: 24px; height: 3px; background: var(--dark-accent); }
.about-title { font-size: var(--fs-xl); }
.about p { color: var(--ink-muted); max-width: 58ch; }
.principles { display: flex; flex-wrap: wrap; gap: 8px; }
.principles li { padding: 8px 14px; background: var(--box-muted); font-family: var(--font-mono); font-size: var(--fs-xs); }

/* ---------- 09 FAQ ---------- */
.faq { display: grid; border-top: 1px solid var(--line); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-q { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 60px; padding: 16px 0; border: 0; background: none; text-align: left; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); line-height: 1.3; }
.faq-q .icon { width: 22px; height: 22px; transition: transform var(--dur) var(--ease-out); }
.faq-q[aria-expanded="true"] .icon { transform: rotate(45deg); }
@media (hover: hover) { .faq-q:hover { color: var(--accent); } }
.faq-a { padding-bottom: 20px; max-width: 60ch; color: var(--ink-muted); animation: drop var(--dur) var(--ease-out); }

/* ---------- 10 Begin: form ---------- */
.end-grid { display: grid; gap: clamp(32px, 4vw, 56px); align-items: start; }
@media (min-width: 1024px) { .end-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); } }
.form-card { padding: clamp(24px, 3vw, 40px); background: var(--surface); color: var(--ink); --box-bg: var(--bg); }
.form { display: grid; gap: 22px; }
.field { display: grid; gap: 8px; }
.field-label, .chips-field legend { font-weight: 600; font-size: var(--fs-sm); }
.req { color: var(--signal); margin-left: 2px; }
.opt { font-weight: 400; color: var(--ink-muted); }
.input, .select, .textarea { width: 100%; min-height: 52px; padding: 12px 14px; background: var(--surface); color: var(--ink); border: 1.5px solid #9AA2AD; font-size: var(--fs-base); line-height: 1.4; transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; padding-right: 44px; }
.input::placeholder, .textarea::placeholder { color: #737B86; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11, 110, 79, .25); }
.input-prefix { display: flex; }
.input-prefix .prefix { display: flex; align-items: center; padding: 0 12px; background: var(--box-muted); font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-muted); flex: none; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--signal); }
.field-error { display: none; gap: 6px; align-items: flex-start; font-size: var(--fs-sm); font-weight: 500; color: var(--signal); }
.field.has-error .field-error { display: flex; }
.field-error .icon { width: 16px; height: 16px; margin-top: 4px; }
/* send failure: shown under the fields with the direct email as the way out */
.send-error { display: flex; gap: 8px; align-items: flex-start; padding: 12px 16px; background: var(--signal-soft); color: var(--signal); font-size: var(--fs-sm); font-weight: 500; }
.send-error[hidden] { display: none; }
.send-error .icon { flex: none; width: 16px; height: 16px; margin-top: 4px; }
.send-error a { color: inherit; font-weight: 600; }
.on-dark .send-error { background: #3A1512; color: var(--dark-signal); }
.mail-note { font-size: var(--fs-sm); color: var(--ink-muted); }
/* spam trap for bots; kept out of view and out of the tab order */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.chips-field { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; }
.chips-field legend { padding: 0; margin-bottom: 12px; }
.chip-set { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 16px; background: var(--bg); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; transition: background-color var(--dur-fast) var(--ease-out); }
.chip input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.chip:has(input:checked) { background: var(--accent-soft); color: var(--accent-hover); }
.chip:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .chip:hover { background: var(--box-muted); } }
.form-summary { display: grid; gap: 8px; padding: 16px; background: var(--signal-soft); }
.form-summary p { font-weight: 600; color: var(--signal); }
.form-summary ul { list-style: disc; padding-left: 20px; display: grid; gap: 4px; }
.form-summary a { color: var(--ink); }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-success { display: grid; gap: 12px; padding: 28px; background: var(--accent-soft); color: var(--ink); animation: drop var(--dur-enter) var(--ease-out); }
.success-head { display: flex; gap: 12px; align-items: center; }
.success-head .icon { width: 28px; height: 28px; color: var(--accent); }
.success-head h3 { font-size: var(--fs-md); }
.success-url { font-family: var(--font-mono); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding-top: 24px; border-top: 1px solid var(--dark-line); font-size: var(--fs-sm); color: var(--dark-muted); }
.footer a { color: var(--dark-text); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.footer-link { background: none; border: 0; padding: 0; font: inherit; color: var(--dark-text); cursor: pointer; min-height: 44px; }
@media (hover: hover) { .footer a:hover, .footer-link:hover { color: var(--dark-accent); } }

/* ---------- Reduced motion: scenes switch in place, panels stay put ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; transition-delay: 0ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  .gap-bar > span { transform: none; }
}
