/* Front page: the live midterm readout is the hero (headline and odds left, House hex map right, call to action under
   the odds); the other two projects sit below as a compact secondary row. */
:root {
  --paper: #f4f5f7; --surface: #ffffff; --ink: #161a23; --muted: #5b6374; --faint: #8a92a3; --rule: #dde1e8;
  --d: #2a78d6; --r: #c74843; --cta: #161a23; --cta-ink: #ffffff;
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1117; --surface: #151922; --ink: #e7eaf0; --muted: #9aa3b5; --faint: #7f889a; --rule: #262c38;
    --d: #5b9cf0; --r: #e8706a; --cta: #e7eaf0; --cta-ink: #0e1117; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1117; --surface: #151922; --ink: #e7eaf0; --muted: #9aa3b5; --faint: #7f889a; --rule: #262c38;
  --d: #5b9cf0; --r: #e8706a; --cta: #e7eaf0; --cta-ink: #0e1117; color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.55 var(--f-body); -webkit-font-smoothing: antialiased;
  padding-inline: var(--gutter);
}
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 3px solid var(--d); outline-offset: 3px; border-radius: 2px; }
.num { font-variant-numeric: tabular-nums; }

.top, main, footer { max-width: 1240px; margin-inline: auto; }
.top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding-block: 22px 0;
}
.brand { min-width: 0; }
.wordmark { font: 760 21px/1 var(--f-display); font-stretch: 112%; letter-spacing: -0.02em; }
.defn { margin: 6px 0 0; font: 400 13px/1.35 var(--f-body); color: var(--muted); }
.defn i { font-family: Georgia, "Times New Roman", serif; color: var(--ink); margin-right: 2px; }
.top nav { display: flex; gap: clamp(14px, 3vw, 28px); padding-top: 3px; font: 500 14px/1 var(--f-body); color: var(--muted); }
.top nav a:hover { color: var(--ink); }

/* Hero: two columns on wide screens; the call to action stays under the odds. */
.hero {
  display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 13fr);
  grid-template-areas: "head fig" "cta fig"; grid-template-rows: auto 1fr;
  column-gap: clamp(28px, 5vw, 72px); row-gap: 28px;
  padding-block: clamp(36px, 6vw, 76px) clamp(40px, 6vw, 72px);
}
.hero-head { grid-area: head; min-width: 0; }
.hero-fig { grid-area: fig; min-width: 0; margin: 0; align-self: start; }
.hero-cta { grid-area: cta; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; align-self: start; }

.eyebrow {
  display: flex; align-items: center; gap: 10px; margin: 0 0 18px;
  font: 500 12px/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--d); position: relative; flex: none; }
.pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--d);
  opacity: 0; animation: ping 2.4s ease-out infinite;
}
@keyframes ping { 0% { transform: scale(.5); opacity: .8; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
h1 {
  margin: 0; font: 760 clamp(36px, 4.5vw, 62px)/1 var(--f-display); font-stretch: 104%;
  letter-spacing: -0.035em; text-wrap: balance;
}
h1 .d { color: var(--d); }
h1 .r { color: var(--r); }
.sub { margin: 18px 0 0; max-width: 44ch; color: var(--muted); font-size: 17px; }

.odds {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 30px 0 0;
  border-top: 1px solid var(--rule);
}
.odd { padding: 14px 12px 0 0; min-width: 0; }
.odd + .odd { padding-left: 14px; border-left: 1px solid var(--rule); }
.odd dt { font: 500 12px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.odd dd { margin: 0; }
.odd b { font: 720 clamp(28px, 3.2vw, 40px)/1.1 var(--f-display); letter-spacing: -0.02em; }
.odd .who { font: 600 14px/1 var(--f-display); color: var(--muted); }
.odd .range { font: 400 13px/1.35 var(--f-body); color: var(--muted); margin-top: 4px; }
.odd .range span { display: block; }
.odd .range .ci { font: 400 12px/1.35 var(--f-mono); color: var(--faint); }
.odds-note { margin: 14px 0 0; font-size: 12px; line-height: 1.45; color: var(--faint); max-width: 54ch; }

.cta {
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 20px; border-radius: 999px;
  background: var(--cta); color: var(--cta-ink); font: 600 15px/1 var(--f-display); font-stretch: 105%;
}
.cta span { transition: transform .2s ease; }
.cta:hover span { transform: translateX(3px); }
.stamp { margin: 0; font: 400 12px/1.4 var(--f-mono); color: var(--faint); }

/* Map and histogram */
.map-wrap { position: relative; }
#hexmap { display: block; width: 100%; height: auto; overflow: visible; }
#hexmap .dist { cursor: pointer; transition: opacity .15s ease; }
#hexmap .dist polygon { stroke: currentColor; stroke-width: .06; }
#hexmap.hovering .dist { opacity: .4; }
#hexmap.hovering .dist.on { opacity: 1; }
#hexmap .dist.on polygon { stroke: var(--ink); stroke-width: .22; }
#hexmap .lines { pointer-events: none; fill: none; stroke-linecap: round; }
#hexmap .dline { stroke: var(--paper); stroke-width: .28; opacity: .9; }
#hexmap .sline { stroke: var(--paper); stroke-width: .5; }
.tip {
  position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 12px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px;
  padding: 7px 10px; font: 400 12px/1.4 var(--f-mono); white-space: nowrap; box-shadow: 0 6px 18px rgb(0 0 0 / .14);
}
.tip b { font-weight: 500; }
.tip .tm { color: var(--muted); }
.hist-wrap { margin-top: 14px; }
#hist { display: block; width: 100%; height: 64px; }
#hist .bar-d { fill: var(--d); }
#hist .bar-r { fill: var(--r); }
#hist .maj { stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.hist-axis { position: relative; height: 18px; font: 400 11px/1 var(--f-mono); color: var(--faint); }
.hist-axis span { position: absolute; top: 5px; transform: translateX(-50%); white-space: nowrap; }
.hist-axis .maj-label { color: var(--ink); }
figcaption {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px;
  font-size: 13px; line-height: 1.45; color: var(--muted);
}
.legend { display: inline-flex; align-items: center; gap: 6px; font: 400 11px/1 var(--f-mono); color: var(--faint); }
.ramp {
  width: 96px; height: 8px; border-radius: 2px;
  background: linear-gradient(90deg, #6f1b18, #9c2b26 5%, #c64a42 15%, #e58c82 30%, #f6d3ce 45%, #f3f1ec 50%, #d3e3f8 55%, #86b6ef 70%, #3a80d8 85%, #1f5aa8 95%, #143f7a);
}

/* Secondary projects: compact rows with small thumbnails */
.more {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px clamp(20px, 4vw, 48px);
  padding-block: 28px 8px; border-top: 1px solid var(--rule);
}
.more-h {
  grid-column: 1 / -1; margin: 0; font: 500 12px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.project { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; min-width: 0; }
.project img {
  display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 3 / 1; object-fit: cover;
  border-radius: 6px; background: var(--rule); transition: filter .3s ease;
}
.project-text { min-width: 0; }
.project h3 { display: flex; align-items: baseline; gap: 8px; margin: 0; font: 700 21px/1.15 var(--f-display); font-stretch: 105%; letter-spacing: -0.02em; }
.project p { margin: 6px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.go { font: 400 17px/1 var(--f-body); color: var(--muted); transition: transform .2s ease, color .2s ease; }
.project:hover .go, .project:focus-visible .go { transform: translate(3px, -3px); color: var(--ink); }
.project:hover img { filter: brightness(1.05) saturate(1.1); }

footer {
  display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: baseline;
  padding-block: 40px 36px; font-size: 13px; color: var(--muted);
}
footer a:hover { color: var(--ink); }
footer .fine { flex-basis: 100%; color: var(--faint); font-size: 12px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "fig" "cta"; grid-template-rows: auto; }
}
@media (max-width: 760px) {
  .more { grid-template-columns: minmax(0, 1fr); }
  .top nav { font-size: 13px; }
  .defn { max-width: 24ch; }
}
@media (max-width: 420px) {
  .odd { padding-right: 8px; }
  .odd + .odd { padding-left: 10px; }
  .odd .range { font-size: 12px; }
  .project h3 { font-size: 18px; }
  .project p { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse::after { animation: none; }
  .cta span, .go, #hexmap .dist, .project img { transition: none; }
}
