/* Empty Stadiums — story site.
   Layout: one left-aligned reading column with a margin column for method notes;
   figures break out to the wide measure. The stand of seats is the only loud element. */
:root {
  /* colour: matchday concrete, terrace ink, tip-up seat plastic, home claret, away blue, referee yellow */
  --concrete: #e6e7e2;
  --concrete-2: #dadcd5;
  --ink: #18242b;
  --ink-2: #3f4c53;
  --ink-3: #66727a;
  --rule: #c5c9c2;
  --seat: #b4bcbd;
  --seat-back: #9aa4a6;
  --home: #a3263a;
  --away: #1f6fa8;
  --card: #e2b007;
  --card-ink: #3a2e00;
  --focus: #1f6fa8;

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --text: "Newsreader", "Iowan Old Style", Georgia, serif;

  /* type scale, perfect fourth from 18px body */
  --s-1: 0.844rem;
  --s0: 1.125rem;
  --s1: 1.5rem;
  --s2: 2rem;
  --s3: 2.666rem;
  --s4: clamp(3rem, 9vw, 7.5rem);

  --measure: 38rem;
  --note: 15rem;
  --wide: 70rem;
  --indent: clamp(0px, 7vw, 8rem);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --concrete: #13212b; --concrete-2: #1a2b36; --ink: #e5e9e4; --ink-2: #c0c8c6; --ink-3: #8e9a9c;
    --rule: #2c3e49; --seat: #4b606b; --seat-back: #3a4d58; --home: #e4637a; --away: #3d93d6;
    --card: #f0c22e; --card-ink: #2a2100; --focus: #8cc4ee; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --concrete: #13212b; --concrete-2: #1a2b36; --ink: #e5e9e4; --ink-2: #c0c8c6; --ink-3: #8e9a9c;
  --rule: #2c3e49; --seat: #4b606b; --seat-back: #3a4d58; --home: #e4637a; --away: #3d93d6;
  --card: #f0c22e; --card-ink: #2a2100; --focus: #8cc4ee; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--concrete);
  color: var(--ink);
  font: 400 var(--s0)/1.62 var(--text);
  font-optical-sizing: auto;
  overflow-x: hidden;
}
/* side gutter lives on each full-width band's inner wrapper */
.wrap {
  max-width: 90rem; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: inherit; text-decoration-color: var(--home); text-decoration-thickness: 1.5px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; }
p { margin: 0; }
strong { font-weight: 650; }
.num { line-height: 1; font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 600; font-stretch: 92%; white-space: nowrap; }

/* ---------- hero: the stand ---------- */
.hero { position: relative; height: 250vh; }
.hero-pin {
  position: sticky; top: 0; min-height: 100svh;
  display: grid; grid-template-rows: auto 1fr auto; gap: 1.25rem;
  padding-block: clamp(1.5rem, 5vh, 3.5rem) 1.5rem;
}
.title {
  font-size: var(--s4); line-height: 0.86; letter-spacing: -0.02em;
  font-weight: 860; font-stretch: 125%;
  margin-left: var(--indent);
}
.title span { display: block; }
.title .t2 { font-stretch: 62%; font-weight: 300; letter-spacing: 0.01em; transition: font-stretch 0.6s ease, font-weight 0.6s ease; }
.hero[data-state="0"] .title .t2 { font-stretch: 125%; font-weight: 860; letter-spacing: -0.02em; }
.byline { margin-left: var(--indent); margin-top: 0.75rem; font-family: var(--display); font-size: var(--s-1); color: var(--ink-2); font-stretch: 100%; }
.stand-wrap { position: relative; min-height: 14rem; }
#stand { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-caption {
  margin-left: var(--indent); max-width: 34rem; min-height: 5.4em;
  font-size: var(--s1); line-height: 1.3;
}
.hero-caption p { transition: opacity 0.35s ease; }
.hero-caption p[aria-hidden="true"] { display: none; }
.scroll-hint { font-family: var(--display); font-size: var(--s-1); color: var(--ink-3); margin-top: 0.5rem; }

