/* ============================================================
   FABLE5 — HERO ("The Molten Core" forge hero)
   Visual layer for templates/fable5/partials/hero.php.
   ------------------------------------------------------------
   Scope: every rule is namespaced under .fbl-hero so it cannot
   leak into other sections (Phase 2 is hero-only).
   Palette: fable5-LOCAL component variables (--fbl-*), declared
   on .fbl-hero. These intentionally do NOT redefine global
   --mt-* tokens (that is the later dark-foundation phase) and
   do NOT reuse home_test token names. Layout primitives
   (radius / z-index) reuse existing --mt-* tokens.
   ============================================================ */

.fbl-hero {
  /* fable5-local forge palette (dark identity, hero-scoped) */
  --fbl-coal:       #03070E;                    /* near-black cold night */
  --fbl-smoke:      rgba(214, 232, 248, 0.58);
  --fbl-smoke-dim:  rgba(214, 232, 248, 0.32);
  --fbl-accent:     #2D9CFF;                    /* dell blue, lifted */
  --fbl-accent-hi:  #9BD1FF;                    /* ice highlight */
  --fbl-ember:      #0076CE;                    /* dell blue core */
  --fbl-hairline:   rgba(214, 232, 248, 0.12);
  --fbl-ink:        #E8F1FA;                    /* body text on coal */
  --fbl-serif:      "Cormorant Garamond", Georgia, serif;
  --fbl-sans:       "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fbl-display:    "Anton", Impact, "Arial Narrow", sans-serif;

  position: relative;
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background: var(--fbl-coal);
  color: var(--fbl-ink);
  font-family: var(--fbl-sans);
}

/* ---------- Layer 0: background media (image div / video element) ---------- */
.fbl-hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;          /* applies to <video> */
  background-size: cover;     /* applies to the image <div> */
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* ---------- Layer 1: overlay scrim over the media (opacity-driven) ---------- */
.fbl-hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(3, 7, 14, var(--fbl-hero-scrim, 0.82));
}

/* ---------- Layer 1: heat vignette (atmosphere, above the overlay) ---------- */
.fbl-hero__heat {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(70% 38% at 50% 108%, rgba(0, 118, 206, 0.18), transparent 70%),
    radial-gradient(120% 90% at 50% 45%, transparent 40%, rgba(3, 7, 14, calc(var(--fbl-hero-scrim, 0.82) * 0.95)) 88%);
}

/* ---------- Layer 2: forge canvas ---------- */
.fbl-hero__forge {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- top bar (decorative chrome) ---------- */
.fbl-hero__bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(14px + env(safe-area-inset-top)) clamp(18px, 4vw, 52px) 14px;
}

.fbl-hero__wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 700 13px/1 var(--fbl-sans);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--fbl-ink);
}

.fbl-hero__spark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--fbl-accent-hi), var(--fbl-ember));
  box-shadow: 0 0 12px rgba(45, 156, 255, 0.8);
  animation: fblHeroSpark 2.2s ease-in-out infinite;
}

@keyframes fblHeroSpark {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(0.6); }
}

.fbl-hero__temp {
  font: 300 9.5px/1.6 var(--fbl-sans);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--fbl-smoke-dim);
  text-align: right;
  white-space: nowrap;
}
.fbl-hero__temp b { color: var(--fbl-accent); font-weight: 700; }

/* ---------- word-progress dots ---------- */
.fbl-hero__dots {
  position: absolute;
  z-index: 10;
  left: 50%;
  transform: translateX(-50%);
  top: calc(58px + env(safe-area-inset-top));
  display: flex;
  gap: 9px;
}
.fbl-hero__dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--fbl-hairline);
  transition: background 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
}
.fbl-hero__dots i.on {
  background: var(--fbl-accent);
  box-shadow: 0 0 8px rgba(45, 156, 255, 0.8);
  transform: scale(1.35);
}

/* canvas owns the centre */
.fbl-hero__spacer { position: relative; z-index: 5; pointer-events: none; }

/* ---------- altar: whisper + CTA + hint ---------- */
.fbl-hero__altar {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 0 clamp(18px, 5vw, 56px) calc(clamp(20px, 4vh, 44px) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2.4vh, 24px);
}
.fbl-hero--align-left  .fbl-hero__altar { text-align: left;  align-items: flex-start; }
.fbl-hero--align-right .fbl-hero__altar { text-align: right; align-items: flex-end; }

