/* ==========================================================================
   Intro: the E-play mark assembles from both sides, then the slogan writes in.
   Timeline (driven by classes from assets/js/intro.js):
     .is-playing   0.0s  silver "E" frame flies in from the left, blue play button spins in from the right
                   1.1s  pieces lock together (impact pulse) + light sweep
                   1.5s  slogan lines draw out, letters appear one by one
     .is-leaving   3.0s  overlay fades away, revealing the site
   ========================================================================== */

.intro { display: none; }

.intro-on .intro {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; justify-items: center; gap: clamp(18px, 3vw, 30px);
  background: radial-gradient(60% 50% at 50% 50%, #0b1630 0%, var(--bg) 70%);
  overflow: hidden;
}
.intro-on .intro.is-done { display: none; }
html.intro-lock, html.intro-lock body { overflow: hidden; }

/* soft blue glow that blooms when the pieces meet */
.intro__glow {
  position: absolute; left: 50%; top: 50%; width: 70vmax; height: 70vmax; translate: -50% -50%;
  background: radial-gradient(closest-side, rgba(31,123,255,.35), transparent 70%);
  opacity: 0; scale: .6; pointer-events: none;
}

/* the E-play mark: both pieces share one canvas (196 x 224), so they overlay exactly */
.intro__logo {
  position: relative;
  width: clamp(130px, 22vw, 210px);
  aspect-ratio: 196 / 224;
}
.intro__piece {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; will-change: transform, opacity, filter;
}
.intro__piece--play { filter: drop-shadow(0 0 18px rgba(31,123,255,.65)); }

/* light sweep, clipped to the mark's shape */
.intro__sweep {
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: url("../img/brand/e-mark.png") center / 100% 100% no-repeat;
          mask: url("../img/brand/e-mark.png") center / 100% 100% no-repeat;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.85) 50%, transparent 65%) no-repeat;
  background-size: 250% 100%; background-position: 120% 0;
  opacity: 0;
}

/* slogan */
.intro__slogan {
  display: flex; align-items: center; gap: clamp(10px, 2vw, 22px);
  font-family: var(--font-body); font-weight: 500; text-transform: uppercase;
  font-size: clamp(11px, 1.6vw, 17px); letter-spacing: .42em; color: #dfe6f2;
}
.intro__line { width: clamp(28px, 7vw, 90px); height: 2px; background: var(--blue); border-radius: 2px; scale: 0 1; }
.intro__line:first-child { transform-origin: right; }
.intro__line:last-child { transform-origin: left; }
.intro__words { display: inline-flex; margin-right: -.42em; } /* cancel trailing letter-spacing */
.intro__char { opacity: 0; display: inline-block; white-space: pre; }

.intro__skip {
  position: absolute; right: 20px; bottom: 20px; padding: 8px 14px; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted);
  font-size: 13px; cursor: pointer; opacity: 0; transition: opacity .4s .6s, color .2s;
}
.intro__skip:hover { color: var(--text); }

/* ---------- playing ---------- */
.intro.is-playing .intro__piece--frame { animation: fly-left 1s .15s var(--ease-out) both; }
.intro.is-playing .intro__piece--play  { animation: fly-right-spin 1.05s .25s var(--ease-out) both; }
.intro.is-playing .intro__logo  { animation: impact .5s 1.1s ease-out both; }
.intro.is-playing .intro__glow  { animation: bloom 1.6s 1s ease-out both; }
.intro.is-playing .intro__sweep { animation: sweep 1s 1.25s ease-in-out both; }
.intro.is-playing .intro__line  { animation: draw .6s 1.5s var(--ease-out) both; }
.intro.is-playing .intro__char  { animation: char-in .5s calc(1.65s + var(--i) * 40ms) var(--ease-out) both; }
.intro.is-playing .intro__skip  { opacity: 1; }

/* ---------- leaving ---------- */
.intro.is-leaving { animation: intro-out .7s ease-in forwards; }
.intro.is-leaving .intro__logo,
.intro.is-leaving .intro__slogan { animation: lift .7s ease-in forwards; }

@keyframes fly-left {
  from { opacity: 0; transform: translateX(-70vw) rotate(-10deg) scale(1.3); filter: blur(10px); }
  60%  { opacity: 1; filter: blur(0); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes fly-right {
  from { opacity: 0; transform: translateX(70vw) skewX(-12deg); filter: blur(10px); }
  60%  { opacity: 1; filter: blur(0); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes fly-right-spin {
  from { opacity: 0; transform: translateX(70vw) rotate(240deg) scale(.6); }
  60%  { opacity: 1; }
  to   { opacity: 1; transform: none; }
}
@keyframes impact {
  0%   { scale: 1; }
  30%  { scale: 1.035; }
  100% { scale: 1; }
}
@keyframes bloom {
  0%   { opacity: 0; scale: .6; }
  35%  { opacity: 1; scale: 1; }
  100% { opacity: .45; scale: 1.1; }
}
@keyframes sweep {
  0%   { opacity: 1; background-position: 120% 0; }
  100% { opacity: 1; background-position: -20% 0; }
}
@keyframes draw { to { scale: 1 1; } }
@keyframes char-in {
  from { opacity: 0; transform: translateY(10px); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes intro-out { to { opacity: 0; visibility: hidden; } }
@keyframes lift { to { transform: translateY(-24px) scale(.96); } }

@media (prefers-reduced-motion: reduce) {
  .intro-on .intro { display: none; }
}
