/* ============================================================
   Brownfield Opportunities — design tokens
   v1.8 (2026-04-30): editorial refresh — serif headline, KPI strip,
   warmer surfaces, tighter chrome, perf-aware (no web fonts, no
   backdrop-blur on hot paths).
   ============================================================ */
:root {
  /* Surfaces — warmer, less SaaS-blue than v1.7 */
  --bg: #f1f2f4;
  --bg-elev: #fafafb;        /* hero / KPI strip background */
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --border: #d8dde6;
  --border-strong: #b8c0cc;
  --text: #15212e;
  --text-soft: #3b4655;
  --muted: #6b7480;
  /* Accent — deeper, less Microsoft-blue. Reads "policy / editorial". */
  --accent: #1c5e9e;
  --accent-strong: #0e4378;
  --accent-soft: rgba(28, 94, 158, 0.08);
  /* NPL status palette — single source of truth. */
  --status-final: #b8332f;
  --status-deleted: #8a94a3;
  --status-proposed: #b8821a;
  --status-other: #3f7a3f;
  --status-acres: #1c5e9e;
  /* "Site is transactable today" green — drives the Cleanup Complete and
     Active Reuse pills in the detail panel. Distinct from --status-other
     (which colors NPL "Not on NPL" pills) so the readiness signal isn't
     conflated with an NPL-status shade. */
  --readiness-ready: #2f7a4d;
  /* Map markers and legend are colored by program (one dot per program). */
  --program-superfund: #b8332f;
  --program-brownfield: #1c5e9e;
  --program-fuds: #6f3691;
  --program-brac: #c46a14;
  /* Vector basemap palette */
  --map-ocean: #dde3ec;
  --map-land: #f5f7fa;
  --map-state-stroke: #4a5568;
  --map-county-stroke: #b9c2d0;
  --map-marker-stroke: #ffffff;
  --inset-bg: #ffffff;
  --inset-stroke: #4a5568;
  --shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.06);

  /* ----- Typography ----- */
  /* System sans for body. System serif for display — avoids any web-font
     fetch (Charter ships with macOS, Source Serif 4 with newer browsers,
     graceful fallback to Georgia / Times). Numbers always tabular. */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Charter", "Source Serif 4", "Source Serif Pro", "Iowan Old Style", "Apple Garamond", "Palatino", "Georgia", "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11", "tnum";
}

[data-theme="dark"] {
  --bg: #0d121a;
  --bg-elev: #131923;
  --surface: #161c26;
  --surface-2: #1d2531;
  --border: #2c3645;
  --border-strong: #3b4757;
  --text: #e8eaef;
  --text-soft: #b9c2d0;
  --muted: #94a0b1;
  --accent: #7eb6e8;
  --accent-strong: #a4cdf2;
  --accent-soft: rgba(126, 182, 232, 0.12);
  --status-final: #ef5050;
  --status-deleted: #94a0b1;
  --status-proposed: #d4a93f;
  --status-other: #5fa45f;
  --status-acres: #7eb6e8;
  --readiness-ready: #6cc18a;
  --program-superfund: #ef5050;
  --program-brownfield: #7eb6e8;
  --program-fuds: #b47ad8;
  --program-brac: #e6a040;
  --map-ocean: #0a0f17;
  --map-land: #1d2531;
  --map-state-stroke: #5a6577;
  --map-county-stroke: #2e3848;
  --map-marker-stroke: #0d121a;
  --inset-bg: #1d2531;
  --inset-stroke: #5a6577;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, .tab, a { touch-action: manipulation; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* Visually hidden until keyboard-focused — first thing in tab order so a
   keyboard user can jump past the toolbar straight to the map/table. */
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  background: var(--accent-strong);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 2000;
  text-decoration: none;
  transition: top 120ms;
}
.skip-link:focus { top: 8px; outline: 2px solid var(--accent); outline-offset: 2px; }

