/* Light colors stay in each declaration's fallback, preserving the original UI.
   Dark tokens distinguish surfaces, readable accents, and solid action fills. */
:root {
  color-scheme: light;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --theme-canvas: #141c19;
  --theme-surface: #1d2823;
  --theme-surface-soft: #202d26;
  --theme-surface-hover: #2a3a30;
  --theme-surface-glass: rgb(29 40 35 / 96%);
  --theme-canvas-glass: rgb(20 28 25 / 96%);
  --theme-fade: rgb(20 28 25 / 0%);
  --theme-text: #e6ece6;
  --theme-secondary: #b7c5b9;
  --theme-muted: #a7b6aa;
  --theme-border: #415449;
  --theme-border-strong: #799783;
  --theme-accent: #a9d6bb;
  --theme-action: #356348;
  --theme-clay: #e8af91;
  --theme-clay-action: #935333;
  --theme-warning-surface: #352b22;
  --theme-warning-text: #edc592;
  --theme-danger-text: #ffb4a6;
  --theme-info-surface: #22313e;
  --theme-info-text: #b5d4f1;
  --theme-focus: #e8af91;
  background: var(--theme-canvas);
  color: var(--theme-text);
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--theme-border, #d9ded4);
  border-radius: 50%;
  background: var(--theme-surface, #fff);
  color: var(--theme-accent, #284e40);
  cursor: pointer;
}
.theme-toggle:hover {
  background: var(--theme-surface-hover, #e9ede4);
}
.theme-toggle:focus-visible {
  outline: 3px solid var(--theme-focus, #ae775a);
  outline-offset: 3px;
}
[data-theme-toggle] {
  width: auto;
  padding: 0 14px;
  border-radius: 22px;
  font: inherit;
  font-size: 13px;
}
html[data-theme='dark'] input::placeholder,
html[data-theme='dark'] textarea::placeholder {
  color: var(--theme-muted);
  opacity: 1;
}
/* Preserve map tiles and photography; only the map's UI follows the theme. */
html[data-theme='dark'] .leaflet-container {
  background: var(--theme-surface);
  color: var(--theme-text);
}
html[data-theme='dark'] .leaflet-popup-content-wrapper,
html[data-theme='dark'] .leaflet-popup-tip,
html[data-theme='dark'] .leaflet-bar a {
  background: var(--theme-surface);
  color: var(--theme-text);
}
html[data-theme='dark'] .leaflet-bar a:hover {
  background: var(--theme-surface-hover);
}
html[data-theme='dark'] .leaflet-control-attribution {
  background: var(--theme-surface-glass);
  color: var(--theme-secondary);
}
html[data-theme='dark'] .leaflet-control-attribution a,
html[data-theme='dark'] .leaflet-container a.leaflet-popup-close-button {
  color: var(--theme-accent);
}
@media (max-width: 520px) {
  .header-actions {
    gap: 2px;
  }
  .header-actions .theme-toggle {
    width: 44px;
    height: 44px;
  }
}
