*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-body);
  overflow-x: hidden;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; }
h2 { font-size: clamp(2rem, 4.2vw, 3.25rem); font-weight: 700; line-height: 1.02; font-variation-settings: 'opsz' 96; }
h3 { font-size: 1.25rem; font-weight: 650; line-height: 1.2; }
p { margin: 0; }

/* Backdrop: soft light pools and topographic contours behind the glass */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 50vh at 12% 8%, var(--bg-glow-a), transparent 70%),
    radial-gradient(55vw 55vh at 92% 70%, var(--bg-glow-b), transparent 70%),
    var(--bg);
}
.contours { width: 100%; height: 100%; }
.contours path { fill: none; stroke: var(--contour); stroke-width: 1; }

/* Top bar */
.topbar {
  position: sticky; top: 12px; z-index: 20;
  margin: 12px auto 0; width: min(1200px, calc(100% - 32px));
  display: flex; align-items: center; gap: 20px;
  padding: 10px 12px 10px 18px; border-radius: 999px;
}
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1.05rem/1 var(--font-display); white-space: nowrap; }
.wordmark-mark { width: 26px; height: 26px; color: var(--redwood); }
.wordmark-mark circle { fill: var(--poppy); }
.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav a {
  text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 550; font-size: 0.95rem; white-space: nowrap;
  color: var(--ink-soft); transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.topnav a:hover { background: var(--glass-strong); color: var(--ink); }

/* Theme switch: one object moving, icons cross-fade inside the thumb */
.theme-toggle {
  flex: none; position: relative; width: 58px; height: 32px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--glass-rim); background: var(--fog-deep); padding: 0;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.theme-thumb {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--glass-strong); box-shadow: var(--glass-shadow);
  transition: transform var(--duration) var(--ease), background var(--duration) var(--ease);
}
.theme-thumb svg { position: absolute; inset: 4px; width: 16px; height: 16px; transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease); }
.icon-sun { fill: var(--poppy); stroke: var(--poppy); stroke-width: 1.6; }
.icon-moon { fill: var(--bay); opacity: 0; transform: rotate(-40deg) scale(0.6); }
:root[data-theme="dark"] .theme-thumb { transform: translateX(26px); }
:root[data-theme="dark"] .icon-sun { opacity: 0; transform: rotate(40deg) scale(0.6); }
:root[data-theme="dark"] .icon-moon { opacity: 1; transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-thumb { transform: translateX(26px); }
  :root:not([data-theme]) .icon-sun { opacity: 0; transform: rotate(40deg) scale(0.6); }
  :root:not([data-theme]) .icon-moon { opacity: 1; transform: none; }
}