main:focus { outline: none; }

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  position: relative;
  z-index: 50;
}
.brand h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--text);
}
.brand .sub {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  flex: 1 1 240px;
  min-width: 220px;
  max-width: 360px;
  transition: border-color 120ms, background 120ms;
}
.search:focus-within { border-color: var(--accent); background: var(--surface); }
.search-icon {
  color: var(--muted);
  font-size: 14px;
  margin-right: 6px;
  user-select: none;
}
.search input {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 4px 0;
  outline: none;
  flex: 1;
  min-width: 0;
}
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search-count {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 360px;
  letter-spacing: 0.01em;
}
.search-count:empty { display: none; }
@media (max-width: 900px) {
  .search-count { display: none; }
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 32px; height: 32px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.icon-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.icon-btn[aria-expanded="true"] { background: var(--accent-strong); color: white; border-color: var(--accent-strong); }
/* Tiny chip on the filter button when filters are active. Lives outside
   the button hit area so the hit target stays 32px. */
.icon-btn .chip-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--surface);
}
.icon-btn[aria-expanded="true"] .chip-count { background: var(--surface); color: var(--accent-strong); }
/* Same trap as the detail-panel had: a `display: inline-flex` rule wins over
   the implicit `display: none` from [hidden]. Force it back. */
.chip-count[hidden] { display: none; }

.tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.tab {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms, color 120ms, box-shadow 120ms;
  font-family: inherit;
}
.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}
.tab:hover:not(.active) { color: var(--text); }

/* ============================================================
   Hero strip — slim editorial intro above the map
   ============================================================ */
.hero {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 22px 24px 18px;
  position: relative;
  z-index: 40;
}
.hero-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.hero-eyebrow {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 6px;
}
.hero-eyebrow .dot { color: var(--border-strong); margin: 0 5px; }
.hero h2 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--text);
  max-width: 580px;
}
.hero p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-soft);
  max-width: 580px;
}
.hero p a { color: var(--accent); }

/* KPI deck — Bloomberg/FT-style metric strip */
.kpi-deck {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.kpi {
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.kpi:last-child { border-right: none; }
.kpi-label {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
  /* Allow wrap so the label keeps its meaning rather than truncating to
     "ACRES TRACK..." on narrow tablet columns. The KPI cell sets a min
     line height so two-line and one-line labels align across cells. */
  min-height: 2.4em;
  line-height: 1.2;
}
.kpi-num {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--text);
  display: block;
}
.kpi-sub {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.3;
  /* Truncate at one line on desktop (avoids a tall second row); allow wrap
     on the mobile carousel where each KPI gets generous min-width.
     `display: block` is required for `overflow: hidden` + `text-overflow:
     ellipsis` to take effect — those properties no-op on `display: inline`,
     which is the default for `<span>`. Without this, the subtext bleeds
     across the column boundary into the next KPI cell (UAT-006). */
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .kpi-sub { white-space: normal; overflow: visible; text-overflow: clip; }
}
.kpi-sub.kpi-sub-strong { color: var(--text-soft); }

@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; gap: 16px; }
  .hero h2 { font-size: 22px; }
}
@media (max-width: 640px) {
  .hero { padding: 14px 14px 12px; }
  .hero-eyebrow { font-size: 9.5px; }
  .hero h2 { font-size: 18px; }
  .hero p { font-size: 12.5px; }
  /* On phones the map is the product — hide hero copy, keep the KPI deck
     as a swipeable carousel so users still see headline numbers. */
  .hero-copy { display: none; }
  .kpi-deck {
    border-radius: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .kpi { scroll-snap-align: start; }
  .kpi-num { font-size: 18px; }
}

/* ============================================================
   Filters strip
   ============================================================ */
.filters {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filters[hidden] { display: none; }
.filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.filter select, .filter input[type="range"] {
  font: inherit;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  min-width: 160px;
  font-weight: 400;
  font-family: var(--font-sans);
}
.filter select:hover { border-color: var(--border-strong); }
.filter input[type="range"] { padding: 0; min-width: 200px; accent-color: var(--accent); }
.filter select[multiple] { min-height: 60px; padding: 4px; }
.filter-acreage { min-width: 220px; }
.acreage-ticks-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  padding: 0 2px;
}
.filter-status { min-width: 150px; }
.check-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 14px;
}
.check-group .check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  cursor: pointer;
}
.check-group .check input { accent-color: var(--accent); cursor: pointer; }
.filter-status legend { padding-bottom: 4px; }
.filter-program {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-program legend {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  padding: 0 0 2px 0;
}
.filter-program .check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  cursor: pointer;
}
.filter-program .check input { accent-color: var(--accent); cursor: pointer; }
.muted-num { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; text-transform: none; letter-spacing: 0; }
.text-btn {
  font: inherit;
  font-size: 12px;
  background: transparent;
  color: var(--accent);
  border: none;
  cursor: pointer;
  padding: 6px 0;
  text-decoration: underline;
  font-family: inherit;
}
.text-btn:hover { color: var(--accent-strong); }

