/* color-scheme tells Chrome and dark-mode extensions the page already has a dark theme, so they don't invert it a second time. */
html { color-scheme: light; }

.theme-toggle {
  margin-left: 18px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font: 600 13px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions .theme-toggle { margin-left: 0; }

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8eef6;
  --muted: #a9b7c8;
  --line: #2c3a4a;
  --bg: #0e141b;
  --brand: #2dd4bf;
  --brand-dark: #5eead4;
  --accent: #fbbf24;
  --card: #17202a;
}

html[data-theme="dark"] .btn:not(.ghost) { background: #0f766e; color: #fff !important; }
html[data-theme="dark"] .btn:not(.ghost):hover { background: #0d9488; }

html[data-theme="dark"] .hero {
  background: linear-gradient(180deg, #13261f 0%, var(--bg) 100%);
}
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .step::before,
html[data-theme="dark"] .stage::before {
  background: #134e4a;
  color: #5eead4;
}
html[data-theme="dark"] .redact { background: #3b4b5e; }
html[data-theme="dark"] th { background: #132e2b; color: #5eead4; }
html[data-theme="dark"] .pill { display: inline-block; width: auto; background: #14532d; color: #86efac; }
html[data-theme="dark"] section.band,
html[data-theme="dark"] #how,
html[data-theme="dark"] #pricing {
  background: #121a23 !important;
}
html[data-theme="dark"] a.lead:hover,
html[data-theme="dark"] .map-hit.on { background: #132e2b; }
html[data-theme="dark"] .sample { box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .8); }
html[data-theme="dark"] #map,
html[data-theme="dark"] .ntl-map { background: #1b2633; }
html[data-theme="dark"] .final {
  background: #070b10;
  border: 1px solid var(--line);
  color: #e2e8f0;
}
html[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.95);
}
html[data-theme="dark"] .leaflet-popup-content-wrapper,
html[data-theme="dark"] .leaflet-popup-tip {
  background: var(--card);
  color: var(--ink);
}
html[data-theme="dark"] .leaflet-popup-content a,
html[data-theme="dark"] .leaflet-control-attribution a { color: #5eead4; }
html[data-theme="dark"] .leaflet-bar a {
  background: var(--card);
  color: var(--ink);
  border-bottom-color: var(--line);
}
html[data-theme="dark"] .leaflet-bar a:hover { background: #1e2a36; }
html[data-theme="dark"] .leaflet-control-attribution {
  background: rgba(23, 32, 42, .92);
  color: var(--muted);
}

@media (max-width: 900px) {
  header .wrap {
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  header nav,
  .header-actions {
    display: flex;
    align-items: center;
    flex: 1 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
  }
  .theme-toggle,
  header nav .btn { margin-left: 0; flex: none; }
}
