/* ============================================================
   Elections Site — Common Styles
   ============================================================ */

/* CSS Custom Properties */
/* ── Color & chip semantics (design-system pass, 2026-07-07) ─────────────
   ACCENTS
   - navy (--ms-navy): chrome, headings, links — never data.
   - party colors (--ms-dem-blue / --ms-rep-red + partyColor()): partisan data
     ONLY. Never decorate non-partisan UI with them.
   - brand gold (--ms-gold): editorial accents (kickers, pullquotes, election-
     card borders). darker gold (--ms-gold-num): "at stake" numbers (toss-ups,
     seats up, upcoming). Gold never means a party or a status.
   - status trio (green/blue/gold on the results map): reporting status only.
   CHIPS (one style per job — don't invent variants)
   - .party-badge     party identity square (D/R/I...)
   - .forecast-tag    race ratings (Solid/Likely/Lean/Tilt/Toss-up)
   - .ec-tag          race attributes (Open Seat, Uncontested, Incumbent Defeated)
   - .ev-chip         state-section summary chips on results pages
   - calendar type chips (PRIMARY/SPECIAL/...) live in calendar.html only.
   Maps encode held-vs-open by TEXTURE (MapRenderer patterns), not by a second
   lighter shade of the party hue. */
:root {
  --ms-navy: #043858;
  --ms-gold: #d0ac60;      /* brand gold (logomark): editorial accents — kickers, pullquotes, card borders */
  --ms-gold-num: #c59000;  /* darker gold: "at stake" numbers — toss-ups, seats up, upcoming events */
  --ms-pink: #e50963;
  --ms-dem-blue: #6cb3d2;
  --ms-rep-red: #e50963;
  --ms-purple: #8b567f;
  --ms-divided: #8b567f;
  --ms-tossup: #978f84;
  --ms-other: #978f84;
  --ms-vacant: #d9d9d9;
  --ms-bg: #ffffff;
  --ms-text: #043858;
  --ms-text-light: #666;
  --ms-border: #ddd;
  --ms-card-shadow: 0 2px 8px rgba(0,0,0,0.08);
  --ms-radius: 6px;
}

/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Work Sans', sans-serif;
  background: var(--ms-bg);
  color: var(--ms-text);
  line-height: 1.5;
}

/* Focus styles for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--ms-navy);
  outline-offset: 2px;
}
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
details summary:focus-visible {
  outline: 2px solid var(--ms-navy);
  outline-offset: 2px;
}

/* Skip-to-content link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--ms-navy);
  color: #fff;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  z-index: 10000;
  text-decoration: none;
  border-radius: 0 0 6px 0;
}
.skip-link:focus {
  top: 0;
}

/* Typography */
.heading-xl {
  font-family: 'Work Sans', sans-serif;
  font-weight: 800;
  font-size: 38px;
  color: var(--ms-navy);
  line-height: 1.1;
}
.heading-lg {
  font-family: 'Work Sans', sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--ms-navy);
  line-height: 1.2;
}
.heading-md {
  font-family: 'Work Sans', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--ms-navy);
  line-height: 1.3;
}
.heading-sm {
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--ms-navy);
  line-height: 1.4;
}
.body-text {
  font-family: 'Merriweather', serif;
  font-weight: 300;
  font-size: 14px;
  color: var(--ms-text-light);
  line-height: 1.6;
}
.separator { color: #9bb5c4; font-weight: 400; margin: 0 6px; }
.subtitle {
  font-size: 15px;
  font-weight: 400;
  color: var(--ms-text-light);
  margin-top: 4px;
}

/* Layout */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 40px 60px;
}
.section {
  margin-bottom: 48px;
}
.section-title {
  font-family: 'Work Sans', sans-serif;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ms-text-light);
  margin-bottom: 16px;
  border-bottom: 2px solid var(--ms-navy);
  padding-bottom: 6px;
}
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ms-navy);
}
.section-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ms-navy);
  margin: 0;
}
.section-header .section-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--ms-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* Party Badges */
.party-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 3px;
  color: white;
}
/* Chamber leadership badge. Tied to the CANDIDATE, not the race (Bill, 2026-09-02), so it
   travels with the person wherever they render -- including a contest they lost, where it is
   the most informative: "Phil Berger, President Pro Tem -- Lost". Deliberately quieter than
   .party-badge: party is the primary signal on a candidate row, leadership is context. */
