/* 33-forge-header (fgh): ember-forge hero ground for /forged-sites/.
   Replaces the duplicate Home hammer video inside .fs-hero with a dark night-forge hearth:
   canonical IFS anvil + glowing billet in the open lower-right bay, rising forge embers,
   and arcing/falling sparks on a 2D canvas. Static lit hearth under reduced motion / pause. */

.fs-hero-media.fgh,
.fgh {
  --fgh-heat: 0;
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  contain: paint;
  background-color: #141142;
  background-image:
    radial-gradient(50% 48% at 76% 84%, rgba(230, 73, 37, .34) 0%, rgba(165, 45, 15, .16) 46%, rgba(20, 17, 66, 0) 76%),
    radial-gradient(44% 34% at 32% 98%, rgba(184, 48, 15, .16) 0%, rgba(20, 17, 66, 0) 72%),
    linear-gradient(180deg, #0e0b2e 0%, #141142 52%, #1b1238 84%, #24132e 100%);
}

/* Tactile forge grain (matches 30-forged-wordmark sumi/iron texture family) */
.fgh::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .46;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .96 0 0 0 0 .82 0 0 0 0 .62 0 0 0 .045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* Warm furnace breath in the lower-right bay (below .fs-first-draft, above .fs-ink-edge) */
.fgh-glow {
  position: absolute;
  right: max(0%, calc((100% - 1240px) / 2 - 40px));
  bottom: 54px;
  width: clamp(340px, 44vw, 640px);
  height: clamp(220px, 30vw, 390px);
  background: radial-gradient(ellipse at 52% 66%,
    rgba(255, 206, 126, .28) 0%,
    rgba(230, 73, 37, .28) 36%,
    rgba(165, 45, 15, .12) 60%,
    rgba(20, 17, 66, 0) 80%);
  opacity: calc(.8 + var(--fgh-heat) * .2);
  transform: translateZ(0);
}

.fgh-cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Canonical IFS anvil + hot billet framed in the open lower-right hero bay, visible above the fold on desktop */
.fgh-hearth {
  position: absolute;
  right: max(5%, calc((100% - 1240px) / 2 + 56px));
  bottom: 112px;
  width: clamp(248px, 25vw, 356px);
  aspect-ratio: 270 / 150;
  opacity: .96;
  transform: translateZ(0);
}

.fgh-hearth svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.fgh-billet-flare {
  opacity: calc(.68 + var(--fgh-heat) * .32);
}

/* Static spark constellation shows before JS boots and under no-JS; canvas takes over once painted */
.fgh.fgh-ready .fgh-still-sparks {
  opacity: 0;
}

/* Shield left hero copy (>= 9.8:1 contrast) and card backdrop (>= 5.1:1) while leaving the lower-right hearth clear */
.fs-hero:has(.fgh)::after {
  background:
    linear-gradient(100deg,
      rgba(15, 12, 48, .94) 0%,
      rgba(20, 17, 66, .88) 41%,
      rgba(20, 17, 66, .34) 64%,
      rgba(20, 17, 66, .04) 100%),
    linear-gradient(180deg,
      rgba(16, 13, 52, .48) 0%,
      rgba(16, 13, 52, .16) 54%,
      rgba(14, 10, 34, 0) 100%);
}

/* Keep pointer cursor normal over the bottom-right motion toggle when .w1-anvil hammer cursor is active */
.fs-page .fs-hero.w1-anvil .a11ym-btn {
  cursor: pointer;
}

@media (max-width: 1050px) {
  .fgh-hearth {
    right: 56px;
    bottom: 66px;
    width: clamp(200px, 28vw, 264px);
    opacity: .92;
  }
  .fgh-glow {
    right: -20px;
    bottom: 24px;
    width: 420px;
    height: 250px;
  }
}

@media (max-width: 700px) {
  /* Phones stack hero copy down to padding-bottom: 168px; keep copy backdrop deep navy and open the bottom hearth bay */
  .fs-hero:has(.fgh)::after {
    background: linear-gradient(180deg,
      rgba(15, 12, 48, .92) 0%,
      rgba(20, 17, 66, .90) calc(100% - 170px),
      rgba(20, 17, 66, .24) calc(100% - 104px),
      rgba(15, 11, 36, .06) 100%);
  }
  .fgh-hearth {
    right: 54px;
    bottom: 48px;
    width: 176px;
    opacity: .92;
  }
  .fgh-glow {
    right: -24px;
    bottom: 8px;
    width: 300px;
    height: 180px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fgh, .fgh *,
  .fs-hero:has(.fgh) .dvd-em {
    animation: none !important;
    transition: none !important;
  }
}

html.a11ym-paused .fgh,
html.a11ym-paused .fgh *,
html.a11ym-paused .fs-hero:has(.fgh) .dvd-em {
  animation: none !important;
  transition: none !important;
}

@media print {
  .fgh {
    display: none !important;
  }
}
