/* PFAS-only standalone exhibit — self-contained; nothing under web/css
   or web/exhibit is imported. Tokens are the main exhibit's validated
   values, trimmed to what this page draws (dataviz skill; light and
   dark are both selected, not auto-inverted). */

:root {
  color-scheme: light dark;
}

.px-root {
  color-scheme: light;
  /* chrome */
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  /* PFAS sequential ramp — the main exhibit's validated blue steps
     (worst adjacent ΔE 13.9 CVD / 15.3 normal; §6 of
     docs/MAP_EXHIBIT.md). The zero-detect and no-sampling states draw
     nothing at all on this page: known detections only. */
  --ramp-det: #6da7ec;
  --ramp-ge4: #256abf;
  --ramp-gt10: #0d366b;
  /* Install-base overlay (different channel: marks, not fill) */
  --orders: #eb6834;
  --orders-ring: #fcfcfb;
  /* Problem penetration — two categorical states. Blue = reached
     (the validated ramp's own #256abf step), orange = the standing
     gap semantic. Pair validated with the dataviz validator:
     ΔE 23.8 CVD / 34.1 normal (light), all checks pass. */
  --pen-well: #256abf;
  --pen-not: #eb6834;
  /* map furniture */
  --state-border: #b9b7ae;
}

:root[data-theme="dark"] .px-root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --ink-muted: #898781;
  --hairline: #2c2c2a;
  --border: rgba(255, 255, 255, 0.10);
  --ramp-det: #256abf;
  --ramp-ge4: #6da7ec;
  --ramp-gt10: #b7d3f6;
  --orders: #d95926;
  --orders-ring: #1a1a19;
  /* dark pair selected, not inverted: #3987e5 is the exhibit's own
     dark-selected blue; vs #d95926 ΔE 26.8 CVD / 31.8 normal, all
     validator checks pass on the dark surface. */
  --pen-well: #3987e5;
  --pen-not: #d95926;
  --state-border: #4a4a45;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .px-root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --ink-muted: #898781;
    --hairline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --ramp-det: #256abf;
    --ramp-ge4: #6da7ec;
    --ramp-gt10: #b7d3f6;
    --orders: #d95926;
    --orders-ring: #1a1a19;
    --pen-well: #3987e5;
    --pen-not: #d95926;
    --state-border: #4a4a45;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

.px-root {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.px-header {
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--hairline);
}

.px-header h1 {
  font-size: 17px;
  font-weight: 650;
  margin: 0 0 3px;
}

.px-header p {
  margin: 0;
  color: var(--ink-2);
  font-size: 12.5px;
  max-width: 72em;
}

.px-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  font-size: 13px;
}

.px-controls .spacer { flex: 1; }

.px-controls button {
  font: inherit;
  color: var(--ink-2);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
}
.px-controls button:hover:not(:disabled) { color: var(--ink); }
.px-controls button:disabled { color: var(--ink-muted); cursor: default; }

/* The two reveal buttons: the active state must be unmistakable with
   nobody narrating — pressed gets a filled pill, the main exhibit's
   checked-control treatment. */
#btn-orders, #btn-pen {
  color: var(--ink);
  font-weight: 550;
}
#btn-orders[aria-pressed="true"], #btn-pen[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
  font-weight: 650;
}
#btn-orders:disabled, #btn-pen:disabled {
  color: var(--ink-muted);
  font-weight: 400;
}

.px-main {
  flex: 1;
  display: flex;
  min-height: 0;
}

.px-maparea {
  flex: 1;
  position: relative;
  min-width: 0;
  background: var(--surface);
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#map.dragging { cursor: grabbing; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  padding: 8px 10px;
  font-size: 12px;
  max-width: 300px;
  line-height: 1.45;
  z-index: 5;
}
.tooltip .tt-zip { font-weight: 650; margin-bottom: 2px; }
.tooltip .tt-dim { color: var(--ink-2); }
.tooltip .tt-state { font-weight: 600; }

.px-side {
  width: 320px;
  overflow-y: auto;
  border-left: 1px solid var(--hairline);
  background: var(--page);
  padding: 14px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.panel h2 {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 8px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 12px;
}
.legend-row .count {
  margin-left: auto;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.swatch {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  border: 1px solid var(--border);
  flex: none;
}

.mark { width: 18px; height: 15px; flex: none; position: relative; }
.mark svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* Methodology: source, vintage, coverage, the install-base definition
   and the penetration definition — collapsed by default. */
.methodology summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.methodology summary:hover { color: var(--ink); }
.methodology[open] summary { margin-bottom: 6px; }
.methodology h3 {
  font-size: 11.5px;
  font-weight: 650;
  margin: 12px 0 2px;
  color: var(--ink);
}
.methodology p {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--ink-2);
  line-height: 1.55;
}

.px-footer {
  padding: 8px 20px;
  border-top: 1px solid var(--hairline);
  color: var(--ink-muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.hidden { display: none !important; }

@media (max-width: 900px) {
  .px-main { flex-direction: column; }
  .px-side {
    width: auto;
    border-left: none;
    border-top: 1px solid var(--hairline);
  }
  .px-maparea { min-height: 420px; }
}
