/* ═══════════════════════════════════════════════
   SAMAN SALOUR — MOTION LAYER
   Prestige animation inspired by Bertrand Candas
   (momentum scroll · masked reveals · magnetic)
   and p5aholic (mouse-reactive, living motion).
   ═══════════════════════════════════════════════ */

/* ── Smooth-scroll wrapper ─────────────────────── */
/* When momentum scroll is active, the content is lifted out of flow and
   driven by transform; body carries the scroll height. */
html.lenis { scroll-behavior: auto; }
html.lenis #scroll-content {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  will-change: transform;
}
#scroll-content { transform-origin: 50% 0; }

/* ════════════════════════════════════════════════
   LOAD INTRO — counter + curtain wipe
   ════════════════════════════════════════════════ */
html.intro-lock { overflow: hidden; }
html.intro-lock body { overflow: hidden; }

.intro {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background:
    radial-gradient(130% 120% at 50% 8%, var(--hi) 0%, var(--bg) 46%, var(--bg-deep) 100%);
  overflow: hidden;
  transition: transform 1.05s cubic-bezier(.76,0,.24,1);
}
.intro.is-done { transform: translateY(-101%); pointer-events: none; }

.intro__mark {
  font-family: 'Cinzel', serif; font-size: 11px;
  letter-spacing: .56em; color: var(--gold);
  text-transform: uppercase;
  opacity: 0; transform: translateY(14px);
  animation: introUp .9s cubic-bezier(.2,.7,.3,1) .12s forwards;
}
.intro__rule {
  width: 0; height: 1px; margin: 26px 0 30px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: introRule 1.5s cubic-bezier(.5,0,.2,1) .3s forwards;
}
.intro__count {
  font-family: 'Cinzel', serif; font-weight: 500;
  font-size: clamp(64px, 13vw, 168px); line-height: .9;
  letter-spacing: .02em;
  background: linear-gradient(180deg, var(--ink), var(--sepia) 70%, var(--muted));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: flex-start;
}
.intro__count sup {
  font-size: .26em; color: var(--gold);
  -webkit-text-fill-color: var(--gold);
  margin-left: .15em; margin-top: .5em; letter-spacing: .1em;
}
.intro__bar {
  position: absolute; left: 0; bottom: 0; height: 2px;
  width: 100%; background: rgba(198,162,74,.12);
}
.intro__bar i {
  position: absolute; inset: 0 auto 0 0; height: 100%;
  width: var(--p, 0%);
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  box-shadow: 0 0 14px rgba(224,188,99,.5);
}
.intro__cap {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  font-family: 'Cinzel', serif; font-size: 9.5px; letter-spacing: .42em;
  text-transform: uppercase; color: var(--muted);
  opacity: 0; animation: introUp .9s ease .3s forwards;
}

@keyframes introUp   { to { opacity: 1; transform: translateY(0); } }
@keyframes introRule { to { width: clamp(120px, 22vw, 280px); } }

/* ════════════════════════════════════════════════
   MASKED LINE REVEALS — headings rise from a clip
   ════════════════════════════════════════════════ */
.mask-line {
  display: block; overflow: hidden;
  padding-bottom: .04em;   /* room for descenders inside the clip */
}
.mask-line__in {
  display: block;
  transform: translateY(112%);
  transition: transform 1.1s cubic-bezier(.16,1,.3,1);
  will-change: transform;
}
.mask-line.in .mask-line__in,
[data-split].in .mask-line__in { transform: translateY(0); }

/* ════════════════════════════════════════════════
   MAGNETIC ELEMENTS
   ════════════════════════════════════════════════ */
.magnetic {
  display: inline-block;
  transition: transform .42s cubic-bezier(.2,.8,.3,1);
  will-change: transform;
}
.nav-links a.magnetic,
.brand.magnetic { will-change: transform; }

/* ════════════════════════════════════════════════
   HERO DUST CANVAS
   ════════════════════════════════════════════════ */
.dust {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
  opacity: .9;
}
.hero .hero-grid,
.hero .scroll-hint { position: relative; z-index: 2; }

/* ════════════════════════════════════════════════
   SCROLL PROGRESS
   ════════════════════════════════════════════════ */
#scrollProgress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 202; pointer-events: none;
}
#scrollFill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 30%, var(--gold-bright) 70%, var(--gold) 100%);
  box-shadow: 0 0 8px rgba(224,188,99,.5);
  transition: width .08s linear;
}

/* ════════════════════════════════════════════════
   TICKER MARQUEE
   ════════════════════════════════════════════════ */
.ticker-wrap {
  overflow: hidden;
  border-top: 1px solid rgba(198,162,74,.1);
  border-bottom: 1px solid rgba(198,162,74,.1);
  padding: 13px 0;
  user-select: none;
}
.ticker-track {
  display: flex; align-items: center;
  width: max-content;
  animation: tickerScroll 28s linear infinite;
}
.ticker-track:hover { animation-play-state: paused; }
.ti {
  font-family: 'Cinzel', serif; font-size: 9.5px;
  letter-spacing: .52em; text-transform: uppercase;
  color: var(--muted); padding: 0 28px;
  transition: color .25s;
}
.ticker-track:hover .ti { color: var(--sepia-2); }
.ti-sep {
  color: var(--gold); font-size: 11px;
  line-height: 1; flex-shrink: 0;
}
@keyframes tickerScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ════════════════════════════════════════════════
   CURSOR COMET TRAIL
   ════════════════════════════════════════════════ */
.c-trail {
  position: fixed; pointer-events: none; z-index: 9997;
  width: 4px; height: 4px;
  background: var(--gold-bright);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: transform, opacity, left, top;
}

/* ════════════════════════════════════════════════
   THREE.JS CODEX CONTAINER
   ════════════════════════════════════════════════ */
.codex-3d {
  width: min(44vw, 520px);
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: visible;
}
.codex-3d canvas {
  display: block;
}

/* ── Reduced motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .intro { display: none; }
  .mask-line__in { transform: none; transition: none; }
  .magnetic { transition: none; }
  .dust { display: none; }
  .ticker-track { animation: none; }
  .c-trail { display: none; }
}
