/* ============================================================================
   Does the grid bind? — Ember on Ink
   A warm-shifted cinematic dark world. The ground is brown-black, never
   blue-black; every neutral carries the same hue so long reading stays easy.
   Chart series are the validated categorical steps (see colophon), not the
   UI accent — the accent is for interface, the series are for data.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300..900&family=Newsreader:opsz,wght@6..72,300..600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* ground */
  --ground:      #14100E;
  --ground-deep: #0D0A09;
  --raised:      #1E1815;
  --raised-2:    #2A221E;
  --hairline:    #3A2F29;

  /* ink */
  --ink:         #F2E9E0;
  --ink-2:       #C9B9AC;
  --muted:       #A8988C;
  --faint:       #948376;

  /* accent — interface only */
  --ember:       #E8853A;
  --ember-deep:  #C4611F;
  --gold:        #E5B54A;

  /* data series — validated on --ground, adjacent-pair CVD ΔE ≥ 8, normal ≥ 15 */
  --s1: #d95926;   /* ember-orange */
  --s2: #199e70;   /* aqua */
  --s3: #3987e5;   /* blue */
  --s4: #d55181;   /* magenta */

  /* status — fixed, never themed, always shipped with icon + label */
  --ok:       #0ca30c;
  --warn:     #fab219;
  --bad:      #d03b3b;

  --grid-line: #2A221E;

  --measure: 68ch;
  --gutter: clamp(1.25rem, 5vw, 4rem);

  /* exponential ease-out: everything decelerates, nothing bounces */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);

  color-scheme: dark;
}

/* ---------------------------------------------------------- browser surfaces
   The parts we did not draw still belong to the design. */
::selection { background: var(--ember-deep); color: #fff; }
html { scrollbar-color: var(--raised-2) var(--ground); scrollbar-width: thin; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--ground); }
::-webkit-scrollbar-thumb { background: var(--raised-2); border-radius: 99px;
  border: 3px solid var(--ground); }
::-webkit-scrollbar-thumb:hover { background: var(--hairline); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; border-radius: 2px; }
* { caret-color: var(--ember); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: 'Newsreader', Georgia, 'Times New Roman', serif;
  font-optical-sizing: auto;
  font-size: clamp(1.0625rem, 0.95rem + 0.42vw, 1.1875rem);
  line-height: 1.68;
  font-weight: 350;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* the ember bleed: a single warm source behind the whole page */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120vw 80vh at 50% -10%, rgba(232,133,58,0.10), transparent 60%),
    radial-gradient(90vw 60vh at 85% 110%, rgba(196,97,31,0.07), transparent 62%);
}
main, header, footer { position: relative; z-index: 1; }

/* ------------------------------------------------------------------- type */
h1, h2, h3, .display {
  font-family: 'Fraunces', Georgia, serif;
  font-variation-settings: 'SOFT' 22, 'WONK' 1;
  font-weight: 560;
  line-height: 1.03;
  letter-spacing: -0.032em;
  text-wrap: balance;
  margin: 0;
}
h2 { font-size: clamp(2rem, 1.3rem + 3.2vw, 3.9rem); }
h3 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.85rem); letter-spacing: -0.022em; font-weight: 600; }

p { margin: 0 0 1.15em; }
strong { font-weight: 600; color: #FFF6EC; }
em { font-style: italic; color: var(--ink); }

a {
  color: var(--ink);
  text-decoration-color: var(--ember);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color .25s var(--ease), text-decoration-color .25s var(--ease);
}
a:hover { color: var(--ember); text-decoration-color: var(--ember); }

.num, .mono, code, td.n, th.n {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'zero' 1;
  letter-spacing: -0.02em;
}

/* --------------------------------------------------------------- structure */
.wrap { width: min(100% - (var(--gutter) * 2), 1240px); margin-inline: auto; }
.col  { width: min(100%, var(--measure)); margin-inline: auto; }
.col-wide { width: min(100%, 92ch); margin-inline: auto; }

section { padding-block: clamp(5rem, 11vh, 9.5rem); }
section + section { border-top: 1px solid var(--hairline); }

.lede {
  font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.6rem);
  line-height: 1.5; color: var(--ink-2); font-weight: 300;
  letter-spacing: -0.012em;
}
.small { font-size: 0.875rem; line-height: 1.6; color: var(--muted); }
.note {
  font-size: 0.85rem; line-height: 1.62; color: var(--muted);
  border-top: 1px solid var(--hairline); padding-top: 0.9rem; margin-top: 1.6rem;
}

