/* Theoros v3: the YC F26-style layer over the kit. Floating blurred nav, hairline guides, grain, HUD labels,
   a large display headline, the live broadcast frame, the sticky story, the colour picker and scroll reveals.
   Where this file and the kit disagree, this file wins (decided 2026-11-21). */

:root {
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --guide: color-mix(in oklab, var(--p-ink) 8%, transparent);
}

/* ── Free-height sections: the new layout sets its own rhythm ─────────────── */
main > section.th-free.th-free {
  height: auto; min-height: 0; display: block;
  padding: clamp(96px, 11vw, 168px) 0 0;
}
main > section.th-free.th-free > .wrap.wrap { height: auto; display: block; }
main > section.th-hero.th-free.th-free { padding-top: calc(var(--nav) + clamp(48px, 7vw, 96px)); }
main > section.th-questions.th-free.th-free { padding-bottom: clamp(96px, 11vw, 168px); }
html { scroll-padding-top: 88px; }

/* ── Floating nav: inset, blurred, square-cut corners ─────────────────────── */
.nav.nav {
  inset: 12px 12px auto 12px; max-width: 1304px; margin-inline: auto; height: 60px;
  border: 1px solid var(--line); border-radius: 6px;
  background: color-mix(in oklab, var(--p-bg) 70%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3);
}
.nav.nav > .wrap { width: 100%; padding-inline: 16px 10px; }
.nav.nav .btn { min-height: 40px; }
.nav.nav .th-theme { width: 40px; height: 40px; }
/* the phone sheet is fixed to the window: an open nav drops the blur (a filter would trap it) and goes full width */
.nav.nav.is-open { inset: 0 0 auto 0; max-width: none; border-radius: 0; border-width: 0 0 1px; background: var(--p-bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (max-width: 639px) { .nav.nav { inset: 8px 8px auto 8px; height: 56px; } }

/* ── Hairline guides at the content's edges, and a faint grain over the page ── */
.th-guides { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.th-guides::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; translate: -50% 0;
  width: min(100% - 2 * var(--gut) + 2px, 1282px);
  border-inline: 1px solid var(--guide);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 70; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
html[data-theme="light"] body::after { opacity: 0.035; mix-blend-mode: multiply; }

/* ── HUD labels and type ──────────────────────────────────────────────────── */
.th-hud {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0;
  font: 500 12px/1.4 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
}
.th-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success, #A3AE72); box-shadow: 0 0 0 0 color-mix(in oklab, #A3AE72 60%, transparent); animation: th-pulse 2.4s ease-out infinite; }
@keyframes th-pulse { 0% { box-shadow: 0 0 0 0 rgb(163 174 114 / .55); } 70%, 100% { box-shadow: 0 0 0 8px rgb(163 174 114 / 0); } }

.th-display {
  margin: 22px 0 0; max-width: 16ch;
  font: 500 clamp(44px, 7.3vw, 108px)/0.96 var(--font-display); letter-spacing: -0.035em; text-wrap: balance;
}
.th-display__mute { display: block; color: var(--muted); }
.th-h2 { margin: 18px 0 0; font: 500 clamp(32px, 4.2vw, 58px)/1.02 var(--font-display); letter-spacing: -0.025em; text-wrap: balance; }
.th-h2 .muted { color: var(--muted); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.th-hero__row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--s-6);
  margin-top: clamp(24px, 3vw, 40px);
}
.th-hero__lead { margin: 0; max-width: 54ch; font-size: clamp(17px, 1.35vw, 20px); line-height: 1.5; color: var(--ink); }
.th-hero__row .btn-row { margin: 0; flex-wrap: nowrap; }
.th-stage { position: relative; margin-top: clamp(40px, 5vw, 72px); }
.th-stage__hud {
  display: flex; justify-content: space-between; gap: var(--s-4); padding: 10px 2px;
  font: 500 11px/1.4 var(--mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
}
.th-stage .bc { outline: 1px solid var(--line); outline-offset: 7px; }
.th-play {
  display: inline-flex; align-items: center; gap: 8px; padding: 0; min-height: 28px;
  background: none; border: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer;
}
.th-play svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.th-play .th-play__run { display: none; fill: currentColor; stroke: none; }
.th-play[aria-pressed="true"] .th-play__run { display: block; }
.th-play[aria-pressed="true"] .th-play__pause { display: none; }
.th-play:hover { color: var(--ink); }

@media (max-width: 767px) {
  .th-hero__row { grid-template-columns: minmax(0, 1fr); }
  .th-hero__row .btn-row { flex-wrap: wrap; }
  .th-stage__hud--bottom > span { display: none; }
}

/* the hero enters once on load */
@media (prefers-reduced-motion: no-preference) {
  .th-in { animation: th-rise 0.9s var(--ease-out) both; }
  .th-in:nth-child(2) { animation-delay: 80ms; }
  .th-in:nth-child(3) { animation-delay: 160ms; }
  .th-in:nth-child(4) { animation-delay: 260ms; }
}
@keyframes th-rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

/* scroll-driven reveals, where the browser has them */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .th-reveal { animation: th-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 70%; }
  }
}

/* ── Fact row ─────────────────────────────────────────────────────────────── */
.th-facts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: clamp(56px, 7vw, 96px) 0 0;
  border-top: 1px solid var(--line);
}
.th-facts > div { padding: var(--s-5) var(--s-5) 0 0; }
.th-facts > div + div { padding-left: var(--s-5); border-left: 1px solid var(--line); }
.th-facts dt { font: 500 clamp(40px, 4.4vw, 64px)/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.th-facts dd { margin: 10px 0 0; max-width: 26ch; font-size: 14px; line-height: 1.45; color: var(--muted); }
@media (max-width: 767px) {
  .th-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .th-facts > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .th-facts > div:nth-child(n+3) { border-top: 1px solid var(--line); margin-top: var(--s-5); }
}

/* ── The broadcast frame ──────────────────────────────────────────────────── */
.bc {
  --team-a: #D19B5E; --team-a-ink: #14120F; --team-b: #2A2620;
  --fade: 0.5s var(--ease-out);
  position: relative; margin: 0; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 4px;
  background: #0b0a09; color: #F2EEE6; container-type: inline-size; font-family: var(--font-text);
}
.bc__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bc__shade { position: absolute; inset: 0; background: rgb(11 10 9 / 0.62); opacity: 0; transition: opacity var(--fade); }
.bc[data-state="pre"] .bc__shade, .bc[data-state="break"] .bc__shade { opacity: 1; }

.bc__bug, .bc__toast, .bc__pre, .bc__break, .bc__tape { transition: opacity var(--fade), transform var(--fade), visibility var(--fade); }
.bc[data-state="pre"] :is(.bc__bug, .bc__toast, .bc__break),
.bc[data-state="live"] :is(.bc__pre, .bc__break),
.bc[data-state="break"] :is(.bc__bug, .bc__toast, .bc__pre, .bc__tape) { opacity: 0; visibility: hidden; transform: translateY(6px); }

/* scoreboard */
.bc__bug {
  position: absolute; left: 3.2cqi; top: 3.6cqi; display: flex; align-items: stretch;
  font: 600 clamp(8px, 1.55cqi, 15px)/1 var(--font-text); font-variant-numeric: tabular-nums;
  background: rgb(20 18 15 / 0.92); border-radius: 2px; overflow: hidden;
}
.bc__team { display: flex; align-items: center; gap: 0.5em; padding: 0.6em 0.75em; }
.bc__team b { font: 500 1.2em/1 var(--font-display); letter-spacing: 0.03em; }
.bc__chip { width: 0.32em; align-self: stretch; margin: -0.6em 0 -0.6em -0.75em; background: var(--team-b); }
.bc__team--home .bc__chip { background: var(--team-a); }
.bc__score { min-width: 1.4em; text-align: right; transition: background-color 0.3s, color 0.3s; padding: 0.1em 0.2em; border-radius: 2px; }
.bc.is-scored .bc__team--home .bc__score { background: var(--team-a); color: var(--team-a-ink); }
.bc__per { display: flex; align-items: center; padding: 0 0.7em; color: #A39A8D; font-weight: 500; }
.bc__clock { display: flex; align-items: center; padding: 0 0.75em; background: var(--team-a); color: var(--team-a-ink); }

.bc__toast {
  position: absolute; left: 3.2cqi; top: calc(3.6cqi + clamp(8px, 1.55cqi, 15px) * 2.6 + 0.6cqi);
  padding: 0.55em 0.8em; font: 500 clamp(8px, 1.3cqi, 13px)/1 var(--font-text);
  background: rgb(20 18 15 / 0.92); border-left: 3px solid var(--team-a); border-radius: 2px;
}
.bc:not(.is-scored) .bc__toast { opacity: 0; visibility: hidden; transform: translateY(-6px); }

/* matchup card */
.bc__pre { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 2.4cqi; text-align: center; }
.bc__kicker { font: 600 clamp(8px, 1.15cqi, 12px)/1.2 var(--font-text); letter-spacing: 0.16em; text-transform: uppercase; color: var(--team-a); }
.bc__match { display: flex; align-items: center; gap: 4cqi; }
.bc__side { display: grid; justify-items: center; gap: 1cqi; }
.bc__side b { font: 500 clamp(22px, 6.4cqi, 72px)/0.9 var(--font-display); letter-spacing: 0.02em; }
.bc__side small { font-size: clamp(8px, 1.3cqi, 14px); color: #c9c1b5; }
.bc__side .bc__chip { width: 4cqi; height: 0.5cqi; margin: 0; align-self: auto; }
.bc__vs { font: 500 clamp(10px, 2cqi, 22px)/1 var(--font-display); color: #A39A8D; }

/* break graphic */
.bc__break {
  position: absolute; inset: 9% 12%; display: grid; grid-template-rows: auto 1fr auto; gap: 2cqi;
  padding: 3.6cqi 4.4cqi; background: rgb(20 18 15 / 0.94); border-top: 0.45cqi solid var(--team-a); border-radius: 3px;
}
.bc[data-state="break"] .bc__break { transform: none; }
.bc__break-head { display: flex; justify-content: space-between; align-items: center; }
.bc__break-head img { width: clamp(12px, 2.2cqi, 24px); height: auto; }
.bc__rows { display: grid; align-content: center; }
.bc__row { display: flex; justify-content: space-between; align-items: baseline; padding: 1.1cqi 0; border-top: 1px solid rgb(242 238 230 / 0.12); font-size: clamp(9px, 1.5cqi, 16px); }
.bc__row:last-child { border-bottom: 1px solid rgb(242 238 230 / 0.12); }
.bc__row b { font: 500 clamp(13px, 3cqi, 34px)/1 var(--font-display); font-variant-numeric: tabular-nums; }
.bc__sponsor { display: none; align-items: baseline; gap: 0.8em; font-size: clamp(8px, 1.3cqi, 13px); color: #A39A8D; }
.bc__sponsor b { font: 500 1.35em/1 var(--font-display); color: #F2EEE6; }
.bc[data-sponsor="on"] .bc__sponsor { display: flex; }

/* the stats tape: one thin band on the bottom edge, never over the play */
.bc__tape {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: stretch;
  height: clamp(18px, 3.3cqi, 32px); font: 500 clamp(8px, 1.3cqi, 13px)/1 var(--font-text);
  background: rgb(20 18 15 / 0.9); border-top: 1px solid var(--team-a);
}
.bc__tape-tag { flex: none; display: flex; align-items: center; gap: 0.4em; padding: 0 1em; background: var(--team-a); color: var(--team-a-ink); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.9em; }
.bc__tape-tag b { font-weight: 700; }
.bc__tape-window { flex: 1; min-width: 0; overflow: hidden; display: flex; align-items: center; }
.bc__tape-track { display: flex; width: max-content; animation: bc-tape 34s linear infinite; }
.bc__tape-run { display: flex; }
.bc__tape-item { white-space: nowrap; padding: 0 1.6em; position: relative; }
.bc__tape-item::after { content: ""; position: absolute; right: -2px; top: 50%; width: 4px; height: 4px; margin-top: -2px; background: var(--team-a); }
.bc__tape-item--sponsor { color: #E9C89A; }
.bc:not([data-sponsor="on"]) .bc__tape-item--sponsor { display: none; }
.bc.is-paused .bc__tape-track { animation-play-state: paused; }
@keyframes bc-tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .bc__tape-track, .th-dot { animation: none; }
  .bc, .bc * { transition: none !important; }
}

/* ── Sticky story ─────────────────────────────────────────────────────────── */
.th-story__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s-8); margin-top: var(--s-7); }
.th-story__steps { list-style: none; margin: 0; padding: 0 0 22vh; }
.th-step { min-height: 72vh; display: flex; flex-direction: column; justify-content: center; gap: var(--s-3); opacity: 0.32; transition: opacity 0.4s var(--ease-out); }
.th-step.is-active { opacity: 1; }
.th-step__n { font: 500 12px/1 var(--mono); color: var(--accent, var(--p-accent)); letter-spacing: 0.06em; }
.th-step h3 { margin: 0; font: 500 clamp(26px, 2.6vw, 36px)/1.1 var(--font-display); letter-spacing: -0.02em; }
.th-step p { margin: 0; max-width: 40ch; font-size: 17px; line-height: 1.55; }
.th-story__pin { position: relative; }
.th-story__pin > .th-stage { position: sticky; top: max(96px, calc(50vh - 250px)); margin-top: 0; }
@media (prefers-reduced-motion: no-preference) { .th-step { transition: opacity 0.4s var(--ease-out); } }

.th-switch {
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; margin-top: var(--s-3);
  min-height: 44px; padding: 0 14px 0 10px; border: 1px solid var(--line-strong, var(--line)); border-radius: 4px;
  background: transparent; color: var(--ink); font: 500 14px/1 var(--font-text); cursor: pointer;
}
.th-switch__knob { position: relative; width: 30px; height: 16px; border-radius: 2px; background: var(--surface, var(--p-surface)); border: 1px solid var(--line-strong, var(--line)); }
.th-switch__knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 1px; background: var(--muted); transition: transform 0.25s var(--ease-out), background-color 0.25s; }
.th-switch[aria-pressed="true"] .th-switch__knob::after { transform: translateX(14px); background: var(--p-accent); }
.th-switch:hover { border-color: var(--ink); }

@media (max-width: 1023px) {
  .th-story__grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .th-story__pin { order: -1; position: sticky; top: 76px; z-index: 2; padding-bottom: var(--s-4); background: var(--bg, var(--p-bg)); }
  .th-story__pin > .th-stage { position: static; }
  .th-step { min-height: 56vh; }
}
@media (max-width: 639px) {
  .th-story__pin { top: 68px; }
  .th-story__pin .th-stage__hud { display: none; }
  .th-step { min-height: 48vh; }
  .th-step p { font-size: 16px; }
}

/* ── Colour picker ────────────────────────────────────────────────────────── */
.th-colours__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s-8); align-items: center; margin-top: var(--s-4); }
.th-colours__copy > p { margin: var(--s-4) 0 0; max-width: 42ch; font-size: 17px; line-height: 1.55; }
.th-picker { margin-top: var(--s-6); display: grid; gap: var(--s-5); }
.th-presets { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; border: 0; }
.th-presets legend { width: 100%; margin-bottom: 10px; padding: 0; font: 500 12px/1.4 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.th-presets button {
  width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-strong, var(--line)); border-radius: 4px; cursor: pointer;
  background: linear-gradient(135deg, var(--a) 0 50%, var(--b) 50% 100%);
  transition: transform 0.2s var(--ease-out);
}
.th-presets button:hover { transform: translateY(-2px); }
.th-presets button[aria-pressed="true"] { outline: 2px solid var(--p-accent); outline-offset: 2px; }
.th-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.th-fields label { display: grid; gap: 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.th-fields input[type="color"] { width: 100%; height: 48px; padding: 4px; border: 1px solid var(--line-strong, var(--line)); border-radius: 4px; background: transparent; cursor: pointer; }
.th-fields input[type="text"] {
  height: 48px; padding: 0 12px; border: 1px solid var(--line-strong, var(--line)); border-radius: 4px;
  background: transparent; color: var(--ink); font: 600 16px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
}
.th-colours .th-stage { margin-top: 0; }
@media (max-width: 1023px) {
  .th-colours__grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-7); }
}
@media (max-width: 479px) { .th-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .th-fields label:last-child { grid-column: 1 / -1; } }