/* ============================================================
   Views (map + table)
   ============================================================ */
main {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.view {
  position: absolute;
  inset: 0;
  display: none;
}
.view.active { display: block; }
#map { width: 100%; height: 100%; background: var(--bg); }
.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(255, 255, 255, 0.85) !important;
  padding: 2px 6px !important;
}
.leaflet-container { background: var(--bg); }
[data-theme="dark"] .leaflet-control-attribution { background: rgba(20,25,35,0.85) !important; color: #aab !important; }
[data-theme="dark"] .leaflet-control-attribution a { color: var(--accent); }
/* Refined zoom control to match the new chrome */
.leaflet-bar {
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-soft) !important;
  border-radius: 6px !important;
  overflow: hidden;
}
.leaflet-bar a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-bottom-color: var(--border) !important;
}
.leaflet-bar a:hover { background: var(--surface-2) !important; }

/* ============================================================
   Inset region labels (AK / HI / PR / Pacific)
   ============================================================ */
.inset-label {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px 4px 0 0;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  pointer-events: none;
}

/* ============================================================
   Map legend — flat card, per-program counts, no backdrop-blur
   (perf: backdrop-filter recomposites every pan/zoom frame)
   ============================================================ */
.legend {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px 8px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text);
  box-shadow: var(--shadow);
  max-width: 220px;
}
.legend-title {
  font-weight: 600;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.85;
}
.legend-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-soft);
}
.legend-num {
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 500;
}
.legend-foot {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* ============================================================
   Table — paginated, sticky head
   ============================================================ */
.table-wrap {
  height: 100%;
  overflow: auto;
  padding: 0;
  background: var(--surface);
  /* Containment caps invalidation cost when rows append (pagination). */
  contain: layout paint;
}
#sites-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
#sites-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
  text-align: left;
  padding: 11px 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 1;
}
#sites-table thead th.num { text-align: right; }
#sites-table thead th[aria-sort] { color: var(--accent); }
#sites-table thead th[aria-sort]::after {
  content: " " attr(data-sort-glyph);
  font-size: 10px;
  opacity: 0.7;
}
#sites-table tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 90ms;
}
#sites-table tbody tr:hover { background: var(--surface-2); }
#sites-table tbody tr.selected { background: var(--accent-soft); }
[data-theme="dark"] #sites-table tbody tr.selected { background: rgba(126, 182, 232, 0.12); }
#sites-table td {
  padding: 9px 14px;
  vertical-align: top;
  color: var(--text-soft);
}
#sites-table td:first-child { color: var(--text); font-weight: 500; }
#sites-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-sentinel {
  width: 100%;
  height: 1px;
  pointer-events: none;
}

/* ============================================================
   Detail panel
   ============================================================ */
.detail {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 92vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px 24px 28px;
  overflow-y: auto;
  z-index: 1000;
  transform: translateX(0);
  visibility: visible;
  transition: transform 200ms cubic-bezier(.2,.8,.2,1), visibility 0s linear 0s;
  contain: layout paint;
}
/* Program-color top stripe — set by JS in selectSite() via --detail-stripe */
.detail::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--detail-stripe, var(--accent));
}
.detail[hidden] {
  display: block;
  transform: translateX(110%);
  pointer-events: none;
  visibility: hidden;
  transition: transform 200ms cubic-bezier(.4,0,.2,1), visibility 0s linear 200ms;
}
.detail h2 {
  margin: 0 36px 4px 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
}
.detail h3 {
  margin: 22px 0 8px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 16px;
  font-weight: 600;
}
.detail .muted { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
}
.close:hover { background: var(--surface-2); color: var(--text); }

.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 7px 14px;
  font-size: 13px;
  margin: 0;
}
.kv dt { color: var(--muted); font-size: 12px; padding-top: 1px; }
.kv dd { margin: 0; word-wrap: break-word; color: var(--text-soft); }
.kv dd.muted-cell { color: var(--muted); font-style: italic; }
/* Same muted treatment for table cells when a column doesn't apply to the
   record's program — e.g. STATUS column for ACRES/BRAC (UAT-009). */
#sites-table td .muted-cell { color: var(--muted); font-style: italic; }
/* Inline acreage note for FUDS records lacking a digitized boundary. The
   parent `<dd>` itself isn't muted (acreage may say "N/A" but we still want
   regular weight); the note is. The `[hidden]` rule guards against the
   "[hidden] trap" — see CLAUDE.md. */
