/* Central Florida Values Voter Guide — America theme */
:root {
  --navy: #0a1f44;
  --navy-mid: #112a5c;
  --navy-light: #1a3a7a;
  --old-glory-blue: #002868;
  --old-glory-red: #bf0a30;
  --red: #bf0a30;
  --red-bright: #e01840;
  --red-soft: #fce8ec;
  --white: #ffffff;
  --star-white: #f8fafc;
  --cream: #f4f6fa;
  --cream-dark: #e2e8f0;
  --gold: #c9a227;
  --gold-bright: #f0d060;
  --gold-dim: #8a7020;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #cbd5e1;
  --success: #166534;
  --danger: #991b1b;
  --trump: #b91c1c;
  --musk: #0284c7;
  --r-party: #bf0a30;
  --d-party: #002868;
  --shadow: 0 4px 20px rgba(0, 40, 104, 0.12);
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Georgia", "Times New Roman", "Palatino Linotype", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--cream);
  /* Soft starfield + light stripe wash */
  background-image:
    radial-gradient(circle at 12% 8%, rgba(0, 40, 104, 0.06) 0 1px, transparent 2px),
    radial-gradient(circle at 48% 22%, rgba(191, 10, 48, 0.05) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 14%, rgba(0, 40, 104, 0.06) 0 1px, transparent 2px),
    linear-gradient(
      180deg,
      #ffffff 0%,
      #f8fafc 40%,
      #eef2f8 100%
    );
  background-size: 48px 48px, 64px 64px, 56px 56px, 100% 100%;
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

/* ── Patriotic stripe bar (top of page) ── */
body::before {
  content: "";
  display: block;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    var(--old-glory-red) 0 28px,
    var(--white) 28px 40px,
    var(--old-glory-blue) 40px 68px,
    var(--white) 68px 80px
  );
  position: sticky;
  top: 0;
  z-index: 110;
}

/* ── Header ── */
.site-header {
  background:
    linear-gradient(180deg, rgba(0, 40, 104, 0.15) 0%, transparent 100%),
    linear-gradient(135deg, #001a44 0%, var(--old-glory-blue) 45%, #0a2f6b 100%);
  color: var(--white);
  padding: 0;
  position: sticky;
  top: 6px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 20, 60, 0.35);
  border-bottom: 3px solid var(--old-glory-red);
}

/* Stars field on header */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 30%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1.5px 1.5px at 18% 55%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 28% 22%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 42% 70%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 55% 35%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 68% 18%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 78% 60%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1.5px 1.5px at 90% 40%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 95% 75%, rgba(255, 255, 255, 0.5), transparent);
  pointer-events: none;
  opacity: 0.9;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem 0.75rem;
  position: relative;
  z-index: 1;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #3b5b9a, var(--old-glory-blue) 70%);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  color: var(--star-white);
  border: 3px solid var(--old-glory-red);
  box-shadow:
    0 0 0 2px var(--white),
    0 2px 8px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  line-height: 1;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.brand .tagline {
  font-size: 0.78rem;
  opacity: 0.95;
  margin-top: 0.2rem;
  color: #fca5a5;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.election-badge {
  background: rgba(191, 10, 48, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: var(--white);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(191, 10, 48, 0.35);
}

.nav-tabs {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.9rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 0.15rem;
}

.nav-tab {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.78);
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: inherit;
}

.nav-tab:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
}

.nav-tab.active {
  color: #fff;
  border-bottom-color: var(--old-glory-red);
  background: rgba(191, 10, 48, 0.15);
}

/* ── Layout ── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Controls ── */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 3px solid var(--old-glory-red);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 140px;
  flex: 1;
}

.control-group label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--old-glory-blue);
}

.control-group select,
.control-group input[type="search"] {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  background: #f8fafc;
  color: var(--text);
  font-family: inherit;
}

.control-group select:focus,
.control-group input:focus {
  outline: 2px solid var(--old-glory-blue);
  outline-offset: 1px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}

.chip:hover {
  border-color: var(--old-glory-red);
}

.chip.active,
.chip:has(input:checked) {
  background: var(--old-glory-blue);
  color: var(--white);
  border-color: var(--old-glory-blue);
}

.chip input {
  accent-color: var(--old-glory-red);
}