.fbl-hero__whisper {
  font: italic 500 clamp(16px, 2.4vw, 23px)/1.5 var(--fbl-serif);
  color: var(--fbl-smoke);
  max-width: 42ch;
  margin: 0;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1.2s ease 0.9s, transform 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.9s;
}
.fbl-hero.is-live .fbl-hero__whisper { opacity: 1; transform: none; }

.fbl-hero__whisper-sub {
  display: block;
  margin-top: 0.5em;
  font: 300 clamp(13px, 1.15vw, 15px)/1.7 var(--fbl-sans);
  font-style: normal;
  color: var(--fbl-smoke-dim);
  max-width: 56ch;
}
.fbl-hero--align-center .fbl-hero__whisper,
.fbl-hero--align-center .fbl-hero__whisper-sub { margin-left: auto; margin-right: auto; }

/* ---------- actions ---------- */
.fbl-hero__actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.fbl-hero--align-left  .fbl-hero__actions { justify-content: flex-start; }
.fbl-hero--align-right .fbl-hero__actions { justify-content: flex-end; }

.fbl-hero__cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 15px 34px;
  font: 700 10.5px/1 var(--fbl-sans);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--fbl-accent-hi);
  background: transparent;
  border: 1px solid rgba(45, 156, 255, 0.45);
  border-radius: var(--mt-radius-full, 999px);
  text-decoration: none;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px);
  transition-property: opacity, transform, color, border-color, box-shadow;
  transition-duration: 1.2s, 1.2s, 0.4s, 0.4s, 0.4s;
  transition-delay: 1.15s, 1.15s, 0s, 0s, 0s;
  transition-timing-function: ease, cubic-bezier(0.16, 1, 0.3, 1), ease, ease, ease;
}
.fbl-hero.is-live .fbl-hero__cta { opacity: 1; transform: none; }
.fbl-hero__cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, var(--fbl-ember), var(--fbl-accent), var(--fbl-accent-hi));
  opacity: 0;
  transition: opacity 0.4s ease;
}
.fbl-hero__cta:hover {
  color: var(--fbl-coal);
  border-color: transparent;
  box-shadow: 0 0 40px rgba(45, 156, 255, 0.45);
}
.fbl-hero__cta:hover::before { opacity: 1; }

/* secondary / ghost CTA */
.fbl-hero__cta--ghost {
  color: var(--fbl-smoke);
  border-color: var(--fbl-hairline);
}
.fbl-hero__cta--ghost::before { display: none; }
.fbl-hero__cta--ghost:hover {
  color: var(--fbl-accent-hi);
  border-color: rgba(45, 156, 255, 0.45);
  box-shadow: none;
}

/* ---------- hint ---------- */
.fbl-hero__hint {
  font: 300 9px/1 var(--fbl-sans);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--fbl-smoke-dim);
  margin: 0;
  opacity: 0;
  transition: opacity 1.4s ease 1.6s;
}
.fbl-hero.is-live .fbl-hero__hint { opacity: 0.8; }
.fbl-hero__hint b { color: var(--fbl-accent); font-weight: 700; }

/* ---------- corner instruments ---------- */
.fbl-hero__corner {
  position: absolute;
  z-index: 10;
  font: 300 9px/1.8 var(--fbl-sans);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--fbl-smoke-dim);
}
.fbl-hero__corner b { color: var(--fbl-accent); font-weight: 700; }
.fbl-hero__corner--bl {
  left: clamp(18px, 4vw, 52px);
  bottom: calc(clamp(16px, 3vh, 32px) + env(safe-area-inset-bottom));
}
.fbl-hero__corner--br {
  right: clamp(18px, 4vw, 52px);
  bottom: calc(clamp(16px, 3vh, 32px) + env(safe-area-inset-bottom));
  text-align: right;
}

/* ---------- internal page header variant (hero_purpose = internal) ----------
   Compact: reduced height, progress dots hidden. The PHP partial also drops
   the description + secondary CTA and disables auto word-cycling for internal. */
.fbl-hero--internal {
  height: auto;
  min-height: 56vh;
  min-height: 52svh;
}
.fbl-hero--internal .fbl-hero__dots { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 680px) {
  .fbl-hero__corner { display: none; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .fbl-hero__spark { animation: none; }
  .fbl-hero__whisper,
  .fbl-hero__cta,
  .fbl-hero__hint {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .fbl-hero.is-live .fbl-hero__hint { opacity: 0.8; }
}
