/* ==========================================================================
   PERPETUAL VENTURES — animations.css
   All motion lives here. Every hidden "start state" is gated behind the
   `.js` class (set by a tiny inline script in <head>), so if JavaScript is
   unavailable the content is simply visible — nothing is ever stuck hidden.
   `.is-ready` is added to <html> once the page has loaded.
   ========================================================================== */

/* ---------- Page loader / page transition curtain ---------- */
.preloader { opacity: 1; visibility: visible; transition: opacity .55s var(--ease), visibility 0s linear 0s; }
.preloader.is-hidden { opacity: 0; visibility: hidden; transition: opacity .6s var(--ease) .05s, visibility 0s linear .7s; pointer-events: none; }
.preloader.is-leaving { opacity: 1; visibility: visible; transition: opacity .35s var(--ease); }
.preloader img { animation: logoPulse 1.4s var(--ease) infinite alternate; }
@keyframes logoPulse { from { opacity: .45; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

/* ---------- Hero entrance ---------- */
.hero__media img { transform: scale(1.14); }
.is-ready .hero__media img { animation: heroZoom 20s var(--ease-out-expo) forwards; }
@keyframes heroZoom { from { transform: scale(1.14); } to { transform: scale(1.02); } }

/* Headline lines: each line is masked and slides up */
.line { display: block; overflow: hidden; padding-bottom: .12em; margin-bottom: -.12em; }
.line > span { display: block; }
.js .line > span { transform: translateY(112%); }
.is-ready .line > span { animation: lineUp 1.1s var(--ease-out-expo) forwards; animation-delay: calc(.25s + var(--l, 0) * .14s); }
@keyframes lineUp { to { transform: translateY(0); } }

.js .hero-anim { opacity: 0; transform: translateY(22px); }
.is-ready .hero-anim { animation: heroIn 1s var(--ease-out-expo) forwards; animation-delay: calc(.2s + var(--d, 0) * .12s); }
@keyframes heroIn { to { opacity: 1; transform: translateY(0); } }

.hero__scroll::after { transform-origin: top; animation: scrollCue 2.2s var(--ease) infinite; }
@keyframes scrollCue { 0% { transform: scaleY(0); opacity: 1; } 55% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- Scroll reveals (Intersection Observer adds .is-visible) ---------- */
.js [data-reveal] {
  opacity: 0; transform: translateY(34px);
  transition: opacity .95s var(--ease-out-expo), transform .95s var(--ease-out-expo);
  transition-delay: calc(var(--i, 0) * 110ms);
  will-change: opacity, transform;
}
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="left"] { transform: translateX(-44px); }
.js [data-reveal="right"] { transform: translateX(44px); }
.js [data-reveal="scale"] { transform: scale(.94); }
.js [data-reveal].is-visible { opacity: 1; transform: none; will-change: auto; }

/* Image reveal: a clean wipe with a slow settle */
.js .img-reveal { clip-path: inset(0 0 98% 0); transition: clip-path 1.3s var(--ease-out-expo); transition-delay: calc(var(--i, 0) * 120ms); }
.js .img-reveal:not(.is-visible) img { transform: scale(1.25); }
.js .img-reveal img { transition: transform 1.8s var(--ease-out-expo); transition-delay: calc(var(--i, 0) * 120ms); }
.js .img-reveal.is-visible { clip-path: inset(0 0 0 0); }
.js .img-reveal.is-visible:not(.is-done) img { transform: scale(1); }
/* once revealed, hand the hover zoom back to component CSS */
.js .img-reveal.is-done img { transition: transform 1.4s var(--ease-out-expo); transition-delay: 0s; }

.is-ready .hero-anim.eyebrow::before, .is-ready .hero-anim .eyebrow::before { transform: scaleX(1); }

/* Underline draw-in for section eyebrows */
.js .eyebrow::before { transform: scaleX(0); transform-origin: left; transition: transform 1s var(--ease-out-expo) .2s; }
.js .is-visible .eyebrow::before, .js .eyebrow.is-visible::before { transform: scaleX(1); }

/* Parallax targets are moved by JS (transform), keep them GPU-friendly */
[data-parallax] { will-change: transform; }

/* ---------- Floating button entrance ---------- */
.js .fab-whatsapp { opacity: 0; transform: scale(.6); }
.js.is-ready .fab-whatsapp { animation: fabIn .7s var(--ease-out-expo) 1.6s forwards; }
@keyframes fabIn { to { opacity: 1; transform: scale(1); } }
.fab-whatsapp::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #1f9d55; opacity: 0; animation: ping 3.6s ease-out 4s infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: .6; } 70%, 100% { transform: scale(1.7); opacity: 0; } }

/* ---------- Reduced motion: honour the visitor's preference ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .js [data-reveal], .js .hero-anim, .js .line > span, .js .fab-whatsapp { opacity: 1 !important; transform: none !important; }
  .js .img-reveal { clip-path: none !important; }
  .js .img-reveal img, .hero__media img { transform: none !important; }
  .preloader { display: none !important; }
  .hero__scroll::after, .fab-whatsapp::after { animation: none !important; }
}
