:root {
  color-scheme: light;
  --navy: #102a43;
  --blue: #1e3a8a;
  --blue-2: #274aa5;
  --teal: #0f766e;
  --gold: #f59e0b;
  --gold-dark: #b8860b;
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2ff;
  --shadow: 0 18px 50px rgba(15, 23, 42, .09);
  --radius: 18px;
  --header-h: 72px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --navy: #dbeafe;
  --blue: #7aa2ff;
  --blue-2: #9bb8ff;
  --teal: #5eead4;
  --gold: #fbbf24;
  --gold-dark: #fcd34d;
  --ink: #f8fafc;
  --text: #cbd5e1;
  --muted: #94a3b8;
  --line: #27364a;
  --surface: #101a29;
  --surface-2: #0b1420;
  --surface-3: #172554;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface-2);
  color: var(--text);
  font-family: "Source Sans Pro", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
body.dialog-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid rgba(245, 158, 11, .55); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; left: 16px; top: -80px; padding: 10px 16px; border-radius: 8px; background: var(--gold); color: #111827; font-weight: 800; text-decoration: none; transition: top .2s; }
.skip-link:focus { top: 12px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1200px) / 2));
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid rgba(226, 232, 240, .88);
  backdrop-filter: blur(14px);
}
[data-theme="dark"] .site-header { background: rgba(16, 26, 41, .94); border-color: var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #102a43; text-decoration: none; }
[data-theme="dark"] .brand { color: #f8fafc; }
.brand-mark { width: 36px; height: 42px; display: grid; place-items: center; color: white; background: var(--blue); clip-path: polygon(50% 0, 94% 16%, 85% 72%, 50% 100%, 15% 72%, 6% 16%); }
.brand-mark span { font-weight: 900; font-size: 19px; transform: translateY(-1px); }
.brand-copy { display: grid; line-height: 1; letter-spacing: .02em; }
.brand-copy strong { font-family: Montserrat, ui-sans-serif, system-ui, sans-serif; font-size: 14px; letter-spacing: .055em; }
.brand-copy small { margin-top: 4px; color: var(--gold-dark); font-size: 10px; font-weight: 900; letter-spacing: .34em; }
.header-meta { display: flex; align-items: center; gap: 12px; }
.private-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: 12px; font-weight: 800; }
.private-dot, .verified-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(15, 118, 110, .12); }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.icon-button:hover { transform: translateY(-1px); border-color: var(--blue); }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }

.hero { position: relative; overflow: hidden; padding: 70px max(24px, calc((100vw - 1200px) / 2)) 40px; background: var(--surface); }
.hero::before { content: ""; position: absolute; width: 520px; height: 520px; right: -210px; top: -270px; border: 110px solid rgba(30, 58, 138, .055); border-radius: 50%; }
.hero::after { content: ""; position: absolute; width: 170px; height: 170px; right: 10%; top: 70px; background-image: radial-gradient(rgba(245, 158, 11, .36) 1.5px, transparent 1.5px); background-size: 16px 16px; opacity: .55; }
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(360px, .7fr); gap: 72px; align-items: end; }
.eyebrow { margin: 0 0 10px; color: var(--gold-dark); font-size: 12px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; color: var(--ink); font-family: Montserrat, ui-sans-serif, system-ui, sans-serif; line-height: 1.12; }
h1 { max-width: 850px; font-size: clamp(2.55rem, 5.6vw, 5.15rem); letter-spacing: -.05em; }
h1 span { color: var(--blue); }
.hero-lede { max-width: 730px; margin: 24px 0 0; color: var(--text); font-size: clamp(1.04rem, 1.7vw, 1.2rem); }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(248, 250, 252, .74); box-shadow: 0 12px 35px rgba(15, 23, 42, .05); overflow: hidden; }
[data-theme="dark"] .hero-stats { background: rgba(11, 20, 32, .78); }
.hero-stats div { padding: 22px 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hero-stats div:nth-child(2n) { border-right: 0; }
.hero-stats div:nth-child(n+3) { border-bottom: 0; }
.hero-stats strong { display: block; color: var(--ink); font-family: Montserrat, sans-serif; font-size: 28px; line-height: 1; }
.hero-stats span { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.search-shell { position: relative; z-index: 2; max-width: 1020px; margin-top: 48px; display: grid; grid-template-columns: minmax(0, 1fr) 220px auto; gap: 0; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.search-field { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0 14px; }
.search-field svg { width: 21px; flex: 0 0 auto; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.search-field input { min-width: 0; width: 100%; height: 48px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 17px; }
.search-field input::placeholder { color: #94a3b8; }
.search-field kbd { padding: 2px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; color: var(--muted); background: var(--surface-2); font-size: 12px; }
.county-field { display: flex; align-items: center; border-left: 1px solid var(--line); }
.county-field select { width: 100%; height: 48px; padding: 0 36px 0 16px; border: 0; outline: 0; color: var(--text); background: var(--surface); font-weight: 700; cursor: pointer; }
.search-button, .compare-open { min-width: 108px; border: 0; border-radius: 11px; background: var(--blue); color: white; font-weight: 800; cursor: pointer; transition: background .18s, transform .18s; }
.search-button:hover, .compare-open:hover:not(:disabled) { background: var(--blue-2); transform: translateY(-1px); }
.data-note { position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; margin: 17px 0 0 10px; color: var(--muted); font-size: 12px; }

.explorer { width: min(1200px, calc(100% - 48px)); margin: 0 auto; padding: 54px 0 110px; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(390px, .88fr); gap: 34px; align-items: start; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { font-size: clamp(1.85rem, 3vw, 2.4rem); letter-spacing: -.035em; }
.section-heading > p { margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.quick-filters { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 16px; scrollbar-width: none; }
.quick-filters::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 800; cursor: pointer; }
.filter-chip:hover, .filter-chip.is-active { border-color: var(--blue); color: var(--blue); background: var(--surface-3); }
.results-list { display: grid; gap: 10px; }
.result-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); overflow: hidden; transition: border-color .18s, box-shadow .18s, transform .18s; }
.result-card:hover { border-color: rgba(30, 58, 138, .42); box-shadow: 0 10px 28px rgba(15, 23, 42, .07); transform: translateY(-1px); }
.result-card.is-active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(30, 58, 138, .08); }
.card-main { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 13px; min-width: 0; padding: 18px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.card-index { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--blue); background: var(--surface-3); font-size: 12px; font-weight: 900; }
.card-copy { min-width: 0; display: grid; }
.card-kicker { display: flex; align-items: center; gap: 7px; color: var(--gold-dark); font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.profile-pill { display: inline-flex; padding: 2px 6px; border-radius: 5px; background: rgba(15, 118, 110, .1); color: var(--teal); letter-spacing: .04em; }
.card-name { margin-top: 2px; overflow: hidden; color: var(--ink); font-family: Montserrat, sans-serif; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.card-stats { margin-top: 4px; color: var(--muted); font-size: 12px; }
.card-arrow { color: var(--muted); font-size: 20px; transition: transform .18s, color .18s; }
.card-main:hover .card-arrow { color: var(--blue); transform: translateX(3px); }
.compare-add { min-width: 96px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0 14px; border: 0; border-left: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 800; cursor: pointer; }
.compare-add:hover { color: var(--blue); }
.compare-add.is-selected { color: var(--teal); background: rgba(15, 118, 110, .08); }
.load-more { width: 100%; margin-top: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--blue); background: var(--surface); font-weight: 800; cursor: pointer; }
.load-more:hover { border-color: var(--blue); }
.empty-state { padding: 50px 24px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); text-align: center; }
.empty-state > span { display: block; color: var(--muted); font-size: 44px; }
.empty-state h3 { margin-top: 8px; font-size: 19px; }
.empty-state p { margin: 7px 0 16px; color: var(--muted); }
.text-button { border: 0; background: none; color: var(--blue); font-weight: 800; cursor: pointer; }

.detail-panel { position: sticky; top: calc(var(--header-h) + 24px); min-height: 610px; max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); scrollbar-width: thin; }
.detail-close { display: none; position: absolute; right: 16px; top: 16px; z-index: 2; }
.detail-placeholder { min-height: 608px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; text-align: center; }
.detail-placeholder h3 { font-size: 23px; }
.detail-placeholder > p:last-child { max-width: 340px; margin: 12px 0 0; color: var(--muted); }
.placeholder-map { width: 145px; margin-bottom: 28px; color: var(--blue); }
.placeholder-map svg { width: 100%; fill: rgba(30, 58, 138, .1); stroke: rgba(30, 58, 138, .28); stroke-width: 2; }
.placeholder-map circle { fill: var(--gold); stroke: var(--surface); stroke-width: 3; }
.detail-hero { position: relative; padding: 28px 28px 25px; overflow: hidden; background: linear-gradient(140deg, #102a43, #1e3a8a 72%); color: white; }
.detail-hero::after { content: ""; position: absolute; width: 150px; height: 150px; right: -50px; bottom: -70px; border: 35px solid rgba(255, 255, 255, .08); border-radius: 50%; }
.detail-hero .eyebrow { color: #fcd34d; }
.detail-hero h2 { position: relative; z-index: 1; color: white; font-size: clamp(1.7rem, 3vw, 2.25rem); letter-spacing: -.04em; }
.detail-badges { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.detail-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; background: rgba(255, 255, 255, .09); color: rgba(255,255,255,.9); font-size: 10px; font-weight: 800; }
.detail-body { padding: 24px 28px 30px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.metric { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.metric span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.metric strong { display: block; margin-top: 5px; color: var(--ink); font-family: Montserrat, sans-serif; font-size: 17px; }
.detail-section { padding-top: 24px; }
.detail-section + .detail-section { margin-top: 24px; border-top: 1px solid var(--line); }
.detail-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.detail-section h3 { font-size: 16px; }
.detail-section-heading span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.ward-list { display: grid; gap: 12px; }
.ward-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; align-items: center; }
.ward-row strong { color: var(--ink); font-size: 12px; }
.ward-row > span { color: var(--text); font-size: 12px; font-weight: 800; }
.ward-track { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.ward-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #2dd4bf); }
.issue-list { display: flex; flex-wrap: wrap; gap: 7px; }
.issue-tag { padding: 6px 9px; border: 1px solid rgba(30, 58, 138, .15); border-radius: 8px; color: var(--blue); background: var(--surface-3); font-size: 11px; font-weight: 800; }
.context-card { padding: 14px 15px; border-left: 3px solid var(--gold); border-radius: 0 10px 10px 0; background: var(--surface-2); }
.context-card p { margin: 0; font-size: 13px; }
.context-card p + p { margin-top: 8px; }
.unavailable-note { display: flex; gap: 10px; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); background: var(--surface-2); font-size: 12px; }
.detail-actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 24px; }
.primary-link, .source-toggle { min-height: 45px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border-radius: 10px; font-size: 12px; font-weight: 900; text-decoration: none; }
.primary-link { background: var(--blue); color: white; }
.primary-link:hover { background: var(--blue-2); }
.primary-link.is-disabled { background: var(--line); color: var(--muted); pointer-events: none; }
.source-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--blue); cursor: pointer; }
.sources-box { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.sources-box p { margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.sources-box a { display: block; padding: 5px 0; font-size: 11px; font-weight: 800; word-break: break-word; }

.compare-tray { position: fixed; z-index: 50; left: 50%; bottom: 20px; width: min(680px, calc(100% - 28px)); min-height: 70px; transform: translateX(-50%); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 10px 10px 17px; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: rgba(15, 23, 42, .96); color: white; box-shadow: 0 22px 60px rgba(15, 23, 42, .3); backdrop-filter: blur(14px); }
.compare-selections { min-width: 0; display: flex; gap: 10px; }
.compare-selection { min-width: 0; display: flex; align-items: center; gap: 8px; padding-right: 10px; border-right: 1px solid rgba(255,255,255,.15); }
.compare-selection:last-child { border-right: 0; }
.compare-selection span { max-width: 150px; overflow: hidden; font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.compare-selection button { border: 0; background: none; color: #cbd5e1; cursor: pointer; }
.compare-open { align-self: stretch; padding: 0 19px; }
.compare-open:disabled { opacity: .45; cursor: not-allowed; }
.dialog-backdrop { position: fixed; z-index: 80; inset: 0; padding: 32px; background: rgba(15, 23, 42, .72); backdrop-filter: blur(8px); overflow-y: auto; }
.compare-dialog { width: min(980px, 100%); margin: 0 auto; border-radius: 22px; background: var(--surface); box-shadow: 0 35px 90px rgba(0,0,0,.35); overflow: hidden; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 26px 28px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.compare-grid { display: grid; grid-template-columns: 170px 1fr 1fr; }
.compare-grid > div { min-width: 0; padding: 17px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.compare-grid > div:nth-child(3n) { border-right: 0; }
.compare-grid > div:nth-last-child(-n+3) { border-bottom: 0; }
.compare-label { color: var(--muted); background: var(--surface-2); font-size: 11px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.compare-heading { color: var(--ink); font-family: Montserrat, sans-serif; font-size: 18px; font-weight: 800; }
.compare-value { color: var(--ink); font-weight: 800; }
.compare-issues { display: flex; flex-wrap: wrap; gap: 5px; }
.compare-issues span { padding: 5px 7px; border-radius: 6px; background: var(--surface-3); color: var(--blue); font-size: 10px; font-weight: 800; }
.compare-note { color: var(--muted); font-size: 12px; font-weight: 500; }

@media (max-width: 980px) {
  .hero { padding-top: 54px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-stats { max-width: 520px; }
  .explorer { grid-template-columns: 1fr; }
  .detail-panel { position: fixed; z-index: 70; inset: var(--header-h) 0 0; max-height: none; min-height: 0; border: 0; border-radius: 0; transform: translateX(105%); transition: transform .25s ease; }
  .detail-panel.is-open { transform: translateX(0); }
  .detail-close { display: grid; }
  .detail-placeholder { display: none; }
  .detail-hero { padding-right: 76px; }
}

@media (max-width: 720px) {
  :root { --header-h: 64px; }
  .site-header { padding-inline: 17px; }
  .private-badge { font-size: 0; padding: 9px; }
  .private-badge::after { content: "Private"; font-size: 11px; }
  .hero { padding: 42px 18px 28px; }
  .hero::after { display: none; }
  h1 { font-size: clamp(2.35rem, 12vw, 3.65rem); }
  .hero-lede { margin-top: 18px; font-size: 1rem; }
  .hero-stats { width: 100%; }
  .hero-stats div { padding: 17px; }
  .hero-stats strong { font-size: 22px; }
  .search-shell { margin-top: 32px; grid-template-columns: 1fr; gap: 7px; padding: 7px; }
  .search-field { border-bottom: 1px solid var(--line); }
  .search-field kbd { display: none; }
  .county-field { border-left: 0; }
  .county-field select { padding-inline: 14px; }
  .search-button { min-height: 46px; }
  .data-note { align-items: flex-start; margin-left: 4px; }
  .verified-dot { margin-top: 6px; flex: 0 0 auto; }
  .explorer { width: calc(100% - 28px); padding-top: 40px; }
  .section-heading { align-items: start; flex-direction: column; gap: 4px; }
  .card-main { grid-template-columns: 35px minmax(0, 1fr); padding: 15px 13px; }
  .card-index { width: 35px; height: 35px; }
  .card-arrow { display: none; }
  .compare-add { min-width: 50px; padding: 0 10px; }
  .compare-add span:last-child { display: none; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .metric { padding: 11px 8px; }
  .metric strong { font-size: 14px; }
  .detail-body { padding-inline: 20px; }
  .detail-actions { grid-template-columns: 1fr; }
  .compare-tray { bottom: 10px; min-height: 64px; }
  .compare-selection span { max-width: 90px; }
  .compare-open { padding-inline: 14px; font-size: 12px; }
  .dialog-backdrop { padding: 0; }
  .compare-dialog { min-height: 100%; border-radius: 0; }
  .dialog-header { padding: 20px; position: sticky; top: 0; z-index: 2; background: var(--surface); }
  .compare-grid { grid-template-columns: 104px 1fr 1fr; font-size: 12px; }
  .compare-grid > div { padding: 13px 10px; }
  .compare-heading { font-size: 14px; }
}

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