h2 + .lede, h2 + p { margin-top: 1.5rem; }
.viz { margin-block: clamp(2.5rem, 6vh, 4.5rem); }

/* ------------------------------------------------------------------- hero */
.hero {
  min-height: 100svh; display: grid; align-content: center;
  padding-block: 11vh 9.5rem; border: 0; position: relative;
}
.hero h1 {
  font-size: clamp(3.2rem, 1.4rem + 8.6vw, 9.5rem);
  font-variation-settings: 'SOFT' 18, 'WONK' 1;
  font-weight: 620; letter-spacing: -0.046em; line-height: 0.92;
}
.hero h1 .q { display: block; color: var(--ink); }
.hero h1 .q + .q { color: var(--ember);
  text-shadow: 0 0 70px rgba(232,133,58,0.28), 0 2px 0 rgba(0,0,0,0.35); }
.hero-sub {
  margin-top: clamp(1.75rem, 4vh, 3rem);
  max-width: 54ch; font-size: clamp(1.15rem, 1rem + 0.7vw, 1.5rem);
  line-height: 1.48; color: var(--ink-2); font-weight: 300;
}
.hero-meta {
  margin-top: clamp(2rem, 5vh, 3.25rem);
  display: flex; flex-wrap: wrap; gap: 0.6rem 2.25rem;
  font-size: 0.8rem; color: var(--faint); letter-spacing: 0.02em;
}
.hero-meta b { color: var(--muted); font-weight: 500; }

/* the probability readout */
.prob { margin-top: clamp(2rem, 5vh, 3.25rem); max-width: 40rem; }
.prob-label {
  font-size: 0.78rem; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--muted); font-family: 'IBM Plex Mono', monospace; font-weight: 500;
}
.prob-value {
  font-family: 'Fraunces', serif; font-weight: 700;
  font-size: clamp(3.4rem, 1.5rem + 8vw, 7.5rem);
  line-height: 1; color: var(--ember); letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums; margin-top: 0.3rem;
  text-shadow: 0 0 70px rgba(232,133,58,0.26);
}
.prob-track {
  height: 8px; background: var(--raised); border-radius: 99px;
  margin-top: 1.4rem; overflow: hidden; position: relative;
}
.prob-fill {
  height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--ember-deep), var(--ember));
  box-shadow: 0 1px 10px -2px rgba(232,133,58,0.55);
  transition: width 2.1s var(--ease);
}
.prob-foot { margin-top: 0.85rem; font-size: 0.9rem; color: var(--muted); }

.scroll-cue {
  position: absolute; bottom: 2.25rem; right: 0;
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--faint); font-family: 'IBM Plex Mono', monospace;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
}
.scroll-cue svg { animation: drift 2.6s var(--ease-soft) infinite; }
@media (max-width: 760px) { .scroll-cue { display: none; } }
@keyframes drift { 0%,100% { translate: 0 0; opacity:.5 } 50% { translate: 0 6px; opacity:1 } }

/* ------------------------------------------------------- reveal choreography */
.rise { opacity: 0; translate: 0 22px; filter: blur(6px);
  transition: opacity .95s var(--ease), translate 1.05s var(--ease), filter .95s var(--ease); }
.rise.in { opacity: 1; translate: 0 0; filter: blur(0); }
.rise.d1 { transition-delay: .09s } .rise.d2 { transition-delay: .18s }
.rise.d3 { transition-delay: .27s } .rise.d4 { transition-delay: .36s }

