/* ══════════════════════════════════════════════════════════════════════
   Dylan Fout — DEFY case study
   Dark cinematic / editorial data.
   Series colors validated against both surfaces (dataviz six checks):
   #f2410f · #3987e5 · #199e70  — all-pairs PASS on #111315 and #08090A.
   ══════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* surfaces */
  --plane:      #08090a;
  --plane-alt:  #0b0d0f;
  --surface:    #111315;
  --surface-2:  #16191c;
  --rule:       #23272c;
  --grid:       #1c1f23;

  /* ink */
  --ink:        #ffffff;
  --ink-2:      #a9afb6;
  --ink-3:      #757d85;

  /* data + brand */
  --accent:     #f2410f;   /* series 1 · long form · brand */
  --accent-lit: #ff6435;   /* UI only — hover/glow, never a data mark */
  --s2:         #3987e5;   /* series 2 · shorts / discovery */
  --s3:         #199e70;   /* series 3 */

  /* type */
  --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --wrap: 1240px;
  --nav-h: 68px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent-lit);
  outline-offset: 3px;
  border-radius: 3px;
}

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

.skip {
  position: fixed; top: -100px; left: 1rem; z-index: 200;
  background: var(--accent); color: #fff; padding: .7rem 1.1rem;
  font: 600 14px/1 var(--sans); border-radius: 6px; text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ── film grain ───────────────────────────────────────────────────── */
.grain {
  position: fixed; inset: -50%;
  z-index: 1; pointer-events: none;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainshift 700ms steps(1) infinite;
}
@keyframes grainshift {
  0%   { transform: translate(0,0); }
  25%  { transform: translate(-2%,1%); }
  50%  { transform: translate(1%,-2%); }
  75%  { transform: translate(-1%,-1%); }
  100% { transform: translate(2%,1%); }
}
@media (prefers-reduced-motion: reduce) { .grain { animation: none; } }

/* ── shared type ──────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 1.4rem;
}
.eyebrow b { color: var(--accent); font-weight: 700; }
.eyebrow--hero { color: var(--ink-2); margin-bottom: 1.8rem; }

.tick {
  display: inline-block; width: 26px; height: 2px;
  background: var(--accent); vertical-align: middle;
  margin-right: .7rem; translate: 0 -3px;
}
.tick--alt { background: var(--s2); }

.bignum { font-variant-numeric: proportional-nums; }

/* ══════════════ NAV ══════════════ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--plane) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid transparent;
  transition: border-color .4s var(--ease), background .4s var(--ease);
}
.nav.is-stuck { border-bottom-color: var(--rule); background: color-mix(in srgb, var(--plane) 92%, transparent); }

.nav__inner {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto; height: var(--nav-h);
  display: flex; align-items: center; gap: 2rem;
}

.nav__brand {
  display: flex; align-items: center; gap: .6rem;
  text-decoration: none; margin-right: auto; flex-shrink: 0;
}
.nav__mark {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
  flex-shrink: 0;
}
.nav__name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.nav__sub {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  letter-spacing: .12em; text-transform: uppercase;
  padding-left: .65rem; margin-left: .1rem; border-left: 1px solid var(--rule);
}
@media (max-width: 900px) { .nav__sub { display: none; } }

.nav__links { display: flex; gap: 1.6rem; }
.nav__links a {
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  text-decoration: none; position: relative; padding: .3rem 0;
  transition: color .25s var(--ease);
}
.nav__links a::after {
  content: ''; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px;
  background: var(--accent); transition: right .3s var(--ease);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after,
.nav__links a.is-active::after { right: 0; }
.nav__links a.is-active { color: var(--ink); }
@media (max-width: 1080px) { .nav__links { display: none; } }

.nav__cta {
  font-size: 13px; font-weight: 600; text-decoration: none;
  padding: .5rem 1rem; border: 1px solid var(--rule); border-radius: 999px;
  color: var(--ink-2); white-space: nowrap;
  transition: all .25s var(--ease);
}
.nav__cta:hover { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 12%, transparent); }
@media (max-width: 620px) { .nav__cta { display: none; } }

.nav__progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.nav__progress i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-lit));
}

/* ══════════════ SECTION JUMP BAR ══════════════
   Only exists where the nav links don't (≤1080px). Slides in past the hero so
   the opening screen stays clean, then stays put so a reader can skip ahead
   instead of scrolling 45 screens to find out what's next. */
.jump {
  position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 85;
  background: color-mix(in srgb, var(--plane) 93%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--rule);
  transform: translateY(-101%);
  transition: transform .38s var(--ease);
  will-change: transform;
}
.jump.is-on { transform: none; }
@media (min-width: 1081px) { .jump { display: none; } }

.jump__track {
  display: flex; gap: .4rem;
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; scroll-behavior: smooth;
  padding: .55rem 1.25rem;
}
.jump__track::-webkit-scrollbar { display: none; }

.jump__chip {
  flex: none; display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .8rem; border-radius: 999px;
  border: 1px solid var(--rule); background: transparent;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-2); text-decoration: none; white-space: nowrap;
  transition: background .22s var(--ease), border-color .22s var(--ease), color .22s var(--ease);
}
.jump__chip b { color: var(--ink-3); font-weight: 500; }
.jump__chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.jump__chip.is-on b { color: rgba(255,255,255,.72); }

