/* hymaps-safety.css — hyMaps v2.1 live SAFETY / HAZARDS overlay styling
 * ──────────────────────────────────────────────────────────────────────────
 * Owned by maps-safety. Styles ONLY this domain's DOM markers (rendered through
 * the engine's E.addMarker wrapper `.hm-mk > .hm-mk-inner`) and the air-quality
 * chip. Everything is additive + self-scoped under `hmsf-` classes so it never
 * collides with other modules' CSS files.
 *
 * Neon glow is gated to dark / pitched (3D) views to keep light + flat maps calm
 * and mobile-smooth. It triggers on EITHER the shipped engine signal
 * (`html[data-hymaptype="dark"]`) OR the JS-set body flags
 * (`body.hmsf-dark` / `body.hmsf-pitched`) that hymaps-safety.js maintains.
 */

/* Resolve to Hypatia / cyber tokens when present (mirrors hymaps-cyber.css). */
:root {
  --hmsf-neon:   var(--accent, #00ffa3);
  --hmsf-neon2:  var(--info, #3ac9ff);
  --hmsf-quake-lo:  #36d399;
  --hmsf-quake-mid: #ffb454;
  --hmsf-quake-hi:  #ff4d4d;
  --hmsf-fire:      #ff5a1f;
  --hmsf-good:      #2ec4b6;
  --hmsf-bad:       #ff4d4d;
}

/* The engine marker wrapper is fixed-size; let our content fill + center it. */
.hm-mk-inner > .hmsf-quake,
.hm-mk-inner > .hmsf-hazard,
.hm-mk-inner > .hmsf-fire,
.hm-mk-inner > .hmsf-beach {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Earthquakes: magnitude-scaled disc + a pulsing ring ─────────────────── */
.hmsf-quake {
  position: relative;
  border-radius: 50%;
  color: #06121f;
  font: 700 11px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 50% 38%,
              color-mix(in srgb, var(--hmsf-quake-mid) 92%, white),
              var(--hmsf-quake-mid));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.hmsf-quake.sev-lo  { background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--hmsf-quake-lo) 92%, white), var(--hmsf-quake-lo)); }
