:root {
  /* Palette reuses philipmathieu.com's own tokens (gray scale, primary red,
     link blue) so this piece reads as part of the site rather than a
     standalone microsite. Shah/Bellows/Jackson stay separate — they're
     chart-only candidate identifiers, not part of the site's UI palette. */
  --ink: #1a1a1a;
  --muted: #4a4a4a;
  --faint: #666666;
  --surface: #f7f7f7;
  --card: #ffffff;
  --line: #e5e5e5;
  --line-strong: #cccccc;
  --link: #1d9acc;
  --accent: #ce112d;
  --accent-600: #a00e24;
  --shah: #2a78d6;
  --bellows: #008300;
  --jackson: #eda100;
  /* Jackson's amber as *text*: #eda100 on white is ~1.9:1, unreadable at 15px.
     This is the same hue pushed dark enough to clear AA (~4.9:1) while still
     reading as his color beside the chart. */
  --jackson-ink: #a86c00;
  --maxw: 1120px;
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
/* The UA's [hidden] rule is a bare attribute selector, so any class that sets
   `display` silently outranks it and the element stays visible (the CI
   whiskers toggle via the hidden property), so this has to win. */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-weight: 500; line-height: 1.12; letter-spacing: -0.01em; }
em { font-style: italic; }
strong { font-weight: 600; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }

.hero__eyebrow, .panel__scenario, .slider__label, .regime__caption,
.footer__meta {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
}

/* ---------- series crumb ---------- */
.crumb {
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--faint);
  text-align: center;
  padding-top: 2rem;
}
.crumb a { color: var(--muted); text-decoration-color: var(--line-strong); }
.crumb a:hover { color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 15vh 6vw 9vh;
  text-align: center;
}
.hero__eyebrow { margin-bottom: 1.4rem; }
.hero__title { font-size: clamp(2.6rem, 6.5vw, 5rem); margin: 0 0 1.6rem; }
.hero__title em { color: var(--accent); }
.hero__dek {
  max-width: 40rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
}
/* Byline: present but quiet — sans, small, no link-blue. The underline is the
   only tell that it's a mailto. */
