/* ============================================================
   animations.css — Keyframes, scroll-reveal states, marquee,
   progress bars, page transition, and reduced-motion handling.
   ============================================================ */

/* ---------- Keyframes ---------- */
@keyframes meshDrift1 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(8vmax, 6vmax, 0) scale(1.15); }
}
@keyframes meshDrift2 {
  0%   { transform: translate3d(0, 0, 0) scale(1.05); }
  100% { transform: translate3d(-7vmax, -5vmax, 0) scale(1.2); }
}

@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0 var(--glow); }
  70%  { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes pulseGreen {
  0%   { box-shadow: 0 0 0 0 rgba(50, 205, 50, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(50, 205, 50, 0); }
  100% { box-shadow: 0 0 0 0 rgba(50, 205, 50, 0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

@keyframes bounceArrow {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50%      { transform: translateY(10px); opacity: 0.4; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

@keyframes shimmer {
  0%   { transform: translateX(-130%) skewX(-18deg); }
  100% { transform: translateX(230%) skewX(-18deg); }
}

@keyframes marqueeLeft {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes marqueeRight {
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes popCheck {
  0%   { transform: scale(0) rotate(-12deg); opacity: 0; }
  60%  { transform: scale(1.18) rotate(0); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes haloPulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 0.85; transform: scale(1.04); }
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes dotCycle {
  0%   { background: var(--accent-3); box-shadow: 0 0 8px var(--glow); }
  50%  { background: #A8EBA8; box-shadow: 0 0 12px rgba(168, 235, 168, 0.6); }
  100% { background: var(--accent-3); box-shadow: 0 0 8px var(--glow); }
}

/* ---------- Hero entrance (staggered, gated on the intro) ----------
   Scoped to .hero so the CTA banners (which reuse .hero-stagger) are
   driven only by their own scroll-triggered rules, not on page load. */
.hero .hero-stagger > * { opacity: 0; }
body:not(.intro-done) .hero .hero-stagger > * { animation: none; opacity: 0; }
body.intro-done .hero .hero-stagger > * {
  animation: fadeInUp 0.9s var(--ease) forwards;
}
body.intro-done .hero .hero-stagger > *:nth-child(1) { animation-delay: 0.08s; }
body.intro-done .hero .hero-stagger > *:nth-child(2) { animation-delay: 0.18s; }
body.intro-done .hero .hero-stagger > *:nth-child(3) { animation-delay: 0.28s; }
body.intro-done .hero .hero-stagger > *:nth-child(4) { animation-delay: 0.38s; }
body.intro-done .hero .hero-stagger > *:nth-child(5) { animation-delay: 0.48s; }
body.intro-done .hero .hero-stagger > *:nth-child(6) { animation-delay: 0.58s; }
body.intro-done .hero .hero-stagger > *:nth-child(7) { animation-delay: 0.68s; }

/* ---------- Scroll reveal states (driven by reveal.js) ---------- */
[data-reveal] {
  opacity: 0;
  transition:
    opacity 0.8s var(--ease),
    transform 0.8s var(--ease);
  will-change: opacity, transform;
}
[data-reveal="fade-up"]    { transform: translateY(40px); }
[data-reveal="fade-down"]  { transform: translateY(-40px); }
[data-reveal="fade-left"]  { transform: translateX(-48px); }
[data-reveal="fade-right"] { transform: translateX(48px); }
[data-reveal="scale-in"]   { transform: scale(0.9); }
[data-reveal="blur-in"]    { filter: blur(14px); }

[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
  filter: none;
}

/* Rise-up: strong upward travel + slight scale, for CTA banners */
[data-reveal="rise-up"] {
  opacity: 0;
  transform: translateY(80px) scale(0.97);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
  will-change: opacity, transform;
}
[data-reveal="rise-up"].is-revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ---------- Animated progress bars (about page) ---------- */
.progress {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  box-shadow: 0 0 16px var(--glow);
  transition: width 1.4s var(--ease);
}
.progress.is-filled .progress__fill {
  width: var(--value, 0%);
}

/* ---------- Scroll indicator ---------- */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: clamp(18px, 4vh, 38px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  z-index: 3;
}
.scroll-cue svg { animation: bounceArrow 1.8s var(--ease-in-out) infinite; }

/* ---------- Page transition overlay ---------- */
.page-curtain {
  position: fixed;
  inset: 0;
  z-index: var(--z-transition);
  background: var(--bg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.32s ease;
}
.page-curtain.is-active {
  opacity: 1;
  pointer-events: all;
}
/* (v5) Initial-reveal curtain removed — the #mk-intro cinematic intro
   handles the first reveal. The .page-curtain above is still used by
   page-transition.js for smooth fades between pages on navigation. */

/* ---------- Marquee ---------- */
.marquee { position: relative; overflow: hidden; }
.marquee__track {
  display: flex;
  width: max-content;
  gap: var(--sp-5);
  padding-block: var(--sp-1);
  will-change: transform;
}
.marquee--left .marquee__track  { animation: marqueeLeft 34s linear infinite; }
.marquee--right .marquee__track { animation: marqueeRight 34s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .hero-stagger > * { opacity: 1; }
  [data-reveal] { opacity: 1 !important; transform: none !important; filter: none !important; }
  .bg-mesh::before,
  .bg-mesh::after { animation: none; }
  .marquee__track { animation: none; }
  .scroll-cue svg { animation: none; }
}