.leader-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  padding: 2px 6px;
  margin-left: 5px;
  border-radius: 999px;
  background: #f2e7c9;
  color: #6b4c00;
  vertical-align: middle;
  white-space: nowrap;
}
.party-d { background: var(--ms-dem-blue); }
.party-r { background: var(--ms-rep-red); }
.party-i { background: var(--ms-purple); }
.party-g { background: #2e8b57; }
.party-np { background: #f5e6a3; color: #5a4e1a; }
.party-text-d { color: var(--ms-dem-blue); font-weight: 600; }
.party-text-r { color: var(--ms-rep-red); font-weight: 600; }

/* Cards */
.card {
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  padding: 20px;
  box-shadow: var(--ms-card-shadow);
  background: white;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* Forecast Tags */
.forecast-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 3px; }
.forecast-tossup { background: #fff3cd; color: #856404; }
.forecast-lean-d { background: #d1ecf1; color: #0c5460; }
.forecast-lean-r { background: #f8d7da; color: #721c24; }
.forecast-likely-d { background: #a8d8ea; color: #043858; }
.forecast-likely-r { background: #f5b7b1; color: #78281f; }
.forecast-solid-d { background: var(--ms-dem-blue); color: white; }
.forecast-solid-r { background: var(--ms-rep-red); color: white; }

/* Election Race Cards */
.election-card { border-left: 4px solid var(--ms-gold); }
.election-card .ec-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 6px; }
.election-card .ec-title { font-family: 'Work Sans', sans-serif; font-weight: 700; font-size: 15px; margin: 0; }
/* Linked card title looks identical to a plain (unlinked) title at rest;
   the dotted underline only appears on hover. */
.ec-title-link { color: inherit; text-decoration: none; border-bottom: none; }
.ec-title-link:hover { border-bottom: 1px dotted #ccc; }
.election-card .ec-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.election-card .ec-context { font-size: 12px; color: #666; margin-top: 6px; font-family: 'Work Sans', sans-serif; }
.election-card .ec-candidates { list-style: none; padding: 0; margin: 10px 0 0; }
.election-card .ec-candidates li { padding: 3px 0; font-size: 14px; display: flex; align-items: center; gap: 6px; font-family: 'Work Sans', sans-serif; }
.election-card .ec-candidates .incumbent-marker { font-size: 11px; font-style: italic; color: #999; }
.election-card .ec-note { font-size: 12px; font-style: italic; color: #666; margin-top: 8px; border-top: 1px solid #f0f0f0; padding-top: 6px; }
.ec-tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; }
.ec-tag-open { background: #fff3e0; color: #e65100; }
.ec-tag-unopposed { background: #eee; color: #666; }
.ec-tag-featured { background: #e8f5e9; color: #2e7d32; }
/* .ec-tag-matchup removed 2026-09-16 with the Incumbent Match-Up badge (see common.js) */

/* Stat Cards */
.stat-card {
  text-align: center;
  padding: 24px 16px;
}
.stat-number {
  font-family: 'Work Sans', sans-serif;
  font-weight: 800;
  font-size: 42px;
  color: var(--ms-navy);
  line-height: 1;
}
.stat-label {
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--ms-text-light);
  margin-top: 6px;
}

/* Navigation Cards */
.nav-card {
  display: block;
  padding: 20px;
  text-decoration: none;
  color: var(--ms-text);
  transition: transform 0.15s, box-shadow 0.15s;
}
.nav-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.nav-card-title {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 4px;
}
.nav-card-desc {
  font-size: 13px;
  color: var(--ms-text-light);
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ms-text-light);
  padding: 8px 12px;
  border-bottom: 2px solid var(--ms-navy);
}
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
}
.data-table tr:hover td {
  background: #f8f9fa;
}
.data-table .party-col {
  width: 40px;
  text-align: center;
}

/* Tooltip */
.tooltip {
  position: fixed;
  background: var(--ms-navy);
  color: white;
  padding: 12px 16px;
  border-radius: var(--ms-radius);
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 1000;
  max-width: 300px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.tooltip.visible { opacity: 1; }
.tooltip .tt-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.tt-party-d { color: #6cb3d2; }
.tt-party-r { color: #EA9999; }

/* Accordion (details/summary) */
details {
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  margin-bottom: 8px;
}
details summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: '\25B8';
  font-size: 12px;
  transition: transform 0.15s;
}
details[open] summary::before { transform: rotate(90deg); }
details .details-content {
  padding: 0 16px 16px;
}

/* Legacy Header (kept for pages not yet migrated) */
.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}
.site-header img {
  width: 40px;
  height: auto;
}
.site-header .site-title {
  font-weight: 800;
  font-size: 20px;
  color: var(--ms-navy);
  text-decoration: none;
}
.breadcrumb {
  font-size: 14px;
  color: var(--ms-text-light);
  margin-bottom: 8px;
}
.breadcrumb a {
  color: var(--ms-navy);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }

/* Legacy Footer (kept for pages not yet migrated) */
.site-footer {
  border-top: 1px solid var(--ms-border);
  padding-top: 24px;
  margin-top: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.site-footer img { width: 32px; height: auto; }
.site-footer .footer-text {
  font-size: 13px;
  color: var(--ms-text-light);
}

/* ============================================================
   Global Navigation System
   ============================================================ */

/* Corporate Utility Bar */
.utility-bar {
  background: var(--ms-navy);
  color: white;
  font-size: 12px;
  line-height: 1;
}
.utility-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.utility-brand {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.utility-brand:hover { color: white; }
.utility-links {
  display: flex;
  gap: 16px;
}
.utility-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: color 0.15s;
}
.utility-links a:hover { color: white; }

/* Main Elections Nav */
.nav-drawer-head { display: none; }

.elections-nav {
  background: white;
  border-bottom: 2px solid var(--ms-navy);
  position: sticky;
  top: 0;
  z-index: 900;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 56px;
}
.nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ms-navy);
  font-weight: 800;
  font-size: 18px;
  white-space: nowrap;
  margin-right: 24px;
  flex-shrink: 0;
}
.nav-brand img {
  width: 32px;
  height: auto;
}

/* Nav Items */
.nav-item {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ms-text-light);
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.nav-item:hover {
  color: var(--ms-navy);
  background: #f0f4f7;
}
.nav-item.active {
  color: var(--ms-navy);
  background: #e8eef3;
}
.nav-caret {
  font-size: 10px;
  margin-left: 3px;
  opacity: 0.6;
}

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border: none;
  background: none;
  cursor: pointer;
  margin-left: auto;
}
.nav-hamburger span {
  display: block;
  height: 2px;
  background: var(--ms-navy);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Dropdowns */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 200px;
  padding: 6px 0;
  z-index: 950;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}
.nav-dropdown:hover > .nav-dropdown-menu,
.nav-dropdown.open > .nav-dropdown-menu {
  display: block;
}
.nav-dropdown:hover > .nav-state-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px;
  min-width: 280px;
}
.nav-dropdown-menu a {
  display: block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ms-text);
  text-decoration: none;
  transition: background 0.1s;
}
.nav-dropdown-menu a:hover { background: #f0f4f7; }
.nav-dropdown-menu a.active { color: var(--ms-navy); font-weight: 700; }
.nav-dropdown-section {
  display: block;
  padding: 10px 16px 4px;
  font-family: 'Work Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--ms-text-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.nav-dropdown-section:first-child { padding-top: 4px; }
.nav-dropdown-divider {
  border-top: 1px solid var(--ms-border);
  margin: 6px 0;
}

/* State Picker Grid */
.nav-dropdown.open > .nav-state-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px;
  min-width: 280px;
}
.nav-state-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ms-navy);
  text-decoration: none;
  border-radius: 3px;
  transition: background 0.1s;
}
.nav-state-link:hover { background: #e8eef3; }

/* Topic Subnav (three-tab: Overview / 2026 / Trends) */
.topic-subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.topic-subnav a {
  display: inline-block;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ms-text-light);
  text-decoration: none;
  border: 1px solid var(--ms-border);
  border-radius: 20px;
  transition: all 0.15s;
}
.topic-subnav a:hover {
  border-color: var(--ms-navy);
  color: var(--ms-navy);
}
.topic-subnav a.active {
  background: var(--ms-navy);
  border-color: var(--ms-navy);
  color: white;
}

/* Global Footer */
.global-footer {
  border-top: 2px solid var(--ms-navy);
  margin-top: 48px;
  padding: 32px 0 24px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.footer-brand img { width: 36px; height: auto; }
.footer-title {
  font-weight: 800;
  font-size: 16px;
  color: var(--ms-navy);
}
.footer-subtitle {
  font-size: 12px;
  color: var(--ms-text-light);
}
.footer-links {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
}
.footer-links a {
  font-size: 13px;
  font-weight: 600;
  color: var(--ms-navy);
  text-decoration: none;
}
.footer-links a:hover { text-decoration: underline; }
.footer-attribution {
  font-size: 12px;
  color: var(--ms-text-light);
  margin-bottom: 8px;
}
.footer-cta {
  font-size: 13px;
  color: var(--ms-text-light);
}
.footer-cta a {
  color: var(--ms-navy);
  font-weight: 600;
  text-decoration: none;
}
.footer-cta a:hover { text-decoration: underline; }
.footer-feedback {
  font-size: 12px;
  color: var(--ms-text-light);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--ms-border);
}
.footer-feedback a {
  color: var(--ms-navy);
  font-weight: 600;
  text-decoration: none;
}
.footer-feedback a:hover { text-decoration: underline; }

/* Map download button — right-aligned below the map */
.map-download-btn {
  display: block;
  width: fit-content;
  margin: 10px 0 0 auto;
  padding: 7px 16px;
  background: #ffffff;
  border: 1.5px solid var(--ms-navy);
  border-radius: 4px;
  color: var(--ms-navy);
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  transition: background 0.15s, color 0.15s;
}
.map-download-btn:hover {
  background: var(--ms-navy);
  color: #ffffff;
}
body.embed .map-download-btn { display: none; }
.map-download-group {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.map-download-group .map-download-btn { margin: 10px 0 0 0; }
body.embed .map-download-group { display: none; }

/* Per-page feedback bar */
.feedback-bar {
  text-align: right;
  font-size: 12px;
  color: var(--ms-text-light);
  padding: 10px 0 4px;
  border-top: 1px solid var(--ms-border);
  margin-top: 32px;
}
.feedback-bar a {
  color: var(--ms-navy);
  font-weight: 600;
  text-decoration: none;
}
.feedback-bar a:hover { text-decoration: underline; }

/* ============================================================
   MapRenderer Component
   ============================================================ */
.map-renderer {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}
.map-renderer-title {
  font-family: 'Work Sans', sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: var(--ms-navy);
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.1;
}
.map-renderer-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin-top: 16px;
  margin-bottom: 0;
  justify-content: center;
}
.map-renderer-legend .legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.map-renderer-legend .legend-label {
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--ms-navy);
  white-space: nowrap;
}
.map-renderer-legend .legend-swatch {
  width: 26px;
  height: 26px;
  border-radius: 2px;
  flex-shrink: 0;
}
.map-renderer-svg {
  width: 100%;
  margin-top: -52px;
}
.map-renderer .us-map .state-group:hover .state-fill path {
  filter: brightness(0.85);
}
.map-renderer .us-map .state-label {
  font-family: 'Work Sans', sans-serif;
  font-weight: 800;
  font-size: 28px;
  fill: white;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.map-renderer-source {
  text-align: center;
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  color: var(--ms-text-light);
  margin-top: 8px;
}

/* Case Study Cards (101 pages) */
.case-study {
  background: white;
  border: 1px solid var(--ms-border);
  border-top: 3px solid var(--ms-navy);
  border-radius: 0 0 var(--ms-radius) var(--ms-radius);
  padding: 24px 28px 20px;
  margin: 32px 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.case-study-label {
  font-family: 'Work Sans', sans-serif;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ms-gold);
  margin-bottom: 6px;
}
.case-study-title {
  font-family: 'Work Sans', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--ms-navy);
  margin-bottom: 12px;
}
.case-study h3 {
  margin-top: 0;
  margin-bottom: 14px;
}
.case-study p:last-child { margin-bottom: 0; }

/* Chart/card header titles (used inside .card wrappers for charts) */
.chart-title {
  font-family: 'Work Sans', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--ms-navy);
  margin: 0 0 4px;
  line-height: 1.3;
}
.chart-subtitle {
  font-family: 'Work Sans', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--ms-text-light);
  margin: 0 0 16px;
  line-height: 1.5;
}

/* Office Overview Callout */
.office-overview {
  background: #f0f5f8;
  border-left: 4px solid var(--ms-navy);
  padding: 20px 24px;
  border-radius: 0 var(--ms-radius) var(--ms-radius) 0;
  margin: 0 0 32px;
}
.office-overview-title {
  font-family: 'Work Sans', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--ms-navy);
  margin-bottom: 10px;
}
.office-overview ul {
  margin: 0;
  padding-left: 20px;
}
.office-overview li {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ms-text);
  margin-bottom: 6px;
}
.office-overview li:last-child { margin-bottom: 0; }
/* Sub-bullets: a note's text can nest its own <ul><li> to break up a long
   bullet (e.g. per-district or per-office detail). Without this, the
   nested list's margin:0 leaves it running straight into the intro
   sentence above it. */