/* --------------------------------------------------------------- scoreboard */
.score { display: grid; gap: 1px; background: var(--hairline);
  border: 1px solid var(--hairline); border-radius: 10px; overflow: hidden; }
.claim {
  background: var(--ground); padding: 1.15rem 1.35rem;
  display: grid; grid-template-columns: 3.1rem 1fr auto; gap: 0.5rem 1.15rem;
  align-items: start; transition: background .35s var(--ease);
}
.claim:hover { background: var(--raised); }
.claim-id {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.82rem; font-weight: 600;
  color: var(--faint); padding-top: 0.22em; letter-spacing: 0;
}
.claim-text { font-size: 1.02rem; line-height: 1.45; color: var(--ink); }
.claim-note { grid-column: 2 / -1; font-size: 0.875rem; color: var(--muted);
  line-height: 1.55; margin-top: 0.35rem; }
.tag {
  display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 0.32rem 0.6rem;
  border-radius: 5px; border: 1px solid currentColor; background: rgba(0,0,0,0.25);
}
.tag svg { width: 13px; height: 13px; flex: none; }
.tag.true    { color: #3fce3f; }
.tag.partial { color: var(--warn); }
.tag.false   { color: #f06a6a; }

/* ------------------------------------------------------------------ regimes */
.regimes { display: grid; gap: 1.1rem; }
@media (min-width: 900px) { .regimes { grid-template-columns: repeat(3, 1fr); } }
.regime {
  border: 1px solid var(--hairline); border-radius: 12px; padding: 1.6rem 1.5rem;
  background: linear-gradient(180deg, var(--raised), var(--ground));
  position: relative; overflow: hidden;
  box-shadow: 0 14px 34px -22px rgba(0,0,0,0.85);
}
.regime::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--tone, var(--hairline)); opacity: .85;
}
.regime.c { --tone: var(--s1); }
.regime.b { --tone: var(--gold); }
.regime.a { --tone: var(--s2); }
.regime-key {
  font-family: 'Fraunces', serif; font-size: 2.6rem; font-weight: 700;
  line-height: 1; color: var(--tone); letter-spacing: -0.04em;
}
.regime-cond {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.82rem; color: var(--ink-2);
  margin-top: 0.75rem; padding: 0.4rem 0.6rem; background: rgba(0,0,0,0.35);
  border-radius: 5px; display: inline-block;
}
.regime h3 { margin-top: 0.85rem; font-size: 1.22rem; }
.regime p { margin: 0.65rem 0 0; font-size: 0.95rem; color: var(--ink-2); line-height: 1.55; }
.regime.hit { border-color: var(--tone); box-shadow: 0 0 0 1px var(--tone),
  0 18px 50px -24px rgba(217,89,38,0.6); }
.regime-flag {
  margin-top: 1.1rem; font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--tone); font-weight: 600;
}

/* -------------------------------------------------------------- chart shell */
figure { margin: 0; }
figcaption {
  margin-top: 1rem; font-size: 0.85rem; color: var(--muted); line-height: 1.6;
  max-width: 80ch;
}
figcaption b { color: var(--ink-2); font-weight: 600; }
.chart { width: 100%; display: block; overflow: visible; --vb-fs: 11px; --vb-fd: 12px; }
/* A 780-unit viewBox renders at roughly 0.45x on a phone, so nominal 11px type
   lands at 5px. Size for the effective pixel, not the nominal one. */
@media (max-width: 760px) { .chart { --vb-fs: 27px; --vb-fd: 31px; } }
.chart text { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
.ax { fill: var(--muted); font-size: var(--vb-fs); }
.ax-title { fill: var(--faint); font-size: calc(var(--vb-fs) * 0.94); letter-spacing: 0.08em; text-transform: uppercase; }
.gl { stroke: var(--grid-line); stroke-width: 1; }
.dl { fill: var(--ink); font-size: var(--vb-fd); font-weight: 500; }

.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; margin-bottom: 1.1rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.85rem; color: var(--ink-2); }
.legend i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; flex: none; }

