/* Map engine (lib/mapkit.js) — markers, cones' HTML parts, popups, the position-editor panel, map
   containers. Shared by the map, site and queue views; owned by lib. The basemap follows the theme
   (BASEMAP_FLAVOR / BASEMAP_FLAVOR_LIGHT); marker outlines and label scrims stay dark (--map-*) — they read
   on both flavours.
   State colours: alarm red · dark (cameras down) amber · ok green · disarmed grey · live vehicle blue. */
.mapbox .off, .minimap .off { height: 100%; display: grid; place-items: center; color: var(--media-ink-2); padding: var(--sp-3); text-align: center; background: var(--map-bubble); }
.s-alarm { --mk: var(--danger); } .s-dark { --mk: var(--cam-stale); } .s-ok { --mk: var(--ok); } .s-disarmed { --mk: var(--map-idle); }
.s-online { --mk: var(--ok); } .s-offline { --mk: var(--cam-stale); } .s-unknown { --mk: var(--map-idle); } .s-site { --mk: var(--map-ink); } .s-live { --mk: var(--info-ink); }
.mk-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--map-outline); background: var(--mk); flex: none; }
.mk-pin { position: relative; width: 22px; height: 30px; cursor: pointer; filter: drop-shadow(0 1px 2px var(--map-shadow)); }
.mk-pin i { display: block; width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--mk, var(--map-ink)); border: 2px solid var(--map-outline); }
.mk-pin.parked { opacity: .45; }
.mk-pin.edit { cursor: grab; }
.mk-veh { position: relative; cursor: pointer; display: grid; place-items: center; }
.mk-veh svg { display: block; filter: drop-shadow(0 1px 2px var(--map-shadow)); }
.mk-veh path { fill: var(--mk, var(--info-ink)); stroke: var(--map-outline); stroke-width: 1.5; }
.mk-veh .mk-age { position: absolute; top: 28px; white-space: nowrap; font: var(--fs-2xs) var(--font-mono); background: var(--map-scrim); color: var(--map-ink); padding: 0 4px; border-radius: var(--r-xs); }
.mk-veh.stale path { opacity: .5; } .mk-veh.stale .mk-age { background: var(--danger); color: var(--on-danger); }
.mk-cam { position: relative; display: flex; align-items: center; gap: 4px; cursor: pointer; transform: translateX(calc(50% - 7px)); }
.mk-cam i { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--mk, var(--map-idle)); border: 2px solid var(--map-outline); box-shadow: 0 0 0 1px var(--map-halo); }
.mk-cam span { font-size: var(--fs-2xs); white-space: nowrap; background: var(--map-scrim); padding: 0 4px; border-radius: var(--r-xs); color: var(--map-ink); }
.mk-cam.gps i { border-style: dashed; }
.mk-cam.edit { cursor: grab; }
.mk-aim { width: 14px; height: 14px; background: var(--accent); border: 2px solid var(--map-outline); transform: rotate(45deg); cursor: grab; }
/* Alarm: a ring expands out of the marker every 2.2 s (the #/map view's language) — calmer than a blink and
   never hides the marker itself. Reduced motion: a static ring. */
.mk-pin.s-alarm::before, .mk-veh.s-alarm::before, .mk-cam.s-alarm::before {
  content: ''; position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  border: 2px solid var(--danger); pointer-events: none; animation: mk-ring 2.2s var(--ease-out) infinite;
}
.mk-pin.s-alarm::before { left: 50%; top: 11px; }
.mk-veh.s-alarm::before { left: 50%; top: 50%; }
.mk-cam.s-alarm::before { left: 7px; top: 50%; }
@keyframes mk-ring { from { transform: scale(0.8); opacity: 0.95; } to { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mk-pin.s-alarm::before, .mk-veh.s-alarm::before, .mk-cam.s-alarm::before { animation: none; transform: scale(1.6); opacity: 0.8; } }
.mpop { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--ink); min-width: 200px; }
.mpop .red { color: var(--danger-ink); }
.maplibregl-popup-content { background: var(--surface) !important; color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-md) !important; padding: 10px 12px !important; box-shadow: var(--shadow-3) !important; font-family: var(--font-ui); }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-popup-close-button { color: var(--ink-2); font-size: 16px; }
.maplibregl-ctrl-attrib { font-size: 10px; }
/* Compact attribution starts expanded until the map is dragged — never, on the non-interactive alarm
   inset, where it covers the camera. There it shows on hover/tap of the ⓘ. */
.minimap .maplibregl-ctrl-attrib:not(:hover) .maplibregl-ctrl-attrib-inner { display: none; }
.mapedit table input { padding: 3px 5px; min-height: 28px; }
.mappanel .mapedit { margin-top: var(--sp-1); }