.office-overview li ul {
  margin-top: 8px;
}
.office-overview-updated {
  font-size: 12px;
  font-style: italic;
  color: var(--ms-text-light);
  margin-top: 10px;
}

/* Inline tags */
.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  background: #f0f0f0;
  color: var(--ms-text-light);
}
.tag-tossup { background: #d0ac60; color: white; }
.tag-lean-d { background: #6CB3D2; color: white; }
.tag-lean-r { background: #EA9999; color: white; }
.tag-likely-d { background: #498AA9; color: white; }
.tag-likely-r { background: #E86987; color: white; }
.tag-solid-d { background: #043858; color: white; }
.tag-solid-r { background: #e50963; color: white; }

/* Utility */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--ms-text-light); }
.text-sm { font-size: 13px; }

/* Reporting percentage (election night) */
.reporting-pct {
  display: block;
  font-size: 11px;
  color: var(--ms-text-light);
  font-style: italic;
}

/* Two-column layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

/* Responsive */
@media (max-width: 768px) {
  .page-container { padding: 20px 16px 40px; }
  .heading-xl { font-size: 28px; }
  .heading-lg { font-size: 22px; }
  .two-col { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .stat-number { font-size: 32px; }
  .site-header { flex-wrap: wrap; }

  /* Nav responsive */
  .utility-inner { padding: 6px 16px; }
  .utility-links { gap: 12px; }
  .nav-inner { padding: 0 16px; }
  .nav-hamburger { display: flex; }
  .nav-menu {
    display: none;
    /* Full-screen drawer with its own header row (close button) — never ends
       mid-page into content, never depends on the page chrome behind it. */
    position: fixed;
    inset: 0;
    background: white;
    flex-direction: column;
    align-items: stretch;
    overflow-y: auto;
    z-index: 950;
    -webkit-overflow-scrolling: touch;
  }
  .nav-menu.open { display: flex; }
  body.nav-drawer-open { overflow: hidden; }
  .nav-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 2px solid var(--ms-navy);
    position: sticky;
    top: 0;
    background: white;
  }
  .nav-drawer-title {
    font-family: 'Work Sans', sans-serif;
    font-weight: 800;
    font-size: 16px;
    color: var(--ms-navy);
  }
  .nav-drawer-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--ms-navy);
    cursor: pointer;
    padding: 6px 10px;
  }
  .nav-menu .nav-item,
  .nav-menu .nav-dropdown-btn {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
  }
  .nav-menu .nav-dropdown { width: 100%; }
  .nav-item { padding: 10px 24px; justify-content: flex-start; }
  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 24px;
    max-height: none;
    overflow-y: visible;
  }
  .nav-state-grid {
    min-width: auto;
    grid-template-columns: repeat(5, 1fr);
  }
  .footer-inner { padding: 0 16px; }
  .footer-links { flex-wrap: wrap; gap: 12px; }
}

@media (max-width: 480px) {
  .utility-links a:nth-child(n+3) { display: none; }
  .nav-brand span { font-size: 15px; }
}

/* ============================================================
   101 PAGES — Shared article/content styles
   ============================================================ */

/* Article body typography */
.article-body p {
  font-family: 'Merriweather', serif;
  font-weight: 300;
  font-size: 15px;
  line-height: 1.8;
  color: var(--ms-text);
  margin-bottom: 20px;
}
.article-body strong, .article-body b {
  font-weight: 900;
}
.article-body h2 {
  font-family: 'Work Sans', sans-serif;
  font-weight: 800;
  font-size: 26px;
  color: var(--ms-navy);
  margin-top: 48px;
  margin-bottom: 16px;
  line-height: 1.2;
}
.article-body h3 {
  font-family: 'Work Sans', sans-serif;
  font-weight: 700;
  font-size: 19px;
  color: var(--ms-navy);
  margin-top: 32px;
  margin-bottom: 12px;
  line-height: 1.3;
}
.article-body ul, .article-body ol {
  font-family: 'Merriweather', serif;
  font-weight: 300;
  font-size: 15px;
  line-height: 1.8;
  color: var(--ms-text);
  margin-bottom: 20px;
  padding-left: 24px;
}
.article-body li { margin-bottom: 8px; }
.article-body a {
  color: var(--ms-dem-blue);
  text-decoration: none;
  font-weight: 400;
}
.article-body a:hover { text-decoration: underline; }
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
}
.article-body th {
  background: var(--ms-navy);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
}
.article-body td {
  padding: 8px 14px;
  border-bottom: 1px solid #eee;
}
.article-body tr:hover td { background: #f8f9fa; }

/* Lead paragraph */
.lead {
  font-size: 17px !important;
  font-weight: 400 !important;
  color: var(--ms-text) !important;
  line-height: 1.7 !important;
  margin-bottom: 32px !important;
}

/* Topic subnav */
.subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.subnav a {
  display: inline-block;
  padding: 8px 18px;
  border: 2px solid var(--ms-border);
  border-radius: var(--ms-radius);
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  color: var(--ms-text-light);
  transition: all 0.15s;
}
.subnav a:hover { border-color: var(--ms-navy); color: var(--ms-navy); }
.subnav a.active { background: var(--ms-navy); border-color: var(--ms-navy); color: white; }

/* Stats grid (unified across all 101 pages) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

/* Table of contents (unified across all 101 pages) */
.toc {
  background: #f8f9fa;
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  padding: 20px 24px;
  margin: 24px 0 40px;
}
.toc-title {
  font-family: 'Work Sans', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--ms-navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.toc ol {
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
  padding-left: 20px;
  margin: 0;
}
.toc li { margin-bottom: 6px; line-height: 1.4; }
.toc a { color: var(--ms-dem-blue); text-decoration: none; font-weight: 600; }
.toc a:hover { text-decoration: underline; }

/* Callout box */
.callout {
  background: #f0f5f8;
  border-left: 4px solid var(--ms-navy);
  padding: 20px 24px;
  border-radius: 0 var(--ms-radius) var(--ms-radius) 0;
  margin: 28px 0;
}
.callout p {
  margin-bottom: 8px;
  font-size: 15px !important;
  font-weight: 400 !important;
}
.callout strong, .callout b {
  font-weight: 900 !important;
}
.callout p:last-child { margin-bottom: 0; }

/* Pullquote */
.pullquote {
  border-left: 4px solid var(--ms-gold);
  padding: 16px 24px;
  margin: 32px 0;
  background: #faf8f4;
  border-radius: 0 var(--ms-radius) var(--ms-radius) 0;
}
.pullquote p {
  font-style: italic !important;
  font-size: 16px !important;
  font-weight: 400 !important;
  line-height: 1.7 !important;
  margin-bottom: 8px !important;
}
.pullquote .attribution {
  font-family: 'Work Sans', sans-serif !important;
  font-style: normal !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  color: var(--ms-text-light) !important;
  margin-bottom: 0 !important;
}

/* Selection table */
.selection-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
}
.selection-table th {
  background: var(--ms-navy);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
}
.selection-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--ms-border);
  color: var(--ms-text);
}
.selection-table tr:nth-child(even) td { background: #f8f9fa; }
.selection-table .state-list { font-size: 13px; line-height: 1.6; }
/* 50-state data-table cell helpers (certification/recounts/off-cycle 101s) */
.selection-table .st { font-weight: 700; color: var(--ms-navy); white-space: nowrap; }
.selection-table .days, .selection-table .thr { font-weight: 700; white-space: nowrap; }
.selection-table .muted { color: var(--ms-text-light); }

/* Small note under a data table/chart (101 pages) */
.table-note {
  font-size: 12.5px;
  font-style: italic;
  color: var(--ms-text-light);
  line-height: 1.6;
  margin: 10px 0 26px;
}

/* Image placeholder */
.img-placeholder {
  background: #f4f6f8;
  border: 2px dashed var(--ms-border);
  border-radius: var(--ms-radius);
  padding: 40px 24px;
  margin: 32px 0;
  text-align: center;
}
.img-placeholder p {
  font-family: 'Work Sans', sans-serif !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  color: var(--ms-text-light) !important;
  margin-bottom: 4px !important;
}
.img-placeholder .img-caption {
  font-weight: 400 !important;
  font-size: 12px !important;
  color: #999 !important;
  margin-bottom: 0 !important;
}

/* Placeholder notice (for incomplete pages) */
.placeholder-notice {
  background: #fff8e1;
  border: 2px dashed #d0ac60;
  border-radius: var(--ms-radius);
  padding: 24px;
  margin: 32px 0;
  text-align: center;
}
.placeholder-notice p {
  font-family: 'Work Sans', sans-serif !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  color: #856404 !important;
  margin-bottom: 8px !important;
}
.placeholder-notice p:last-child { margin-bottom: 0 !important; }

/* MM source line */
.mm-source {
  font-family: 'Work Sans', sans-serif;
  font-size: 12px;
  color: var(--ms-text-light);
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--ms-border);
}
.mm-source a { color: var(--ms-dem-blue); text-decoration: none; }
.mm-source a:hover { text-decoration: underline; }

