:root {
  --bg: #b9c5bb;
  --paper: rgba(228, 235, 228, 0.78);
  --paper-strong: rgba(236, 241, 235, 0.86);
  --paper-deep: rgba(217, 226, 217, 0.9);
  --ink: #132523;
  --muted: #4d5f5b;
  --line: rgba(19, 37, 35, 0.14);
  --accent: #234942;
  --accent-soft: #bccfc5;
  --democrat: #4d775d;
  --republican: #8d6548;
  --mixed: #7a775f;
  --shadow: 0 24px 60px rgba(12, 24, 23, 0.18);
  --shadow-soft: 0 14px 34px rgba(12, 24, 23, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Sans 3", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(56, 87, 78, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(104, 84, 64, 0.12), transparent 24%),
    linear-gradient(180deg, #cdd7ce 0%, #bcc8be 48%, #b4c0b6 100%);
}

.page-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px 24px 34px;
  position: relative;
}

.page-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03));
  opacity: 0.18;
}

.hero,
.layout {
  display: grid;
  gap: 20px;
}

.hero h1,
.panel-heading h2,
.district-name {
  font-family: "Newsreader", serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 3.8vw, 3.2rem);
  line-height: 0.98;
  max-width: 18ch;
  text-wrap: balance;
}

.eyebrow,
.section-label,
.hero-label,
.district-type,
.donor-title {
  margin: 0 0 8px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede,
.county-summary,
.district-meta,
.official-role,
.donor-note {
  color: var(--muted);
}

.lede {
  margin: 0;
  max-width: 62ch;
  font-size: 1rem;
  line-height: 1.45;
}

.hero-card,
.map-panel,
.details-panel,
.district-card {
  background: var(--paper);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.info-panel {
  display: grid;
  gap: 20px;
  align-content: start;
}

.hero > div:first-child {
  position: relative;
  padding: 22px 24px 22px;
  border-radius: 24px;
  border: 1px solid rgba(22, 43, 40, 0.1);
  background:
    linear-gradient(145deg, rgba(236, 241, 235, 0.8), rgba(217, 226, 217, 0.72)),
    radial-gradient(circle at top right, rgba(72, 106, 121, 0.08), transparent 30%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero > div:first-child::after {
  content: "";
  position: absolute;
  inset: auto auto 0 0;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(40, 84, 77, 0.14), transparent 68%);
  transform: translate(-18%, 32%);
  pointer-events: none;
}

.hero-card {
  padding: 18px 20px 18px 24px;
  align-self: stretch;
  background:
    linear-gradient(180deg, rgba(237, 241, 235, 0.94), rgba(217, 225, 217, 0.92));
  position: relative;
  overflow: hidden;
}

.sources-card {
  align-self: start;
  box-shadow: var(--shadow-soft);
  margin-top: 22px;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: linear-gradient(180deg, rgba(40, 84, 77, 0.86), rgba(71, 105, 121, 0.7));
}

.hero-card ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
}

.layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}

.map-panel,
.details-panel {
  padding: 24px;
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(245, 248, 243, 0.95), rgba(232, 238, 232, 0.92));
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(22, 43, 40, 0.08);
}

.panel-heading h2,
.district-name {
  margin: 0;
  font-size: 1.75rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(247, 249, 246, 0.32);
}

.finder-panel {
  margin-bottom: 16px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(243, 247, 242, 0.97), rgba(230, 237, 231, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.finder-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.finder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(140px, 0.55fr);
  gap: 10px;
  margin-bottom: 10px;
}

.finder-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.finder-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(23, 33, 38, 0.16);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
}

.finder-input:focus {
  outline: 2px solid rgba(44, 94, 87, 0.18);
  border-color: rgba(44, 94, 87, 0.4);
}

.finder-button {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #356a62, #2b5952);
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(43, 89, 82, 0.18);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.finder-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(43, 89, 82, 0.22);
  filter: brightness(1.02);
}