/* ── Hero / intro ── */
.hero-card {
  background:
    linear-gradient(135deg, rgba(191, 10, 48, 0.12) 0%, transparent 40%),
    linear-gradient(135deg, #001a44 0%, var(--old-glory-blue) 50%, #123a7a 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Stripe accent on hero */
.hero-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: repeating-linear-gradient(
    180deg,
    var(--old-glory-red) 0 10px,
    var(--white) 10px 14px,
    var(--old-glory-red) 14px 24px
  );
}

.hero-card::after {
  content: "★★★";
  position: absolute;
  right: 1.25rem;
  top: 1rem;
  font-size: 0.95rem;
  letter-spacing: 0.25em;
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.hero-card h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin-bottom: 0.5rem;
  color: #fff;
  padding-left: 0.5rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.hero-card p {
  opacity: 0.95;
  max-width: 65ch;
  font-size: 0.95rem;
  padding-left: 0.5rem;
}

.priority-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-left: 0.5rem;
}

.priority-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.priority-pill span {
  color: #fca5a5;
  margin-right: 0.25rem;
  font-weight: 800;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  border-bottom: 3px solid var(--old-glory-blue);
}

.stat-card:nth-child(even) {
  border-bottom-color: var(--old-glory-red);
}

.stat-card .num {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--old-glory-blue);
  line-height: 1;
}

.stat-card .lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Race sections ── */
.race-block {
  margin-bottom: 1.75rem;
}

.race-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px double var(--old-glory-blue);
  position: relative;
}

.race-header h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--old-glory-blue);
}

.race-header h3::before {
  content: "★ ";
  color: var(--old-glory-red);
  font-size: 0.9em;
}

.race-header .race-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.race-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.9rem;
  /* Let card tooltips stack above later grid cells */
  isolation: auto;
  overflow: visible;
  position: relative;
  z-index: 0;
}

/* ── Candidate card ── */
.candidate-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
  position: relative;
  z-index: 1;
  border-left: 4px solid var(--old-glory-blue);
  /* Allow score tooltips to paint outside the card */
  overflow: visible;
}

.candidate-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 40, 104, 0.18);
  z-index: 5;
}

/* When an (i) tip is open, lift this card above neighbors */
.candidate-card.tip-open {
  z-index: 40;
}

.candidate-card.top-pick {
  border-color: var(--old-glory-red);
  border-left-width: 4px;
  border-width: 2px 2px 2px 4px;
  background: linear-gradient(180deg, #fff5f6 0%, var(--white) 45%);
  box-shadow: 0 4px 24px rgba(191, 10, 48, 0.15);
}

.top-pick-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  background: linear-gradient(90deg, var(--old-glory-red), #d4143a);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(191, 10, 48, 0.4);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.cand-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--old-glory-blue);
  line-height: 1.25;
}

.cand-status {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.party-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: white;
  flex-shrink: 0;
}

.party-badge.R {
  background: var(--r-party);
}
.party-badge.D {
  background: var(--d-party);
}
.party-badge.L,
.party-badge.NPA,
.party-badge.I {
  background: #555;
}

.score-ring-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.score-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--old-glory-blue);
  background: conic-gradient(var(--old-glory-red) calc(var(--pct) * 1%), var(--cream-dark) 0);
  position: relative;
  flex-shrink: 0;
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 6px;
  background: var(--white);
  border-radius: 50%;
}

.score-ring span {
  position: relative;
  z-index: 1;
}

.score-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.bar-row {
  display: grid;
  grid-template-columns: 7.25rem 1fr 1.75rem;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.7rem;
}

/* Label + value above the bar — ⓘ never sits on the colored fill */
.bar-row-stack {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  align-items: stretch;
}

.bar-row-stack .bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 1.1rem;
}

.bar-row .bl {
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  min-width: 0;
}

.bar-track {
  height: 8px;
  background: var(--cream-dark);
  border-radius: 999px;
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

.bar-row-stack .bv {
  font-weight: 700;
  color: var(--old-glory-blue);
  font-size: 0.72rem;
  text-align: right;
  flex-shrink: 0;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--navy);
}

