/* ============================================================
   DIVSPROUT — ANIMATIONS
   Keyframes, scroll reveal, micro-interactions.
   ============================================================ */

/* ── Keyframes ───────────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Scroll Reveal ───────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity var(--duration-slower) var(--ease-out),
    transform var(--duration-slower) var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.stagger > * {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity var(--duration-slower) var(--ease-out),
    transform var(--duration-slower) var(--ease-out);
}

.stagger.is-visible > *:nth-child(1) { transition-delay: 0ms;   opacity: 1; transform: none; }
.stagger.is-visible > *:nth-child(2) { transition-delay: 60ms;  opacity: 1; transform: none; }
.stagger.is-visible > *:nth-child(3) { transition-delay: 120ms; opacity: 1; transform: none; }
.stagger.is-visible > *:nth-child(4) { transition-delay: 180ms; opacity: 1; transform: none; }
.stagger.is-visible > *:nth-child(5) { transition-delay: 240ms; opacity: 1; transform: none; }
.stagger.is-visible > *:nth-child(6) { transition-delay: 300ms; opacity: 1; transform: none; }
.stagger.is-visible > *:nth-child(7) { transition-delay: 360ms; opacity: 1; transform: none; }
.stagger.is-visible > *:nth-child(8) { transition-delay: 420ms; opacity: 1; transform: none; }

/* ── Page entrance ───────────────────────────────────────── */
.animate-fade-up {
  animation: fadeUp var(--duration-slower) var(--ease-out) both;
}

.animate-fade-in {
  animation: fadeIn var(--duration-slow) var(--ease-out) both;
}

.animate-scale-in {
  animation: scaleIn var(--duration-slow) var(--ease-out) both;
}

/* Delay utilities */
.delay-1 { animation-delay: 80ms; }
.delay-2 { animation-delay: 160ms; }
.delay-3 { animation-delay: 240ms; }
.delay-4 { animation-delay: 320ms; }
.delay-5 { animation-delay: 400ms; }

/* ── Number counter ──────────────────────────────────────── */
[data-count] {
  animation: countUp var(--duration-slow) var(--ease-out) both;
}

/* ── Loading shimmer ─────────────────────────────────────── */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--color-bg-elevated) 25%,
    var(--color-bg-hover)    50%,
    var(--color-bg-elevated) 75%
  );
  background-size: 200% auto;
  animation: shimmer 1.5s linear infinite;
}

/* ── 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;
  }

  .reveal,
  .stagger > * {
    opacity: 1;
    transform: none;
  }
}
