/* ==========================================================================
   ACE ARTE — animations.css
   Keyframes, scroll-reveal fallbacks and the reduced-motion contract.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Keyframes
   -------------------------------------------------------------------------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translate3d(0, 34px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideLeft {
  from { opacity: 0; transform: translate3d(48px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes slideRight {
  from { opacity: 0; transform: translate3d(-48px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Hero headline lines rise out of a clipping mask. */
@keyframes maskUp {
  from { transform: translate3d(0, 110%, 0); }
  to { transform: translate3d(0, 0, 0); }
}

@keyframes ripple {
  to { transform: scale(2.6); opacity: 0; }
}

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

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

@keyframes pulseRing {
  0% { transform: scale(0.9); opacity: 0.55; }
  70% { transform: scale(1.65); opacity: 0; }
  100% { transform: scale(1.65); opacity: 0; }
}

@keyframes scrollHint {
  0% { transform: translateY(-100%); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translateY(100%); opacity: 0; }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* --------------------------------------------------------------------------
   Hero load sequence — the one orchestrated moment on the page
   -------------------------------------------------------------------------- */
.mask-line { display: block; overflow: hidden; }
.mask-line > span {
  display: block;
  transform: translate3d(0, 110%, 0);
}
.is-ready .mask-line > span {
  animation: maskUp 1.05s var(--ease-out) forwards;
}
.is-ready .mask-line:nth-child(1) > span { animation-delay: 0.15s; }
.is-ready .mask-line:nth-child(2) > span { animation-delay: 0.28s; }
.is-ready .mask-line:nth-child(3) > span { animation-delay: 0.41s; }

.hero-fade { opacity: 0; }
.is-ready .hero-fade { animation: fadeUp 0.9s var(--ease-out) forwards; }
.is-ready .hero-fade--1 { animation-delay: 0.55s; }
.is-ready .hero-fade--2 { animation-delay: 0.7s; }
.is-ready .hero-fade--3 { animation-delay: 0.85s; }
.is-ready .hero-fade--4 { animation-delay: 1s; }

/* --------------------------------------------------------------------------
   Reveal-on-scroll fallback (used when AOS is unavailable; the
   .is-inview class is toggled by animations.js via IntersectionObserver)
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; will-change: opacity, transform; }
.reveal.is-inview { animation: fadeUp 0.85s var(--ease-out) forwards; }
.reveal--left.is-inview { animation-name: slideRight; }
.reveal--right.is-inview { animation-name: slideLeft; }
.reveal--fade.is-inview { animation-name: fadeIn; }

/* Stagger children of a revealed group. */
.reveal-group > * { opacity: 0; }
.reveal-group.is-inview > * { animation: fadeUp 0.8s var(--ease-out) forwards; }
.reveal-group.is-inview > *:nth-child(1) { animation-delay: 0.04s; }
.reveal-group.is-inview > *:nth-child(2) { animation-delay: 0.12s; }
.reveal-group.is-inview > *:nth-child(3) { animation-delay: 0.2s; }
.reveal-group.is-inview > *:nth-child(4) { animation-delay: 0.28s; }
.reveal-group.is-inview > *:nth-child(5) { animation-delay: 0.36s; }
.reveal-group.is-inview > *:nth-child(6) { animation-delay: 0.44s; }
.reveal-group.is-inview > *:nth-child(7) { animation-delay: 0.52s; }
.reveal-group.is-inview > *:nth-child(8) { animation-delay: 0.6s; }

/* --------------------------------------------------------------------------
   Ambient / decorative motion
   -------------------------------------------------------------------------- */
.float-soft { animation: floatY 6s var(--ease-in-out) infinite; }

.pulse-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid currentColor;
  animation: pulseRing 2.4s var(--ease-out) infinite;
  pointer-events: none;
}

.shimmer {
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.35) 50%, transparent 80%);
  background-size: 200% 100%;
  animation: shimmer 2.4s linear infinite;
}

/* Parallax layers are transformed by animations.js / GSAP. */
.parallax-layer { will-change: transform; }

/* --------------------------------------------------------------------------
   Reduced motion — everything resolves to its final state
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .reveal,
  .reveal-group > *,
  .hero-fade { opacity: 1 !important; }

  .mask-line > span { transform: none !important; }

  .media-frame:hover img,
  .btn-ace:hover { transform: none !important; }
}