.bar-fill.christian {
  background: linear-gradient(90deg, #5b21b6, #7c3aed);
}
.bar-fill.paleo {
  background: linear-gradient(90deg, #166534, #22c55e);
}
.bar-fill.republican {
  background: linear-gradient(90deg, #9f1239, var(--old-glory-red));
}

.bar-row .bv {
  font-weight: 700;
  text-align: right;
  color: var(--old-glory-blue);
}

.callout-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.callout {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.6rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.callout.trump {
  background: #fef2f2;
  color: var(--trump);
  border: 1px solid #fecaca;
}

.callout.musk {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.callout.desantis {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.callout.limited {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.callout.incumbent {
  background: #eff6ff;
  color: var(--old-glory-blue);
  border: 1px solid #bfdbfe;
}

.card-bio {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  font-size: 0.75rem;
  color: var(--old-glory-red);
  font-weight: 600;
  margin-top: auto;
}

/* ── Measure cards ── */
.measure-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--old-glory-red);
}

.measure-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--old-glory-blue);
  margin-bottom: 0.35rem;
}

.measure-type {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.rec-badge {
  display: inline-block;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.rec-badge.yes,
.rec-badge.lean-yes {
  background: #dcfce7;
  color: var(--success);
  border: 1px solid #86efac;
}

.rec-badge.no,
.rec-badge.lean-no {
  background: #fee2e2;
  color: var(--danger);
  border: 1px solid #fca5a5;
}

.measure-card p {
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.yn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0.75rem 0;
}

@media (max-width: 600px) {
  .yn-grid {
    grid-template-columns: 1fr;
  }
}

.yn-box {
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

.yn-box strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--old-glory-blue);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Policy tracker ── */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  border-left: 3px solid var(--old-glory-red);
}

.timeline-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 0.9rem;
  margin-left: 0.5rem;
  box-shadow: var(--shadow);
  position: relative;
}

.timeline-item::before {
  content: "★";
  position: absolute;
  left: -1.95rem;
  top: 1rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--old-glory-blue);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 2px var(--old-glory-red);
  color: var(--white);
  font-size: 0.55rem;
  display: grid;
  place-items: center;
  line-height: 1;
}

.timeline-date {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--old-glory-red);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-item h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--old-glory-blue);
  margin: 0.25rem 0 0.4rem;
}

.impact-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.impact-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--cream-dark);
  color: var(--text-muted);
}

.impact-tag.positive {
  background: #dcfce7;
  color: var(--success);
}
.impact-tag.lean-positive {
  background: #ecfdf5;
  color: #047857;
}
.impact-tag.neutral {
  background: #f3f4f6;
  color: #6b7280;
}

/* ── Methodology ── */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.method-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--old-glory-blue);
}

.method-card:nth-child(2) {
  border-top-color: var(--old-glory-red);
}

.method-card:nth-child(3) {
  border-top-color: var(--old-glory-blue);
}

.method-card h3 {
  font-family: var(--font-display);
  color: var(--old-glory-blue);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.weight-badge {
  background: var(--old-glory-red);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.method-card ol,
.method-card ul {
  margin: 0.6rem 0 0 1.1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.method-card li {
  margin-bottom: 0.3rem;
}

.disclaimer-box {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-left: 4px solid var(--old-glory-red);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  font-size: 0.88rem;
  margin: 1rem 0;
  color: #7c2d12;
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 26, 68, 0.6);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  position: relative;
  margin: auto 0;
  border-top: 4px solid var(--old-glory-red);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  background: #f1f5f9;
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--old-glory-blue);
}

.modal h2 {
  font-family: var(--font-display);
  color: var(--old-glory-blue);
  padding-right: 2rem;
  margin-bottom: 0.35rem;
}

.modal .section-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--old-glory-red);
  margin: 1rem 0 0.4rem;
}

.modal ul {
  margin-left: 1.1rem;
  font-size: 0.9rem;
}

.modal p {
  font-size: 0.92rem;
  color: var(--text);
}