.finder-button-secondary {
  color: var(--accent);
  background: rgba(44, 94, 87, 0.08);
  border: 1px solid rgba(44, 94, 87, 0.14);
  box-shadow: none;
}

.finder-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.finder-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.finder-note a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.finder-note a:hover {
  text-decoration: underline;
}

.address-suggestions {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(250, 252, 249, 0.98);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.address-suggestion {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(23, 33, 38, 0.08);
  padding: 12px 14px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.address-suggestion:last-child {
  border-bottom: 0;
}

.address-suggestion:hover,
.address-suggestion:focus-visible {
  background: rgba(13, 92, 99, 0.08);
}

.swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: -1px;
}

.swatch.democrat {
  background: var(--democrat);
}

.swatch.republican {
  background: var(--republican);
}

.swatch.mixed {
  background: var(--mixed);
}

.map-frame {
  min-height: 640px;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(85, 110, 88, 0.26), transparent 24%),
    radial-gradient(circle at 78% 18%, rgba(131, 103, 73, 0.24), transparent 24%),
    radial-gradient(circle at 48% 28%, rgba(206, 212, 197, 0.42), transparent 28%),
    linear-gradient(180deg, rgba(246, 249, 244, 0.18), rgba(255, 255, 255, 0.04)),
    linear-gradient(145deg, rgba(78, 98, 83, 0.16), rgba(117, 108, 86, 0.14));
  border: 1px solid rgba(25, 49, 45, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  position: relative;
}

.map-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.12), transparent 24%, transparent 56%, rgba(0, 0, 0, 0.08) 100%);
  pointer-events: none;
}

.map-frame svg {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
}

.terrain-shadow path {
  fill: rgba(22, 35, 24, 0.16);
  filter: blur(2px);
}

.terrain-layer {
  filter: drop-shadow(0 10px 14px rgba(13, 23, 22, 0.12));
}

.county-label {
  fill: rgba(243, 247, 241, 0.96);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(20, 32, 30, 0.68);
  stroke-width: 2.4px;
  stroke-linejoin: round;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(13, 23, 22, 0.2);
}

.county {
  stroke: rgba(244, 248, 243, 0.86);
  stroke-width: 1.2px;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill 140ms ease, opacity 140ms ease, transform 140ms ease;
  filter:
    saturate(0.98)
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.18))
    drop-shadow(0 3px 4px rgba(13, 24, 23, 0.16));
}

.county:hover,
.county:focus-visible {
  opacity: 0.94;
  stroke: rgba(19, 37, 35, 0.78);
  stroke-width: 1.9px;
}

.county.active {
  stroke: var(--ink);
  stroke-width: 2.3px;
  filter:
    saturate(1)
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.2))
    drop-shadow(0 5px 8px rgba(13, 24, 23, 0.22));
}

.district-list {
  display: grid;
  gap: 16px;
  overflow: visible;
}

.district-card {
  padding: 20px;
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(247, 249, 245, 0.94), rgba(233, 239, 233, 0.91));
}

