/* Sprayed? — friendly field-guide stickers on a pastel map. */

:root {
  --ground: #EAF2E3;
  --surface: #FFFFFF;
  --ink: #23312B;
  --muted: #55665C;
  --hairline: #D3DDCC;
  --land: #E7F0DF;
  --park: #BFE3AE;
  --water: #AEDCF1;
  --q: #D9442F;

  --now: #F0604D;
  --now-soft: #FBD3CC;
  --upcoming: #8D86F0;
  --upcoming-soft: #DEDBFC;
  --recent: #F4B23E;
  --recent-soft: #FCE6B8;
  --clear: #4CC38A;
  --clear-soft: #CDEFDC;

  --on-color: #23312B; /* icons and text on saturated status fills */
  --shadow-c: #23312B;
  --border: 2.5px solid var(--ink);
  --border-thin: 2px solid var(--ink);
  --shadow: 4px 4px 0 var(--shadow-c);
  --shadow-sm: 2px 2px 0 var(--shadow-c);
  --shadow-xs: 1.5px 1.5px 0 var(--shadow-c);
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 14px;
  --gutter: 16px;

  --font-display: 'Fredoka', 'Figtree', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --history: #C9D4C2;

  /* Label hazard pins (highest signal word), a plum ramp kept apart from the status colors.
     Dark → light by severity; each also carries a letter (D / W / C / ?). */
  --hz-danger: #4B1D45;
  --hz-warning: #9B3F7A;
  --hz-caution: #F3CDE3;
  --hz-unknown: #FFFFFF;
  color-scheme: light;
}


/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  /* Keep focused/anchored content clear of the sticky tab bar (height set by app.js). */
  scroll-padding-top: calc(var(--sticky-h, 0px) + 12px);
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
}

body.sheet-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--upcoming);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
}

.label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  background: var(--surface);
  border: var(--border-thin);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.skip-link:focus {
  top: 12px;
}

.i {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.i-sm {
  width: 16px;
  height: 16px;
}

.i-xs {
  width: 14px;
  height: 14px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  flex: none;
}

.dot-now { background: var(--now); }
.dot-upcoming { background: var(--upcoming); border-style: dashed; }
.dot-recent { background: var(--recent); }

/* ---------- Layout ---------- */

/* Map view: one column on phones; sidebar + sticky map on desktop. */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 12px var(--gutter) 24px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  max-width: 640px;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .layout {
    max-width: none;
    grid-template-columns: clamp(400px, 34vw, 440px) minmax(0, 1fr);
    grid-template-rows: repeat(4, min-content) 1fr;
    column-gap: 24px;
    padding: 20px;
  }

  .layout > * {
    grid-column: 1;
    min-width: 0;
  }

  .layout > .map-frame {
    grid-column: 2;
    grid-row: 1 / -1;
    position: sticky;
    top: calc(var(--sticky-h, 84px) + 20px);
    align-self: start;
    height: calc(100vh - var(--sticky-h, 84px) - 40px);
    height: calc(100dvh - var(--sticky-h, 84px) - 40px);
  }
}

/* Trends (and the guide's fallback message): full-width pages. */
.view-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px var(--gutter) 32px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.page-head {
  margin: 8px 4px 20px;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

/* Headings get focus programmatically on view switches; no ring for that. */
.page-title:focus,
.home-headline:focus {
  outline: none;
}

.page-intro {
  margin: 8px 0 0;
  max-width: 68ch;
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
}

.page-status {
  margin: 0 4px 16px;
  font-weight: 600;
  color: var(--muted);
}

.trends-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (min-width: 900px) {
  .view-page {
    padding: 20px 24px 40px;
  }

  .page-title {
    font-size: 40px;
  }

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

  .trends-grid > .trends-card {
    grid-column: 1 / -1;
  }

  .trends-card .period-bars {
    max-width: 820px;
  }
}

/* ---------- Cards and buttons ---------- */

.card {
  background: var(--surface);
  border: var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: var(--border-thin);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--shadow-c);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--shadow-c);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-small {
  min-height: 40px;
  padding: 6px 14px;
  font-size: 14px;
}

.btn-primary {
  background: var(--now);
  color: var(--on-color);
}