/* ── Vote info ── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.info-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--old-glory-blue);
}

.info-card:nth-child(even) {
  border-top-color: var(--old-glory-red);
}

.info-card h3 {
  font-family: var(--font-display);
  color: var(--old-glory-blue);
  margin-bottom: 0.5rem;
}

.info-card a {
  color: var(--old-glory-blue);
  font-weight: 600;
}

.info-card ul {
  margin: 0.5rem 0 0 1.1rem;
  font-size: 0.9rem;
}

/* ── Footer ── */
.site-footer {
  background:
    linear-gradient(180deg, transparent, rgba(191, 10, 48, 0.15)),
    linear-gradient(135deg, #001a44 0%, var(--old-glory-blue) 100%);
  color: rgba(255, 255, 255, 0.8);
  padding: 1.75rem 1.25rem;
  text-align: center;
  font-size: 0.82rem;
  margin-top: 2rem;
  border-top: 4px solid var(--old-glory-red);
  position: relative;
}

.site-footer::before {
  content: "★★★★★";
  display: block;
  letter-spacing: 0.4em;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 0.65rem;
  font-size: 0.75rem;
}

.site-footer a {
  color: #fca5a5;
}

.site-footer .footer-inner {
  max-width: 800px;
  margin: 0 auto;
}

/* ── Empty ── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  background: var(--white);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

code {
  background: #f1f5f9;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--old-glory-blue);
}

/* ── Print ── */
@media print {
  body::before {
    display: none;
  }
  .site-header {
    position: static;
  }
  .nav-tabs,
  .controls,
  .modal-backdrop {
    display: none !important;
  }
  .panel {
    display: block !important;
  }
  .candidate-card {
    break-inside: avoid;
  }
}

/* ── Ask Grok panel ── */
.grok-panel {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 2px solid var(--old-glory-blue);
  background: linear-gradient(180deg, #f0f4fb 0%, #ffffff 100%);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--old-glory-blue);
}

.grok-panel .section-title {
  margin-top: 0;
  color: var(--old-glory-blue);
  font-size: 0.85rem;
}

.grok-intro {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0.65rem;
}

.grok-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.grok-chip {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: var(--old-glory-blue);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.grok-chip:hover {
  background: #dbeafe;
  border-color: var(--old-glory-blue);
}

.grok-log {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  min-height: 0;
}

.grok-log:empty {
  display: none;
}

.grok-msg {
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font-size: 0.88rem;
}

.grok-msg-user {
  background: var(--old-glory-blue);
  color: #fff;
  align-self: flex-end;
  max-width: 92%;
  margin-left: auto;
}

.grok-msg-assistant {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--old-glory-red);
  max-width: 100%;
}

.grok-msg-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.grok-msg-pending {
  opacity: 0.7;
  font-style: italic;
}

.grok-msg-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
  opacity: 0.85;
}

.grok-msg-user .grok-msg-label {
  color: #fca5a5;
}

.grok-msg-assistant .grok-msg-label {
  color: var(--old-glory-red);
}

.grok-msg-body p {
  margin: 0 0 0.35rem;
  line-height: 1.45;
  font-size: 0.88rem;
}

.grok-msg-body p:last-child {
  margin-bottom: 0;
}

.grok-msg-user .grok-msg-body p {
  color: #fff;
}

.grok-form {
  display: flex;
  gap: 0.5rem;
}

.grok-input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
}

.grok-input:focus {
  outline: 2px solid var(--old-glory-blue);
  outline-offset: 1px;
}

.grok-submit {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--old-glory-blue), #1a3a7a);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 40, 104, 0.25);
}

.grok-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #003080, var(--old-glory-blue));
}

.grok-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.grok-status {
  font-size: 0.75rem;
  margin-top: 0.45rem;
  min-height: 1.1em;
  color: var(--text-muted);
}

.grok-status.thinking {
  color: var(--old-glory-blue);
  font-weight: 600;
}

.grok-status.ok {
  color: #64748b;
}

/* Measure status badges */
.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  margin: 0 0.4rem 0.55rem 0;
}

