/* ── Animations ── */

[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

[data-animate-stagger] > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

[data-animate-stagger].visible > *:nth-child(1) { transition-delay: 0s; }
[data-animate-stagger].visible > *:nth-child(2) { transition-delay: 0.1s; }
[data-animate-stagger].visible > *:nth-child(3) { transition-delay: 0.2s; }

[data-animate-stagger].visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Hero entrance */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero h1,
.hero .hero-sub,
.hero .hero-actions {
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out) forwards;
}

.hero h1 { animation-delay: 0.1s; }
.hero .hero-sub { animation-delay: 0.25s; }
.hero .hero-actions { animation-delay: 0.4s; }

/* Fallback: if JS doesn't add .visible within 2s, show elements via CSS animation */
@keyframes animateFallback {
  to { opacity: 1; transform: translateY(0); }
}

[data-animate] {
  animation: animateFallback 0.6s ease-out 2s forwards;
}

[data-animate-stagger] > * {
  animation: animateFallback 0.5s ease-out 2.2s forwards;
}

/* When JS has fired, disable the CSS fallback (class added by animations.js) */
.js-animate-ready [data-animate],
.js-animate-ready [data-animate-stagger] > * {
  animation: none;
}

/* Once .visible is applied by JS, ensure full visibility */
.js-animate-ready [data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

.js-animate-ready [data-animate-stagger].visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* No JS at all: show everything */
noscript ~ * [data-animate],
noscript ~ * [data-animate-stagger] > * {
  opacity: 1 !important;
  transform: none !important;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  [data-animate],
  [data-animate-stagger] > * {
    opacity: 1;
    transform: none;
  }

  .hero h1,
  .hero .hero-sub,
  .hero .hero-actions {
    opacity: 1;
  }
}