.btn.is-active {
  background: var(--clear-soft);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: var(--border-thin);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.icon-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* ---------- Header and view tabs ---------- */

/* Phones: the top bar is only a wrapper (display: contents) so the tab bar can stick to the
   top of the page on its own. Desktop: the whole bar is one sticky row. */
.topbar {
  display: contents;
}

.site-header {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-items: center;
  max-width: 640px;
  margin: 0 auto;
  padding: 20px var(--gutter) 4px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.tabs {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  display: flex;
  gap: 8px;
  padding: 10px max(var(--gutter), calc(50% - 320px)) 12px;
  background: var(--ground);
  border-bottom: 2px solid var(--hairline);
}

.tab {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 12px;
  border: var(--border-thin);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.tab .i {
  width: 18px;
  height: 18px;
}

.tab:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-sm);
}

.tab:active {
  transform: translate(1.5px, 1.5px);
  box-shadow: none;
}

.tab[aria-current='page'] {
  background: var(--ink);
  color: var(--surface);
  box-shadow: 2px 2px 0 var(--muted);
}

@media (max-width: 380px) {
  .tabs {
    gap: 6px;
  }

  .tab {
    padding: 6px 9px;
    font-size: 14px;
  }

  .tab .i {
    display: none;
  }
}

@media (min-width: 900px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 20px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: var(--ground);
    border-bottom: 2px solid var(--hairline);
  }

  .site-header {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 16px;
  }

  .site-header .brand {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .site-header .tagline {
    grid-column: 2;
    margin: 0;
    font-size: 14px;
  }

  .site-header .updated {
    grid-column: 2;
    margin: 2px 0 0;
  }

  .tabs {
    position: static;
    flex: none;
    padding: 0;
    background: none;
    border: 0;
  }

  .tab {
    flex: none;
    padding: 6px 16px;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  grid-column: 1 / -1;
  justify-self: start;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--now);
  border: var(--border);
  box-shadow: var(--shadow-sm);
  color: #23312B;
}

.brand-mark svg path:first-child {
  fill: #FFFFFF;
}

.brand-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.01em;
}

.brand-q {
  color: var(--q);
}

.tagline {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  font-weight: 600;
  color: var(--muted);
  font-size: 15px;
}

.updated {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  min-height: 1.4em;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--recent-soft);
  border: var(--border-thin);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
  font-weight: 600;
  font-size: 15px;
}

.notice p {
  margin: 0;
}

/* ---------- Home card ---------- */

.home-card {
  padding: 18px 18px 18px;
  position: relative;
  overflow: hidden;
}

.home-loc {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-headline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 27px;
  line-height: 1.12;
  margin: 8px 0 14px;
  text-wrap: balance;
}

.home-card.is-now .home-headline {
  color: var(--ink);
}

.home-body > * + * {
  margin-top: 12px;
}

.today-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.today-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  min-height: 56px;
  padding: 8px 12px 8px 8px;
  border: var(--border-thin);
  border-radius: var(--r-sm);
  background: var(--now-soft);
  box-shadow: var(--shadow-xs);
}

.today-row:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-sm);
}

.tr-body {
  display: grid;
  min-width: 0;
}

.tr-park {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.25;
}