/* Hero */
.hero {
  position: relative; width: min(1320px, 100%); margin: -64px auto 0;
  min-height: min(940px, 100vh); display: grid; align-items: end;
  padding: 120px 24px 48px;
}
.hero-map { position: absolute; inset: 40px 0 0 0; }
.hero-map {
  overflow: hidden;
  --fade-x: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
  --fade-y: linear-gradient(to bottom, transparent, #000 6%, #000 92%, transparent);
  -webkit-mask-image: var(--fade-x), var(--fade-y); -webkit-mask-composite: source-in;
  mask-image: var(--fade-x), var(--fade-y); mask-composite: intersect;
}
.hero-map svg { width: 100%; height: 100%; display: block; }
.hero-copy {
  position: relative; z-index: 2; max-width: 540px; padding: 36px 36px 28px;
}
.hero-title {
  font-size: clamp(3.4rem, 8.4vw, 7.6rem); font-weight: 780; line-height: 0.9; letter-spacing: -0.045em;
  font-variation-settings: 'opsz' 96;
  background: linear-gradient(170deg, var(--ink) 30%, var(--redwood) 115%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lede { margin-top: 20px; font-size: 1.2rem; line-height: 1.5; color: var(--ink-soft); max-width: 34ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.button {
  display: inline-flex; align-items: center; min-height: 46px; padding: 0 22px; border-radius: 999px;
  font-weight: 650; text-decoration: none; white-space: nowrap;
  transition: transform var(--duration) var(--ease), background var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.button-primary { background: var(--poppy); color: var(--on-poppy); box-shadow: 0 10px 24px -12px var(--poppy); }
.button-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -12px var(--poppy); }
.button-glass { background: var(--glass-strong); border: 1px solid var(--glass-rim); }
.button-glass:hover { background: var(--glass); }
.hero-facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 4px 28px; margin: 28px 0 0; padding-top: 20px; border-top: 1px solid var(--glass-rim); }
.hero-facts div { display: contents; }
.hero-facts dt { grid-row: 2; font-size: 0.85rem; color: var(--ink-soft); }
.hero-facts dd { grid-row: 1; margin: 0; font: 700 1.6rem/1.1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* Hero map layers */
.hm-context { fill: none; stroke: var(--map-county-line); stroke-width: 0.8; }
/* One orchestrated entrance: the boundary draws, then the communities settle in. */
.hm-member { stroke: var(--map-land); stroke-width: 0.9; opacity: 0.92; animation: hm-fade 700ms var(--ease) both; animation-delay: calc(1100ms + var(--i, 0) * 70ms); }
.hm-uninc { fill: url(#hatch); animation: hm-fade 900ms var(--ease) 900ms both; }
.hm-outline { fill: none; stroke: var(--map-outline); stroke-width: 2.2; stroke-linejoin: round; }
.hm-draw { stroke-dasharray: 1; animation: hm-draw 1800ms cubic-bezier(0.65, 0, 0.35, 1) both; }
.hm-label { font: 600 11.5px/1 var(--font-body); fill: var(--map-label); paint-order: stroke; stroke: var(--map-label-halo); stroke-width: 3.5px; stroke-linejoin: round; }
.hero-map .hm-label { animation: hm-fade 600ms var(--ease) 2000ms both; }
@keyframes hm-fade { from { opacity: 0; } }
@keyframes hm-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.hm-water-label { font: italic 500 14px/1 var(--font-body); fill: var(--bay); opacity: 0.85; letter-spacing: 0.08em; }

/* Sections */
.section { width: min(1200px, calc(100% - 32px)); margin: 0 auto; padding: 96px 0 0; }
.section-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px; align-items: end; margin-bottom: 32px; }
.section-head p { color: var(--ink-soft); max-width: 60ch; font-size: 1.08rem; }

.map-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 20px; }
.political { min-height: 560px; padding: 12px; overflow: hidden; }
.political svg { width: 100%; height: 100%; display: block; }
.roster { padding: 24px 24px 20px; display: flex; flex-direction: column; gap: 22px; }
.roster h3 { font-size: 1rem; color: var(--ink-soft); font-family: var(--font-body); font-weight: 600; letter-spacing: 0; margin-bottom: 8px; }
.roster-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.roster-list button {
  width: 100%; display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 10px;
  padding: 7px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink);
  font: inherit; font-size: 0.98rem; text-align: left; cursor: pointer;
  transition: background var(--duration) var(--ease);
}
.roster-list button:hover, .roster-list button[aria-pressed="true"] { background: var(--glass-strong); }
.swatch { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--glass-rim); }
.roster-pop { color: var(--ink-soft); font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.roster-note { font-size: 0.92rem; color: var(--ink-soft); margin-top: auto; }

/* Political map (home-page version) */
.pm-shape { stroke: var(--map-land); stroke-width: 0.8; cursor: pointer; transition: opacity var(--duration) var(--ease), filter var(--duration) var(--ease); }
.pm-dim .pm-shape:not(.is-active) { opacity: 0.35; }
.pm-shape.is-active { filter: saturate(1.25) brightness(1.04); }
.pm-card { pointer-events: none; }

/* Numbers */
.numbers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 8px; }
.number { padding: 22px 22px 20px; border-radius: var(--radius-md); }
.number + .number { box-shadow: -1px 0 0 var(--glass-rim); }
.number:nth-child(4n + 1) { box-shadow: none; }
.number:nth-child(n + 5) { border-top: 1px solid var(--glass-rim); border-radius: 0; }
.number-value { font: 720 clamp(1.9rem, 3.4vw, 2.7rem)/1.05 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.number-label { margin-top: 8px; font-weight: 600; }
.number-detail { margin-top: 4px; font-size: 0.88rem; color: var(--ink-soft); }
.number-detail a { color: var(--bay); }
.numbers-note { margin-top: 14px; font-size: 0.88rem; color: var(--ink-soft); max-width: 80ch; }
.skeleton-row { height: 120px; margin: 8px; border-radius: var(--radius-md); background: linear-gradient(90deg, var(--glass), var(--glass-strong), var(--glass)); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Why */
.why-body { display: grid; gap: 20px; }
.why-item { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 32px; padding: 30px 32px; }
.why-item h3 { font-size: clamp(1.3rem, 2.2vw, 1.65rem); }
.why-text { display: grid; gap: 14px; max-width: 68ch; }
.why-text p { line-height: 1.65; }
.why-sources { margin-top: 6px; font-size: 0.86rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.why-sources a { color: var(--bay); }
.why-closing { padding: 30px 32px; font: 600 clamp(1.2rem, 2vw, 1.5rem)/1.4 var(--font-display); letter-spacing: -0.01em; }

/* How: a real sequence, so numbered */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; counter-reset: step; }
.step { counter-increment: step; padding: 24px 24px 22px; }
.step::after {
  content: counter(step); position: absolute; top: 18px; right: 22px;
  font: 800 2.6rem/1 var(--font-display); color: var(--redwood); opacity: 0.28;
}
.step h3 { padding-right: 48px; }
.step p { margin-top: 10px; color: var(--ink-soft); font-size: 0.98rem; }
.step-cite { display: block; margin-top: 12px; font-size: 0.82rem; color: var(--bay); }
.precedents { margin-top: 20px; padding: 28px 32px; }
.precedents h3 { margin-bottom: 14px; }
.precedent-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 28px; }
.precedent-list strong { display: block; font-family: var(--font-display); font-size: 1.05rem; }
.precedent-list span { color: var(--ink-soft); font-size: 0.95rem; }

/* Explore */
.explore-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.explore-card { display: block; padding: 24px; text-decoration: none; transition: transform var(--duration) var(--ease), background var(--duration) var(--ease); }
.explore-card:hover { transform: translateY(-2px); background: var(--glass-strong); }
.explore-card p { margin-top: 8px; color: var(--ink-soft); font-size: 0.95rem; }

.footer { width: min(1200px, calc(100% - 32px)); margin: 96px auto 0; padding: 28px 0 48px; border-top: 1px solid var(--glass-rim); color: var(--ink-soft); font-size: 0.9rem; display: grid; gap: 6px; }

/* Hero stacks below 1100px: the map needs the full width */
@media (max-width: 1100px) {
  .hero { margin-top: 0; padding: 0 16px 24px; min-height: 0; display: block; }
  .hero-map { position: relative; inset: auto; height: min(62vh, 560px); min-height: 360px; margin: 8px -16px 0; }
  .hero-copy { margin: -64px auto 0; max-width: 640px; }
}

/* Tablet */
@media (max-width: 980px) {
  .topnav a { padding: 8px 10px; }
  .section-head, .why-item { grid-template-columns: 1fr; gap: 12px; }
  .map-layout { grid-template-columns: 1fr; }
  .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .number:nth-child(n) { box-shadow: none; border-top: 1px solid var(--glass-rim); border-radius: 0; }
  .number:nth-child(-n + 2) { border-top: 0; }
  .number:nth-child(even) { box-shadow: -1px 0 0 var(--glass-rim); }
  .explore-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .explore-card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .topnav { display: none; }
  .theme-toggle { margin-left: auto; }
  .hero-copy { padding: 26px 22px 22px; }
  .hero-facts dd { font-size: 1.3rem; }
  .hero-facts { gap: 4px 18px; }
  .section { padding-top: 72px; }
  .political { min-height: 420px; }
  .why-item, .why-closing, .precedents { padding: 24px 20px; }
  .explore-grid { grid-template-columns: 1fr; }
}
@media (max-width: 440px) {
  .numbers { grid-template-columns: 1fr; }
  .number:nth-child(n) { box-shadow: none; border-top: 1px solid var(--glass-rim); }
  .number:first-child { border-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
