/* ForeverHumans Toolkit — overlay.css
 * The stream overlay: a 1920x1080 browser source that is TRANSPARENT
 * everywhere except the alert card itself. No backdrop, no page paint
 * — fx.js is deliberately not loaded on this page because its boot
 * paints an opaque scene behind everything.
 *
 * Paint comes from the theme tokens overlay.js stamps on the root as
 * CSS vars (--fh-surface / --fh-text / --fh-accent / --fh-accent2,
 * plus --fh-font / --fh-display-font). The defaults below are just the
 * Neon preset as a pre-JS fallback.
 *
 * Entrance animations touch transform / opacity only, so the card
 * never shoves layout around. .calm has NO keyframe animation at all:
 * it fades in on an opacity transition (overlay.js flips the opacity
 * right after appending), for popLevel 0 and performance mode.
 */

:root {
  --fh-surface: #15151f;
  --fh-text: #f4f4f5;
  --fh-accent: #39ff14;
  --fh-accent2: #ff2ea6;
  --fh-font: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --fh-display-font: 'Permanent Marker', 'Arial Black', 'Franklin Gothic Heavy', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

body {
  font-family: var(--fh-font);
  color: var(--fh-text);
}

/* ---------- stage ---------- */
/* Fixed full-viewport slot. Cards share one grid cell so a leaving
   card and the next card occupy the exact same spot while the exit
   fade runs — nothing ever sits side by side. */

#alertStage {
  position: fixed;
  inset: 0;
  display: grid;
  justify-items: center;
  align-items: start;
  padding-top: 12vh;
  pointer-events: none;
  z-index: 1;
}

/* ---------- alert card ---------- */

.fh-alert {
  grid-area: 1 / 1;
  position: relative;
  min-width: 520px;
  max-width: 920px;
  padding: 30px 44px 32px;
  border-radius: 20px;
  background: var(--fh-surface);
  color: var(--fh-text);
  border: 2px solid var(--fh-accent);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(57, 255, 20, 0.35);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.45),
    0 0 28px color-mix(in srgb, var(--fh-accent) 40%, transparent),
    0 0 64px color-mix(in srgb, var(--fh-accent2) 22%, transparent);
  text-align: center;
  font-family: var(--fh-font);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.fh-alert-icon {
  display: block;
  font-size: 54px;
  line-height: 1;
  margin-bottom: 10px;
}

.fh-alert-name {
  font-family: var(--fh-display-font);
  font-size: 64px;
  line-height: 1.05;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.fh-alert-label {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--fh-accent);
}

.fh-alert-detail {
  margin-top: 6px;
  font-size: 26px;
  line-height: 1.25;
  opacity: 0.85;
  overflow-wrap: anywhere;
}

/* ---------- entrance animations (transform / opacity only) ---------- */

@keyframes fh-alert-burst {
  0% { transform: scale(0.3); opacity: 0; }
  55% {
    transform: scale(1.08);
    opacity: 1;
    box-shadow:
      0 18px 48px rgba(0, 0, 0, 0.45),
      0 0 54px color-mix(in srgb, var(--fh-accent) 75%, transparent),
      0 0 110px color-mix(in srgb, var(--fh-accent2) 45%, transparent);
  }
  75% { transform: scale(0.98); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.fh-alert.anim-burst { animation: fh-alert-burst 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }

@keyframes fh-alert-bounce {
  0% { transform: translateY(-140px); opacity: 0; }
  45% { transform: translateY(0); opacity: 1; }
  62% { transform: translateY(-26px); opacity: 1; }
  78% { transform: translateY(0); opacity: 1; }
  88% { transform: translateY(-10px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
.fh-alert.anim-bounce { animation: fh-alert-bounce 0.8s ease-out both; }

@keyframes fh-alert-slide {
  0% { transform: translateX(120%); opacity: 0; }
  70% { transform: translateX(-3%); opacity: 1; }
  100% { transform: translateX(0); opacity: 1; }
}
.fh-alert.anim-slide { animation: fh-alert-slide 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) both; }

/* Exit: fade + shrink on the base transition. The entrance animation
   is switched off so the transition owns transform / opacity. */
.fh-alert.leaving {
  animation: none;
  opacity: 0;
  transform: scale(0.92);
}

/* Calm: no keyframes, ever — a plain opacity fade on a transition. */
.fh-alert.calm {
  animation: none !important;
  transition: opacity 0.35s ease;
}

/* ---------- in-card sparks (js/alerts.js burstSparks) ---------- */

.fh-spark {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
}

/* ---------- test strip (test mode only — a tool, not stream paint) ---------- */

#testStrip {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 50;
  max-width: 340px;
  background: rgba(9, 9, 14, 0.88);
  color: #e4e4e7;
  border: 1px solid #3f3f46;
  border-radius: 10px;
  padding: 12px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

#testStrip[hidden] { display: none; }

#testStrip .test-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #a1a1aa;
  margin-bottom: 8px;
}

#testStrip .test-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#testStrip button {
  appearance: none;
  background: #1f1f28;
  color: #f4f4f5;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

#testStrip button:hover { border-color: #39ff14; }

#testStrip button.test-rapid { font-weight: 700; }

#testStrip .test-status {
  margin-top: 10px;
  font-size: 12px;
  color: #a1a1aa;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .fh-alert {
    animation: none !important;
    transition: none !important;
  }
}
