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

/* ── VARIABLES ───────────────────────────────────────── */
:root {
  --navy:  #0D2340;
  --blue:  #1B4F8A;
  --sky:   #3D7CC9;
  --red:   #C0232C;
  --cream: #F5F0E8;
  --sand:  #E8DFD0;
  --ink:   #1A1A1A;
  --mist:  #8A9BB0;
  --white: #FFFFFF;
  --serif: 'Playfair Display', Georgia, serif;
  --sans:  'Source Sans 3', 'Helvetica Neue', sans-serif;
}

/* ── BASE ────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
html:has(body.map-page) { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
}
body.map-page { height: 100%; overflow-x: unset; }

/* ── HEADER ──────────────────────────────────────────── */
header {
  background: var(--navy);
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* index wraps header content in .header-inner */
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

/* precincts lays out directly on header */
.map-page header {
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── LOGO ────────────────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}
.logo svg { flex-shrink: 0; }
.logo-star { width: 32px; height: 32px; flex-shrink: 0; }
.logo-text {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}
.map-page .logo-text { font-size: 1rem; }
.logo-text span {
  color: #7EB3E8;
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--sans);
}
.map-page .logo-text span { font-size: 0.68rem; }

/* ── NAV (index) ─────────────────────────────────────── */
nav { display: flex; gap: 1.75rem; align-items: center; }
nav a {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #A8C4E0;
  text-decoration: none;
  transition: color 0.2s;
}
nav a:hover { color: var(--white); }
.nav-cta {
  background: var(--red);
  color: var(--white) !important;
  padding: 0.45rem 1rem;
  border-radius: 3px;
  transition: background 0.2s !important;
}
.nav-cta:hover { background: #a01d25 !important; }

/* ── BACK LINK (precincts) ───────────────────────────── */
.back-link {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: #A8C4E0;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.back-link:hover { color: var(--white); }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  background: var(--red);
  color: var(--white);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.85rem 2rem;
  border-radius: 3px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  border: none;
  cursor: pointer;
}
.btn-primary:hover { background: #a01d25; transform: translateY(-1px); }

.btn-ghost {
  display: inline-block;
  background: transparent;
  color: var(--white);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.85rem 2rem;
  border-radius: 3px;
  text-decoration: none;
  border: 1.5px solid rgba(255,255,255,0.35);
  transition: border-color 0.2s, transform 0.15s;
  cursor: pointer;
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.8); transform: translateY(-1px); }

/* ═══════════════════════════════════════════════════════
   INDEX PAGE
   ═══════════════════════════════════════════════════════ */

/* ── HERO ────────────────────────────────────────────── */
.hero {
  background: var(--navy);
  position: relative;
  overflow: hidden;
  padding: 5rem 2rem 4.5rem;
  text-align: center;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 20% 50%, rgba(27,79,138,0.55) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 40%, rgba(192,35,44,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 15% 20%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 72% 10%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 45% 35%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 88% 55%, rgba(255,255,255,0.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 70%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 80%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 5% 50%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 93% 25%, rgba(255,255,255,0.2) 0%, transparent 100%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 780px; margin: 0 auto; }
.hero-eyebrow {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #7EB3E8;
  border: 1px solid rgba(126,179,232,0.35);
  padding: 0.3rem 0.9rem;
  border-radius: 2px;
  margin-bottom: 1.5rem;
  animation: fadeUp 0.6s ease both;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 900;
  color: var(--white);
  line-height: 1.1;
  margin-bottom: 1.25rem;
  animation: fadeUp 0.6s 0.1s ease both;
}
.hero h1 em { font-style: normal; color: #7EB3E8; }
.hero p {
  font-size: 1.1rem;
  font-weight: 300;
  color: #A8C4E0;
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto 2.25rem;
  animation: fadeUp 0.6s 0.2s ease both;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeUp 0.6s 0.3s ease both;
}

/* ── MEETING BANNER ──────────────────────────────────── */
.meeting-band {
  background: var(--red);
  padding: 1rem 2rem;
  text-align: center;
}
.meeting-band p {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.04em;
}
.meeting-band strong { font-weight: 700; }

/* ── SECTIONS ────────────────────────────────────────── */
section { padding: 5rem 2rem; }
.section-inner { max-width: 1100px; margin: 0 auto; }

.section-label {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.6rem;
}
.section-title {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  margin-bottom: 1rem;
}
.section-body {
  font-size: 1.05rem;
  font-weight: 300;
  color: #3a3a3a;
  line-height: 1.75;
  max-width: 620px;
}

/* ── MEETINGS SECTION ────────────────────────────────── */
.meeting { background: var(--navy); }
.meeting .section-title { color: var(--white); }
.meeting .section-body { color: #A8C4E0; }
.meeting .section-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}
.meeting-card {
  background: var(--white);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.meeting-card-header {
  background: var(--blue);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.meeting-card-header svg { flex-shrink: 0; }
.meeting-card-header h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--white);
}
.meeting-card-body { padding: 1.75rem 2rem; }
.meeting-detail {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.meeting-detail:last-child { margin-bottom: 0; }
.detail-icon {
  width: 36px;
  height: 36px;
  background: var(--cream);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.detail-text strong {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mist);
  margin-bottom: 0.15rem;
}
.detail-text span {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
}
.detail-text a { font-size: 0.9rem; color: var(--sky); text-decoration: none; }
.detail-text a:hover { text-decoration: underline; }

/* ── VOTER RESOURCES ─────────────────────────────────── */
.resources { background: var(--sand); }
.resources .section-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 3rem;
}
.resources-intro { grid-column: 1 / -1; }
.resource-card {
  background: var(--white);
  border-radius: 6px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(13,35,64,0.07);
  border-top: 4px solid var(--blue);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.resource-card.red-top { border-top-color: var(--red); }
.resource-icon {
  width: 48px;
  height: 48px;
  background: var(--cream);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.resource-card h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
}
.resource-card p {
  font-size: 0.95rem;
  font-weight: 300;
  color: #555;
  line-height: 1.65;
  flex: 1;
}
.resource-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--blue);
  text-decoration: none;
  text-transform: uppercase;
  transition: gap 0.2s, color 0.2s;
}
.resource-link:hover { gap: 0.65rem; color: var(--navy); }
.resource-link svg { transition: transform 0.2s; }
.resource-link:hover svg { transform: translateX(3px); }

/* ── CONTACT ─────────────────────────────────────────── */
.contact { background: var(--navy); }
.contact .section-title { color: var(--white); }
.contact .section-body { color: #A8C4E0; margin-bottom: 2.5rem; }
.contact-grid {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 2.5rem;
}
.contact-item {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
  min-width: 220px;
}
.contact-item:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); }
.contact-icon {
  width: 44px;
  height: 44px;
  background: rgba(61,124,201,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.contact-info strong {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mist);
  margin-bottom: 0.2rem;
}
.contact-info span { font-size: 0.95rem; font-weight: 600; color: var(--white); }

/* ── FOOTER ──────────────────────────────────────────── */
footer {
  background: #08141F;
  border-top: 3px solid var(--red);
  padding: 2rem;
  text-align: center;
}
footer p { font-size: 0.8rem; color: #4a6070; line-height: 1.8; }
footer a { color: #4a6070; text-decoration: none; }
footer a:hover { color: #7EB3E8; }

/* ── DIVIDER ─────────────────────────────────────────── */
.rule { width: 48px; height: 3px; background: var(--red); margin: 1.25rem 0 1.5rem; }

/* ── ANIMATIONS ──────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── PRECINCT CTA (index) ────────────────────────────── */
.precinct-cta { background: var(--sand); }
.precinct-cta .section-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}
.precinct-map-preview {
  background: var(--white);
  border: 1px solid #D0D8E4;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(13,35,64,0.07);
}
.precinct-map-preview-header {
  background: var(--blue);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.precinct-map-preview-header span {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--white);
}
.precinct-map-preview-body { padding: 1.5rem; }
.precinct-map-preview-body p {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.65;
  margin-bottom: 1.25rem;
}
.precinct-steps { list-style: none; margin-bottom: 1.5rem; }
.precinct-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #555;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--sand);
}
.precinct-steps li:last-child { border-bottom: none; }
.step-num {
  background: var(--red);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── INDEX RESPONSIVE ────────────────────────────────── */
@media (max-width: 760px) {
  nav { display: none; }
  .get-involved .section-inner,
  .meeting .section-inner { grid-template-columns: 1fr; gap: 2rem; }
  .resources .section-inner { grid-template-columns: 1fr; }
  .resources-intro { grid-column: auto; }
  .contact-grid { flex-direction: column; }
  .contact-item { min-width: 0; }
  .precinct-cta .section-inner { grid-template-columns: 1fr; gap: 2rem; }
}

/* ═══════════════════════════════════════════════════════
   PRECINCTS PAGE
   ═══════════════════════════════════════════════════════ */

/* ── PAGE LAYOUT ─────────────────────────────────────── */
.page {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: calc(100vh - 60px);
}

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  background: var(--white);
  border-right: 1px solid var(--sand);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-head {
  background: var(--navy);
  padding: 1.5rem 1.5rem 1.25rem;
  flex-shrink: 0;
}
.sidebar-head h1 {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 0.4rem;
}
.sidebar-head p { font-size: 0.85rem; font-weight: 300; color: #A8C4E0; line-height: 1.5; }

.search-area {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--sand);
  flex-shrink: 0;
}
.search-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mist);
  margin-bottom: 0.5rem;
}
.search-row { display: flex; gap: 0.5rem; }
.search-input {
  flex: 1;
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid #D0D8E4;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
  color: var(--ink);
  background: var(--cream);
}
.search-input:focus { border-color: var(--sky); background: var(--white); }
.search-input::placeholder { color: #AAB5C4; }
.search-btn {
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 4px;
  padding: 0.6rem 1rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.search-btn:hover { background: var(--navy); }
.search-hint { font-size: 0.76rem; color: var(--mist); margin-top: 0.4rem; }

.result-panel { flex: 1; overflow-y: auto; padding: 1.25rem 1.5rem; }

.status-idle { text-align: center; padding: 2rem 1rem; }
.status-idle svg { opacity: 0.18; margin-bottom: 0.75rem; }
.status-idle p { font-size: 0.9rem; color: var(--mist); line-height: 1.6; }

.status-loading { text-align: center; padding: 2rem 1rem; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--sand);
  border-top-color: var(--sky);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-loading p { font-size: 0.9rem; color: var(--mist); }

.status-error {
  background: #FFF0F0;
  border: 1px solid #F5C6C6;
  border-radius: 6px;
  padding: 1rem;
  font-size: 0.88rem;
  color: var(--red);
  line-height: 1.5;
}

.precinct-card { background: var(--cream); border-radius: 6px; overflow: hidden; margin-bottom: 1rem; }
.precinct-card-top { background: var(--navy); padding: 1rem 1.25rem; }
.precinct-card-top .label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7EB3E8;
  margin-bottom: 0.3rem;
}
.precinct-card-top h2 {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--white);
}
.precinct-card-body { padding: 1rem 1.25rem; }
.precinct-card-body p { font-size: 0.88rem; color: #555; line-height: 1.6; margin-bottom: 0.85rem; }

.cta-btn {
  display: block;
  width: 100%;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.cta-btn:hover { background: #a01d25; transform: translateY(-1px); }

.precinct-list-head {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mist);
  margin-bottom: 0.6rem;
  padding-top: 0.25rem;
}
.precinct-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
  font-size: 0.88rem;
  color: var(--ink);
}
.precinct-list-item:hover { background: var(--cream); }
.precinct-list-item.active { background: #DDEEFF; font-weight: 700; color: var(--navy); }
.precinct-list-item .num {
  background: var(--navy);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 700;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.precinct-list-item.active .num { background: var(--red); }

/* ── MAP ─────────────────────────────────────────────── */
#map { width: 100%; height: 100%; position: relative; }
.leaflet-control-attribution { font-size: 10px; }

/* ── LEAFLET POPUP ───────────────────────────────────── */
.leaflet-popup-content-wrapper {
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.leaflet-popup-content { margin: 0; width: auto !important; }
.leaflet-popup-tip { display: none; }
.popup-inner { min-width: 220px; }
.popup-head { background: var(--navy); padding: 0.85rem 1rem; color: var(--white); }
.popup-head .sub {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7EB3E8;
  margin-bottom: 0.2rem;
}
.popup-head h3 { font-family: var(--serif); font-size: 1.05rem; font-weight: 700; }
.popup-body { padding: 0.85rem 1rem; }
.popup-body p { font-size: 0.82rem; color: #555; line-height: 1.5; margin-bottom: 0.75rem; }
.popup-cta {
  display: block;
  background: var(--red);
  color: var(--white) !important;
  text-align: center;
  padding: 0.6rem 0.85rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background 0.2s;
}
.popup-cta:hover { background: #a01d25; }

/* ── PRECINCTS RESPONSIVE ────────────────────────────── */
@media (max-width: 768px) {
  .page {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: calc(100vh - 60px);
  }
  .sidebar {
    height: auto;
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid var(--sand);
  }
  #map { height: 55vw; min-height: 300px; }
}