/* What's Next navigation */
.whats-next {
  display: flex;
  gap: 16px;
  margin-top: 32px;
}
.whats-next a {
  flex: 1;
  display: block;
  padding: 20px 24px;
  border: 2px solid var(--ms-border);
  border-radius: var(--ms-radius);
  text-decoration: none;
  transition: all 0.15s;
}
.whats-next a:hover {
  border-color: var(--ms-navy);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.whats-next .next-label {
  font-family: 'Work Sans', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--ms-navy);
  margin-bottom: 4px;
}
.whats-next .next-desc {
  font-family: 'Work Sans', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--ms-text-light);
}

/* Inline map components (101 pages) */
.inline-map-section { width: 100%; }
.inline-map-title {
  font-family: 'Work Sans', sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: var(--ms-navy);
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.1;
}
.inline-map-title .separator { color: #9bb5c4; font-weight: 400; margin: 0 6px; }
.inline-tab {
  padding: 8px 16px;
  border: 2px solid var(--ms-border);
  border-radius: var(--ms-radius);
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  background: white;
  color: var(--ms-text-light);
  transition: all 0.15s;
}
.inline-tab:hover { border-color: var(--ms-navy); color: var(--ms-navy); }
.inline-tab.active { background: var(--ms-navy); border-color: var(--ms-navy); color: white; }
.inline-map-wrapper { display: flex; flex-direction: column; }
.inline-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-bottom: 12px;
  justify-content: center;
}
.inline-map-main { margin-top: -30px; width: 100%; }
.inline-map-main svg { width: 100%; height: auto; display: block; }
.inline-legend-row { display: flex; align-items: center; gap: 8px; }
.inline-legend-swatch { width: 20px; height: 20px; border-radius: 2px; flex-shrink: 0; }
.inline-legend-label {
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--ms-navy);
  line-height: 1.3;
  white-space: nowrap;
}
.inline-map-source {
  font-family: 'Merriweather', serif;
  font-weight: 300;
  font-size: 12px;
  color: #666;
  margin-top: 8px;
}
.inline-tooltip {
  position: fixed;
  background: #043858;
  color: white;
  padding: 12px 16px;
  border-radius: 6px;
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 1000;
  max-width: 300px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.inline-tooltip.visible { opacity: 1; }
.inline-tt-state { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.inline-tt-type { font-weight: 400; opacity: 0.9; }

/* 101 pages responsive */
@media (max-width: 768px) {
  .article-body h2 { font-size: 22px; margin-top: 36px; }
  .lead { font-size: 15px !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .whats-next { flex-direction: column; }
  .inline-legend-label { font-size: 12px; }
  .selection-table { font-size: 12px; }
  .selection-table th, .selection-table td { padding: 6px 10px; }
}

/* Ballot measure cards — shared across year pages, state pages, and any other
   context that lists ballot measures. Keep in sync with buildBallotMeasureCard()
   in common.js. */
.measure-card {
  background: white;
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  transition: box-shadow 0.15s;
}
.measure-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.measure-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.measure-state {
  font-weight: 800;
  font-size: 14px;
  color: var(--ms-navy);
  text-decoration: none;
}
.measure-state:hover { text-decoration: underline; }
.measure-number {
  font-weight: 700;
  font-size: 14px;
  color: var(--ms-text);
}
.measure-result {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.result-passed { background: #d4edda; color: #155724; }
.result-failed { background: #f8d7da; color: #721c24; }
.result-pending { background: #fff3cd; color: #856404; }
.result-overturned { background: #fee2e2; color: #7f1d1d; border: 1px solid #ef4444; }
.result-other   { background: #e2e3e5; color: #383d41; }
.measure-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--ms-text-light);
  margin-left: auto;
  white-space: nowrap;
}
.measure-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--ms-text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.measure-title-link {
  color: var(--ms-text);
  text-decoration: none;
}
.measure-title-link:hover .measure-title { color: var(--ms-navy); }
.measure-desc {
  font-size: 13px;
  color: var(--ms-text-light);
  line-height: 1.5;
  margin-bottom: 8px;
}
.measure-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--ms-text-light);
}
.measure-meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta-label { font-weight: 600; }
.vote-bar-container {
  margin-top: 8px;
  margin-bottom: 4px;
}
.vote-bar {
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  background: #eee;
}
.vote-bar .yes-bar { background: #28a745; }
.vote-bar .no-bar  { background: #dc3545; }
/* The strong color follows the winning (or leading) side; the other side is tinted. */
.vote-bar--yes .no-bar  { background: #f5c6c0; }
.vote-bar--no  .yes-bar { background: #b7e1c1; }
.vote-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
}
.vote-bar-labels .yes-label { color: #28a745; }
.vote-bar-labels .no-label  { color: #dc3545; }

/* ── Primary results card (buildPrimaryResultCard) ─────────────────────── */
.primary-result-card { padding: 14px 16px; }
.prc-title { font-size: 15px; font-weight: 700; color: var(--ms-navy); margin: 0 0 2px; }
.prc-title a { color: inherit; text-decoration: none; font-weight: inherit; }
.prc-title a:hover { text-decoration: underline; }
.prc-meta { font-size: 12px; color: var(--ms-text-light); margin-bottom: 8px; }
.prc-contest { margin: 12px 0; }
.prc-contest:first-of-type { margin-top: 4px; }
.prc-contest-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.prc-contest-label { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ms-navy); }
.prc-tag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 3px; }
.prc-tag.counting { background: #ede7f6; color: #4527a0; border: 1px solid #b39ddb; }
.prc-tag.uncontested { background: #f5f5f5; color: #666; border: 1px solid #ddd; }
.prc-cand { margin: 5px 0; }
.prc-cand-line { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.prc-name { color: var(--ms-text); }
.prc-cand.won .prc-name, .prc-cand.won .prc-name a, .prc-cand.won .prc-figs { font-weight: 700; }
.prc-inc { color: #888; font-style: italic; font-size: 12px; }
.prc-figs { margin-left: auto; font-variant-numeric: tabular-nums; color: #555; font-size: 12px; white-space: nowrap; }
.prc-check { color: #2e7d32; font-weight: 700; }
.prc-runoff { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 3px; background: #f3e5f5; color: #6a1b9a; }
.prc-elim { font-size: 10px; color: #999; font-style: italic; }
.prc-rcv-sub { font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700;
  color: #8a8a8a; margin: 8px 0 3px; border-bottom: 1px solid #eee; padding-bottom: 2px; }
.prc-rcv-sub:first-of-type { margin-top: 4px; }
.prc-bar { height: 6px; background: #eef0f2; border-radius: 3px; margin-top: 3px; overflow: hidden; }
.prc-bar > span { display: block; height: 100%; border-radius: 3px; }
.prc-missing { font-size: 12px; color: #777; font-style: italic; margin-top: 8px; padding-top: 6px; border-top: 1px dashed #e5e7eb; }
.prc-empty { font-size: 13px; color: #777; font-style: italic; }
.prc-adv { margin-left: auto; font-size: 11px; color: #2e7d32; font-weight: 600; }
.prc-cand-line a, .prc-meta a { color: inherit; text-decoration: none; }
.prc-cand-line a:hover, .prc-meta a:hover { text-decoration: underline; }
.prc-tag.topn { background: #e8eef5; color: #1d3f6b; border: 1px solid #aebfd6; }
.prc-tag.incdef { background: #fce4ec; color: #c62828; border: 1px solid #f8bbd0; }
.prc-tag.flip.flip-d { background: #dbedf5; color: #0c4a6e; border: 1px solid #6cb3d2; }
.prc-tag.flip.flip-r { background: #fce7ef; color: #9f0f35; border: 1px solid #e50963; }
.prc-tag.flip.flip-o { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.prc-tag.close  { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.prc-tag.runoff { background: #fff3e0; color: #e65100; border: 1px dashed #ffb74d; }
.prc-tag.rcv    { background: #e8eaf6; color: #283593; border: 1px solid #c5cae9; }
.prc-tag.unofficial { background: #fffde7; color: #795548; border: 1px dashed #d7ccc8; }
/* Ranked-choice rounds table (collapsed by default) */
.prc-rcv { margin-top: 8px; border-top: 1px solid #eee; padding-top: 6px; }
.prc-rcv > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: #283593; list-style: none; }
.prc-rcv > summary::-webkit-details-marker { display: none; }
.prc-rcv > summary::before { content: '▸ '; color: #999; }
.prc-rcv[open] > summary::before { content: '▾ '; }
.rcv-scroll { overflow-x: auto; max-width: 100%; margin-top: 6px; -webkit-overflow-scrolling: touch; }
.rcv-table { border-collapse: collapse; font-size: 11.5px; width: max-content; min-width: 100%; }
.rcv-table th, .rcv-table td { padding: 4px 8px; text-align: right; border-bottom: 1px solid #f0f0f0; white-space: nowrap; }
.rcv-table th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px; color: #888; font-weight: 600; }
.rcv-table th:last-child { color: #283593; }
.rcv-table td.rcv-name, .rcv-table th:first-child { text-align: left; }
.rcv-table td.rcv-name a { color: inherit; }
.rcv-table .rcv-v { display: block; font-size: 10px; color: #999; font-variant-numeric: tabular-nums; }
.rcv-table td { font-variant-numeric: tabular-nums; }
.rcv-table .rcv-elim { color: #ccc; }
.rcv-table tr.rcv-won { background: #f1f8f3; }
.rcv-table tr.rcv-won td.rcv-name { font-weight: 700; }
.rcv-table tr.rcv-exh { color: #aaa; font-style: italic; }
.rcv-table tr.rcv-exh td { border-top: 1px solid #e8e8e8; }

/* ── Mobile safety: wide tables scroll inside their own container ────────
   (election-night traffic is phone traffic; a wide results table must never
   make the page itself scroll horizontally) */
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 768px) {
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 6px 8px; }
  .phase-toggle { flex-wrap: wrap; }
  .phase-tab { padding: 7px 14px; font-size: 13px; }
}

/* ── Fat footer: section links so no page is a dead end ────────────────── */
.footer-sections {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 24px 32px;
  margin: 20px 0 24px;
  padding: 20px 0;
  border-top: 1px solid var(--ms-border, #e2e2e2);
  border-bottom: 1px solid var(--ms-border, #e2e2e2);
}
.footer-col { display: flex; flex-direction: column; gap: 7px; }
.footer-col-title {
  font-family: 'Work Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ms-text-light, #888);
  margin-bottom: 3px;
}
.footer-col a {
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  text-decoration: none;
  color: var(--ms-navy, #043858);
}
.footer-col a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .footer-sections { grid-template-columns: repeat(2, 1fr); }
}


/* ── Skeleton loading states (design-system pass) ──────────────────────── */
.skeleton-block {
  border-radius: var(--ms-radius);
  background: linear-gradient(90deg, #eef1f4 25%, #f7f9fa 50%, #eef1f4 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-block { animation: none; }
}

/* ── Explainer (-101) enhancements: TOC pills + numbered section anchors ── */
.page-toc {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin: 14px 0 6px;
}
.page-toc-label {
  font-family: 'Work Sans', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ms-text-light, #888);
  margin-right: 4px;
}
.page-toc a {
  font-family: 'Work Sans', sans-serif;
  font-size: 12px; font-weight: 600;
  color: var(--ms-navy); background: #eef1f4;
  border-radius: 999px; padding: 5px 12px; text-decoration: none;
}
.page-toc a:hover { background: #e2e8ee; }
.sec-anchor {
  display: flex; align-items: center; gap: 10px;
  margin: 40px 0 -18px;
}
.sec-anchor-num {
  font-family: 'Work Sans', sans-serif;
  font-weight: 800; font-size: 13px; color: var(--ms-gold);
}
.sec-anchor-rule {
  flex: 1; height: 1px;
  background: linear-gradient(to right, var(--ms-gold) 0, var(--ms-gold) 48px, #e8e8e8 48px);
}
h2[id] { scroll-margin-top: 76px; }

/* ── Nav search box (Model B nav restructure, 2026-07-08) ──────────────── */
.nav-search { margin-left: 8px; display: flex; align-items: center; }
.nav-search input {
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  padding: 7px 12px;
  border: 1px solid #d8dee4;
  border-radius: 999px;
  width: 170px;
  background: #f7f9fa;
  transition: width 0.15s, background 0.15s;
}
.nav-search input:focus {
  outline: 2px solid var(--ms-navy);
  outline-offset: -1px;
  background: white;
  width: 210px;
}
@media (max-width: 1400px) and (min-width: 769px) {
  .nav-search input { width: 118px; }
  .nav-search input:focus { width: 150px; }
}
@media (max-width: 768px) {
  .nav-search { margin: 8px 16px 16px; }
  .nav-search input { width: 100%; }
}

/* ── Back-to-top button (site-wide, injected by nav.js) ────────────────── */
#back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--ms-navy);
  color: white;
  font-size: 19px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 900;
}
#back-to-top.visible { opacity: 0.88; pointer-events: auto; transform: none; }
#back-to-top:hover { opacity: 1; }
@media print { #back-to-top { display: none; } }

/* ── Concept auto-links to explainers (js/explainer_links.js) ──────────── */
a.concept-link {
  color: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  text-decoration-color: #9bb5c4;
}
a.concept-link:hover {
  color: var(--ms-dem-blue);
  text-decoration-style: solid;
}

/* ── Election-card expander ───────────────────────────────────────────────────
   A table row that opens into a full election card, so a summary table can hand
   off to the real card component instead of re-describing a race in columns.

   Promoted here 2026-09-23 from BYTE-IDENTICAL copies in ai-candidates.html and
   maha-candidates.html (both since removed) when the utility-regulator explainer
   became the third user. Three copies is where a rule quietly starts to drift.

   Markup contract — see the handler in any of those pages:
     <button class="expand-btn" data-seat="{stable id}">View race</button>
   and on click insert  <tr class="card-row"><td colspan=N>{buildElectionCard()}</td></tr>
   ⛔ data-seat must be a UNIQUE key. seat_label is NOT unique: every seat on a
   multi-member body shares one (both Alabama PSC races are "AL Public Service
   Commissioner"). Key on seat_id. */
.expand-btn {
  background: #eef4f8; color: var(--ms-navy); border: 1px solid var(--ms-border); cursor: pointer;
  font-family: 'Work Sans', sans-serif; font-weight: 700; font-size: 12px; padding: 4px 12px; border-radius: 6px;
}
.expand-btn:hover { background: #dfeaf2; }
tr.card-row > td { background: #f7fafc; padding: 14px 16px 6px; }

/* Horizontal scroll container for wide tables (house rule: the page body never
   scrolls sideways, the table does). */
.tbl-wrap { overflow-x: auto; }

/* Secondary line inside a table cell — a seat's office under its state name. */
td .sub { color: #7d8f9c; font-size: 12.5px; }
