/* ============================================================
   motion.css — keyframes, ambient loops, reveal states
   Reveal initial-states are applied by GSAP (JS) so content is
   NEVER stuck hidden if JS fails. CSS here = ambient + fallback.
   ============================================================ */

@keyframes float-y {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -16px, 0); }
}

@keyframes float-soft {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(6px, -12px, 0) rotate(1.5deg); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

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

@keyframes sheen {
  0% { transform: translateX(-120%) skewX(-12deg); opacity: 0; }
  18% { opacity: 0.8; }
  60% { transform: translateX(220%) skewX(-12deg); opacity: 0; }
  100% { transform: translateX(220%) skewX(-12deg); opacity: 0; }
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  94% { opacity: 0.72; }
  96% { opacity: 1; }
  98% { opacity: 0.85; }
}

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

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

@keyframes scroll-dot {
  0% { transform: translate(-50%, 0); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translate(-50%, 18px); opacity: 0; }
}

@keyframes dash-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes laser-bob {
  0%, 100% { transform: translateX(-40%); }
  50% { transform: translateX(40%); }
}

@keyframes ember-rise {
  0% { transform: translateY(0) scale(1); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(-180px) scale(0.3); opacity: 0; }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}

@keyframes shimmer-text {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ---- Ambient utility classes ---- */
.anim-float { animation: float-y 7s var(--ease-inout) infinite; }
.anim-float-soft { animation: float-soft 9s var(--ease-inout) infinite; }
.anim-spin-slow { animation: spin-slow 36s linear infinite; }
.anim-pulse { animation: pulse-glow 4.5s var(--ease-inout) infinite; }

/* SVG draw-on: JS adds .is-drawn when in view; CSS provides the look */
.draw path,
.draw circle,
.draw line,
.draw polyline,
.draw rect,
.draw polygon {
  stroke-dasharray: var(--len, 400);
  stroke-dashoffset: var(--len, 400);
}
.draw.is-drawn path,
.draw.is-drawn circle,
.draw.is-drawn line,
.draw.is-drawn polyline,
.draw.is-drawn rect,
.draw.is-drawn polygon {
  animation: dash-draw 1.6s var(--ease-out) forwards;
}

/* ---- Reveal fallback ----
   With JS: .reveal stays as authored, GSAP sets/animates it.
   Without JS (.no-js): force everything visible. */
.no-js .reveal,
.no-js [data-reveal] {
  opacity: 1 !important;
  transform: none !important;
}

/* Grain texture overlay */
.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================================
   Reduced motion — calm, readable, no parallax churn
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .grain { display: none; }
  .reveal,
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
