/* ============================================================
   ForgeMint: the landing-page intro ("the curtain")
   ------------------------------------------------------------
   Styles for the curtain that intro.js injects on the landing page (it plays
   on every load; ?intro=0 skips it). Nothing here applies when the script
   does not run, so a JS-off visitor sees the normal landing page.

   The curtain is decorative and does not respond to reduced motion:
   the owner's rule for this project is to ship the full effect, never a
   reduced rendering of it (see AGENTS.md).
   ============================================================ */

.fm-intro-runway {
  height: 260vh;
  position: relative;
}

.fm-intro {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  z-index: 200;                     /* over the header (50) and the playhead (130) */
  background: radial-gradient(
    120% 90% at 50% 52%,
    color-mix(in srgb, var(--palette-slate) 42%, var(--palette-ink)) 0%,
    var(--palette-ink) 64%
  );
}

/* --- the smoke that sits behind everything --- */
.fm-intro-smoke {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* --- the photographic plume, blurred --- */
.fm-intro-plume {
  position: absolute;
  inset: -22% -32%;
  pointer-events: none;
  background:
    url("assets/forgemint-smoke.webp") center / 80% auto no-repeat,
    url("assets/forgemint-smoke.webp") 10% 80% / 68% auto no-repeat,
    url("assets/forgemint-smoke.webp") 94% 20% / 60% auto no-repeat;
  filter: blur(28px) saturate(.5) brightness(1.3);
  opacity: .52;
  mix-blend-mode: screen;
}

/* --- the warm rim light behind the mark --- */
.fm-intro-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 78vmin;
  height: 78vmin;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(
    closest-side,
    color-mix(in srgb, var(--accent) 20%, transparent),
    color-mix(in srgb, var(--accent) 5%, transparent) 55%,
    transparent 72%
  );
  filter: blur(12px);
}

/* --- the cinematic falloff --- */
.fm-intro-vig {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    76% 60% at 50% 50%,
    transparent 40%,
    color-mix(in srgb, var(--palette-ink) 94%, transparent) 100%
  );
}

/* --- the stage: the wordmark sits directly above the mark, the pair centred
       as one lockup. Every size is in vmin, so the lockup always fits --- */
.fm-intro-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.fm-intro-markwrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- the wordmark: the brand name, above the mark --- */
.fm-intro-word {
  display: block;
  width: min(54vmin, 660px);
  height: auto;
  margin-bottom: -4.5vmin;      /* absorbs the frame's transparent top padding */
  filter: drop-shadow(0 12px 26px color-mix(in srgb, var(--palette-ink) 70%, transparent));
}

/* --- the mark: big, and it stays big --- */
.fm-intro-mark {
  display: block;
  width: min(76vmin, 860px);
  height: auto;
  will-change: transform;
  filter:
    drop-shadow(0 44px 90px color-mix(in srgb, var(--palette-ink) 80%, transparent))
    drop-shadow(0 0 60px color-mix(in srgb, var(--accent) 16%, transparent));
}

/* --- the veil: dense smoke settled over the mark itself, so the mark starts
       buried in it and the scroll burns it away --- */
.fm-intro-veil {
  position: absolute;
  inset: -6%;
  pointer-events: none;
  background: radial-gradient(
    closest-side at 50% 50%,
    rgba(196, 208, 214, .62) 0%,
    rgba(186, 199, 206, .42) 46%,
    rgba(170, 184, 192, .16) 76%,
    rgba(160, 174, 182, 0) 100%
  );
  mix-blend-mode: screen;
}

/* --- the near layer: smoke that drifts IN FRONT of the mark --- */
.fm-intro-front {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  filter: blur(11px) brightness(1.18);
}

.fm-intro-hint {
  position: absolute;
  left: 50%;
  bottom: 5.5vh;
  margin: 0;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent-hi);
  white-space: nowrap;
}