.hero__byline {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--faint);
  margin: 1.5rem 0 0;
}
.hero__byline a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.hero__byline a:hover { color: var(--ink); text-decoration-color: var(--ink); }
.hero__scrollcue {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  margin-top: 3.4rem;
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------- scrolly ---------- */
.scrolly {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 6vw;
  display: flex;
  gap: 4vw;
  align-items: flex-start;
}
.scrolly__graphic {
  position: sticky;
  top: 6vh;
  flex: 1 1 54%;
  min-width: 0;
}
.scrolly__steps { flex: 1 1 46%; }
.step {
  min-height: 82vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3vh 0;
  opacity: 0.32;
  transition: opacity 0.35s ease;
}
.step.is-active { opacity: 1; }
.step h2 { font-size: clamp(1.5rem, 3vw, 2.15rem); margin: 0 0 1rem; }
.step p { margin: 0 0 1rem; }
.step p:last-child { margin-bottom: 0; }

/* ---------- panel ---------- */
/* Ruled like a tally sheet, not a product card: a heavy top rule (report
   header), hairline bottom, square corners, no ambient shadow. */
.panel {
  background: var(--card);
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 1.5rem 1.6rem 1.4rem;
}
.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1rem;
  /* The title never wraps. When the two can't share a row, the counter drops
     to its own line instead — a two-line title reads as a layout accident. */
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.panel__scenario { color: var(--ink); flex: 1 1 auto; white-space: nowrap; }
.panel__s {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}
.panel__sval {
  display: inline-block;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 15px;
  color: var(--jackson-ink);
  margin-left: 0.3rem;
}

/* ---------- rounds ---------- */
.rounds { display: flex; flex-direction: column; gap: 1.15rem; }
.round { position: relative; }

/* When someone takes a majority on the first ballot there is no second round.
   The block stays in place, greys out, and gets stamped — the absence of a
   final ballot IS the finding here, so it should be visible, not removed. */
.round__content { transition: opacity 0.5s ease, filter 0.5s ease; }
.round--spent .round__content {
  filter: grayscale(1);
  opacity: 0.32;
}
.round__stamp {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.round--spent .round__stamp { opacity: 1; }
.round__stamp span {
  transform: rotate(-5deg);
  border: 2px solid rgba(26, 26, 26, 0.34);
  border-radius: 3px;
  padding: 0.3rem 0.85rem;
  background: rgba(247, 247, 247, 0.82);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(26, 26, 26, 0.62);
}
/* Styled like a roll-call/scoreboard tab rather than a soft caption — the
   rounds are a real sequence (first ballot, final ballot), so the label
   should read as a record marker, not decoration. */
.round__head {
  display: inline-block;
  margin-bottom: 0.6rem;
  padding: 0.15rem 0.5rem;
  background: var(--ink);
  color: var(--card);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.barrow {
  display: grid;
  grid-template-columns: 6.7rem 1fr 3.2rem;
  align-items: center;
  gap: 0.7rem;
  padding: 0.16rem 0;
}
.barrow--out { opacity: 0.5; }
.barrow--hi .barrow__name { font-weight: 600; }
.barrow--hi .barrow__track { box-shadow: 0 0 0 2px rgba(26,26,26,0.09); border-radius: 5px; }
.barrow__name {
  font-family: var(--sans);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.barrow__track {
  position: relative;
  height: 15px;
  background: #eeeeee;
  border-radius: 4px;
}
.barrow__fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.1, 1), background 0.3s;
}
/* During a scripted sweep or a drag, the input IS the animation — a CSS
   transition on top of it just lags half a second behind every frame. Both
   marks must be suppressed together, or they desynchronise. */
.rounds.is-animating .barrow__fill,
.rounds.is-scrubbing .barrow__fill { transition: background 0.3s; }
.rounds.is-animating .barrow__ci,
.rounds.is-scrubbing .barrow__ci { transition: none; }
/* 5th-95th percentile of this candidate's own total. Deliberately understated:
   the decisive uncertainty is in the GAP (stated in the verdict), and a loud
   whisker invites readers to judge significance by whether two bars overlap —
   which is wrong here, since the totals are strongly anticorrelated. */
.barrow__ci {
  position: absolute;
  top: 50%;
  height: 7px;
  transform: translateY(-50%);
  border-left: 1.5px solid rgba(26, 26, 26, 0.55);
  border-right: 1.5px solid rgba(26, 26, 26, 0.55);
  pointer-events: none;
  /* must match .barrow__fill exactly, or the whisker arrives before its bar */
  transition: left 0.5s cubic-bezier(0.4, 0, 0.1, 1),
              width 0.5s cubic-bezier(0.4, 0, 0.1, 1);
}
.barrow__ci::before {
  content: "";
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1.5px;
  background: rgba(26, 26, 26, 0.45);
  transform: translateY(-50%);
}
.barrow--out .barrow__ci { display: none; }
.barrow__maj {
  position: absolute;
  left: 50%; top: -3px; bottom: -3px;
  width: 2px;
  background: repeating-linear-gradient(var(--ink) 0 3px, transparent 3px 6px);
  opacity: 0.5;
}
.barrow__val {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  color: var(--ink);
}
.barrow--out .barrow__val { color: var(--faint); font-style: italic; }

/* unmeasurable seats: named, not silently dropped */
.barrow--nodata .barrow__name { color: var(--faint); font-style: italic; }
.barrow--nodata .barrow__val {
  color: var(--faint);
  font-style: italic;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
/* "Candidate 4*" vs "C4*": both are in the DOM, the breakpoint picks one. */
.barrow__name--abbr { display: none; }
.barrow__track--nodata {
  background: repeating-linear-gradient(
    135deg, transparent 0 5px, #ececec 5px 10px);
  border: 1px dashed var(--line-strong);
}
/* Footnote marker tying the unmeasurable seats to the note directly below.
   Raised like a superscript without <sup>, so it can't disturb line height. */
.ast {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
  color: var(--faint);
  font-size: 13px;
  line-height: 0;
  position: relative;
  top: -0.28em;
  margin-left: 0.12rem;
}
.round__note .ast { margin: 0 0.22rem 0 0; top: -0.2em; }

.round__note {
  font-family: var(--sans);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--faint);
  margin: 0.75rem 0 0;
  padding-left: 0.1rem;
  max-width: 34rem;
}
.round__note a { color: var(--muted); }

/* ---------- verdict ---------- */
.verdict {
  margin-top: 1.3rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--line);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.verdict { align-items: flex-start; }
.verdict__dot {
  width: 11px; height: 11px; border-radius: 50%; flex: none;
  margin-top: 0.42em;
}
.verdict__unc {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--faint);
}
.verdict__unc b { color: var(--muted); font-weight: 600; }

/* ---------- 100 conventions (icon array) ---------- */
.grid100 {
  margin-top: 1.3rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--line);
}
.grid100__head { margin-bottom: 0.75rem; }
.grid100__pips {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 3px;
  max-width: 22rem;
}
.pip {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--line-strong);
  transition: background 0.25s ease;
}
.grid100__note {
  border-top: none;
  margin-top: 0.85rem;
  padding-top: 0;
  gap: 1rem;
}
.grid100__note b { font-family: var(--mono); color: var(--ink); }
@media (max-width: 820px) {
  .grid100__pips { grid-template-columns: repeat(20, 1fr); max-width: none; }
}