.district-header,
.official-main {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.district-party,
.party-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.party-pill.democrat,
.district-party.democrat {
  background: rgba(34, 116, 165, 0.12);
  color: var(--democrat);
}

.party-pill.republican,
.district-party.republican {
  background: rgba(196, 69, 54, 0.12);
  color: var(--republican);
}

.party-pill.mixed,
.district-party.mixed {
  background: rgba(199, 168, 74, 0.16);
  color: #8a6b08;
}

.officials {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.official-card {
  position: relative;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(249, 251, 247, 0.84), rgba(236, 241, 236, 0.9));
  overflow: visible;
  z-index: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.official-layout {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.official-card:hover,
.official-card:focus-within {
  z-index: 20;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    0 18px 28px rgba(18, 35, 33, 0.08);
}

.official-photo-button {
  position: relative;
  display: block;
  width: 108px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.official-photo-button:hover .official-photo,
.official-photo-button:focus-visible .official-photo {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(23, 33, 38, 0.18);
}

.official-photo {
  display: block;
  width: 108px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(25, 49, 45, 0.08);
  box-shadow: 0 10px 22px rgba(25, 49, 45, 0.12);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.photo-badge {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  display: inline-flex;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(25, 49, 45, 0.82);
  color: #fff;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.official-name {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.official-name:hover {
  color: var(--accent);
}

.global-photo-popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999;
  width: 260px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(247, 250, 246, 0.98), rgba(233, 239, 234, 0.96));
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.global-photo-popover img {
  display: block;
  width: 100%;
  max-width: 148px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 8px;
}

.voting-link {
  display: inline-block;
  margin: 6px 0 10px;
}

.global-photo-popover .donor-list {
  max-height: 220px;
  overflow: auto;
  padding-right: 6px;
}

.photo-link,
.donor-list a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.photo-link:hover,
.donor-list a:hover {
  text-decoration: underline;
}

.donors-wrap {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.donor-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.donor-note {
  margin: 10px 0 0;
  font-size: 0.88rem;
}

.district-picker,
.exact-match-banner {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(244, 248, 243, 0.94), rgba(230, 237, 231, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.picker-intro,
.exact-match-banner {
  margin: 0;
  color: var(--muted);
}

.district-picker-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.district-picker-button {
  border: 1px solid rgba(23, 33, 38, 0.14);
  background: rgba(249, 252, 248, 0.96);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.district-picker-button:hover,
.district-picker-button.active {
  border-color: rgba(44, 94, 87, 0.32);
  background: rgba(44, 94, 87, 0.1);
  color: var(--accent);
}

.empty-state {
  padding: 28px 20px;
  border-radius: 20px;
  border: 1px dashed rgba(23, 33, 38, 0.18);
  color: var(--muted);
  background: rgba(248, 251, 247, 0.62);
}

.seo-panel {
  margin-top: 24px;
  display: grid;
  gap: 20px;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.seo-card,
.faq-card {
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(236, 241, 235, 0.92), rgba(223, 231, 223, 0.92));
  box-shadow: var(--shadow-soft);
}

.seo-card h2,
.faq-card h2,
.faq-item h3 {
  font-family: "Newsreader", serif;
  letter-spacing: -0.02em;
}

.seo-card h2,
.faq-card h2 {
  margin: 0 0 12px;
  font-size: 1.6rem;
}

.seo-card p,
.faq-item p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.seo-card p:last-child,
.faq-item p:last-child {
  margin-bottom: 0;
}

.faq-list {
  display: grid;
  gap: 14px;
}

.faq-item {
  padding: 18px 18px 16px;
  border-radius: 18px;
  background: rgba(250, 252, 249, 0.48);
  border: 1px solid rgba(19, 37, 35, 0.08);
}

.faq-item h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

@media (max-width: 1120px) {
  .hero,
  .layout,
  .seo-grid {
    grid-template-columns: 1fr;
  }

  .sources-card {
    margin-top: 20px;
  }

  .map-frame {
    min-height: 500px;
  }

  .county-label {
    font-size: 9px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 18px 14px 26px;
  }

  .panel-heading,
  .district-header,
  .official-main {
    flex-direction: column;
  }

  .map-panel,
  .details-panel,
  .seo-card,
  .faq-card {
    padding: 18px;
  }

  .official-layout {
    grid-template-columns: 1fr;
  }

  .official-photo-button,
  .official-photo {
    width: 124px;
  }

  .map-frame {
    min-height: 420px;
  }

  .county-label {
    font-size: 7px;
  }

  .finder-row {
    flex-direction: column;
  }

  .finder-grid {
    grid-template-columns: 1fr;
  }

  .global-photo-popover {
    position: static;
    width: 100%;
    margin-top: 10px;
  }
}