/* ---------- article grid ---------- */
.beat {
  display: grid; gap: 0.9rem 3rem;
  grid-template-columns: minmax(0, var(--measure));
  margin-left: var(--indent);
}
.beat + .beat, figure + .beat { margin-top: clamp(3rem, 8vh, 5rem); }
.beat + figure { margin-top: 1.6rem; }
@media (min-width: 72rem) {
  .beat { grid-template-columns: minmax(0, var(--measure)) minmax(0, var(--note)); }
  .beat > .note { grid-column: 2; grid-row: 1 / span 6; align-self: start; }
}
.beat > :not(.note) { grid-column: 1; }
.beat h3 {
  font-size: var(--s2); line-height: 1.05; font-weight: 780; font-stretch: 108%; letter-spacing: -0.01em;
  max-width: 20ch;
}
.lede { font-size: var(--s1); line-height: 1.38; }
.note {
  font-family: var(--display); font-size: var(--s-1); line-height: 1.5; color: var(--ink-2);
  font-stretch: 96%; border-left: 2px solid var(--rule); padding-left: 0.9rem;
}
.note p + p { margin-top: 0.5rem; }

/* ---------- figures ---------- */
figure { margin: 2.4rem 0 0; margin-left: var(--indent); max-width: var(--wide); }
figure.narrow { max-width: 46rem; }
.fig-head { max-width: var(--measure); margin-bottom: 0.9rem; }
.fig-title { font-family: var(--display); font-size: var(--s0); font-weight: 700; font-stretch: 100%; line-height: 1.3; }
.fig-sub { font-family: var(--display); font-size: var(--s-1); color: var(--ink-2); line-height: 1.45; margin-top: 0.2rem; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg text { font-family: var(--display); fill: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart svg .axis path, .chart svg .axis line, .chart svg .grid line { stroke: var(--rule); }
.chart svg .zero { stroke: var(--ink-3); stroke-width: 1; }
.chart svg .lab-strong { fill: var(--ink); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; font-family: var(--display); font-size: var(--s-1); color: var(--ink-2); margin-top: 0.7rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.key { width: 12px; height: 12px; display: inline-block; border-radius: 3px; flex: none; }
.key.dot { border-radius: 50%; }
.key.ring { border-radius: 50%; background: transparent !important; border: 2px solid var(--ink); }
.key.line { height: 2px; width: 18px; border-radius: 1px; }
figcaption, .source { font-family: var(--display); font-size: var(--s-1); color: var(--ink-3); margin-top: 0.7rem; max-width: var(--measure); line-height: 1.45; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-x .chart svg { min-width: 680px; }

details.numbers { margin-top: 0.6rem; font-family: var(--display); font-size: var(--s-1); color: var(--ink-2); max-width: 46rem; }
details.numbers summary { cursor: pointer; color: var(--ink-2); width: fit-content; }
details.numbers summary:hover { color: var(--ink); }
details.numbers table { border-collapse: collapse; margin-top: 0.6rem; font-variant-numeric: tabular-nums; min-width: 22rem; }
details.numbers th, details.numbers td { text-align: right; padding: 0.25rem 0.8rem 0.25rem 0; border-bottom: 1px solid var(--rule); }
details.numbers th:first-child, details.numbers td:first-child { text-align: left; }
details.numbers th { font-weight: 600; color: var(--ink); }

.tip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 17rem;
  background: var(--ink); color: var(--concrete); border-radius: 4px;
  font-family: var(--display); font-size: 0.8rem; line-height: 1.4; padding: 0.5rem 0.65rem;
  opacity: 0; transform: translateY(4px); transition: opacity 0.12s, transform 0.12s;
}
.tip.on { opacity: 1; transform: none; }
.tip b { font-weight: 650; display: block; }

/* ---------- controls ---------- */
.toggle { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 999px; padding: 3px; gap: 2px; margin-bottom: 1rem; }
.toggle button {
  font: 600 var(--s-1)/1 var(--display); color: var(--ink); background: transparent; border: 0;
  border-radius: 999px; padding: 0.55rem 0.95rem; cursor: pointer;
}
.toggle button[aria-pressed="true"] { background: var(--ink); color: var(--concrete); }

/* ---------- the 100 matches ---------- */
.hundred { display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); gap: 2rem; align-items: center; }
@media (max-width: 44rem) { .hundred { grid-template-columns: 1fr; } }
.tally { display: grid; gap: 0.8rem; font-family: var(--display); max-width: 16rem; }
.tally div { display: grid; grid-template-columns: 1.1rem 1fr auto; gap: 0.7rem; align-items: baseline; font-size: var(--s0); }
.tally .num { font-size: var(--s2); font-weight: 750; font-stretch: 85%; }
.tally .key { transform: translateY(-2px); }

/* ---------- referee cards ---------- */
.cards-row { display: flex; flex-wrap: wrap; gap: 6px; min-height: 64px; align-items: flex-end; max-width: 46rem; }
.ycard {
  width: 22px; height: 30px; border-radius: 2.5px; background: var(--card);
  transition: transform 0.5s cubic-bezier(.3,.7,.2,1), opacity 0.5s ease, background-color 0.5s ease;
  transition-delay: calc(var(--i) * 14ms);
}
.cards-row.gone .ycard { transform: translateY(14px) rotate(-8deg); opacity: 0.16; background: var(--seat); }

/* ---------- dose: crowd slider ---------- */
.dose { display: grid; gap: 1.6rem; }
@media (min-width: 60rem) { .dose { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.dose-stand { position: relative; aspect-ratio: 16 / 7.5; max-width: 100%; }
#doseStand { position: absolute; inset: 0; width: 100%; height: 100%; }
.crowd-control { font-family: var(--display); margin-top: 1rem; }
.crowd-control label { display: block; font-size: var(--s-1); color: var(--ink-2); }
.crowd-readout { font-size: var(--s3); font-weight: 800; font-stretch: 80%; line-height: 1.05; font-variant-numeric: tabular-nums; }
.crowd-readout small { font-size: var(--s0); font-weight: 500; font-stretch: 100%; color: var(--ink-2); }
input[type="range"] { width: 100%; accent-color: var(--home); margin: 0.6rem 0 0.2rem; height: 2rem; }
.ticks { position: relative; height: 1.1rem; font-size: 0.75rem; color: var(--ink-3); margin-inline: 8px; }
.ticks span { position: absolute; transform: translateX(-50%); }
.ticks span:first-child { transform: none; }
.ticks span:last-child { transform: translateX(-100%); }
.verdict { margin-top: 1rem; font-family: var(--text); font-size: var(--s1); line-height: 1.3; min-height: 3.2em; }

/* ---------- method sequence ---------- */
ol.routine { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; counter-reset: step; }
ol.routine li { counter-increment: step; display: grid; grid-template-columns: 2.2rem 1fr; gap: 0.4rem; }
ol.routine li::before { content: counter(step); font-family: var(--display); font-weight: 750; font-size: var(--s1); line-height: 1.1; color: var(--home); }
.limits { display: grid; gap: 1.1rem; }

footer {
  padding-block: 3rem 4rem; font-family: var(--display); font-size: var(--s-1); color: var(--ink-2);
}
footer .cols { margin-left: var(--indent); display: grid; gap: 1.5rem 3rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); max-width: var(--wide); }
footer h3 { font-size: var(--s0); color: var(--ink); margin-bottom: 0.3rem; font-stretch: 100%; }
footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }

@media (max-width: 40rem) {
  :root { --s3: 2.1rem; --s1: 1.3rem; }
  .hero { height: 220vh; }
  .hero-pin { grid-template-rows: auto min(44svh, 22rem) auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; transition-delay: 0ms !important; }
}

/* ---------- depth: three layers, each a full-width band that gets darker ---------- */
.layer { padding-block: clamp(4rem, 12vh, 7rem); background: var(--concrete); color: var(--ink); }
.layer.evidence { background: var(--concrete-2); }
.layer.deep, footer.deep-foot { background: var(--concrete); color: var(--ink); }
.layer-head { margin-left: var(--indent); margin-bottom: clamp(2.5rem, 7vh, 4.5rem); max-width: 44rem; }
.layer-head h2 {
  font-size: clamp(2.6rem, 7vw, 5.2rem); line-height: 0.92; font-weight: 860; font-stretch: 118%; letter-spacing: -0.02em;
}
.layer-head p { font-size: var(--s1); line-height: 1.35; color: var(--ink-2); margin-top: 0.8rem; }
.evidence .layer-head h2 { font-stretch: 100%; font-weight: 780; }
.deep .layer-head h2 { font-stretch: 80%; font-weight: 650; }

/* the headlines: one fact per screen-ish, statement left, visual right */
.fact {
  margin-left: var(--indent); max-width: var(--wide);
  display: grid; gap: 1.6rem 4rem; align-items: center;
  padding-block: clamp(2.5rem, 8vh, 5rem); border-top: 1px solid var(--rule);
}
@media (min-width: 60rem) { .fact { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } }
.fact h3 {
  font-size: clamp(2rem, 4.6vw, 3.5rem); line-height: 1.0; font-weight: 820; font-stretch: 106%; letter-spacing: -0.018em;
  max-width: 15ch;
}
.fact-text p { margin-top: 1rem; max-width: 34rem; font-size: 1.2rem; line-height: 1.55; color: var(--ink-2); }
.fact h3 .num { font: inherit; white-space: normal; }
.fact-visual { min-width: 0; }
.fact .hundred { grid-template-columns: minmax(0, 24rem) auto; gap: 1.5rem; }
.fact .tally div { grid-template-columns: 1.1rem 6.5rem auto; white-space: nowrap; }
@media (max-width: 30rem) { .fact .hundred { grid-template-columns: 1fr; } }
.fact-visual .source { margin-top: 0.5rem; }
.layer-exit { margin-left: var(--indent); border-top: 1px solid var(--rule); padding-top: 2.5rem; max-width: var(--wide); }
.layer-exit p:first-child { font-size: var(--s1); line-height: 1.35; max-width: 34rem; }
.layer-exit p + p { margin-top: 1rem; font-family: var(--display); font-weight: 650; }
.layer-exit .sep { font-weight: 400; color: var(--ink-3); margin-inline: 0.4rem; }

/* the method band redefines the tokens, so every chart inside follows */
.deep {
  --concrete: #16242e; --concrete-2: #1d2d38; --ink: #e5e9e4; --ink-2: #c0c8c6; --ink-3: #8e9a9c;
  --rule: #2c3e49; --seat: #4b606b; --seat-back: #3a4d58; --home: #e4637a; --away: #3d93d6;
  --card: #f0c22e; --focus: #8cc4ee; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .deep { --concrete: #0c171e; --concrete-2: #13212b; --rule: #253641; }
}
:root[data-theme="dark"] .deep { --concrete: #0c171e; --concrete-2: #13212b; --rule: #253641; }
.deep code { font-size: 0.9em; }

/* depth rail: where am I in the three layers */
.rail {
  position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); top: 50%; align-items: flex-end; transform: translateY(-50%); z-index: 5;
  display: none; flex-direction: column; gap: 0.7rem; font-family: var(--display); font-size: 0.78rem;
}
.rail a { color: var(--ink-3); text-decoration: none; display: flex; flex-direction: row-reverse; align-items: center; gap: 0.5rem; padding-block: 0.15rem; }
.rail a::before { content: ""; width: 14px; height: 2px; background: currentColor; border-radius: 1px; transition: width 0.2s; }
.rail a[aria-current="true"] { color: var(--ink); font-weight: 650; }
.rail a[aria-current="true"]::before { width: 26px; background: var(--home); }
.rail.on-deep a { color: #8e9a9c; }
.rail.on-deep a[aria-current="true"] { color: #e5e9e4; }
@media (min-width: 88rem) { .rail.show { display: flex; } }