/* ---------- probability curves ---------- */
.curves { margin-top: 0.4rem; }
.curves__svg { width: 100%; height: auto; display: block; overflow: visible; }
.cv-grid { stroke: var(--line); stroke-width: 1; }
.cv-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cv-lab {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--faint);
}
.cv-lab--y { text-anchor: end; }
.cv-lab--x { text-anchor: middle; }
.cv-axis {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  fill: var(--faint);
}
.cv-axis--y { text-anchor: middle; }
/* Halo the labels: they sit on the plot, and three curves cross most of it.
   paint-order draws the surface-coloured stroke first, so the glyphs stay
   legible wherever they land without hand-placing them around the lines. */
.cv-name, .cv-actual__lab {
  paint-order: stroke fill;
  stroke: var(--card);
  stroke-width: 3.5px;
  stroke-linejoin: round;
}
.cv-name {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
}
.cv-actual { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.45; }
.cv-actual__lab { text-anchor: end; fill: var(--muted); }
.cv-ptr { stroke: var(--ink); stroke-width: 2; }
.cv-dot { stroke: var(--card); stroke-width: 1.5; }
.curves__read {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.curves__read b { font-family: var(--mono); color: var(--ink); }

/* ---------- regime strip ---------- */
.regime { margin-top: 1.2rem; }
.regime__track {
  position: relative;
  height: 30px;
  border-radius: 5px;
  overflow: visible;
  /* headroom for the "actual" flag, which sits above the bar: below it would
     land in the axis row and collide with the 450 tick */
  margin-top: 2.7rem;
  margin-bottom: 2.6rem;
}
.regime__band {
  position: absolute; top: 0; bottom: 0;
  border-right: 2px solid var(--card);
}
.regime__band:last-of-type { border-right: none; }
.regime__ptr {
  position: absolute; top: -5px; bottom: -5px;
  width: 3px;
  background: var(--ink);
  border-radius: 2px;
  transform: translateX(-1.5px);
  transition: left 0.3s ease;
}
.regime__flag { position: absolute; top: 0; bottom: 0; }
.regime__flag i {
  position: absolute; top: -5px; bottom: -5px; left: 0;
  width: 2px; background: #fff;
}
.regime__flag b {
  position: absolute; bottom: calc(100% + 11px); left: 0;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  text-align: center;
  white-space: nowrap;
}
.regime__axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  margin-top: -2.2rem;
}
.regime__caption { margin-top: 0.5rem; text-align: center; }

/* ---------- legend ---------- */
.legend {
  display: flex;
  gap: 1.2rem;
  margin-top: 1.15rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}
.legend__item, .legend .legend__item {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ---------- sandbox ---------- */
.sandbox {
  max-width: 760px;
  margin: 12vh auto 0;
  padding: 0 6vw;
}
.sandbox__intro { text-align: center; margin-bottom: 2.5rem; }
.sandbox__intro h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0.7rem 0 1rem; }
.sandbox__intro p { max-width: 34rem; margin: 0 auto; color: var(--muted); }
.sandbox__panel { }

/* The regime band IS the control. A separate slider duplicated the same axis
   twice on one screen; dragging the band you're reading is one object. */
