/* ============================================================
   animations.css — BLender scroll & load animations
   IntersectionObserver-based (≈ useInView, no extra libs)

   Animates:
     • Fade-in + slide-up for all sections on scroll entry
     • Scale-in for images and visual blocks
     • Stagger delays for card/list/column groups (up to 7 items)
     • Parallax handled via JS (translateY inline style)
   ============================================================ */

/* ── 0. Page loader — FOUC prevention ──────────────────────── */
#page-loader {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 99999;
  pointer-events: none;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}
#page-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}
.page-loader__bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: #41a0ff;
  animation: loader-bar 0.7s ease-out forwards;
}
@keyframes loader-bar {
  from { width: 0; }
  to   { width: 100%; }
}

/* ── 1. Respect prefers-reduced-motion ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .anim,
  .anim-scale,
  .anim-fade {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
}

/* ── 2. Base hidden states ─────────────────────────────────── */

/* Default: slide-up + fade */
.anim {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity   0.65s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

/* Scale-in + fade (images, visual blocks) */
.anim-scale {
  opacity: 0;
  transform: scale(0.94) translateY(12px);
  transition:
    opacity   0.75s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

/* Fade-only (sliders, timelines — avoids layout shift) */
.anim-fade {
  opacity: 0;
  transition: opacity 0.7s ease;
  will-change: opacity;
}

/* ── 3. Visible states (class added by IntersectionObserver) ─ */

.anim.anim--visible {
  opacity: 1;
  transform: translateY(0);
}

.anim-scale.anim--visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.anim-fade.anim--visible {
  opacity: 1;
}

/* ── 4. Stagger delay helpers ──────────────────────────────── */
/* Applied as .anim-delay-N on each child within a stagger group  */
.anim-delay-1 { transition-delay: 0.06s; }
.anim-delay-2 { transition-delay: 0.13s; }
.anim-delay-3 { transition-delay: 0.20s; }
.anim-delay-4 { transition-delay: 0.27s; }
.anim-delay-5 { transition-delay: 0.34s; }
.anim-delay-6 { transition-delay: 0.41s; }
.anim-delay-7 { transition-delay: 0.48s; }

/* ── 5. Parallax image wrapper ─────────────────────────────── */
/* Smooths out JS-driven translateY from requestAnimationFrame   */
.parallax-img {
  will-change: transform;
  transition: transform 0.08s linear;
}

/* ── 6. Platform 3D canvas container ──────────────────────── */
#platform-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 7 / 6;   /* ~560×480 proportions */
  min-height: 320px;
  max-height: 560px;
}

#platform-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── 7. Static platform canvas (between-sliders) ──────────── */
#between-platform-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 7 / 6;
  min-height: 280px;
  max-height: 300px;
  max-width: 350px;   /* 300 × 7/6 — preserves aspect-ratio when max-height kicks in */
}