.tr-area {
  font-size: 14px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tr-time {
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.home-more {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.home-clear {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--clear-soft);
  border: var(--border-thin);
  font-weight: 600;
  font-size: 15px;
}

.home-next {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  min-height: 44px;
  border: 2px dashed var(--ink);
  border-radius: var(--r-sm);
  background: var(--upcoming-soft);
}

.home-next .hn-text {
  font-size: 15px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  display: grid;
  justify-items: start;
  padding: 10px 12px;
  border: var(--border-thin);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.stat.s-now { background: var(--now-soft); }
.stat.s-upcoming { background: var(--upcoming-soft); border-style: dashed; }
.stat.s-recent { background: var(--recent-soft); }

.stat-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
}

.stat-label {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Kind tiles (icon per product kind) ---------- */

.kind-tile {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: var(--border-thin);
  border-radius: 12px;
  background: var(--surface);
  color: var(--on-color);
  flex: none;
}

.kind-tile.s-now { background: var(--now); }
.kind-tile.s-upcoming { background: var(--upcoming); border-style: dashed; }
.kind-tile.s-recent { background: var(--recent); }

.kind-tile.sm {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

/* ---------- Map ---------- */

.map-frame {
  position: relative;
  height: 55vh;
  height: 55svh;
  min-height: 320px;
  border: var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  background: var(--land);
  isolation: isolate;
}

.map {
  position: absolute;
  inset: 0;
}

.map-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-weight: 600;
  color: var(--muted);
}

.map-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 12px;
  background: var(--surface);
  border: var(--border-thin);
  border-radius: 999px;
  box-shadow: var(--shadow-xs);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

@media (max-width: 420px) {
  .map-legend {
    right: 12px;
    justify-content: space-between;
    gap: 6px;
  }
}

/* MapLibre chrome in the sticker style */
.maplibregl-ctrl-group {
  border: var(--border-thin) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-xs) !important;
  overflow: hidden;
  background: var(--surface) !important;
}

.maplibregl-ctrl-group button {
  width: 36px !important;
  height: 36px !important;
}

.maplibregl-ctrl-group button + button {
  border-top: 2px solid var(--hairline) !important;
}

.maplibregl-ctrl-attrib {
  font-family: var(--font-body);
  font-size: 11px;
}

.maplibregl-ctrl-bottom-right {
  bottom: 0;
}


/* Markers: real buttons styled as sticker pins. MapLibre owns the button's transform,
   so the visual lives on the inner .pin. */
.marker {
  display: block;
  width: 44px;
  height: 52px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.marker .pin {
  position: absolute;
  left: 50%;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: -18px;
  border: 2.5px solid var(--ink);
  border-radius: 13px 13px 13px 4px;
  transform: rotate(-45deg);
  transform-origin: 50% 50%;
  box-shadow: 2px 2px 0 var(--shadow-c);
  background: var(--surface);
  color: var(--on-color);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.marker .pin .i {
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
}

.marker.s-now .pin { background: var(--now); }
.marker.s-upcoming .pin { background: var(--upcoming); border-style: dashed; }
.marker.s-recent .pin { background: var(--recent); }

.marker:hover .pin {
  transform: rotate(-45deg) scale(1.08);
}

.marker:focus-visible {
  outline: none;
}

.marker:focus-visible .pin {
  outline: 3px solid var(--upcoming);
  outline-offset: 3px;
}

.marker.is-selected .pin {
  transform: rotate(-45deg) scale(1.3);
  box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 5.5px var(--ink), 3px 3px 0 5px var(--shadow-c);
}

.home-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  border: 2.5px solid var(--surface);
  box-shadow: 2px 2px 0 var(--shadow-c);
  pointer-events: none;
}

.home-marker .i {
  width: 18px;
  height: 18px;
}

/* ---------- Controls ---------- */

.controls {
  padding: 16px;
  display: grid;
  gap: 18px;
}

.control-block {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-msg {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--recent-soft);
  border-radius: 10px;
  padding: 6px 10px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 6px 14px;
  border: var(--border-thin);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-xs);
}

.chip[aria-pressed='true'] {
  background: var(--ink);
  color: var(--surface);
}

.chip-status[aria-pressed='true'] {
  color: var(--on-color);
}

.chip-status.s-now[aria-pressed='true'] { background: var(--now-soft); color: var(--ink); }
.chip-status.s-upcoming[aria-pressed='true'] { background: var(--upcoming-soft); color: var(--ink); }
.chip-status.s-recent[aria-pressed='true'] { background: var(--recent-soft); color: var(--ink); }

.chip-status[aria-pressed='false'] {
  color: var(--muted);
  box-shadow: none;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.chip-status[aria-pressed='false'] .dot {
  opacity: 0.45;
}

/* Count badge stays ink-on-white even when its chip is ink-filled (pressed). */
.chip[aria-pressed='true'] .count {
  background: var(--surface);
  color: var(--ink);
}

.chip .count {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

/* Week strip */
.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.wk-day {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  min-height: 70px;
  padding: 6px 2px 8px;
  border: var(--border-thin);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  min-width: 0;
}

.wk-day.is-today {
  background: var(--now-soft);
}

.wk-day[aria-pressed='true'] {
  background: var(--ink);
  color: var(--surface);
}

.wk-name {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wk-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.1;
}

.wk-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  min-height: 9px;
}

.wk-dots .dot {
  width: 8px;
  height: 8px;
  border-width: 1.2px;
}

.wk-day[aria-pressed='true'] .dot {
  border-color: var(--surface);
}

.wk-more {
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 8px;
}

/* Search */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  border: var(--border-thin);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 2px 2px 0 var(--hairline);
}

.search:focus-within {
  outline: 3px solid var(--upcoming);
  outline-offset: 2px;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 16px; /* avoids iOS zoom */
  padding: 10px 0;
  outline: none;
}

.search input::placeholder {
  color: var(--muted);
}

/* ---------- List ---------- */

.list-section:focus {
  outline: none;
}

.list-summary {
  margin: 0 4px 10px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.list {
  display: grid;
  gap: 20px;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
}

.group-count {
  font-size: 12px;
  font-weight: 500;
  padding: 1px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
}

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.app-card {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  text-align: left;
  padding: 12px;
  border: var(--border-thin);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--shadow-c);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.app-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--shadow-c);
}

.app-card:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--shadow-c);
}

