:root {
  --measure: 680px;
  --ink: #1a1a1a;
  --muted: #666;
  --rule: #e3e3e3;
  --bg: #fcfbf9;
  --accent: #a50f15;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 22px; }

/* ---- hero ---- */
.hero {
  border-bottom: 1px solid var(--rule);
  padding: 12vh 0 7vh;
  background: linear-gradient(180deg, #fff, var(--bg));
}
.hero .wrap { max-width: 820px; }
.kicker {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 14px;
}
h1 {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1.04;
  margin: 0 0 18px;
  letter-spacing: -0.02em;
}
.dek {
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  color: #333;
  font-style: italic;
  margin: 0 0 22px;
  max-width: 30ch;
}
.byline {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

/* ---- prose ---- */
.prose { max-width: var(--measure); margin: 0 auto; padding: 0 22px; }
.prose p { margin: 0 0 1.15em; }
.prose h2 {
  font-size: clamp(1.7rem, 3.5vw, 2.3rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 1.7em 0 .5em;
}
.prose h3 {
  font-family: var(--sans);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 1.8em 0 .35em;
  padding-top: .9em;
  border-top: 1px solid var(--rule);
}
.dropcap::first-letter {
  font-size: 3.6em;
  float: left;
  line-height: .82;
  padding: 6px 10px 0 0;
  font-weight: 700;
}
.bloc-head { margin-top: 3.2em; }
.bloc-label {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 .2em;
}
.tk-note { color: var(--muted); font-style: italic; }

/* ---- map embeds ---- */
.map-embed { margin: 2.4em auto; padding: 0; }
.map-embed iframe {
  width: 100%;
  height: 78vh;
  min-height: 460px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 28px rgba(0,0,0,.07);
}
.map-embed figcaption {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  max-width: var(--measure);
  margin: .7em auto 0;
  padding: 0 22px;
}
/* wide breakout for maps */
.map-wide {
  width: min(1180px, 94vw);
  max-width: none;
}
/* ---- per-bloc parallax: sticky map + scroll-linked descriptions (desktop) ---- */
.bloc-parallax { position: relative; }
.subcluster {
  scroll-margin-top: 1.5em;
  border-radius: 6px;
  padding: 2px 12px;
  margin: 0 -12px;
  transition: background-color .5s ease, box-shadow .5s ease;
}
.subcluster.cc-active {
  background: rgba(165, 15, 21, 0.05);
  box-shadow: inset 3px 0 0 var(--accent);
}
@media (min-width: 761px) {
  /* Side-by-side: copy column (left) + sticky map column (right), so the map takes
     little vertical real estate and stays beside the descriptions as they scroll. */
  .bloc-parallax {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(500px, 50%, 720px);
    grid-template-rows: auto 1fr;
    gap: 0 34px;
    max-width: min(1360px, 97vw);
    margin: 3em auto 1.6em;
    align-items: start;
  }
  /* left column: bloc intro on top (row 1), subcluster descriptions below (row 2) */
  .bloc-parallax > .bloc-head { grid-column: 1; grid-row: 1; margin-top: 0; }
  .bloc-parallax > section.prose:not(.bloc-head) { grid-column: 1; grid-row: 2; max-width: none; margin: 0; padding: 0; }
  /* right column: sticky map spanning both rows, starting beside the bloc intro */
  .bloc-parallax > .map-embed {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
    position: sticky;
    top: 12px;
    z-index: 3;
    margin: 0;
    width: auto;
    max-width: none;
  }
  .bloc-parallax .map-embed iframe { height: 80vh; min-height: 0; }
  .bloc-parallax .map-embed figcaption { max-width: none; margin: .4em 0 0; padding: 0; font-size: 12px; }
  .bloc-parallax .subcluster { scroll-margin-top: 1.5em; }
}

.map-embed.is-fallback iframe { display: none; }
.map-fallback { display: none; }
.map-embed.is-fallback .map-fallback {
  display: block;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  font-family: var(--sans);
  background: #fff;
}
.map-fallback a { color: var(--accent); font-weight: 700; }

/* ---- projection slots ---- */
.projection-slot {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: #999;
  letter-spacing: .02em;
  border: 2px dashed #cdcdcd;
  border-radius: 8px;
  background: repeating-linear-gradient(45deg, #fafafa, #fafafa 10px, #f3f3f3 10px, #f3f3f3 20px);
  padding: 20px;
  margin: 1.2em 0 1.6em;
  text-align: center;
}
.projection-slot-lg { padding: 52px 20px; font-size: 15px; }

/* ---- filled projection card (generated by build_projections.py) ---- */
.projection {
  font-family: var(--sans);
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  background: #fcfcfc;
  padding: 14px 16px;
  margin: 1.2em 0 1.6em;
}
.projection-lg { padding: 20px 22px; }
.proj-head {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #777; margin-bottom: 10px; display: flex; justify-content: space-between; gap: 10px;
}
.proj-head .proj-scen { color: #aaa; font-weight: 600; text-transform: none; letter-spacing: 0; }
.proj-bars { list-style: none; margin: 0; padding: 0; }
.proj-bars li { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-size: 13px; }
.proj-name { flex: 0 0 64px; color: #333; font-weight: 600; }
.proj-track { flex: 1 1 auto; background: #efefef; border-radius: 3px; height: 16px; overflow: hidden; }
.proj-track i { display: block; height: 100%; border-radius: 3px; }
.proj-pct { flex: 0 0 40px; text-align: right; color: #555; font-variant-numeric: tabular-nums; }
.proj-bars li.win .proj-name { color: #111; }
.proj-bars li.win .proj-pct { color: #111; font-weight: 700; }
.proj-bars li.adv .proj-name::after { content: " ▸"; color: #111; }
.proj-foot { font-size: 11px; color: #888; margin-top: 9px; line-height: 1.4; }
.proj-turnout {
  font-size: 11px; color: #666; margin-top: 7px; padding-top: 7px;
  border-top: 1px solid #ededed; line-height: 1.4;
}
.proj-turnout b { color: #333; }

/* ---- in-article demographic bars (build_demographics.py) ---- */
.demographics { margin: .5em 0 1.2em; }
.demobars { font-family: var(--sans); }
.demo-sec { margin: 0 0 .7em; }
.demo-h {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #555; margin: 0 0 4px; padding-bottom: 2px; border-bottom: 1px solid var(--rule);
}
.demo-h .demo-sub { font-weight: 400; text-transform: none; letter-spacing: 0; color: #aaa; }
.demobar { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-size: 13px; }
.demobar-l { flex: 0 0 86px; color: #444; font-weight: 600; }
.demobar-t { flex: 1 1 auto; position: relative; background: #ececec; border-radius: 3px; height: 15px; }
.demobar-t i { display: block; height: 100%; border-radius: 3px; background: #5b8db8; }
/* city-average tick */
.demobar-t u { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #1a1a1a; }
.demobar-v { flex: 0 0 124px; text-align: right; color: #555; font-variant-numeric: tabular-nums; }
.demobar-cvap { color: #aaa; }
.demobar-inc { font-size: 12px; color: #555; margin-top: 6px; }
.demobar-inc span { color: #999; }
.demobar-key { font-size: 11px; color: #999; margin-top: 5px; }
.demobar-key u { display: inline-block; width: 2px; height: 10px; background: #1a1a1a; vertical-align: middle; }

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 4em;
  padding: 3em 0 5em;
  background: #fff;
}
.site-footer .wrap { max-width: var(--measure); }
.site-footer p { font-family: var(--sans); font-size: 13px; color: var(--muted); margin: 0; }

/* ---- responsive ---- */
@media (max-width: 760px) {
  body { font-size: 17px; }
  .map-embed iframe { height: 70vh; min-height: 380px; }
  .demobar { font-size: 12px; gap: 6px; }
  .demobar-l { flex: 0 0 70px; }
  .demobar-v { flex: 0 0 104px; }
}