/* ── Console and questions on the free rhythm ─────────────────────────────── */
.th-console .grid { margin-top: var(--s-4); }
.th-console .app.ui { height: clamp(420px, 62vh, 620px); }
/* the open pane's picture fills what the pane leaves, so its bottom edge (and the tape on it) shows whole */
.th-console .app__pane--open::after { display: none; }
.th-console .th-open { height: 100%; display: flex; flex-direction: column; }
.th-console .th-open .th-screen { flex: 1 1 0; min-height: 0; aspect-ratio: auto; }
.th-console .th-open .th-screen > img { position: absolute; inset: 0; }
.th-open__head .th-chip { white-space: nowrap; }
@media (max-width: 639px) {
  .th-console .app.ui { height: 460px; }
  .th-console .th-open { padding: 16px; gap: 12px; }
  .th-open__head { flex-wrap: wrap; row-gap: 4px; }
  .th-open__head small { order: 3; flex-basis: 100%; }
}
/* the feature runs on a thin tape along the picture's bottom edge, never over the play */
.th-tape {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: stretch; height: 26px; overflow: hidden;
  font: 500 12px/1 var(--font-text); color: #F2EEE6; background: rgb(20 18 15 / 0.9); border-top: 1px solid var(--b-bronze);
}
.th-tape__tag { flex: none; display: flex; align-items: center; padding: 0 10px; background: var(--b-bronze); color: var(--b-char); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 11px; }
.th-tape__text { display: flex; align-items: center; padding: 0 12px; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.th-questions .grid { margin-top: var(--s-4); }
.th-questions .faq { padding-top: var(--s-2); }
