/* Shared styles for the map pages. Every color comes from ../css/tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 700px at 10% -10%, var(--bg-glow-a), transparent 60%),
    radial-gradient(900px 600px at 100% 110%, var(--bg-glow-b), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0; }
a { color: var(--bay); }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; color: inherit; }

/* Header */
.maps-header {
  position: sticky; top: 12px; z-index: 1000;
  margin: 12px 16px 0;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 16px;
  border-radius: 999px;
}
.maps-header .brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.maps-header .brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(140deg, var(--redwood), var(--bay));
  flex: none;
}
.maps-nav {
  display: flex; gap: 2px; margin-left: auto; overflow-x: auto;
  scrollbar-width: none; min-width: 0;
}
.maps-nav::-webkit-scrollbar { display: none; }
.maps-nav a {
  padding: 7px 12px; border-radius: 999px; white-space: nowrap;
  color: var(--ink-soft); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.maps-nav a:hover { color: var(--ink); background: var(--glass-strong); }
.maps-nav a[aria-current="page"] { color: var(--ink); background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--glass-rim); }

/* Theme toggle: the icon travels with the knob, one clock for every property */
.theme-toggle {
  flex: none; position: relative; width: 52px; height: 30px; padding: 0;
  border-radius: 999px; border: 1px solid var(--glass-rim);
  background: var(--glass-strong); cursor: pointer;
}
.theme-thumb {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--poppy); color: var(--on-poppy);
  display: grid; place-items: center;
  transition: transform var(--duration) var(--ease), background var(--duration) var(--ease);
}
.theme-thumb svg { position: absolute; width: 14px; height: 14px; fill: currentColor; stroke: currentColor; stroke-width: 1.8;
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease); }
.theme-thumb .icon-moon { stroke: none; opacity: 0; transform: rotate(-40deg) scale(0.6); }
:root[data-theme="dark"] .theme-thumb { transform: translateX(22px); background: var(--bay); }
:root[data-theme="dark"] .theme-thumb .icon-sun { opacity: 0; transform: rotate(40deg) scale(0.6); }
:root[data-theme="dark"] .theme-thumb .icon-moon { opacity: 1; transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-thumb { transform: translateX(22px); background: var(--bay); }
  :root:not([data-theme]) .theme-thumb .icon-sun { opacity: 0; transform: rotate(40deg) scale(0.6); }
  :root:not([data-theme]) .theme-thumb .icon-moon { opacity: 1; transform: none; }
}

/* Page scaffolding */
.page { padding: 20px 16px 32px; max-width: 1480px; margin: 0 auto; }
.page-intro { max-width: 760px; margin: 8px 0 18px; }
.page-intro h1 { font-size: clamp(28px, 4.2vw, 44px); line-height: 1.05; font-weight: 750; }
.page-intro p { color: var(--ink-soft); font-size: 16px; line-height: 1.55; margin: 10px 0 0; }

.panel { padding: 18px 20px; border-radius: var(--radius-md); }
.panel h2 { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.muted { color: var(--ink-soft); }
.note { color: var(--ink-soft); font-size: 13px; line-height: 1.45; }

.button-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--glass-rim); background: var(--glass-strong); color: var(--ink);
  padding: 7px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.chip:hover { box-shadow: inset 0 0 0 1px var(--map-county-line); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: transparent; }

/* Tooltip */
.map-tooltip {
  position: fixed; z-index: 2000; pointer-events: none;
  padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4;
  background: var(--glass-strong); color: var(--ink);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-rim); box-shadow: var(--glass-shadow);
  opacity: 0; transition: opacity 120ms var(--ease);
  max-width: 260px;
}
.map-tooltip.show { opacity: 1; }
.map-tooltip strong { font-family: var(--font-display); font-size: 14px; }

/* Stat lists */
.stat-list { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0; font-size: 14px; }
.stat-list dt { color: var(--ink-soft); }
.stat-list dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.stat-list dd.na { font-weight: 400; color: var(--ink-soft); font-style: italic; }

.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; flex: none; }

.footer { padding: 24px 16px 32px; text-align: center; color: var(--ink-soft); font-size: 13px; }

@media (max-width: 640px) {
  .maps-header { flex-wrap: wrap; border-radius: var(--radius-md); padding: 8px 10px; row-gap: 6px; }
  .maps-header .brand { margin-right: auto; }
  .maps-nav { order: 3; width: 100%; margin-left: 0; flex-wrap: wrap; overflow: visible; }
  .maps-nav a { padding: 6px 10px; font-size: 13px; }
}

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

/* OpenStreetMap fallback in dark mode: darken the light tiles to sit on the dark ground */
.basemap-osm-dark { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.35); }