/* anchors have to clear the fixed nav (and the jump bar, where it exists) */
#main > section, #main > .ticker, #main > .seam, #main > .scrub {
  scroll-margin-top: calc(var(--nav-h) + 10px);
}
@media (max-width: 1080px) {
  #main > section, #main > .ticker, #main > .seam, #main > .scrub {
    scroll-margin-top: calc(var(--nav-h) + 56px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .jump { transition: none; }
  .jump__track { scroll-behavior: auto; }
}

/* ══════════════ HERO ══════════════ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--nav-h) + 2.5rem) 0 5.5rem;
  overflow: hidden;
  isolation: isolate;
}

/* --wall-lit is the per-breakpoint brightness; --wall-fade is the live
   multiplier JS drives (entrance, then scroll falloff). Defaults to 1 so the
   wall still shows at full strength if the script never runs. */
.hero__wall {
  position: absolute; inset: -22% -7%;
  z-index: -2;
  display: grid; gap: 12px;
  grid-template-columns: repeat(6, 1fr);
  --wall-lit: .5;
  opacity: calc(var(--wall-lit) * var(--wall-fade, 1));
  filter: grayscale(.35) contrast(1.06);
  will-change: transform, opacity;
}
@media (max-width: 900px) {
  .hero__wall { grid-template-columns: repeat(4, 1fr); --wall-lit: .32; }
  .hero__col:nth-child(n+5) { display: none; }
}
@media (max-width: 560px) {
  .hero__wall { grid-template-columns: repeat(3, 1fr); }
  .hero__col:nth-child(n+4) { display: none; }
}

.hero__col { display: grid; gap: 12px; align-content: start; will-change: transform; }
.hero__col img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  border-radius: 4px; background: var(--surface-2);
}
@keyframes driftUp   { from { transform: translateY(0); }      to { transform: translateY(-50%); } }
@keyframes driftDown { from { transform: translateY(-50%); }   to { transform: translateY(0); } }
.hero__col--up   { animation: driftUp   var(--dur, 90s) linear infinite; }
.hero__col--down { animation: driftDown var(--dur, 90s) linear infinite; }
@media (prefers-reduced-motion: reduce) { .hero__col { animation: none !important; } }

.hero__veil {
  position: absolute; inset: 0; z-index: -1;
  /* the radial keeps the left column of type on near-solid black; the linear
     lands the bottom edge back on the page plane so the hero exits cleanly */
  background:
    radial-gradient(105% 78% at 12% 46%, rgba(8,9,10,.985) 0%, rgba(8,9,10,.93) 34%, rgba(8,9,10,.66) 62%, rgba(8,9,10,.28) 100%),
    linear-gradient(to bottom, var(--plane) 0%, rgba(8,9,10,.3) 20%, rgba(8,9,10,.42) 60%, var(--plane) 98%);
}

.hero__content { position: relative; will-change: transform, opacity; }

.hero__title {
  margin: 0;
  /* bounded by width AND height so the stat row always stays above the fold.
     20vw fills a phone; the 19vh arm takes over on wide screens. */
  font-size: clamp(3.4rem, min(20vw, 19vh), 11rem);
  font-weight: 900;
  font-stretch: 108%;
  line-height: .84;
  letter-spacing: -.045em;
  text-transform: uppercase;
}
.hero__line { display: block; }
.hero__line--accent {
  color: transparent;
  -webkit-text-stroke: 2px var(--accent);
  text-stroke: 2px var(--accent);
  padding-left: .06em;
}
@media (max-width: 700px) { .hero__line--accent { -webkit-text-stroke-width: 1.5px; } }

.js [data-reveal] { opacity: 0; transform: translateY(26px); }
.js [data-reveal].is-in {
  opacity: 1; transform: none;
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}
.js .hero__line[data-reveal] { transform: translateY(.14em); }
.hero__line--accent.is-in { transition-delay: .12s; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
}

.hero__lede {
  max-width: 47ch; margin: 1.6rem 0 0;
  font-size: clamp(1rem, 1.55vw, 1.14rem);
  line-height: 1.6; color: var(--ink-2);
  text-wrap: pretty;
}

.hero__stats {
  list-style: none; margin: 2.4rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0;
  border-top: 1px solid var(--rule);
}
.hero__stat {
  padding: 1rem 1.8rem 1rem 0;
  margin-right: 1.8rem;
  border-right: 1px solid var(--rule);
}
.hero__stat:last-child { border-right: 0; margin-right: 0; }
.hero__stat b {
  display: block;
  font-size: clamp(1.6rem, 3.4vw, 2.5rem);
  font-weight: 800; letter-spacing: -.03em; line-height: 1;
  font-variant-numeric: proportional-nums;
}
.hero__stat span {
  display: block; margin-top: .5rem;
  font-family: var(--mono); font-size: 10px; letter-spacing: .17em;
  text-transform: uppercase; color: var(--ink-3);
}
@media (max-width: 640px) {
  .hero__stat { padding-right: 1.2rem; margin-right: 1.2rem; }
}

.hero__actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2rem; }

.btn {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .85rem 1.5rem; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: all .28s var(--ease);
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-lit); transform: translateY(-2px); box-shadow: 0 12px 34px -12px var(--accent); }
.btn--ghost { border-color: var(--rule); color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--ink-3); color: var(--ink); transform: translateY(-2px); }
.btn__ico {
  width: 0; height: 0; border-style: solid;
  border-width: 5px 0 5px 8px; border-color: transparent transparent transparent currentColor;
}

