/* METREAL VOL.2 — hero.css
 * Owns: .intro*, .hero-canvas, .hero--gl / .hero--nogl, .hero-title effects
 * (.hero-title-text / .hero-title-ch / .is-in / .is-glitch), .hero-scroll.
 * Layout + typography of the hero content live in style.css.
 * Tokens (--bg, --red, --cyan, --white, --muted, --line, --ease, --font-*) come from style.css.
 */

/* ---------- hero container / canvas ---------- */
.hero { position: relative; overflow: hidden; }
.hero-inner { position: relative; z-index: 1; }

.hero-canvas {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; display: block;
  pointer-events: none;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

/* WebGL unavailable: two blurred smoke blobs */
.hero.hero--nogl .hero-canvas { display: none; }
.hero.hero--nogl {
  background:
    radial-gradient(70% 90% at -8% 55%, rgba(255, 61, 74, .46), rgba(143, 20, 32, .28) 38%, rgba(255, 61, 74, 0) 72%),
    radial-gradient(70% 90% at 108% 45%, rgba(58, 215, 240, .40), rgba(14, 95, 112, .26) 38%, rgba(58, 215, 240, 0) 72%),
    var(--bg, #07080c);
}

/* ---------- title: letter reveal ---------- */
.hero-title {
  position: relative;
  white-space: nowrap;
  font-kerning: none;            /* split letters + glitch copies must line up */
}
.hero-title-text { display: inline-block; }
.hero-title-ch {
  display: inline-block;
  will-change: transform, opacity;
}
.hero-title.is-split:not(.is-in) .hero-title-ch { opacity: 0; }
.hero-title.is-in .hero-title-ch {
  animation: hero-ch-in .62s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes hero-ch-in {
  0%   { opacity: 0; transform: translate3d(0, .42em, 0) scale(1.32); filter: blur(10px); }
  55%  { opacity: 1; transform: translate3d(0, -.05em, 0) scale(.97); filter: blur(0); }
  78%  { transform: translate3d(0, .015em, 0) scale(1.005); }
  100% { opacity: 1; transform: none; filter: none; }
}

/* ---------- title: RGB-split glitch (300 ms bursts, class .is-glitch set by JS) ---------- */
.hero-title::before,
.hero-title::after {
  content: attr(data-glitch);
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0;
  clip-path: inset(50% 0 50% 0);
  mix-blend-mode: screen;
  will-change: clip-path, transform;
}
.hero-title::before { color: var(--red, #ff3d4a); }
.hero-title::after  { color: var(--cyan, #3ad7f0); }
.hero-title.is-glitch::before { opacity: 1; animation: hero-glitch-a .3s steps(1, end) both; }
.hero-title.is-glitch::after  { opacity: 1; animation: hero-glitch-b .3s steps(1, end) both; }
.hero-title.is-glitch .hero-title-text { animation: hero-glitch-base .3s steps(1, end) both; }

@keyframes hero-glitch-a {
  0%   { clip-path: inset(8% 0 66% 0);  transform: translate(-.035em, 0); }
  18%  { clip-path: inset(56% 0 20% 0); transform: translate(.025em, -.01em); }
  36%  { clip-path: inset(30% 0 46% 0); transform: translate(-.02em, .008em); }
  54%  { clip-path: inset(72% 0 6% 0);  transform: translate(.04em, 0); }
  72%  { clip-path: inset(2% 0 84% 0);  transform: translate(-.015em, 0); }
  88%  { clip-path: inset(44% 0 40% 0); transform: translate(.02em, 0); }
  100% { clip-path: inset(50% 0 50% 0); transform: none; }
}
@keyframes hero-glitch-b {
  0%   { clip-path: inset(62% 0 14% 0); transform: translate(.035em, 0); }
  18%  { clip-path: inset(14% 0 70% 0); transform: translate(-.025em, .01em); }
  36%  { clip-path: inset(48% 0 30% 0); transform: translate(.02em, -.008em); }
  54%  { clip-path: inset(4% 0 80% 0);  transform: translate(-.04em, 0); }
  72%  { clip-path: inset(80% 0 4% 0);  transform: translate(.015em, 0); }
  88%  { clip-path: inset(36% 0 50% 0); transform: translate(-.02em, 0); }
  100% { clip-path: inset(50% 0 50% 0); transform: none; }
}
@keyframes hero-glitch-base {
  0%   { transform: translate(.01em, 0); }
  36%  { transform: translate(-.012em, 0) skewX(-2deg); }
  54%  { transform: translate(.008em, 0); }
  72%  { transform: translate(-.006em, 0); }
  100% { transform: none; }
}

/* ---------- scroll cue ---------- */
.hero-scroll {
  position: absolute; left: 50%; bottom: 26px; z-index: 1;
  transform: translateX(-50%);
  padding-top: 56px;
  font-family: var(--font-mono, 'Space Mono', monospace);
  font-size: 10px; letter-spacing: .32em; text-transform: uppercase;
  color: var(--muted, #9a9ca8);
  white-space: nowrap; pointer-events: none;
  transition: opacity .6s ease .35s;
}
.hero-scroll::before,
.hero-scroll::after {
  content: ''; position: absolute; left: 50%; top: 0;
  width: 1px; height: 42px; margin-left: -.5px;
}
.hero-scroll::before { background: var(--line, rgba(255, 255, 255, .14)); }
.hero-scroll::after {
  background: linear-gradient(to bottom, rgba(244, 244, 246, 0), var(--white, #f4f4f6));
  animation: hero-scroll-line 1.9s cubic-bezier(.2, .8, .2, 1) infinite;
}
@keyframes hero-scroll-line {
  0%   { clip-path: inset(0 0 100% 0); }
  45%  { clip-path: inset(0 0 0 0); }
  58%  { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(100% 0 0 0); }
}
html.has-intro .hero:not(.is-ready) .hero-scroll { opacity: 0; }

/* ---------- intro overlay ---------- */
.intro { display: none; }
html.has-intro .intro {
  display: flex; align-items: center; justify-content: center;
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg, #07080c);
  color: var(--white, #f4f4f6);
  cursor: pointer; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  transition: opacity .3s ease;
  /* failsafe: if script dies mid-sequence the overlay still gets out of the way */
  animation: intro-failsafe 1ms linear 3.6s forwards;
}
html.has-intro .intro[hidden] { display: none; }
@keyframes intro-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }

/* faint red / cyan haze so the wipe feels continuous with the hero */
html.has-intro .intro::before,
html.has-intro .intro::after {
  content: ''; position: absolute; top: 50%; width: 70vmax; height: 70vmax;
  border-radius: 50%; pointer-events: none; filter: blur(40px); opacity: .22;
}
html.has-intro .intro::before { left: -35vmax; transform: translateY(-50%); background: radial-gradient(circle, var(--red, #ff3d4a), transparent 62%); }
html.has-intro .intro::after  { right: -35vmax; transform: translateY(-50%); background: radial-gradient(circle, var(--cyan, #3ad7f0), transparent 62%); }

.intro-stage {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  padding: 0 16px; text-align: center;
  transition: opacity .3s ease, transform .4s cubic-bezier(.2, .8, .2, 1);
}
.intro-eyebrow {
  margin: 0; font-size: 11px; letter-spacing: .34em; color: var(--muted, #9a9ca8);
  animation: intro-fade .5s ease both;
}
.intro-line {
  margin: 0; min-height: 1.4em;
  display: inline-flex; align-items: center;
  font-size: 13px; letter-spacing: .24em; color: var(--white, #f4f4f6);
  opacity: 0;
}
.intro.is-typing .intro-line,
.intro--reduced .intro-line { opacity: 1; }
.intro-caret {
  display: inline-block; width: .55em; height: 1.05em; margin-left: .25em;
  background: var(--cyan, #3ad7f0);
  animation: intro-blink .55s steps(1, end) infinite;
}
.intro--reduced .intro-caret { display: none; }

.intro-word {
  position: relative; display: inline-block;
  padding: .16em .34em;
  font-family: var(--font-display, 'Montserrat', sans-serif);
  font-weight: 900; text-transform: uppercase;
  font-size: clamp(64px, 16vw, 180px); line-height: .9; letter-spacing: -.03em;
  color: var(--white, #f4f4f6);
  opacity: 0; transform: scale(1.12);
  transition: opacity .16s ease, transform .22s cubic-bezier(.2, .8, .2, 1), letter-spacing .24s cubic-bezier(.2, .8, .2, 1);
}
.intro.is-word .intro-word { opacity: 1; transform: none; }
.intro.is-open .intro-word { letter-spacing: .06em; }
.intro-morph { display: inline-block; font-variant-ligatures: none; }

.intro-bracket {
  position: absolute; width: .3em; height: .3em; pointer-events: none;
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .2s ease;
}
.intro-bracket--l { left: 0; top: 0; border-left: 2px solid var(--red, #ff3d4a); border-top: 2px solid var(--red, #ff3d4a); }
.intro-bracket--r { right: 0; bottom: 0; border-right: 2px solid var(--cyan, #3ad7f0); border-bottom: 2px solid var(--cyan, #3ad7f0); }
.intro.is-open .intro-bracket--l { transform: translate(-.5em, -.32em); opacity: 0; }
.intro.is-open .intro-bracket--r { transform: translate(.5em, .32em); opacity: 0; }
.intro--reduced .intro-bracket { transition: none; transform: none; opacity: 1; }

/* chromatic split: only a few frames, toggled by JS */
.intro.is-split .intro-morph { text-shadow: -.045em 0 var(--red, #ff3d4a), .045em 0 var(--cyan, #3ad7f0); transform: skewX(-8deg) translateX(.02em); }
.intro.is-split .intro-line  { text-shadow: -2px 0 var(--red, #ff3d4a), 2px 0 var(--cyan, #3ad7f0); }

.intro-skip {
  position: absolute; left: 50%; bottom: 28px; z-index: 1;
  transform: translateX(-50%);
  margin: 0; font-size: 10px; letter-spacing: .32em; color: var(--muted, #9a9ca8);
  animation: intro-fade .4s ease .55s both;
}

/* exit: curtain lifts (clip-path), stage drifts up */
.intro.is-out { opacity: 0; }                       /* fallback when clip-path is unsupported */
.intro.is-out .intro-stage { opacity: 0; transform: translateY(-36px) scale(1.04); }
.intro.is-out .intro-skip { opacity: 0; transition: opacity .15s; }
@supports (clip-path: inset(0 0 100% 0)) {
  html.has-intro .intro { clip-path: inset(0 0 0 0); transition: clip-path .45s cubic-bezier(.2, .8, .2, 1); }
  html.has-intro .intro.is-out { opacity: 1; clip-path: inset(0 0 100% 0); }
  html.has-intro .intro.is-skip { transition-duration: .22s; }
  html.has-intro .intro.intro--reduced { transition: opacity .4s ease; }
  html.has-intro .intro.intro--reduced.is-out { opacity: 0; clip-path: inset(0 0 0 0); }
}

@keyframes intro-fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes intro-blink { 50% { opacity: 0; } }

/* ---------- reduced motion ---------- */