.app-card.is-selected {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink);
}

.app-card.s-now.is-selected { background: var(--now-soft); }
.app-card.s-upcoming.is-selected { background: var(--upcoming-soft); }
.app-card.s-recent.is-selected { background: var(--recent-soft); }

.ac-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ac-park {
  font-weight: 800;
  font-size: 16px;
  line-height: 1.25;
}

.ac-area {
  font-size: 14px;
  color: var(--muted);
}

.ac-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.ac-meta .unmapped {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}

.ac-products {
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

.empty {
  padding: 20px;
  text-align: center;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.empty p {
  margin: 0;
}

.empty-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
}

/* Loading skeletons */
@keyframes shimmer {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

.skeleton-row,
.skeleton-card {
  background: var(--hairline);
  border-radius: 12px;
  animation: shimmer 0.9s ease-in-out infinite alternate;
}

.skeleton-row {
  height: 52px;
  margin-top: 8px;
}

.skeleton-row.short {
  width: 60%;
  height: 20px;
}

.skeleton-card {
  height: 92px;
  border-radius: var(--r-md);
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-row,
  .skeleton-card {
    animation: none;
  }

  * {
    transition: none !important;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px var(--gutter) 24px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  font-size: 14px;
  color: var(--muted);
}

body[data-view='map'] .site-footer {
  max-width: 640px;
}

@media (min-width: 900px) {
  .site-footer,
  body[data-view='map'] .site-footer {
    max-width: none;
    padding: 4px 20px 24px;
  }

  body[data-view='trends'] .site-footer {
    max-width: 1200px;
    padding: 4px 24px 24px;
  }
}

.site-footer p {
  margin: 0 0 8px;
}

.site-footer a {
  color: var(--ink);
}

/* ---------- Detail panel / bottom sheet ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(20, 28, 24, 0.45);
}

.detail {
  position: fixed;
  z-index: 50;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 20px;
}

.detail:focus {
  outline: none;
}

@media (min-width: 900px) {
  .scrim {
    display: none !important;
  }

  .detail {
    top: calc(var(--sticky-h, 84px) + 40px);
    right: 40px;
    width: min(390px, calc(100vw - clamp(400px, 34vw, 440px) - 120px));
    max-height: calc(100dvh - var(--sticky-h, 84px) - 80px);
  }
}

@media (max-width: 899px) {
  .detail {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 86vh;
    max-height: 86dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
    box-shadow: 0 -4px 0 var(--shadow-c);
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    animation: sheet-up 0.22s ease-out;
  }

  .detail::before {
    content: '';
    display: block;
    width: 44px;
    height: 5px;
    margin: -4px auto 10px;
    border-radius: 999px;
    background: var(--hairline);
  }
}

@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: var(--border-thin);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pill.s-now { background: var(--now-soft); }
.pill.s-upcoming { background: var(--upcoming-soft); border-style: dashed; }
.pill.s-recent { background: var(--recent-soft); }

.detail-park {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.15;
  margin: 14px 0 2px;
}

.detail-area {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.detail-status {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.2;
  margin: 14px 0 8px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: var(--border-thin);
  display: inline-block;
}

.detail-status.s-now { background: var(--now-soft); }
.detail-status.s-upcoming { background: var(--upcoming-soft); border-style: dashed; }
.detail-status.s-recent { background: var(--recent-soft); }

.detail-window,
.detail-dist {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0 0;
  font-size: 13px;
}

.detail-window .i,
.detail-dist .i {
  margin-top: 1px;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.facts div {
  padding: 10px 12px;
  border: 2px solid var(--hairline);
  border-radius: var(--r-sm);
}

.facts dd {
  margin: 4px 0 0;
  font-weight: 600;
}

.detail h3.label {
  margin-bottom: 8px;
}

.products {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.products li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.pr-body {
  display: grid;
}

.pr-ai {
  font-size: 14px;
}

.quote {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--ground);
  border-radius: var(--r-sm);
  border-left: 5px solid var(--ink);
}

.quote blockquote {
  margin: 6px 0 0;
  font-size: 15px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.note {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Small screens ---------- */

@media (max-width: 380px) {
  .brand-word {
    font-size: 30px;
  }

  .home-headline {
    font-size: 24px;
  }

  .stat-num {
    font-size: 26px;
  }

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

/* ---------- Past applications (history.json) ---------- */

.dot-history {
  background: var(--history);
  position: relative;
}

.chip-status.s-history[aria-pressed='true'] {
  background: var(--ground);
  color: var(--ink);
}

.home-history {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--ink);
}

.home-history .i {
  margin-top: 2px;
  color: var(--muted);
}

/* History pin: a smaller sage sticker. Still quieter than planned markers
   (no status color, smaller, lighter shadow). The 32px visual sits in a 44px hit area. */
.marker-hist {
  display: block;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.marker-hist .hpin {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--history);
  box-shadow: 2px 2px 0 var(--ink);
  color: var(--ink);
  transition: transform 0.12s ease;
}

.marker-hist .hpin .i {
  width: 17px;
  height: 17px;
  stroke-width: 2.4;
}

.marker-hist:hover .hpin {
  transform: scale(1.1);
}

.marker-hist:focus-visible {
  outline: none;
}

.marker-hist:focus-visible .hpin {
  outline: 3px solid var(--upcoming);
  outline-offset: 3px;
}

.marker-hist.is-selected .hpin {
  transform: scale(1.25);
  box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 5px var(--ink), 2px 2px 0 5px var(--ink);
}

/* Count badge on planned markers whose park also has history. */
.marker .hist-badge {
  position: absolute;
  right: 0;
  top: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  border: 1.5px solid var(--surface);
  background: var(--ink);
  color: var(--surface);
  font-size: 10px;
  font-weight: 500;
  line-height: 15px;
  text-align: center;
  pointer-events: none;
}

/* List: "Past 12 months" park cards */
.group-note {
  margin: -4px 4px 10px;
  font-size: 14px;
  color: var(--muted);
}

.kind-tile.hist {
  background: var(--surface);
  color: var(--ink);
}

.park-card {
  box-shadow: 2px 2px 0 var(--hairline);
  border-color: var(--ink);
}

.park-card:hover {
  box-shadow: 3px 3px 0 var(--hairline);
}

.park-card.is-selected {
  background: var(--ground);
}

.btn-more {
  margin-top: 12px;
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.5;
  white-space: nowrap;
}

.tag-planned {
  justify-self: start;
  margin-top: 4px;
  background: var(--upcoming-soft);
  border-style: dashed;
}

/* Detail: history section and park view */
.pill.s-history {
  background: var(--surface);
}

.detail-status.s-history {
  font-size: 19px;
  background: var(--ground);
}

.hist-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px dashed var(--hairline);
}

.hist-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.2;
}

.hist-count,
.hist-summary {
  margin: 0 0 10px;
  font-size: 15px;
}

.hist-summary {
  margin-top: 12px;
  font-weight: 600;
}

.top-products {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.top-products li {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 4px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 14px;
  max-width: 100%;
}

.top-products .muted {
  font-size: 13px;
}

.tp-n {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.hrecs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.hrec {
  padding: 10px 12px;
  border: 2px solid var(--hairline);
  border-radius: var(--r-sm);
  min-width: 0;
}

.hrec:focus {
  outline: 3px solid var(--upcoming);
  outline-offset: 2px;
}

.hrec p {
  margin: 0;
}

.hrec-when {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  font-size: 12px;
  color: var(--muted);
}

.hrec-area {
  margin-top: 2px !important;
  font-weight: 700;
}

.hrec-products {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.hrec-why {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 4px !important;
  font-size: 13px;
  color: var(--muted);
}

.hr-k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hist-source {
  margin-top: 12px;
}

.hist-source a,
.ctx-sources a {
  color: var(--ink);
}

.planned-label {
  margin-top: 14px;
}

.planned-here {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.planned-row {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 44px;
  padding: 8px 12px;
  text-align: left;
  border: var(--border-thin);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font-size: 14px;
}

.planned-row .dot {
  margin-top: 4px;
}

.planned-row.s-now { background: var(--now-soft); }
.planned-row.s-upcoming { background: var(--upcoming-soft); border-style: dashed; }
.planned-row.s-recent { background: var(--recent-soft); }

/* ---------- County context (context.json) ---------- */

.context-card {
  padding: 18px;
  min-width: 0;
}

.context-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.15;
}

.ctx-years {
  margin-bottom: 12px;
}

.ctx-sub {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.bar-label {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 8px;
  min-width: 0;
}

.bar-name {
  font-weight: 700;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.type-chip {
  padding: 0 7px;
  border: 1.5px solid var(--muted);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.6;
}

.bar-val {
  margin-left: auto;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--ground);
  border: 1.5px solid var(--hairline);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ink);
  transition: width 0.25s ease;
}

.ctx-explain {
  margin: 14px 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.ctx-notes {
  margin: 0 0 10px;
  padding-left: 18px;
  font-size: 13px;
  color: var(--muted);
}

.ctx-notes li + li {
  margin-top: 2px;
}

.ctx-sources {
  margin: 0;
}

.ctx-sources span {
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill,
  .marker-hist .hpin {
    transition: none;
  }
}

/* ---------- Park trends (history.json, all periods) ---------- */

.trend-scope,
.trend-years {
  margin-bottom: 12px;
}

.chip .chip-sub {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.trend-takeaway {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: var(--border-thin);
  border-radius: var(--r-sm);
  background: var(--clear-soft);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.25;
}

.period-bars {
  gap: 6px;
}

.period-row {
  display: grid;
  grid-template-columns: 4.2em minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.period-row .pr-label {
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.period-row .bar-val {
  min-width: 4ch;
  text-align: right;
}

.period-row.is-missing .bar-val {
  color: var(--muted);
  font-size: 11px;
}

.period-row.is-missing .bar-track {
  border-style: dashed;
}

.top-bars .bar-name {
  font-size: 15px;
}

.bar-ai {
  font-size: 13px;
}

.trend-sources {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.trend-sources summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}

.trend-sources ul {
  margin: 0;
  padding-left: 18px;
}

.trend-sources li + li {
  margin-top: 4px;
}

.trend-sources a {
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* Per-park mini timeline (detail panel) */
.mini-trend {
  margin: 4px 0 16px;
  padding: 10px 12px 8px;
  border: 2px solid var(--hairline);
  border-radius: var(--r-sm);
}

.hist-section .mini-trend {
  margin-top: 12px;
}

.mini-total {
  margin: 0 0 8px;
  font-size: 15px;
}

.mini-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  gap: 3px;
  height: 64px;
}

.mb {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  border-bottom: 2px solid var(--ink);
}

.mb-n {
  font-size: 10px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.mb-bar {
  display: block;
  width: 100%;
  max-height: calc(100% - 12px);
  background: var(--ink);
  border-radius: 4px 4px 0 0;
}

.mb.is-missing {
  border-bottom-style: dashed;
  border-bottom-color: var(--muted);
}

.mb.is-missing .mb-n {
  color: var(--muted);
}

.mini-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ---------- Active ingredient buttons ---------- */

.ai-btn {
  display: inline;
  margin: 0;
  padding: 1px 2px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: underline dotted 1.5px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.ai-btn .i {
  display: inline-block;
  margin-left: 3px;
  vertical-align: -2px;
}

.ai-btn:hover {
  background: var(--upcoming-soft);
  text-decoration-style: solid;
}

.ai-btn.muted {
  color: var(--muted);
}

.ai-btn.bar-name {
  font-weight: 700;
  font-size: 15px;
}

/* ---------- Chemical explainer (modal / bottom sheet) ---------- */

body.ex-open {
  overflow: hidden;
}

.ex-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 28, 24, 0.45);
}

.explainer {
  position: fixed;
  z-index: 70;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 20px;
}

.explainer:focus {
  outline: none;
}

@media (min-width: 900px) {
  .explainer {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(520px, calc(100vw - 48px));
    max-height: calc(100dvh - 80px);
  }
}

@media (max-width: 899px) {
  .explainer {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
    box-shadow: 0 -4px 0 var(--shadow-c);
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    animation: sheet-up 0.22s ease-out;
  }

  .explainer::before {
    content: '';
    display: block;
    width: 44px;
    height: 5px;
    margin: -4px auto 10px;
    border-radius: 999px;
    background: var(--hairline);
  }
}

.explainer .pill {
  background: var(--clear-soft);
}

.ex-listed {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.ex-listed .label {
  margin-right: 4px;
}

.ex-card {
  margin-top: 14px;
}

.ex-card + .ex-card {
  padding-top: 14px;
  border-top: 2px dashed var(--hairline);
}

.ex-name {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.2;
}

.ex-kind {
  display: inline-block;
}

.ex-summary {
  margin: 10px 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.ex-rows {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}

.ex-rows div {
  padding: 10px 12px;
  border: 2px solid var(--hairline);
  border-radius: var(--r-sm);
}

.ex-rows dd {
  margin: 4px 0 0;
  font-size: 15px;
}

.ex-src-label {
  margin: 0 0 6px;
}

.ex-sources {
  margin: 0 0 12px;
  padding-left: 18px;
  font-size: 14px;
}

.ex-sources li + li {
  margin-top: 4px;
}

.ex-sources a {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.ex-disclaimer {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 2px dashed var(--hairline);
}

@media (prefers-reduced-motion: reduce) {
  .detail,
  .explainer {
    animation: none;
  }

  .tab:hover,
  .tab:active {
    transform: none;
  }
}

/* ---------- EPA label facts (labels.json) ---------- */

.pr-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
}

.pr-name-link {
  color: var(--ink);
  text-decoration: underline 1.5px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  border-radius: 6px;
}

.pr-name-link .i {
  display: inline-block;
  margin-left: 3px;
  vertical-align: -2px;
}

.pr-name-link:hover {
  background: var(--clear-soft);
}

/* Detail rows: give the label link a comfortable tap area without shifting the layout. */
.products .pr-name-link {
  padding: 4px 2px;
  margin: -4px -2px;
}

.pr-reg {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.lb-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 6px;
  vertical-align: 1px;
}

.pr-name .lb-chips,
.bar-label .lb-chips {
  margin-left: 0;
}

/* Signal words: ink outline + the word itself; stronger fill for stronger words. */
.sw-chip,
.lb-chip {
  display: inline-block;
  padding: 0 7px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.6;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
}

.sw-caution {
  background: var(--surface);
}

.sw-warning {
  background: #E6D8B8;
  border-width: 2px;
  font-weight: 700;
}

.sw-danger {
  background: var(--ink);
  border-width: 2px;
  color: #FFFFFF;
  font-weight: 700;
}

.sw-none {
  background: var(--surface);
  border-color: var(--muted);
  color: var(--muted);
}

.lb-rup {
  background: var(--surface);
  border-style: double;
  border-width: 3px;
  font-weight: 700;
}

.lb-cancelled {
  background: transparent;
  border-style: dashed;
  border-color: var(--muted);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.label-legend {
  margin-top: -6px;
  margin-bottom: 16px;
}

.top-card .label-legend {
  margin-top: 12px;
  margin-bottom: 0;
}

.label-legend a {
  color: var(--ink);
}

/* Explainer: county stream testing row */
.ex-rows .ex-stream {
  border-style: dashed;
  border-color: var(--water);
  background: #F2FAFD;
}

.ex-stream a {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}


/* ---------- Label hazards (hazards.json): hazard, not risk ---------- */

/* "Color pins by" segmented control */
.seg {
  display: inline-flex;
  justify-self: start;
  max-width: 100%;
  padding: 3px;
  gap: 3px;
  border: var(--border-thin);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.seg-btn {
  min-height: 44px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.seg-btn[aria-pressed='true'] {
  background: var(--ink);
  color: var(--surface);
}

.seg-btn[aria-pressed='false']:hover {
  background: var(--ground);
}

.hz-highlight {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.hz-mode-key {
  margin: 0;
  font-size: 14px;
}

.hz-highlight .label {
  margin-top: 2px;
}

.hz-hl-chip[aria-pressed='true'] .i {
  stroke-width: 2.6;
}

.hz-mode-note {
  margin: 0;
}

/* Hazard-mode pins: fill by signal word, letter instead of the kind icon. */
.marker.hz-pin .pin,
.marker-hist.hz-pin .hpin {
  border-style: solid;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.pin-glyph {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1;
}

.marker .pin .pin-glyph {
  transform: rotate(45deg);
}

.marker-hist .hpin .pin-glyph {
  font-size: 15px;
}

.hz-danger .pin,
.hz-danger .hpin,
.hz-swatch.hz-danger {
  background: var(--hz-danger);
  color: #FFFFFF;
}

.hz-warning .pin,
.hz-warning .hpin,
.hz-swatch.hz-warning {
  background: var(--hz-warning);
  color: #FFFFFF;
}

.hz-caution .pin,
.hz-caution .hpin,
.hz-swatch.hz-caution {
  background: var(--hz-caution);
  color: var(--ink);
}

.hz-unknown .pin,
.hz-unknown .hpin,
.hz-swatch.hz-unknown {
  background: var(--hz-unknown);
  color: var(--ink);
}

.marker.hz-unknown .pin,
.marker-hist.hz-unknown .hpin,
.hz-swatch.hz-unknown {
  border-style: dashed;
}

/* Highlight: matching pins get a bold ring; the rest dim. */
.marker.hz-ring .pin,
.marker-hist.hz-ring .hpin {
  box-shadow: 0 0 0 2.5px #FFFFFF, 0 0 0 6px var(--ink), 2px 2px 0 6px var(--shadow-c);
}

.marker.hz-dim .pin,
.marker-hist.hz-dim .hpin,
.marker.hz-dim .hist-badge {
  opacity: 0.35;
}

.marker.hz-dim:focus-visible .pin,
.marker-hist.hz-dim:focus-visible .hpin,
.marker.hz-dim.is-selected .pin,
.marker-hist.hz-dim.is-selected .hpin {
  opacity: 1;
}

/* Hazard legend on the map */
.map-legend-hz {
  right: 12px;
  max-width: 460px;
  border-radius: 16px;
  gap: 4px 12px;
  padding: 8px 12px;
}

.map-legend-hz .lg-title,
.map-legend-hz .lg-note {
  flex: 1 0 100%;
}

.map-legend-hz .lg-title {
  text-transform: uppercase;
  color: var(--muted);
  font-size: 10px;
}

.map-legend-hz .lg-note {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0;
  line-height: 1.35;
  color: var(--muted);
}

.hz-swatch {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 700;
  font-size: 10px;
  line-height: 1;
}

@media (max-width: 420px) {
  .map-legend-hz {
    justify-content: flex-start;
    gap: 2px 10px;
    padding: 6px 10px;
  }

  .map-legend-hz .lg-title {
    display: none;
  }
}

/* Detail panel: small hazard icons per product (title + visually hidden text, plus a visible key). */
.hz-icons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  vertical-align: middle;
}

.hr-prod .hz-icons {
  margin-left: 4px;
}

.hz-ic {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
}

.hz-ic.is-high {
  border-width: 3px;
  border-style: double;
}

/* Dogs & pets / Children: a dashed ring is a label precaution; solid and thicker when a label says harmful.
   The title and visually hidden text say which. */
.hz-ic.is-prec {
  border-style: dashed;
}

.hz-ic.is-aud-toxic {
  border-width: 2.5px;
}

.hz-i {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.hz-key {
  margin: -6px 0 16px;
}

.hrecs + .hz-key,
.btn-more + .hz-key {
  margin-top: 10px;
}

.hz-key p {
  margin: 0;
}

.hz-key-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  color: var(--ink);
}

.hz-key-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
}

.hz-note-text {
  margin-top: 4px !important;
}

/* Explainer: "What the labels warn about" */
.ex-hz {
  margin: 0 0 12px;
  padding: 10px 12px 4px;
  border: 2px solid var(--ink);
  border-radius: var(--r-sm);
  background: #FBF4F8;
}

.ex-hz-title {
  margin: 0 0 6px;
  color: var(--ink);
}

.ex-hz-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ex-hz-list > li + li {
  border-top: 1.5px dashed var(--hairline);
}

.ex-hz-d summary,
.ex-hz-plain {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 44px;
  padding: 10px 0;
  font-size: 15px;
}

.ex-hz-d summary {
  cursor: pointer;
  list-style: none;
}

.ex-hz-d summary::-webkit-details-marker {
  display: none;
}

.ex-hz-d summary::after {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  margin: 6px 4px 0 auto;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
}

.ex-hz-d[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 10px;
}

.ex-hz-d summary .hz-i,
.ex-hz-plain .hz-i {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.ex-hz-quotes {
  list-style: none;
  margin: 0 0 10px 26px;
  padding: 0;
  font-size: 14px;
}

.ex-hz-quotes li {
  padding: 6px 0;
}

.ex-hz-quotes li + li {
  border-top: 1px solid var(--hairline);
}

.ex-hz-q {
  display: block;
  margin: 2px 0;
  font-style: italic;
  overflow-wrap: anywhere;
}

.ex-hz-quotes a {
  color: var(--ink);
  font-weight: 600;
}

.hz-tag {
  display: inline-block;
  padding: 0 6px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.ex-hz-status {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.ex-hz-note {
  margin: 8px 0;
}

@media (prefers-reduced-motion: reduce) {
  .marker.hz-pin .pin,
  .marker-hist.hz-pin .hpin {
    transition: none;
  }
}