.hero__floor {
  position: absolute; left: 0; right: 0; bottom: 1.8rem;
  width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto;
  display: flex; justify-content: space-between; align-items: flex-end;
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-3);
}
.hero__scroll { display: flex; align-items: center; gap: .6rem; }
.hero__scroll::after {
  content: ''; width: 34px; height: 1px; background: var(--ink-3);
  animation: scrollcue 2.4s var(--ease) infinite;
  transform-origin: left;
}
@keyframes scrollcue { 0%,100% { transform: scaleX(.35); opacity: .4; } 50% { transform: scaleX(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hero__scroll::after { animation: none; } }
@media (max-width: 620px) { .hero__window { display: none; } }

/* ══════════════ SECTION SHELL ══════════════ */
.sec { padding: clamp(6rem, 12vw, 11rem) 0; position: relative; }
.sec--alt { background: var(--plane-alt); border-block: 1px solid var(--rule); }

.sec__head { max-width: 780px; margin-bottom: clamp(3rem, 6vw, 5rem); }

.sec__title {
  margin: 0;
  font-size: clamp(2.4rem, 6.2vw, 5rem);
  font-weight: 800; line-height: .96; letter-spacing: -.038em;
  text-wrap: balance;
}
.sec__lede {
  max-width: 60ch; margin: 1.6rem 0 0;
  font-size: clamp(1rem, 1.35vw, 1.12rem); line-height: 1.65;
  color: var(--ink-2); text-wrap: pretty;
}

/* ══════════════ 01 · LEDGER + STATS ══════════════ */
.ledger { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4.5rem); }
@media (max-width: 860px) { .ledger { grid-template-columns: 1fr; } }

.ledger__label {
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-2);
  margin: 0 0 1.6rem; padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--rule);
}

.statgrid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; grid-template-columns: 1fr 1fr; background: var(--rule); border: 1px solid var(--rule); }
.statgrid--four { grid-template-columns: repeat(4, 1fr); margin-bottom: clamp(2.5rem,5vw,4rem); }
@media (max-width: 860px) { .statgrid--four { grid-template-columns: repeat(2, 1fr); } }

.stat {
  background: var(--surface); padding: 1.6rem 1.4rem 1.5rem;
  position: relative; overflow: hidden;
  transition: background .3s var(--ease);
}
.stat:hover { background: var(--surface-2); }
.stat--span { grid-column: 1 / -1; }
.stat__v {
  display: block; font-size: clamp(1.9rem, 3.6vw, 2.9rem);
  font-weight: 800; letter-spacing: -.035em; line-height: 1;
  font-variant-numeric: proportional-nums;
}
.stat__v small { font-size: .48em; font-weight: 600; letter-spacing: -.01em; color: var(--ink-2); margin-left: .12em; }
.stat__l {
  display: block; margin-top: .7rem;
  font-family: var(--mono); font-size: 10px; letter-spacing: .15em;
  text-transform: uppercase; color: var(--ink-3); line-height: 1.5;
}
.stat__d { display: block; margin-top: .45rem; font-size: 12px; font-weight: 600; color: var(--s3); }
.stat__d--down { color: var(--ink-3); }
.stat::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .5s var(--ease);
}
.stat:hover::after { transform: scaleX(1); }
.stat--alt::after { background: var(--s2); }

/* ratio hero figure */
.ratio {
  margin: clamp(3.5rem, 7vw, 6rem) 0 0;
  display: grid; grid-template-columns: 1fr auto; gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding: clamp(2rem, 4vw, 3.2rem);
  border: 1px solid var(--rule); border-radius: 4px;
  background: linear-gradient(160deg, var(--surface) 0%, var(--plane) 100%);
}
@media (max-width: 860px) { .ratio { grid-template-columns: 1fr; } }

.ratio__viz { display: flex; align-items: flex-end; gap: 3px; height: 130px; }
.ratio__bar { flex: 1; background: color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 2px 2px 0 0; height: 4%; }
.ratio__bar--seed { background: var(--ink-3); }

.ratio__cap { display: block; }
.ratio__num {
  display: block; font-size: clamp(3.4rem, 8vw, 6.4rem); font-weight: 900;
  line-height: .9; letter-spacing: -.045em; color: var(--accent);
  font-variant-numeric: proportional-nums;
}
.ratio__unit { display: block; margin-top: .8rem; font-size: clamp(1rem,1.5vw,1.2rem); font-weight: 600; line-height: 1.35; }
.ratio__math {
  display: block; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: 11px; letter-spacing: .05em; color: var(--ink-3);
}

/* ══════════════ 02 · VERSUS ══════════════ */
.versus {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: clamp(1rem, 3vw, 2.5rem); align-items: stretch;
}
@media (max-width: 900px) { .versus { grid-template-columns: 1fr; } }

.vs__card {
  border: 1px solid var(--rule); border-radius: 4px;
  background: var(--surface); padding: clamp(1.5rem, 3vw, 2.2rem);
  display: flex; flex-direction: column;
}
.vs__kind {
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em;
  text-transform: uppercase; margin: 0 0 .9rem;
  display: inline-flex; align-items: center; gap: .5rem;
}
.vs__kind::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.vs__card--short .vs__kind { color: var(--s2); }
.vs__card--long  .vs__kind { color: var(--accent); }
.vs__title { margin: 0 0 1.6rem; font-size: clamp(1.05rem,1.7vw,1.32rem); font-weight: 700; line-height: 1.28; letter-spacing: -.02em; }
.vs__title a { text-decoration: none; border-bottom: 1px solid var(--rule); transition: border-color .25s; }
.vs__title a:hover { border-color: var(--accent); }

.vs__rows { margin-top: auto; display: grid; gap: 1.1rem; }
.vs__row { display: grid; gap: .4rem; }
.vs__rowhead { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.vs__rowlabel { font-family: var(--mono); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-3); }
.vs__rowval { font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: proportional-nums; }
.vs__track { height: 8px; background: var(--grid); border-radius: 999px; overflow: hidden; }
.vs__fill { display: block; height: 100%; width: 0; border-radius: 999px; transition: width 1.1s var(--ease); }
.vs__card--short .vs__fill { background: var(--s2); }
.vs__card--long  .vs__fill { background: var(--accent); }