/* The hint is the cue that tells the visitor to scroll, so it has to stay
   legible: its text is 11px, which needs 4.5:1, not the 3:1 a large label
   would. It could not hold that where it was. Measured from pixels at the
   opening frame, every one of its 597 glyph pixels sat below 4.5:1 (2.61:1 at
   worst) - and the near smoke canvas, which drifts in front of the lockup by
   design, was responsible for 85% of the brightness behind it (the box reads
   mean luminance 0.147 with that layer, 0.021 without). A backing behind the
   label would therefore have changed nothing; the veil was in front of it.
   So the cue does what the escape hatch already does - it paints after the
   near smoke - and carries its own pocket of shade, so the smoke drifts
   around it instead of over it. The pocket is a blurred blob rather than the
   hatch's hard-edged pill on purpose: the hint is a cue, not a control, and
   it should not offer a shape that invites a click. */
.fm-intro-hint::before {
  content: "";
  position: absolute;
  inset: -10px -16px;
  z-index: -1;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--palette-ink) 88%, transparent);
  filter: blur(10px);
}

.fm-intro-arw {
  animation: fm-intro-bob 1.7s ease-in-out infinite;
}

@keyframes fm-intro-bob {
  50% { transform: translateY(6px); }
}

/* --- the way out. While the curtain is up the page behind is inert (see
       intro.js), so the curtain carries the only exit: a pointer has to be
       able to take it, not just a keyboard. It therefore sits ON SCREEN, on
       the same bottom rail as the scroll hint and at the page's own gutter,
       in the hint's treatment (mono, uppercase, tracked, accent). 44px tall
       so a thumb can hit it. Painted last, so the near smoke never blurs it.
       The curtain itself is unchanged: same length, same scrub, same reveal. */
.fm-intro-skip {
  position: absolute;
  right: clamp(20px, 4vw, 40px);
  bottom: 5.5vh;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--space-5);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--palette-ink) 82%, transparent);
  color: var(--accent-hi);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.fm-intro-skip:hover {
  border-color: var(--accent-hi);
  background: color-mix(in srgb, var(--palette-slate) 74%, var(--palette-ink));
  color: var(--palette-linen);
  transform: translateY(-1px);
}

.fm-intro-skip:active { transform: translateY(0); }

/* A focus ring has to be seen, and this one is asked to work over a backdrop
   that is pale smoke at the start of the scrub and near-black ink by its end
   (measured: mean luminance 0.136 -> 0.010 across the run). One colour cannot
   clear 3:1 against both ends - the site's --focus-ring reads 1.45:1 against
   the opening frame. So the hatch gets the two-tone ring the WCAG
   understanding doc prescribes for a non-uniform background: a 2px dark edge,
   a 3px accent band, and a dark edge outside that. Whichever end of the scrub
   is behind it, one of the two carries the contrast, and the crisp edge of
   the other keeps the shape legible. Measured from real pixels: every band
   clears 3:1 over the opening frame, and the 3px accent band carries it at
   9.6:1 by the end of the scrub. */
.fm-intro-skip:focus-visible {
  outline: 3px solid var(--accent-hi);
  outline-offset: 2px;
  box-shadow: 0 0 0 7px var(--palette-ink);
}

/* --- on a phone the hint is centred and the gutter is thin, so a
       right-aligned control lands on top of the hint. Stack it directly above
       the hint instead, on the same rail: one control group, nothing under
       anything else, and still where a thumb expects it --- */
@media (max-width: 520px) {
  .fm-intro-skip {
    left: 50%;
    right: auto;
    bottom: calc(5.5vh + 44px);
    transform: translateX(-50%);
  }
  .fm-intro-skip:hover { transform: translateX(-50%) translateY(-1px); }
  .fm-intro-skip:active { transform: translateX(-50%); }
}

/* --- the settle: the curtain detaches from the scroll (fixed overlay) so the
       page can snap back to its own top underneath it, then dissolves into the
       hero - the last beat of the intro --- */
.fm-intro-settling {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  z-index: 200;
  pointer-events: none;
}

.fm-intro-out {
  opacity: 0;
  transform: translateY(-2.5%);
  transition: opacity .62s var(--ease), transform .62s var(--ease);
}

/* --- the window between the <head> bootstrap and intro.js building the
       curtain: the page must not paint at all, or a first-time visitor sees
       the hero flash before the curtain covers it --- */
html.fm-intro-pending main,
html.fm-intro-pending header.site,
html.fm-intro-pending footer.site,
html.fm-intro-pending #bg-aurora {
  visibility: hidden;
}

/* --- while the curtain is up, the page's own chrome must not float over it --- */
html.fm-intro-active #fx-progress { opacity: 0; }