.hmsf-quake.sev-mid { background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--hmsf-quake-mid) 92%, white), var(--hmsf-quake-mid)); }
.hmsf-quake.sev-hi  { background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--hmsf-quake-hi) 94%, white), var(--hmsf-quake-hi)); color: #fff; }
.hmsf-quake-mag { position: relative; z-index: 2; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35); }
.hmsf-quake-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid currentColor;
  color: var(--hmsf-quake-mid);
  opacity: 0.7;
  animation: hmsf-pulse 2.2s ease-out infinite;
}
.hmsf-quake.sev-lo  .hmsf-quake-ring { color: var(--hmsf-quake-lo); }
.hmsf-quake.sev-hi  .hmsf-quake-ring { color: var(--hmsf-quake-hi); animation-duration: 1.4s; }
@keyframes hmsf-pulse {
  0%   { transform: scale(0.6); opacity: 0.75; }
  70%  { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* ── Hazards (EONET + GDACS): rounded icon badge w/ alert-level color ────── */
.hmsf-hazard {
  border-radius: 9px;
  background: rgba(20, 28, 42, 0.92);
  color: #ffd66b;
  border: 1.5px solid rgba(255, 214, 107, 0.85);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}
.hmsf-hazard iconify-icon { font-size: 18px; line-height: 1; }
.hmsf-hazard.lvl-green  { color: #36d399; border-color: #36d399; }
.hmsf-hazard.lvl-orange { color: #ff9f1c; border-color: #ff9f1c; }
.hmsf-hazard.lvl-red    { color: #ff4d4d; border-color: #ff4d4d; }

/* ── Wildfire detections: small glowing ember dot ───────────────────────── */
.hmsf-fire {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #ffd24d 0%, var(--hmsf-fire) 60%, #b51f00 100%);
  box-shadow: 0 0 6px rgba(255, 90, 31, 0.8);
}

/* ── Beach water quality: teardrop pin (good = teal, advisory = red) ─────── */
.hmsf-beach {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--hmsf-good);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}
.hmsf-beach.bad { background: var(--hmsf-bad); }
.hmsf-beach iconify-icon {
  transform: rotate(45deg);
  color: #fff;
  font-size: 13px;
  line-height: 1;
}

/* ── Air-quality chip (single viewport pill, bottom-left) ────────────────── */
.hmsf-air-chip {
  position: fixed;
  left: 12px;
  bottom: 40px;
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 70vw;
  padding: 6px 11px;
  border-radius: 999px;
  font: 600 12px/1.1 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #08131f;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: saturate(150%) blur(8px);
  backdrop-filter: saturate(150%) blur(8px);
  pointer-events: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hmsf-air-chip .hmsf-air-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #9aa7b4;
}
.hmsf-air-chip.aqi-good       .hmsf-air-dot { background: #2ecc71; }
.hmsf-air-chip.aqi-mod        .hmsf-air-dot { background: #f1c40f; }
.hmsf-air-chip.aqi-usg        .hmsf-air-dot { background: #e67e22; }
.hmsf-air-chip.aqi-unhealthy  .hmsf-air-dot { background: #e74c3c; }
.hmsf-air-chip.aqi-vunhealthy .hmsf-air-dot { background: #9b59b6; }
.hmsf-air-chip.aqi-hazardous  .hmsf-air-dot { background: #7e0023; }
.hmsf-air-chip.aqi-na { opacity: 0.82; }
.hmsf-air-chip.aqi-na .hmsf-air-txt { font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════════════════
 * Neon glow — dark OR pitched (3D) views only. Matches the cyberpunk basemap.
 * Triggered by the engine's html[data-hymaptype="dark"] OR the JS body flags.
 * ═══════════════════════════════════════════════════════════════════════════ */
html[data-hymaptype="dark"] .hmsf-quake.sev-hi,
body.hmsf-dark .hmsf-quake.sev-hi,
body.hmsf-pitched .hmsf-quake.sev-hi {
  box-shadow: 0 0 14px color-mix(in srgb, var(--hmsf-quake-hi) 70%, transparent);
}
html[data-hymaptype="dark"] .hmsf-hazard,
body.hmsf-dark .hmsf-hazard,
body.hmsf-pitched .hmsf-hazard {
  background: rgba(6, 12, 20, 0.92);
  box-shadow: 0 0 12px color-mix(in srgb, currentColor 45%, transparent);
}
html[data-hymaptype="dark"] .hmsf-fire,
body.hmsf-dark .hmsf-fire,
body.hmsf-pitched .hmsf-fire {
  box-shadow: 0 0 10px rgba(255, 90, 31, 0.95), 0 0 18px rgba(255, 90, 31, 0.55);
}
html[data-hymaptype="dark"] .hmsf-beach,
body.hmsf-dark .hmsf-beach,
body.hmsf-pitched .hmsf-beach {
  border-color: color-mix(in srgb, var(--hmsf-neon2) 70%, white);
  box-shadow: 0 0 12px color-mix(in srgb, var(--hmsf-neon2) 45%, transparent);
}
html[data-hymaptype="dark"] .hmsf-air-chip,
body.hmsf-dark .hmsf-air-chip {
  color: #d6fff2;
  background: rgba(6, 12, 20, 0.82);
  border: 1px solid color-mix(in srgb, var(--hmsf-neon) 36%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--hmsf-neon) 22%, transparent);
}

/* ── Accessibility / low-power: stop the quake pulse animation ───────────── */
@media (prefers-reduced-motion: reduce) {
  .hmsf-quake-ring { animation: none; opacity: 0.4; }
}

/* ── Small screens: nudge the air chip clear of bottom UI ────────────────── */
@media (max-width: 480px) {
  .hmsf-air-chip { left: 8px; bottom: 64px; font-size: 11px; padding: 5px 9px; }
}