.vs__mid {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.4rem; padding: 1rem 0;
}
@media (max-width: 900px) { .vs__mid { flex-direction: row; flex-wrap: wrap; } }
.vs__delta { text-align: center; }
.vs__delta b {
  display: block; font-size: clamp(1.5rem,2.6vw,2rem); font-weight: 800;
  letter-spacing: -.03em; line-height: 1;
}
.vs__delta span {
  display: block; margin-top: .35rem; font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); max-width: 15ch;
}

/* ══════════════ CHART CARDS ══════════════ */
.drivers, .split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.2rem, 2.5vw, 2rem); margin-top: clamp(3rem,6vw,5rem); }
@media (max-width: 940px) { .drivers, .split { grid-template-columns: 1fr; } }

/* Full-width stacked cards: the bars get the whole measure to run across, which
   reads far better than two cramped columns. */
.split--stack { grid-template-columns: 1fr; }
.split--stack .chart-card__head { margin-bottom: 1.5rem; }
.split--stack .stack { height: 56px; }

.chart-card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 4px;
  padding: clamp(1.5rem, 3vw, 2.2rem);
  display: flex; flex-direction: column;
}
.chart-card--wide { margin-top: clamp(1.2rem, 2.5vw, 2rem); }
.sec > .wrap > .chart-card--wide:first-of-type { margin-top: clamp(3rem,6vw,5rem); }

.chart-card__head { margin-bottom: 1.8rem; }
.chart-card__title { margin: 0; font-size: clamp(1.15rem,1.9vw,1.45rem); font-weight: 700; letter-spacing: -.025em; }
.chart-card__sub { margin: .45rem 0 0; font-size: 13px; color: var(--ink-3); line-height: 1.5; }
.chart-card__foot {
  margin: 1.8rem 0 0; padding-top: 1.3rem; border-top: 1px solid var(--rule);
  font-size: 13.5px; line-height: 1.6; color: var(--ink-2); text-wrap: pretty;
}
.chart-card__foot b { color: var(--ink); font-weight: 700; }
.chart { margin-top: auto; }

/* horizontal bar rows (shared) */
.bars { display: grid; gap: 2px; }
.bar {
  display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem;
  align-items: baseline; padding: .55rem 0;
  position: relative;
}
.bar__label { font-size: 13.5px; line-height: 1.35; color: var(--ink-2); }
.bar__label b { color: var(--ink); font-weight: 600; }
.bar__val { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar__track { grid-column: 1 / -1; height: 10px; background: var(--grid); border-radius: 0 3px 3px 0; overflow: hidden; }
.bar__fill {
  display: block; height: 100%; width: 0;
  border-radius: 0 3px 3px 0; background: var(--accent);
  transition: width 1.05s var(--ease);
}
.bar__fill--alt { background: var(--s2); }
.bar__fill--s3  { background: var(--s3); }
.bar__fill--mute { background: #3a4046; }
.bar--hl .bar__label b { color: var(--ink); }

.bar__tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase; padding: .12rem .4rem; border-radius: 3px;
  margin-left: .5rem; white-space: nowrap; vertical-align: 1px;
  border: 1px solid currentColor;
}
.bar__tag--short { color: var(--s2); }
.bar__tag--long  { color: var(--accent); }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 1.1rem; margin: 0 0 1.4rem; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: .45rem; font-size: 12px; color: var(--ink-2); }
.legend i { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* ══════════════ PERIOD SMALL MULTIPLES ══════════════ */
.periods { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.2rem,2.5vw,2rem); }
@media (max-width: 860px) { .periods { grid-template-columns: 1fr; } }

.period {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 4px;
  padding: clamp(1.4rem,2.6vw,1.9rem);
}
.period__metric {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-3); margin: 0 0 1.3rem;
}
.period__row { margin-bottom: 1rem; }
.period__row:last-of-type { margin-bottom: 0; }
.period__head { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; margin-bottom: .4rem; }
.period__when { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--ink-3); text-transform: uppercase; }
.period__val { font-size: 1.2rem; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: proportional-nums; }
.period__track { height: 12px; background: var(--grid); border-radius: 0 3px 3px 0; overflow: hidden; }
.period__fill { display: block; height: 100%; width: 0; border-radius: 0 3px 3px 0; transition: width 1.1s var(--ease); }
.period__fill--h1 { background: #3a4046; }
.period__fill--h2 { background: var(--accent); }
.period__delta {
  margin: 1.3rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--rule);
  font-size: 13px; color: var(--ink-2);
}
.period__delta b { color: var(--s3); font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; }

/* ══════════════ SCATTER ══════════════ */
.lengthstat {
  display: flex; align-items: center; gap: clamp(1rem,3vw,2.5rem);
  flex-wrap: wrap; margin-bottom: 2rem;
  padding-bottom: 1.8rem; border-bottom: 1px solid var(--rule);
}
.lengthstat__item { display: grid; grid-template-columns: auto auto; gap: 0 .6rem; align-items: center; }
.lengthstat__dot { width: 12px; height: 12px; border-radius: 50%; grid-row: 1 / 3; }
.lengthstat__item--long  .lengthstat__dot { background: var(--accent); }
.lengthstat__item--short .lengthstat__dot { background: var(--s2); }
.lengthstat__v { font-size: clamp(1.7rem,3.2vw,2.4rem); font-weight: 800; letter-spacing: -.035em; line-height: 1; font-variant-numeric: proportional-nums; }
.lengthstat__l { font-family: var(--mono); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); }
.lengthstat__x { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .2em; text-transform: uppercase; }

