/* ==========================================================================
   WANDERCREST — Animations
   Scroll-reveal, hero entrance, hover micro-interactions.
   All "hidden until revealed" states are scoped under `html.has-js`
   (a tiny inline script adds the class) so content is NEVER invisible
   if JavaScript fails or is disabled.
   Everything respects prefers-reduced-motion.
   ========================================================================== */

/* --- Scroll reveal (IntersectionObserver adds .is-revealed) --- */
html.has-js .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
    will-change: opacity, transform;
}

html.has-js .reveal--left {
    transform: translateX(-32px);
}

html.has-js .reveal--right {
    transform: translateX(32px);
}

html.has-js .reveal--scale {
    transform: scale(0.96);
}

html.has-js .reveal.is-revealed {
    opacity: 1;
    transform: none;
}

/* Stagger helpers (applied to children) */
html.has-js .stagger > * {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

html.has-js .stagger.is-revealed > * {
    opacity: 1;
    transform: none;
}

html.has-js .stagger.is-revealed > *:nth-child(1) { transition-delay: 0.05s; }
html.has-js .stagger.is-revealed > *:nth-child(2) { transition-delay: 0.12s; }
html.has-js .stagger.is-revealed > *:nth-child(3) { transition-delay: 0.19s; }
html.has-js .stagger.is-revealed > *:nth-child(4) { transition-delay: 0.26s; }
html.has-js .stagger.is-revealed > *:nth-child(5) { transition-delay: 0.33s; }
html.has-js .stagger.is-revealed > *:nth-child(6) { transition-delay: 0.4s; }
html.has-js .stagger.is-revealed > *:nth-child(7) { transition-delay: 0.47s; }
html.has-js .stagger.is-revealed > *:nth-child(8) { transition-delay: 0.54s; }

/* --- Hero entrance --- */
html.has-js .hero-entrance > * {
    opacity: 0;
    transform: translateY(26px);
    animation: rise-in 0.85s var(--ease) forwards;
}

html.has-js .hero-entrance > *:nth-child(1) { animation-delay: 0.15s; }
html.has-js .hero-entrance > *:nth-child(2) { animation-delay: 0.28s; }
html.has-js .hero-entrance > *:nth-child(3) { animation-delay: 0.41s; }
html.has-js .hero-entrance > *:nth-child(4) { animation-delay: 0.54s; }
html.has-js .hero-entrance > *:nth-child(5) { animation-delay: 0.67s; }

@keyframes rise-in {
    to {
        opacity: 1;
        transform: none;
    }
}

/* --- Cinematic slow zoom on the hero image only ---
   (page-hero backgrounds use JS parallax instead — never both) */
html.has-js .hero-media img {
    animation: slow-zoom 18s var(--ease) forwards;
}

@keyframes slow-zoom {
    from { transform: scale(1.08); }
    to   { transform: scale(1); }
}

/* --- Parallax (JS-driven transform on .promo-bg / .page-hero-bg) --- */
[data-parallax] {
    will-change: transform;
}

/* ==========================================================================
   Reduced motion — respect user preference
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }

    html.has-js .reveal,
    html.has-js .reveal--left,
    html.has-js .reveal--right,
    html.has-js .reveal--scale,
    html.has-js .stagger > *,
    html.has-js .hero-entrance > * {
        opacity: 1;
        transform: none;
    }

    html.has-js .hero-media img {
        animation: none;
    }

    .marquee-track {
        animation: none;
    }

    [data-parallax] {
        transform: none !important;
    }
}
