/* Offline-map feature styles: the live location dot + precision indicator and its
   error notice (public/js/location-dot.js), plus the map toolbar controls that live
   OUTSIDE the map -- the Topo/Satellite base toggle and the Save-offline button
   (public/js/offline.js). One stylesheet, linked from the page shell, so these
   controls look the same on every surface and never re-inline per page. */

/* The dot: a solid blue disc with a white ring and a soft shadow. The icon is 18x18 with a [9,9]
   anchor, so the 16px children sit at inset 1px (centred on the fix) and the dot has a real tap
   target for the precision popup. */
.loc-dot-icon { position: relative; }
.loc-dot {
  position: absolute;
  left: 1px; top: 1px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #1a73e8;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* Heading cone: emanates from the dot centre toward the facing direction; JS rotates it and
   un-hides it only when the compass is accurate. Centred on the [9,9] anchor (64px box, so a
   -23px inset puts its middle on the dot), rotating about that centre. */
.loc-dot-cone {
  position: absolute;
  left: -23px; top: -23px;
  width: 64px; height: 64px;
  transform-origin: center;
  pointer-events: none;
}
.loc-dot-cone[hidden] { display: none; }

/* A slow expanding halo so a live fix reads as "actively tracking" without being noisy. */
.loc-dot-pulse {
  position: absolute;
  left: 1px; top: 1px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(26, 115, 232, 0.35);
  animation: loc-pulse 2.4s ease-out infinite;
}
@keyframes loc-pulse {
  0%   { transform: scale(1);   opacity: 0.6; }
  70%  { transform: scale(3.2); opacity: 0;   }
  100% { transform: scale(3.2); opacity: 0;   }
}
@media (prefers-reduced-motion: reduce) {
  .loc-dot-pulse { animation: none; opacity: 0; }
}

/* Locate button: matches the Leaflet zoom bar; colour tracks tracking state. The selector is
   qualified with `.leaflet-bar a` so its flex layout OUTRANKS Leaflet's own `.leaflet-bar a {
   display:block }` (equal-specificity block flow was leaving the crosshair riding up and to the
   left); `svg{display:block}` drops the inline-baseline gap, so the icon sits dead-centre. */
.leaflet-bar a.loc-ctrl-btn {
  display: flex; align-items: center; justify-content: center;
  color: #3a4a3d;
}
.loc-ctrl-btn svg { display: block; }
.loc-ctrl-btn.is-locating { color: #1a73e8; animation: loc-spin 1.2s linear infinite; }
.loc-ctrl-btn.is-following { color: #1a73e8; background: #eaf1fe; }
.loc-ctrl-btn.is-paused { color: #1a73e8; }
.loc-ctrl-btn.is-error { color: #c0392b; }
@keyframes loc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .loc-ctrl-btn.is-locating { animation: none; }
}

/* Precision popup: tap the dot to see the exact accuracy + facing direction. Replaces the old
   bottom-left readout pill, which piled up with the wildness key + attribution. */
.loc-pop .leaflet-popup-content { margin: 8px 12px; }
.loc-pop-title { display: block; font-weight: 700; color: #2f3a30; font-size: 13px; }
.loc-pop-acc { display: block; margin-top: 2px; font-size: 12px; color: #5a6156; }
.loc-pop-acc.loc-acc-good { color: #2e7d46; }
.loc-pop-acc.loc-acc-fair { color: #b07d16; }
.loc-pop-acc.loc-acc-poor { color: #c0392b; }

/* Base-map toggle (Topo / Satellite): a segmented control that lives in the map toolbar OUTSIDE
   the map, driving the base layers via map-setup.selectBaseLayer. */
.map-basetoggle { display: inline-flex; border: 1px solid #d3dbcd; border-radius: 8px; overflow: hidden; }
.map-basetoggle[hidden] { display: none; }
.map-basetoggle button {
  padding: 6px 14px; border: 0; background: #fff; cursor: pointer;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #3a4a3d;
}
.map-basetoggle button + button { border-left: 1px solid #d3dbcd; }
.map-basetoggle button.is-active { background: #4C6152; color: #fff; }

/* Weather-radar toggle -- a toolbar button (outside the map); filled green while the radar is on. */
.map-tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid #d3dbcd; border-radius: 8px; background: #fff;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #3a4a3d;
  cursor: pointer;
}
.map-tool-btn svg { flex: none; }
.map-tool-btn[hidden] { display: none; }
.map-tool-btn.is-on { background: #4C6152; border-color: #4C6152; color: #fff; }

/* Overlays dropdown: one "Overlays" button hosting a checklist popover, so weather radar +
   sightshed + soundshed share a single toolbar slot instead of three side-by-side buttons. */
.map-overlays { position: relative; display: inline-flex; }
/* Mounted as a Leaflet control (home explore map): sit above the sibling layers control
   (default .leaflet-control z-index) so the open panel covers it instead of it poking through. */
.leaflet-control.map-overlays { z-index: 810; }
.map-overlays-panel {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 1000;
  min-width: 172px; padding: 5px;
  background: #fff; border: 1px solid #d3dbcd; border-radius: 10px;
  box-shadow: 0 6px 20px rgba(20,26,20,.18);
  display: flex; flex-direction: column; gap: 2px;
}
.map-overlays-panel[hidden] { display: none; }
.overlay-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 6px; width: 100%;
  border: 0; border-radius: 7px; background: none; cursor: pointer;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #3a4a3d;
  text-align: left;
}
.overlay-item:hover, .overlay-item:focus-visible { background: #eef3e8; outline: none; }
.overlay-item svg { flex: none; }
/* The leading check is hidden until the overlay is on; the feature icon then sits after it. */
.overlay-item .overlay-check { visibility: hidden; color: #4C6152; }
.overlay-item.is-on { color: #4C6152; }
.overlay-item.is-on .overlay-check { visibility: visible; }

/* "Save offline" button -- now a toolbar button (outside the map), with the download glyph + label;
   turns green once the bundle is saved. `is-offline` recolours it into a static offline-state label. */
.offline-save {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid #cfe0d5; border-radius: 8px;
  background: #fff;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #4C6152;
  cursor: pointer;
}
.offline-save[hidden] { display: none; }
.offline-save:disabled { cursor: default; }
.offline-save.is-saved { color: #2e7d46; border-color: #bfe0c9; background: #f2faf5; }
.offline-save.is-offline { color: #6b7a5e; border-color: #dfe3d8; background: #f3f5f1; cursor: default; }
.offline-save svg { flex: none; }

/* Location-error alert: a bare red button leaves the user stuck, so on failure a prominent,
   dismissable card is centred over the map behind a dimming scrim that pulls focus to the fix. */
.loc-error-scrim {
  position: absolute; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(22, 30, 24, 0.5);
}
.loc-error {
  position: relative;
  width: 100%; max-width: 400px;
  display: grid; grid-template-columns: auto 1fr; gap: 12px;
  padding: 16px 40px 16px 16px;
  background: #fff; border-radius: 12px; border-top: 5px solid #c0392b;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
  font: 400 13.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #2a2f28;
}
.loc-error-icon { color: #c0392b; margin-top: 1px; }
.loc-error-title { display: block; color: #c0392b; font-weight: 800; font-size: 15.5px; margin-bottom: 4px; }
.loc-error-body { margin: 0 0 6px; }
.loc-error-steps { margin: 0; padding-left: 20px; }
.loc-error-steps li { margin: 4px 0; }
.loc-error-detail { margin: 10px 0 0; font-size: 11.5px; color: #8a938a; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.loc-error-close {
  position: absolute; top: 8px; right: 10px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: #9aa4a0; padding: 2px 4px;
}
.loc-error-close:hover { color: #5a6156; }