.chart--scatter { width: 100%; }
.scatter { width: 100%; height: auto; display: block; overflow: visible; }
.scatter .gridline { stroke: var(--grid); stroke-width: 1; }
.scatter .axisline { stroke: var(--rule); stroke-width: 1; }
.scatter .tick text { font-family: var(--mono); font-size: 9.5px; fill: var(--ink-3); letter-spacing: .06em; }
.scatter .dot { cursor: pointer; transition: r .18s var(--ease), opacity .18s var(--ease); }
.scatter .dot:hover { r: 8; }
.scatter.is-filtered .dot { opacity: .16; }
.scatter.is-filtered .dot.is-on { opacity: 1; }
.scatter .avgline { stroke-width: 1.5; stroke-dasharray: 0; opacity: .55; }
.scatter .avglabel { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; }
.scatter .thresh { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 4; opacity: .5; }

/* ══════════════ 04 · LIBRARY ══════════════ */
.libbar {
  display: flex; flex-wrap: wrap; gap: 1.4rem; justify-content: space-between;
  align-items: flex-start; margin-bottom: 1.6rem;
}
.libbar__filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  padding: .5rem .85rem; border-radius: 999px; border: 1px solid var(--rule);
  background: transparent; color: var(--ink-2); cursor: pointer; white-space: nowrap;
  transition: all .22s var(--ease);
  display: inline-flex; align-items: center; gap: .45rem;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip b { color: var(--ink-3); font-weight: 500; }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.is-on b { color: rgba(255,255,255,.75); }

.libbar__tools { display: flex; gap: .7rem; flex-wrap: wrap; }
.search { position: relative; display: block; }
.search__ico {
  position: absolute; left: .8rem; top: 50%; translate: 0 -50%;
  width: 12px; height: 12px; border: 1.5px solid var(--ink-3); border-radius: 50%;
}
.search__ico::after { content: ''; position: absolute; right: -4px; bottom: -3px; width: 6px; height: 1.5px; background: var(--ink-3); rotate: 45deg; }
.search input {
  font-family: var(--sans); font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-radius: 999px;
  padding: .55rem 1rem .55rem 2.2rem; width: 220px;
  transition: border-color .22s var(--ease);
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--accent); outline: none; }

.select { display: inline-flex; align-items: center; gap: .5rem; }
.select > span { font-family: var(--mono); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-3); }
.select select {
  font-family: var(--sans); font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-radius: 999px;
  padding: .55rem 1rem; cursor: pointer;
}
.select select:focus { border-color: var(--accent); outline: none; }

.libcount {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .15em;
  text-transform: uppercase; color: var(--ink-3);
  margin: 0 0 1.4rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--rule);
}

.grid {
  display: grid; gap: clamp(1rem, 2vw, 1.6rem);
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
}

.ep { display: flex; flex-direction: column; }
.ep__thumb {
  position: relative; display: block; width: 100%; padding: 0;
  border: 1px solid var(--rule); border-radius: 4px; overflow: hidden;
  background: var(--surface-2); cursor: pointer; aspect-ratio: 16/9;
  transition: border-color .28s var(--ease), transform .28s var(--ease);
}
.ep__thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s var(--ease), filter .35s var(--ease);
  filter: saturate(.92);
}
.ep__thumb:hover { border-color: var(--accent); transform: translateY(-3px); }
.ep__thumb:hover img { transform: scale(1.055); filter: saturate(1.05); }
.ep__thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(8,9,10,.75) 0%, rgba(8,9,10,0) 45%);
  pointer-events: none;
}
.ep__play {
  position: absolute; inset: 0; margin: auto;
  width: 54px; height: 54px; border-radius: 50%;
  background: color-mix(in srgb, var(--plane) 65%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.22);
  display: grid; place-items: center; z-index: 2;
  opacity: 0; scale: .82; transition: all .3s var(--ease);
}
.ep__play::before {
  content: ''; width: 0; height: 0; border-style: solid;
  border-width: 7px 0 7px 12px; border-color: transparent transparent transparent #fff;
  margin-left: 3px;
}
.ep__thumb:hover .ep__play, .ep__thumb:focus-visible .ep__play { opacity: 1; scale: 1; }
.ep__thumb:hover .ep__play { background: var(--accent); border-color: var(--accent); }

.ep__dur {
  position: absolute; right: .5rem; bottom: .5rem; z-index: 2;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  background: rgba(8,9,10,.85); padding: .15rem .38rem; border-radius: 3px;
  letter-spacing: .04em;
}
.ep__badge {
  position: absolute; left: .5rem; top: .5rem; z-index: 2;
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  background: rgba(8,9,10,.8); border: 1px solid rgba(255,255,255,.14);
  padding: .18rem .42rem; border-radius: 3px; color: var(--ink-2);
}
.ep__badge--long { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.ep__meta { padding: .85rem .1rem 0; display: grid; grid-template-columns: auto 1fr; gap: 0 .7rem; }
.ep__n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); grid-row: 1 / 3; padding-top: .15rem; }
.ep__t {
  margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.35;
  letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ep__stats { margin: .35rem 0 0; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

.libempty { text-align: center; color: var(--ink-3); padding: 4rem 0; font-size: 15px; }
.libfoot { margin-top: 3rem; text-align: center; font-size: 14px; color: var(--ink-3); }
.libfoot a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 2px; }
.libfoot a:hover { color: var(--accent); }

/* ══════════════ IG DONUT / STACK ══════════════ */
.stack { display: flex; height: 46px; border-radius: 4px; overflow: hidden; gap: 2px; }
.stack__seg { height: 100%; display: grid; place-items: center; width: 0; transition: width 1.1s var(--ease); overflow: hidden; }
.stack__seg span {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  color: #fff; white-space: nowrap; padding-inline: .4rem;
}
.stack__seg--1 { background: var(--accent); }
.stack__seg--2 { background: var(--s2); }
.stack__seg--3 { background: var(--s3); }
.stacklegend { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: 1.2rem; list-style: none; padding: 0; }
.stacklegend li { display: flex; align-items: center; gap: .5rem; font-size: 13px; color: var(--ink-2); }
.stacklegend i { width: 10px; height: 10px; border-radius: 2px; }
.stacklegend b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ══════════════ CALLOUT / PULL ══════════════ */
.callout {
  margin-top: clamp(2rem,4vw,3rem);
  border: 1px solid var(--rule); border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0; padding: clamp(1.6rem,3vw,2.4rem);
  background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 5%, var(--surface)) 0%, var(--surface) 55%);
}
.callout__label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 1rem;
}
.callout__body { margin: 0; font-size: clamp(1rem,1.4vw,1.13rem); line-height: 1.68; color: var(--ink-2); max-width: 72ch; text-wrap: pretty; }