.status-badge-certified {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.status-badge-not-on-ballot {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.status-badge-local {
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #93c5fd;
}

.measure-card.status-not-on-ballot {
  opacity: 0.95;
  border-left-color: #94a3b8;
}

.measure-card.status-local {
  border-left-color: var(--old-glory-blue);
}

.rec-badge.sample {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* ── ZIP bar ── */
.zip-bar {
  margin-bottom: 1rem;
}

.zip-bar-inner {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 4px solid var(--old-glory-red);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
}

.zip-bar-title {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.zip-bar-title strong {
  color: var(--old-glory-blue);
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.zip-bar-warn {
  font-size: 0.8rem;
  color: #9a3412;
  font-weight: 600;
  line-height: 1.4;
}

.zip-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.zip-form input {
  width: 8rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-family: inherit;
}

.zip-form input:focus {
  outline: 2px solid var(--old-glory-blue);
  outline-offset: 1px;
}

.zip-submit {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--old-glory-blue), #1a3a7a);
  color: #fff;
  cursor: pointer;
}

.zip-clear {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text-muted);
  cursor: pointer;
}

.zip-result {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.zip-result.zip-ok {
  background: #eff6ff;
  border: 1px solid #93c5fd;
}

.zip-result.zip-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.zip-ok-title {
  font-weight: 800;
  color: var(--old-glory-blue);
  margin-bottom: 0.35rem;
}

.zip-note,
.zip-disclaimer {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.zip-disclaimer {
  color: #9a3412;
  font-weight: 600;
}

.zip-soe-links {
  margin-top: 0.55rem;
  font-size: 0.88rem;
}

.zip-soe-links a {
  color: var(--old-glory-blue);
  font-weight: 700;
}

.zip-legend {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.race-scope {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  display: inline-block;
}

.race-scope-likely {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.race-scope-maybe {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.race-scope-district {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ── Footer expanded ── */
.site-footer .footer-brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}

.site-footer .footer-tag,
.site-footer .footer-motto {
  margin-top: 0.35rem;
  color: rgba(255, 255, 255, 0.85);
}

.site-footer .footer-motto {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin: 1.15rem 0 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.footer-nav a {
  color: #fca5a5;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
}

.footer-nav a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-legal,
.footer-links-official,
.footer-copy {
  margin-top: 0.65rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}

.footer-copy {
  margin-top: 1rem;
  opacity: 0.85;
}

/* ── Legal / static pages ── */
.legal-page .site-header {
  position: relative;
  top: 0;
}

.legal-main {
  max-width: 760px;
}

.legal-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem 2rem;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--old-glory-red);
}

.legal-card h2 {
  font-family: var(--font-display);
  color: var(--old-glory-blue);
  font-size: 1.65rem;
  margin-bottom: 0.35rem;
}

.legal-card h3 {
  font-family: var(--font-display);
  color: var(--old-glory-blue);
  font-size: 1.1rem;
  margin: 1.35rem 0 0.45rem;
}

.legal-card p,
.legal-card li {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 0.65rem;
}

.legal-card ul,
.legal-card ol {
  margin: 0.4rem 0 0.8rem 1.25rem;
}

.legal-card a {
  color: var(--old-glory-blue);
  font-weight: 600;
}

.legal-updated {
  font-size: 0.82rem !important;
  color: var(--text-muted) !important;
  margin-bottom: 1rem !important;
}

/* ── Score bar info (i) — floating tip on body ── */
.score-info-wrap {
  display: inline-flex;
  vertical-align: middle;
  flex-shrink: 0;
}

.score-info-btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--old-glory-blue);
  background: #eff6ff;
  color: var(--old-glory-blue);
  font-size: 0.62rem;
  font-weight: 800;
  font-style: italic;
  font-family: Georgia, serif;
  line-height: 1;
  padding: 0;
  cursor: help;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.score-info-btn:hover,
.score-info-btn[aria-expanded="true"] {
  background: var(--old-glory-blue);
  color: #fff;
}

/* Fixed to viewport — always above every candidate card */
.score-info-tip-fixed {
  position: fixed !important;
  z-index: 99999 !important;
  left: 0;
  top: 0;
  width: min(300px, calc(100vw - 16px));
  max-height: min(70vh, 420px);
  overflow-y: auto;
  background: #0b1f3a;
  color: #f8fafc;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-align: left;
  white-space: normal;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  pointer-events: auto;
}

.score-info-tip-title {
  font-weight: 800;
  font-size: 0.88rem;
  color: #fff;
  margin-bottom: 0.2rem;
}

.score-info-tip-max {
  font-size: 0.7rem;
  color: #fca5a5;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.score-info-tip-blurb {
  font-size: 0.78rem !important;
  line-height: 1.4;
  color: #e2e8f0 !important;
  margin: 0 0 0.45rem !important;
}

.score-info-tip-list {
  margin: 0 0 0.4rem 0.95rem;
  padding: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #cbd5e1;
}

.score-info-tip-list li {
  margin-bottom: 0.25rem;
}

.score-info-note {
  list-style: none;
  margin-left: -0.85rem;
  font-style: italic;
  color: #fde68a;
}

.score-info-tip-more {
  font-size: 0.68rem !important;
  color: #93c5fd !important;
  margin: 0.35rem 0 0 !important;
}

.modal-score-bars {
  margin: 0.65rem 0 0.25rem;
}