.tt {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0;
  background: var(--raised-2); border: 1px solid var(--hairline);
  border-radius: 8px; padding: 0.6rem 0.8rem; font-size: 0.82rem; color: var(--ink);
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.9);
  transition: opacity .16s var(--ease); max-width: 18rem; line-height: 1.5;
}
.tt.on { opacity: 1; }
.tt b { display:block; font-family:'IBM Plex Mono',monospace; font-size:0.78rem;
  color: var(--muted); font-weight:500; margin-bottom:0.2rem; letter-spacing:0.04em; }

/* ------------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
caption { text-align: left; font-size: 0.85rem; color: var(--muted);
  padding-bottom: 0.7rem; }
th, td { text-align: left; padding: 0.62rem 0.85rem;
  border-bottom: 1px solid var(--hairline); }
th { font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; font-family: 'IBM Plex Mono', monospace; }
td.n, th.n { text-align: right; }
tbody tr:hover { background: var(--raised); }

/* --------------------------------------------------------------- pull quote */
.pull {
  border-left: 1px solid var(--ember); padding-left: clamp(1.1rem, 3vw, 2rem);
  margin-block: clamp(2rem, 5vh, 3.25rem); font-family: 'Fraunces', serif;
  font-size: clamp(1.35rem, 1.05rem + 1.4vw, 2.1rem); line-height: 1.3;
  font-weight: 400; letter-spacing: -0.024em; color: var(--ink);
  font-variation-settings: 'SOFT' 30, 'WONK' 1;
}
.pull cite { display: block; margin-top: 0.9rem; font-family: 'Newsreader', serif;
  font-size: 0.9rem; font-style: normal; color: var(--muted); letter-spacing: 0; }

blockquote.filing {
  margin: 1.8rem 0; padding: 1.3rem 1.5rem; background: var(--raised);
  border: 1px solid var(--hairline); border-radius: 10px;
  font-size: 0.98rem; line-height: 1.62; color: var(--ink-2);
}
blockquote.filing p:last-child { margin-bottom: 0; }
blockquote.filing b { color: var(--ember); font-weight: 600; }
blockquote.filing cite { display:block; margin-top:0.9rem; font-style:normal;
  font-size:0.8rem; color:var(--faint); font-family:'IBM Plex Mono',monospace; }

/* ------------------------------------------------------------------ figures */
.stat-row { display: grid; gap: 1.6rem 2.5rem; margin-block: 2.25rem; }
@media (min-width: 720px) { .stat-row { grid-template-columns: repeat(3, 1fr); } }
.stat-v { font-family: 'Fraunces', serif; font-weight: 640; letter-spacing: -0.04em;
  font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3.2rem); line-height: 1; color: var(--ember); }
.stat-v.cool { color: var(--s2); }
.stat-k { margin-top: 0.55rem; font-size: 0.88rem; color: var(--muted); line-height: 1.5; }

/* ------------------------------------------------------------------- footer */
footer { padding-block: 5rem 7rem; border-top: 1px solid var(--hairline);
  color: var(--muted); font-size: 0.9rem; }
footer h3 { color: var(--ink); margin-bottom: 1rem; }
.colophon { display: grid; gap: 2.5rem; }
@media (min-width: 860px) { .colophon { grid-template-columns: 1.4fr 1fr; } }
.swatches { display: flex; gap: 0.4rem; margin-top: 0.8rem; }
.swatches i { width: 30px; height: 30px; border-radius: 5px; display: block;
  border: 1px solid rgba(255,255,255,0.09); }

/* ------------------------------------------------------------------ a11y */
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 0.5rem; top: -4rem; z-index: 99;
  background: var(--ember); color: #1a0f06; padding: 0.7rem 1.1rem;
  border-radius: 6px; font-weight: 600; transition: top .2s var(--ease);
  text-decoration: none;
}
.skip:focus { top: 0.5rem; }
.skip:hover, .skip:focus { color: #1a0f06; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .rise { opacity: 1; translate: none; filter: none; }
}