.pull {
  margin: 0 0 clamp(3rem,6vw,5rem); padding: 0;
}
.pull p {
  /* the ch measure has to live on the element that carries the display size */
  margin: 0; font-size: clamp(1.5rem,3.6vw,2.6rem); font-weight: 700;
  line-height: 1.18; letter-spacing: -.03em; text-wrap: balance;
  max-width: 26ch;
}

/* ══════════════ SECTION BANDS ══════════════
   A band sits at every section seam. Each one is keyed to what it sits between,
   and the mechanism is deliberately varied so five seams don't read as five
   identical marquees: a scroll-scrubbed timeline, two text marquees running opposite
   directions, a filmstrip, and a split that slides shut. */

/* 1 · hero → stats. The twelve-month window, scrubbed by scroll position —
   the only element on the page that moves because the reader moves rather
   than on a loop. Establishes the window every figure here depends on. */
.scrub {
  position: relative;
  background: var(--plane-alt);
  border-block: 1px solid var(--rule);
  padding: 1.6rem 0 1.45rem;
}
.scrub__row { display: flex; align-items: center; gap: clamp(.7rem, 2vw, 1.3rem); }
.scrub__cap {
  flex: none; white-space: nowrap;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3);
  transition: color .45s var(--ease);
}
.scrub.is-full .scrub__cap--end { color: var(--accent); }

.scrub__track { position: relative; flex: 1; height: 1px; background: var(--rule); }
.scrub__tick {
  position: absolute; top: 50%; width: 1px; height: 7px; margin-top: -3.5px;
  background: var(--rule);
}
.scrub__fill {
  position: absolute; left: 0; top: 0; height: 100%; width: 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 35%, transparent), var(--accent));
}
.scrub__dot {
  position: absolute; top: 50%; left: 0;
  width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.scrub__legend {
  margin: 1.05rem 0 0;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3);
}
.scrub__legend b { color: var(--ink); font-weight: 700; }

/* 3 · youtube → channel. Two halves slide in and meet on the centre line. */
.seam {
  position: relative; display: flex; overflow: hidden;
  height: 76px;
  background: var(--plane-alt);
  border-block: 1px solid var(--rule);
}
.seam__half { flex: 1; position: relative; display: flex; align-items: center; min-width: 0; }
.seam__half--l { justify-content: flex-end; }
.seam__bar { position: absolute; inset: 0; opacity: .13; }
.seam__half--l .seam__bar { background: linear-gradient(90deg, transparent, var(--s2)); }
.seam__half--r .seam__bar { background: linear-gradient(270deg, transparent, var(--accent)); }
.seam__label {
  position: relative; white-space: nowrap;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase;
  padding: 0 clamp(.9rem, 2.5vw, 1.6rem);
}
.seam__half--l .seam__label { color: var(--s2); }
.seam__half--r .seam__label { color: var(--accent); }
.seam__mid {
  position: absolute; left: 50%; top: 22%; bottom: 22%; width: 1px;
  background: var(--rule); z-index: 2;
}
.js .seam__half--l { transform: translateX(-101%); }
.js .seam__half--r { transform: translateX(101%); }
.js .seam.is-in .seam__half { transform: none; transition: transform 1.15s var(--ease); }

@media (max-width: 640px) {
  .scrub { padding: 1.3rem 0 1.2rem; }
  .scrub__cap { font-size: 9px; letter-spacing: .12em; }
  .scrub__legend { font-size: 9px; letter-spacing: .12em; line-height: 1.7; }
  .seam { height: 62px; }
  .seam__label { font-size: 9.5px; letter-spacing: .14em; }
}

@media (prefers-reduced-motion: reduce) {
  .js .seam__half--l, .js .seam__half--r { opacity: 1 !important; transform: none !important; }
}

/* ══════════════ ROLE TICKER ══════════════
   The credits, as a broadcast-style lower third. Two identical sets sit in the
   track and it translates -50%, so the loop is seamless; the second set is
   aria-hidden so the roles are announced once. */
.ticker {
  position: relative; overflow: hidden;
  background: var(--plane-alt);
  border-block: 1px solid var(--rule);
  padding: 1.4rem 0;
}
.ticker::before, .ticker::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: clamp(48px, 9vw, 120px);
  z-index: 2; pointer-events: none;
}
.ticker::before { left: 0; background: linear-gradient(90deg, var(--plane-alt), transparent); }
.ticker::after { right: 0; background: linear-gradient(270deg, var(--plane-alt), transparent); }