.regime--control { margin: 0 0 1.5rem; }
.regime--control .regime__track {
  height: 38px;
  cursor: ew-resize;
  touch-action: none;
}
.regime--control .regime__track:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.regime--control .regime__ptr {
  /* dragged, so no easing: a transition here trails the pointer */
  transition: none;
  width: 4px;
  transform: translateX(-2px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
}
.regime--control .regime__ptr::after {
  content: "";
  position: absolute;
  left: 50%; top: -9px;
  width: 15px; height: 15px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.regime__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.slider__label { white-space: nowrap; }
.slider__out {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 18px;
  color: var(--jackson-ink);
  text-align: right;
}
.sandbox__marks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.8rem;
}
.mark {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.32rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.mark:hover { border-color: var(--ink); color: var(--ink); }
.panel--sandbox { margin-top: 0.5rem; }

/* ---------- contact ---------- */
.contact {
  max-width: 760px;
  margin: 5vh auto 0;
  padding: 1.6rem 6vw 0;
  border-top: 1px solid var(--line);
  text-align: center;
}
.contact__by {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--ink);
}
.contact__note {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--faint);
}
.contact a { color: var(--muted); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.contact a:hover { color: var(--ink); text-decoration-color: var(--ink); }

/* ---------- footer ---------- */
.footer {
  /* Same content width as the sandbox above — narrower read as a mistake. */
  max-width: 760px;
  margin: 6vh auto 0;
  padding: 3rem 6vw 8vh;
  border-top: 1px solid var(--line);
  font-size: 16px;
  color: var(--muted);
  line-height: 1.65;
}
.footer strong { color: var(--ink); }
.footer p { margin: 0 0 1.15rem; }
.footer p:last-of-type { margin-bottom: 0; }
.footer__h {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  margin: 0 0 1.3rem;
}
.footer__meta { font-size: 13px; margin-top: 1.4rem; text-transform: none; letter-spacing: 0; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  body { font-size: 17px; }
  .scrolly { display: block; padding: 0 5vw; }
  .scrolly__graphic {
    position: sticky; top: 0;
    padding: 0.8rem 0 1rem;
    background: linear-gradient(var(--surface) 82%, transparent);
    z-index: 5;
  }
  .scrolly__steps { margin-top: 1rem; }
  .step { min-height: 68vh; }
  /* Abbreviated labels and no name dots: the name column can hand its spare
     width to the bars. */
  .barrow { grid-template-columns: 4.2rem 1fr 3.1rem; }

  /* On a phone the pinned graphic and the prose share one small viewport, so
     the panel keeps only what changes as you scroll: bars, counts, verdict.
     The Article X footnote and the sampling caveat are static methodology —
     both remain in full in the Method section at the foot of the page. */
  .round__note { display: none; }
  .verdict__unc { display: none; }
  .barrow__name--full { display: none; }
  .barrow__name--abbr { display: inline; }
  /* The pinned panel's scenario line already titles each step, so the prose
     headers repeat it — on a phone they cost more height than they're worth. */
  .scrolly .step h2 { display: none; }

  /* Tighter vertical rhythm for everything that stays. */
  .panel { padding: 0.9rem 1rem 0.8rem; }
  .panel__head { margin-bottom: 0.7rem; padding-bottom: 0.55rem; }
  /* The head is ALWAYS two stacked rows on a phone. Left to flex-wrap it
     flipped between one and two rows depending on the scenario title, and
     every flip resized the pinned graphic mid-scroll. The title truncates
     rather than wraps for the same reason. */
  .panel__head { display: block; }
  .panel__scenario { overflow: hidden; text-overflow: ellipsis; }
  .panel__s { text-align: left; margin: 0.2rem 0 0; }
  .rounds { gap: 0.7rem; }
  .round__head { margin-bottom: 0.4rem; }
  .barrow { gap: 0.55rem; padding: 0.1rem 0; }
  .barrow__name { font-size: 13px; }
  .barrow__track { height: 12px; }
  .barrow__val { font-size: 12.5px; }
  .verdict { margin-top: 0.75rem; padding-top: 0.6rem; font-size: 0.95rem; }
  .curves__read { margin-top: 0.6rem; padding-top: 0.55rem; }
}
