/* Shared map component. Pairs with js/geo.js on every page that shows a map.

   The basemap can be light (Roads, Terrain) or dark (Satellite, Dark), so
   nothing here may rely on the page's dark ground: controls carry their own
   surface, and every pin carries a dark outline so it survives snow, water,
   and satellite imagery alike. */

.geo-map {
  position: relative;
  z-index: 0;
  min-height: 22rem;
  background: var(--bg-2);
}

/* ---- controls -------------------------------------------------------- */
.geo-basemaps,
.geo-layers {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: rgba(14, 13, 11, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.geo-layers { flex-direction: column; }

.geo-basemaps button,
.geo-layers button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--target);
  padding: 0.4rem 0.7rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 550;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.geo-layers button { justify-content: flex-start; min-width: 10.5rem; }
.geo-basemaps button .material-symbols-outlined,
.geo-layers button .material-symbols-outlined { font-size: 20px; }

.geo-basemaps button:hover,
.geo-layers button:hover { background: var(--surface-2); color: var(--paper); }

.geo-basemaps button[aria-pressed="true"],
.geo-layers button[aria-pressed="true"] {
  background: var(--amber);
  color: var(--ink);
}
/* An off layer stays legible — it is a control, not a disabled thing. */
.geo-layers button[aria-pressed="false"] { opacity: 0.72; }
.geo-layers button[aria-pressed="false"] .material-symbols-outlined { opacity: 0.6; }

.geo-n {
  margin-left: auto;
  padding-left: 0.5rem;
  font-family: var(--font-clock);
  font-size: 0.72rem;
  opacity: 0.85;
}

@media (max-width: 640px) {
  /* Labels are the first thing to go, never the touch target. */
  .geo-basemaps button span:not(.material-symbols-outlined) { display: none; }
  .geo-basemaps button { padding: 0.4rem 0.55rem; }
  .geo-layers button { min-width: 0; }
  .geo-layers button span:not(.material-symbols-outlined):not(.geo-n) { display: none; }
}

/* ---- pins ------------------------------------------------------------ */
.geo-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 1px;
  border-radius: 50%;
  border: 2px solid #0e0d0b;
  background: var(--amber);
  color: #0e0d0b;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
  transition: transform 0.08s ease;
}
.geo-pin .material-symbols-outlined { font-size: 16px; line-height: 1; }
.leaflet-marker-icon:hover .geo-pin { transform: scale(1.18); }

.geo-pin.cam { background: var(--amber); }
.geo-pin.fire { background: #e35b2a; color: #fff; }
.geo-pin.inc { background: #f0b429; }
.geo-pin.inc-bad { background: #d7391f; color: #fff; }
.geo-pin.inc-warn { background: #f0b429; }
.geo-pin.inc-low { background: #8fa1b3; }

/* The selected pin has to win against a busy satellite tile, so it gets a
   white ring and real size rather than a colour change alone. */
.geo-pin.is-on {
  transform: scale(1.35);
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(227, 160, 8, 0.55), 0 2px 8px rgba(0, 0, 0, 0.7);
  z-index: 500;
}

.geo-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #0e0d0b;
  background: rgba(227, 160, 8, 0.94);
  color: #0e0d0b;
  font-family: var(--font-clock);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
  cursor: pointer;
}
.geo-cluster.fire { background: rgba(227, 91, 42, 0.94); color: #fff; }
.geo-cluster.inc { background: rgba(215, 57, 31, 0.94); color: #fff; }
.leaflet-marker-icon:hover .geo-cluster { border-color: #fff; }

/* ---- leaflet chrome on a light basemap ------------------------------- */
.geo-map .leaflet-control-zoom a {
  width: 34px;
  height: 34px;
  line-height: 32px;
  background: rgba(14, 13, 11, 0.92);
  color: var(--paper);
  border-color: var(--line);
  font-size: 1.15rem;
}
.geo-map .leaflet-control-zoom a:hover { background: var(--surface-2); color: var(--amber); }
.geo-map .leaflet-control-attribution {
  background: rgba(14, 13, 11, 0.82);
  color: var(--faint);
  font-size: 0.68rem;
}
.geo-map .leaflet-control-attribution a { color: var(--muted); }
.geo-map .leaflet-popup-content-wrapper,
.geo-map .leaflet-popup-tip {
  background: var(--surface);
  color: var(--paper);
  border: 1px solid var(--line);
}
.geo-map .leaflet-popup-content { margin: 0.7rem 0.9rem; font-size: 0.9rem; }
.geo-map .leaflet-popup-content a { color: var(--amber); }
.geo-map .leaflet-container a.leaflet-popup-close-button { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .geo-pin { transition: none; }
}