.ticker__track { display: flex; width: max-content; animation: tick 46s linear infinite; }
@keyframes tick { to { transform: translateX(-50%); } }
.ticker:hover .ticker__track { animation-play-state: paused; }

.ticker__set { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; flex: none; }
.ticker__set li {
  display: flex; align-items: center; white-space: nowrap;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-3);
}
.ticker__set li::after {
  content: ''; flex: none;
  width: 5px; height: 5px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 50%, transparent);
  margin: 0 clamp(1.4rem, 3vw, 2.4rem);
}
.ticker__set li.is-lead { color: var(--accent); font-weight: 700; letter-spacing: .14em; }
.ticker__set li.is-lead::after { background: var(--accent); }

/* value + label pairs (the stats band) */
.ticker__set li b { color: var(--ink); font-weight: 700; letter-spacing: .04em; margin-right: .6rem; }
.ticker--shorts .ticker__set li b { color: var(--s2); }

/* runs the other way, so neighbouring bands never scroll in lockstep */
.ticker--rev .ticker__track { animation-direction: reverse; }

/* 4 · channel → library. Real episode frames, leading into the grid. */
.ticker--film { padding: .85rem 0; }
.ticker--film .ticker__set { gap: 8px; }
.ticker--film .ticker__set li::after { display: none; }
.ticker--film img {
  width: 112px; height: 63px; object-fit: cover;
  border-radius: 3px; background: var(--surface-2);
  filter: grayscale(.45); opacity: .78;
  transition: filter .4s var(--ease), opacity .4s var(--ease);
}
.ticker--film:hover img { filter: grayscale(0); opacity: 1; }
@media (max-width: 640px) {
  .ticker__set li { font-size: 10px; letter-spacing: .16em; }
  .ticker--film img { width: 88px; height: 50px; }
}

/* No auto-motion: let it be a normal horizontal scroller instead. */
@media (prefers-reduced-motion: reduce) {
  .ticker { overflow-x: auto; overscroll-behavior-x: contain; }
  .ticker::before, .ticker::after { display: none; }
  .ticker__track { animation: none; }
}

/* ══════════════ PROVED + PLAN ══════════════ */
.proved { margin-bottom: clamp(4rem,8vw,6.5rem); }
.proved__label, .plan__label {
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-2); margin: 0 0 1.8rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--rule);
}
.proved__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem,3vw,2.5rem); }
@media (max-width: 800px) { .proved__list { grid-template-columns: 1fr; } }
.proved__list li { display: grid; grid-template-columns: auto 1fr; gap: 0 1.2rem; }
.proved__n { font-family: var(--mono); font-size: 12px; color: var(--accent); grid-row: 1 / 3; }
.proved__h { margin: 0; font-size: clamp(1.15rem,1.9vw,1.4rem); font-weight: 700; letter-spacing: -.025em; }
.proved__b { margin: .6rem 0 0; font-size: 14.5px; line-height: 1.65; color: var(--ink-2); text-wrap: pretty; }

.plan { position: relative; }
.plan__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.plan__head .plan__label { flex: 1; }
.plan__sub { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 1.8rem; padding-bottom: 1.2rem; }
.plan__list { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.plan__step {
  display: grid; grid-template-columns: 90px 1fr; gap: 0 clamp(1.5rem,4vw,3.5rem);
  padding: clamp(1.8rem,3.5vw,2.6rem) 0;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.plan__step:last-child { border-bottom: 0; }
@media (max-width: 720px) { .plan__step { grid-template-columns: 1fr; gap: .8rem; } }

.plan__num {
  font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--ink-3);
  padding-top: .35rem; position: relative;
}
.plan__num::before {
  content: ''; position: absolute; left: -1.6rem; top: .75rem;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--plane-alt); border: 1.5px solid var(--rule);
  transition: all .4s var(--ease);
}
.plan__step.is-in .plan__num::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
@media (max-width: 720px) { .plan__num::before { display: none; } }

.plan__h { margin: 0; font-size: clamp(1.3rem,2.6vw,1.95rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.18; text-wrap: balance; }
.plan__b { margin: .8rem 0 0; font-size: clamp(.95rem,1.3vw,1.05rem); line-height: 1.7; color: var(--ink-2); max-width: 68ch; text-wrap: pretty; }

.plan__rail { position: absolute; left: -1.6rem; top: 5rem; bottom: 2rem; width: 1.5px; background: var(--rule); }
.plan__rail i { display: block; width: 100%; height: 0; background: var(--accent); transition: height .25s linear; }
@media (max-width: 720px) { .plan__rail { display: none; } }

/* ══════════════ CLOSE ══════════════ */
.close {
  padding: clamp(7rem,14vw,13rem) 0;
  text-align: center;
  background:
    radial-gradient(70% 60% at 50% 0%, color-mix(in srgb, var(--accent) 9%, transparent) 0%, transparent 70%),
    var(--plane);
  border-top: 1px solid var(--rule);
}
.close__kicker {
  margin: 0 auto; max-width: 20ch;
  font-size: clamp(2rem,5.4vw,4.3rem); font-weight: 800;
  line-height: 1.04; letter-spacing: -.04em; text-wrap: balance;
}
.close__thanks { margin: 2.2rem auto 0; max-width: 40ch; font-size: clamp(1rem,1.5vw,1.15rem); color: var(--ink-2); }
.close__mail {
  display: inline-block; margin-top: 2.6rem;
  font-size: clamp(1.05rem,2.2vw,1.6rem); font-weight: 600; letter-spacing: -.02em;
  text-decoration: none; color: var(--ink);
  border-bottom: 2px solid var(--accent); padding-bottom: .35rem;
  transition: color .3s var(--ease);
  word-break: break-word;
}
.close__mail:hover { color: var(--accent); }
.close__sig {
  margin: 3rem 0 0; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3);
}