.acreage-note {
  display: inline;
  margin-left: 8px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}
.acreage-note[hidden] { display: none; }
/* Sub-line under a `<dd>` value that surfaces qualifying criteria — used by
   the data-center reuse cell to expose the EPA RE-Powering rule
   ("≥50 acres · electric transmission · water service area") so the boolean
   isn't opaque. Same `[hidden]` belt-and-suspenders rule as `.acreage-note`. */
.dd-criteria {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}
.dd-criteria[hidden] { display: none; }
.children-list {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-soft);
}
.children-list li { margin: 2px 0; }
.children-list a { cursor: pointer; }

/* Federal documents block in detail panel */
#d-docs-block { margin-top: 16px; }
#d-docs-block h3 { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 6px; }
.docs-count { color: var(--muted); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.docs-list {
  margin: 4px 0 8px;
  padding-left: 0;
  list-style: none;
  font-size: 13px;
  color: var(--text-soft);
}
.docs-list li {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.docs-list li:last-child { border-bottom: 0; }
.docs-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  line-height: 1.35;
}
.docs-list a:hover { text-decoration: underline; }
.doc-size { color: var(--muted); font-weight: 400; font-size: 12px; }
.doc-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.doc-date { font-variant-numeric: tabular-nums; }
.doc-cat::before { content: "· "; color: var(--border); }
.doc-cat:first-child::before { content: ""; }
.docs-source-line { margin: 6px 0 0; font-size: 12px; }
.docs-source-line a { color: var(--accent); }

.source { margin-top: 22px; font-size: 12px; }

/* ============================================================
   Detail-panel tab strip + panes (Overview vs Summary)
   ============================================================ */
.detail-tabs {
  display: flex;
  gap: 2px;
  margin: 14px 0 16px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.detail-tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms, color 120ms, box-shadow 120ms;
}
.detail-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}
.detail-tab:hover:not(.active) { color: var(--text); }
.dpane[hidden] { display: none; }

/* AI summary card (Claude Haiku output) */
.summary-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px 12px;
}
.summary-empty { font-size: 13px; margin: 0; }
#d-summary-body { font-size: 14px; color: var(--text-soft); line-height: 1.55; }
#d-summary-body p { margin: 0 0 10px; }
#d-summary-body p:last-child { margin-bottom: 0; }
.summary-meta {
  margin: 10px 0 0;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.summary-meta[hidden] { display: none; }
#d-summary-empty[hidden], #d-summary-body[hidden] { display: none; }

/* ECHO enforcement block in detail panel */
#d-echo-block { margin-top: 16px; }
#d-echo-block h3 { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 6px; }
#d-echo-block dd.violation { color: var(--status-final); font-weight: 500; }
#d-echo-block[hidden] { display: none; }

/* ============================================================
   Toast (non-blocking status messages)
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px 16px;
  font-size: 13px;
  max-width: 90vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
  z-index: 1100;
}
.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============================================================
   Pills (NPL status + program label)
   ============================================================ */
.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--status-other);
  color: white;
  white-space: nowrap;
  vertical-align: middle;
}
.pill[data-status="F"] { background: var(--status-final); }
.pill[data-status="D"] { background: var(--status-deleted); }
.pill[data-status="P"] { background: var(--status-proposed); }
.pill[data-status="N"] { background: var(--status-other); }
.pill[data-program="superfund"] { background: var(--program-superfund); }
.pill[data-program="brownfield"] { background: var(--program-brownfield); }
.pill[data-program="fuds"] { background: var(--program-fuds); }
.pill[data-program="brac"] { background: var(--program-brac); }
.pill.dc-pill {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 9.5px;
  padding: 0 6px;
}
/* "Cleanup Complete" (NPL Deleted) + "Active Reuse" (RedevelopmentApp
   In_Reuse=Yes) — green outline pills, same shape as .dc-pill. Color
   comes from `--readiness-ready` so future readiness-tier badges share
   the token. Both pills sit in the detail panel's Program cell next to
   the program + DC-candidate pills. */
.pill.cleanup-pill,
.pill.reuse-pill {
  background: transparent;
  color: var(--readiness-ready);
  border: 1px solid var(--readiness-ready);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 9.5px;
  padding: 0 6px;
}

/* DC suitability tier pill (Tier 0 score). Outline-only — accent-colored
   for sub-hyperscale (edge / colo) and green-tinted (`.ready`) for
   hyperscale / mega so the strongest signal pops without color clash. */
