/* hymaps-ufo.css — UFO Sightings live layer skin
 * ──────────────────────────────────────────────────────────────────────────
 * Engine-agnostic DOM marker skins (alien-green #39ff14) + a glass info
 * popup + cluster bubbles, owned by hymaps-ufo.js.
 * Follows the same structure/conventions as hymaps-marine.css:
 *   • No hardcoded brand palette except the UFO accent (#39ff14 / #ff6b35);
 *     everything else falls back to theme tokens.
 *   • Neon glow is gated to dark map type (html.hm-mt-dark /
 *     :root[data-hymaptype="dark"]) so clean/light/satellite stay calm.
 *   • Animation is gated to dark AND disabled under prefers-reduced-motion.
 */

/* ── layer accent variables ───────────────────────────────────────────── */
:root {
  --ufo-green:      #39ff14;
  --ufo-green-dim:  rgba(57, 255, 20, .35);
  --ufo-green-glow: rgba(57, 255, 20, .6);
  --ufo-crash:      #ff6b35;
  --ufo-crash-dim:  rgba(255, 107, 53, .3);
}

/* ── sighting marker (alien-green circle) ─────────────────────────────── */
.hm-ufo-mk {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #001a00;
  background: var(--ufo-green, #39ff14);
  border: 1.5px solid rgba(255, 255, 255, .85);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  cursor: pointer;
  transition: transform .12s cubic-bezier(.2,.9,.3,1);
}
.hm-ufo-mk iconify-icon { font-size: 16px; line-height: 1; }
.hm-ufo-mk:hover { transform: scale(1.12); }

/* crash-retrieval / nuclear-encounter marker — red-orange with white icon */
.hm-ufo-mk.is-crash {
  color: #fff;
  background: var(--ufo-crash, #ff6b35);
  border-color: rgba(255, 255, 255, .9);
}

/* ── cluster bubble ───────────────────────────────────────────────────── */
/* Circular badge rendered by the engine at a scaled size proportional to
 * cluster count. Alien-green fill; mixed green/orange when crashes are
 * present in the cluster. */
.hm-ufo-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font: 700 12px/1 -apple-system, system-ui, sans-serif;
  color: #001a00;
  background: var(--ufo-green, #39ff14);
  border: 2px solid rgba(57, 255, 20, .65);
  box-shadow: 0 0 8px rgba(57, 255, 20, .35), 0 2px 6px rgba(0, 0, 0, .4);
  cursor: pointer;
  transition: transform .12s cubic-bezier(.2,.9,.3,1);
  user-select: none;
}
.hm-ufo-cluster:hover { transform: scale(1.1); }
/* Mixed cluster containing crash/nuclear retrievals */
.hm-ufo-cluster.has-crash {
  background: linear-gradient(135deg, var(--ufo-green, #39ff14) 50%, var(--ufo-crash, #ff6b35) 100%);
  color: #fff;
  border-color: rgba(255, 107, 53, .5);
}

/* ── shared info popup (glass card / bottom sheet on mobile) ──────────── */
.hm-ufo-pop {
  position: fixed;
  inset: 0;
  z-index: 6200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, .28);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.hm-ufo-pop.show { display: flex; }
.hm-ufo-pop-card {
  position: relative;
  width: min(420px, 94vw);
  margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  padding: 16px 16px 14px;
  border-radius: 18px;
  color: var(--text, #0a1722);
  background: var(--bg-card, rgba(255, 255, 255, .98));
  border: 1px solid var(--ufo-green-dim, rgba(57, 255, 20, .3));
  box-shadow: 0 18px 50px rgba(0, 0, 0, .4), 0 0 22px rgba(57, 255, 20, .1);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  animation: hm-ufo-rise .18s cubic-bezier(.2,.9,.3,1);
}
@keyframes hm-ufo-rise {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
/* Close button — ≥44×44px touch target per iOS design rules */
.hm-ufo-pop-x {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted, #6b7785);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}
.hm-ufo-pop-x:hover { background: rgba(0,0,0,.06); }

/* Popup header row — icon + title + badge */
.hm-ufo-pop-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 800 15px/1.2 -apple-system, system-ui, sans-serif;
  margin: 0 40px 10px 0;
}
.hm-ufo-pop-hd iconify-icon {
  font-size: 20px;
  color: var(--ufo-green, #39ff14);
  flex: none;
}
.hm-ufo-pop-hd.is-crash iconify-icon { color: var(--ufo-crash, #ff6b35); }

/* Key-value data rows */
.hm-ufo-pop-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-top: 1px solid var(--border, rgba(0, 0, 0, .08));
  font: 500 13px/1.3 -apple-system, system-ui, sans-serif;
}
.hm-ufo-pop-row span { color: var(--muted, #6b7785); }
.hm-ufo-pop-row b {
  font-weight: 700;
  text-align: right;
  max-width: 64%;
  word-break: break-word;
}
.hm-ufo-pop-row small { color: var(--muted, #6b7785); font-weight: 600; }

/* Description snippet box */
.hm-ufo-desc {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  font: 500 12px/1.5 -apple-system, system-ui, sans-serif;
  color: var(--text, #0a1722);
  background: rgba(57, 255, 20, .07);
  border: 1px solid rgba(57, 255, 20, .22);
}
.hm-ufo-desc.is-crash {
  background: rgba(255, 107, 53, .07);
  border-color: rgba(255, 107, 53, .22);
}

/* Source / type badge */
.hm-ufo-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font: 800 10px/1.4 -apple-system, system-ui, sans-serif;
  letter-spacing: .04em;
  background: rgba(57, 255, 20, .15);
  color: #002200;
  border: 1px solid var(--ufo-green, #39ff14);
  white-space: nowrap;
}
.hm-ufo-badge.is-crash {
  background: rgba(255, 107, 53, .15);
  color: #4a1a00;
  border-color: var(--ufo-crash, #ff6b35);
}

/* Attribution footnote */
.hm-ufo-attrib {
  margin-top: 10px;
  font: 500 10.5px/1.35 -apple-system, system-ui, sans-serif;
  color: var(--muted, #6b7785);
}

/* ── error / info toast ────────────────────────────────────────────────── */
.hm-ufo-toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 7100;
  padding: 10px 20px;
  border-radius: 999px;
  font: 600 13px/1.3 -apple-system, system-ui, sans-serif;
  color: #fff;
  background: rgba(14, 16, 22, .94);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .55);
  opacity: 0;
  transition: opacity .25s ease, transform .25s cubic-bezier(.2,.9,.3,1);
  pointer-events: none;
  white-space: nowrap;
  max-width: min(90vw, 400px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.hm-ufo-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── cyberpunk neon — dark map type only ──────────────────────────────── */
html.hm-mt-dark .hm-ufo-mk,
:root[data-hymaptype="dark"] .hm-ufo-mk {
  border-color: rgba(255, 255, 255, .9);
  box-shadow: 0 0 10px var(--ufo-green, #39ff14), 0 0 2px #fff;
}
html.hm-mt-dark .hm-ufo-mk.is-crash,
:root[data-hymaptype="dark"] .hm-ufo-mk.is-crash {
  box-shadow: 0 0 10px var(--ufo-crash, #ff6b35), 0 0 2px #fff;
}
html.hm-mt-dark .hm-ufo-cluster,
:root[data-hymaptype="dark"] .hm-ufo-cluster {
  box-shadow: 0 0 14px var(--ufo-green, #39ff14), 0 0 28px rgba(57, 255, 20, .3);
  animation: hm-ufo-pulse 2.6s ease-in-out infinite;
}
html.hm-mt-dark .hm-ufo-cluster.has-crash,
:root[data-hymaptype="dark"] .hm-ufo-cluster.has-crash {
  animation: hm-ufo-pulse-crash 2.6s ease-in-out infinite;
}
html.hm-mt-dark .hm-ufo-pop-card,
:root[data-hymaptype="dark"] .hm-ufo-pop-card {
  background: rgba(0, 10, 0, .96);
  color: #d4ffd4;
  border-color: rgba(57, 255, 20, .4);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .75), 0 0 28px rgba(57, 255, 20, .18);
}
html.hm-mt-dark .hm-ufo-pop-row,
:root[data-hymaptype="dark"] .hm-ufo-pop-row {
  border-top-color: rgba(57, 255, 20, .1);
}
html.hm-mt-dark .hm-ufo-pop-row span,
:root[data-hymaptype="dark"] .hm-ufo-pop-row span { color: #7ba87b; }
html.hm-mt-dark .hm-ufo-desc,
:root[data-hymaptype="dark"] .hm-ufo-desc {
  background: rgba(57, 255, 20, .05);
  border-color: rgba(57, 255, 20, .18);
  color: #b0dbb0;
}
html.hm-mt-dark .hm-ufo-desc.is-crash,
:root[data-hymaptype="dark"] .hm-ufo-desc.is-crash {
  background: rgba(255, 107, 53, .06);
  border-color: rgba(255, 107, 53, .2);
  color: #e8b89a;
}

@keyframes hm-ufo-pulse {
  0%, 100% { box-shadow: 0 0 14px var(--ufo-green, #39ff14), 0 0 28px rgba(57, 255, 20, .3); }
  50%       { box-shadow: 0 0 22px var(--ufo-green, #39ff14), 0 0 44px rgba(57, 255, 20, .5); }
}
@keyframes hm-ufo-pulse-crash {
  0%, 100% { box-shadow: 0 0 14px var(--ufo-crash, #ff6b35), 0 0 28px rgba(255, 107, 53, .3); }
  50%       { box-shadow: 0 0 22px var(--ufo-crash, #ff6b35), 0 0 44px rgba(255, 107, 53, .5); }
}

/* ── reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hm-ufo-mk      { transition: none; }
  .hm-ufo-cluster { transition: none; animation: none !important; }
  .hm-ufo-pop-card { animation: none; }
  .hm-ufo-toast   { transition: opacity .1s ease; }
}