/* ══════════════ FOOT ══════════════ */
.foot { padding: 2.5rem 0 3.5rem; border-top: 1px solid var(--rule); background: var(--plane); }
.foot .wrap { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; align-items: baseline; }
.foot__src { margin: 0; max-width: 78ch; font-size: 11.5px; line-height: 1.7; color: var(--ink-3); }
.foot__meta { margin: 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; }
.foot__meta a { color: var(--ink-3); text-decoration: none; }
.foot__meta a:hover { color: var(--accent); }

/* ══════════════ MODAL ══════════════ */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 1.5rem; }
.modal[hidden] { display: none; }
.modal__scrim { position: absolute; inset: 0; background: rgba(4,5,6,.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.modal__panel {
  position: relative; width: min(100%, 1120px);
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px;
  overflow: hidden; box-shadow: 0 40px 120px -30px rgba(0,0,0,.9);
  animation: pop .34s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .modal__panel { animation: none; } }

.modal__frame { aspect-ratio: 16/9; background: #000; }
.modal__frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.modal__bar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 1.1rem clamp(1rem,2.5vw,1.6rem);
  border-top: 1px solid var(--rule);
}
.modal__meta { min-width: 0; flex: 1; }
.modal__n { margin: 0 0 .2rem; font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.modal__title { margin: 0; font-size: clamp(.95rem,1.7vw,1.2rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.modal__stats { margin: .3rem 0 0; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.modal__nav { display: flex; gap: .5rem; flex-shrink: 0; }

.iconbtn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--rule); background: transparent; color: var(--ink-2);
  cursor: pointer; font-size: 15px; line-height: 1;
  display: grid; place-items: center;
  transition: all .22s var(--ease);
}
.iconbtn:hover:not(:disabled) { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.iconbtn:disabled { opacity: .3; cursor: default; }
.iconbtn--close:hover { border-color: var(--ink-2); background: rgba(255,255,255,.07); }

/* ══════════════ TOOLTIP ══════════════ */
.tip {
  position: fixed; z-index: 160; pointer-events: none;
  background: var(--surface-2); border: 1px solid var(--rule); border-radius: 4px;
  padding: .6rem .75rem; max-width: 270px;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,.85);
  font-size: 12.5px; line-height: 1.45;
  transform: translate(-50%, calc(-100% - 12px));
}
.tip[hidden] { display: none; }
.tip__t { font-weight: 600; color: var(--ink); margin: 0 0 .3rem; }
.tip__r { margin: 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: .07em; color: var(--ink-3); text-transform: uppercase; }
.tip__k { display: inline-flex; align-items: center; gap: .35rem; margin-top: .35rem; font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; }
.tip__k i { width: 8px; height: 8px; border-radius: 50%; }

/* ══════════════ SMALL SCREENS ══════════════ */

/* The scatter is drawn in a 1000-unit viewBox. Below ~720px it would scale to
   sub-pixel labels, so it scrolls in its own track instead of shrinking, and
   the SVG type is stepped up to compensate for what scaling is left. */
@media (max-width: 720px) {
  .chart--scatter { overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: .5rem; }
  .chart--scatter .scatter { min-width: 720px; }
  .scatter .tick text { font-size: 13px; }
  .scatter .avglabel { font-size: 12px; }
}

@media (max-width: 640px) {
  .hero { padding: calc(var(--nav-h) + 1.25rem) 0 3.5rem; }
  .eyebrow--hero { font-size: 10px; letter-spacing: .14em; margin-bottom: 1.1rem; }
  .hero__lede { margin-top: 1.15rem; font-size: 1rem; line-height: 1.55; }
  /* three across, one row — the other two live in Stats, one swipe down */
  .hero__stats { margin-top: 1.5rem; flex-wrap: nowrap; }
  .hero__stat:not(.hero__stat--key) { display: none; }
  .hero__stat {
    flex: 1 1 0; min-width: 0;
    padding: .8rem .55rem .8rem 0; margin-right: .55rem;
  }
  .hero__stat b { font-size: 1.4rem; letter-spacing: -.035em; }
  .hero__stat span {
    margin-top: .35rem; font-size: 8.5px; letter-spacing: .11em; white-space: nowrap;
  }
  .hero__actions { margin-top: 1.5rem; gap: .6rem; }
  .btn { padding: .75rem 1.25rem; font-size: 13.5px; }

  .statgrid, .statgrid--four { grid-template-columns: 1fr 1fr; }
  .stat { padding: 1.2rem 1rem; }

  .ratio { padding: 1.4rem; }
  .ratio__viz { height: 90px; }

  /* filter chips scroll sideways rather than stacking into a wall */
  .libbar__filters {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    padding-bottom: .4rem; margin-inline: -1.25rem; padding-inline: 1.25rem;
    scrollbar-width: none;
  }
  .libbar__filters::-webkit-scrollbar { display: none; }
  .libbar__tools { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }

  .grid { grid-template-columns: 1fr; }

  .modal { padding: 0; align-items: stretch; }
  .modal__panel { border-radius: 0; border-inline: 0; }
  .modal__bar { flex-wrap: wrap; gap: .9rem; }
  .modal__nav { margin-left: auto; }

  .lengthstat { gap: 1rem; }
  .lengthstat__x { display: none; }
}

/* ── print: let it fall back to something sane ─────────────────────── */
@media print {
  .grain, .nav, .hero__wall, .modal, .tip { display: none !important; }
  body { background: #fff; color: #000; }
}