.pill.dc-tier-pill {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 9.5px;
  padding: 0 6px;
}
.pill.dc-tier-pill.ready {
  color: var(--readiness-ready);
  border-color: var(--readiness-ready);
}

/* Voltage chip rendered next to the transmission distance in the detail
   panel ("0.4 mi  ·  230 kV"). Same outline-pill shape as the DC tier
   chip but slightly smaller, sits inline. */
.kv-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 5px;
  margin-left: 4px;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface);
  vertical-align: 1px;
  font-variant-numeric: tabular-nums;
}
.kv-chip.ready {
  color: var(--readiness-ready);
  border-color: var(--readiness-ready);
}

/* Persona presets in the filter strip — one button per ladder rung.
   Active state matches the program-checkbox emphasis: filled bg, accent
   border. Each button has a label + small acreage threshold. */
.filter-personas legend { font-weight: 600; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.persona-row { display: flex; flex-wrap: wrap; gap: 6px; }
.persona-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  line-height: 1.15;
  min-width: 110px;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}
.persona-btn:hover { border-color: var(--accent); }
.persona-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.persona-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.persona-btn.active .persona-min { color: rgba(255,255,255,0.78); }
.persona-label { font-weight: 600; font-size: 12px; }
.persona-min { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* State data-center tax incentive block in the detail panel. The chip
   anchors to the source URL so the user can verify the program; meta line
   below carries program + investment threshold + sunset / status. */
.tax-incentive-block {
  margin: 12px 0 4px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}
.tax-chip {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid var(--border);
}
.tax-chip.tax-tier-1 {
  color: #fff;
  background: var(--readiness-ready);
  border-color: var(--readiness-ready);
}
.tax-chip.tax-tier-2 {
  color: var(--accent);
  background: transparent;
  border-color: var(--accent);
}
.tax-chip.tax-tier-3 {
  color: var(--muted);
  background: transparent;
  border-color: var(--border);
}
.tax-chip:hover { filter: brightness(0.92); text-decoration: underline; }
.tax-meta {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.35;
}

/* The hero KPI deck's existing `.kpi-sub.kpi-sub-strong` rule already
   styles the "≥50 ac · power · water" subtext for #kpi-dc — the new
   #kpi-hyperscale subtext picks up the same treatment automatically
   because the markup pattern is identical. No new rules needed here. */

/* ============================================================
   Footer — sources (editorial sites cite, SaaS dashboards don't)
   ============================================================ */
.site-footer {
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  padding: 8px 24px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 0.01em;
}
.site-footer a { color: var(--text-soft); text-decoration-color: var(--border-strong); }
.site-footer a:hover { color: var(--accent); }
.site-footer .footer-sources { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.site-footer .footer-meta { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============================================================
   Mobile — hero compresses, detail becomes bottom sheet
   ============================================================ */
@media (max-width: 640px) {
  .topbar { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .topbar-controls { width: 100%; gap: 6px; }
  .search { flex: 1; min-width: 0; order: -1; }
  .search input { font-size: 16px; /* avoid iOS auto-zoom */ }
  .brand h1 { font-size: 17px; }
  .brand .sub { font-size: 11px; }
  .tab { padding: 8px 12px; font-size: 13px; }
  .kv { grid-template-columns: 110px 1fr; }
  #sites-table { font-size: 12px; }
  #sites-table th, #sites-table td { padding: 9px 10px; }
  .filters { padding: 10px 12px; gap: 12px; }
  .filter select, .filter input[type="range"] { min-width: 120px; font-size: 14px; }

  .legend { font-size: 10.5px; padding: 8px 10px 6px; max-width: 180px; }
  .legend-title { font-size: 9px; }

  .site-footer { padding: 8px 12px; font-size: 10.5px; gap: 4px 12px; }

  /* Bottom-sheet detail panel — easier reach, doesn't block the map. */
  .detail {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 65vh;
    max-height: 75vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(0);
  }
  .detail[hidden] { transform: translateY(110%); }
  .detail::before {
    border-radius: 14px 14px 0 0;
  }
  .detail::after {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-strong);
    margin: -4px auto 10px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
  }
  .close { top: 14px; right: 10px; }
}

/* Tablet (641–1024) */
@media (min-width: 641px) and (max-width: 1024px) {
  .topbar { padding: 12px 16px; }
  .filters { padding: 10px 16px; }
  .hero { padding: 18px 16px 14px; }
}
