/* =============================================================
   animations.css — Keyframes, Scroll Reveal, Load Animations
   gestaltme.com | v1.0 | 2026-03
   =============================================================
   DEPENDS ON: tokens.css
   JS HOOK: core.js adds .is-visible to .reveal elements
            via IntersectionObserver
   ============================================================= */

/* -----------------------------------------------------------
   RESPECT USER PREFERENCES
   All animations disabled if user prefers 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 {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* -----------------------------------------------------------
   KEYFRAMES
----------------------------------------------------------- */

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

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

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

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Subtle pulse for CTA attention */
@keyframes pulseSage {
  0%, 100% { box-shadow: 0 0 0 0 rgba(122,158,142,.4); }
  50%       { box-shadow: 0 0 0 10px rgba(122,158,142,0); }
}

/* -----------------------------------------------------------
   PAGE LOAD ANIMATIONS
   Applied directly to hero elements via CSS.
   Staggered via animation-delay.
   These fire immediately on page load (no JS needed).
----------------------------------------------------------- */

.anim-load-1 {
  animation: fadeUp 0.5s 0.05s ease both;
}

.anim-load-2 {
  animation: fadeUp 0.6s 0.15s ease both;
}

.anim-load-3 {
  animation: fadeUp 0.6s 0.25s ease both;
}

.anim-load-4 {
  animation: fadeUp 0.6s 0.35s ease both;
}

.anim-load-5 {
  animation: fadeUp 0.6s 0.45s ease both;
}

.anim-load-photo {
  animation: scaleIn 0.7s 0.1s ease both;
}

.anim-load-right {
  animation: slideInRight 0.7s 0.2s ease both;
}

/* -----------------------------------------------------------
   SCROLL REVEAL
   Base state: hidden. JS adds .is-visible when in viewport.
   Different reveal directions via modifier classes.
----------------------------------------------------------- */

/* Base - fade up (default) */
/* --delay can be set inline: style="--delay: 0.2s" */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.55s ease var(--delay, 0s),
    transform 0.55s ease var(--delay, 0s);
}

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

/* Fade in only (no movement) */
.reveal--fade {
  opacity: 0;
  transform: none;
  transition: opacity 0.6s ease;
}

.reveal--fade.is-visible {
  opacity: 1;
}

/* Slide from left */
.reveal--left {
  opacity: 0;
  transform: translateX(-32px);
  transition:
    opacity 0.55s ease,
    transform 0.55s ease;
}

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

/* Slide from right */
.reveal--right {
  opacity: 0;
  transform: translateX(32px);
  transition:
    opacity 0.55s ease,
    transform 0.55s ease;
}

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

/* Scale up */
.reveal--scale {
  opacity: 0;
  transform: scale(0.94);
  transition:
    opacity 0.55s ease,
    transform 0.55s cubic-bezier(.34,1.1,.64,1);
}

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

/* -----------------------------------------------------------
   STAGGER DELAYS
   Apply to children inside a grid/list for cascade effect.
   Parent must also have .reveal or just let children animate.
----------------------------------------------------------- */

.stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

.stagger.is-visible > *:nth-child(1)  { opacity: 1; transform: none; transition-delay: 0.05s; }
.stagger.is-visible > *:nth-child(2)  { opacity: 1; transform: none; transition-delay: 0.12s; }
.stagger.is-visible > *:nth-child(3)  { opacity: 1; transform: none; transition-delay: 0.19s; }
.stagger.is-visible > *:nth-child(4)  { opacity: 1; transform: none; transition-delay: 0.26s; }
.stagger.is-visible > *:nth-child(5)  { opacity: 1; transform: none; transition-delay: 0.33s; }
.stagger.is-visible > *:nth-child(6)  { opacity: 1; transform: none; transition-delay: 0.40s; }
.stagger.is-visible > *:nth-child(7)  { opacity: 1; transform: none; transition-delay: 0.47s; }
.stagger.is-visible > *:nth-child(8)  { opacity: 1; transform: none; transition-delay: 0.54s; }
.stagger.is-visible > *:nth-child(9)  { opacity: 1; transform: none; transition-delay: 0.60s; }
.stagger.is-visible > *:nth-child(10) { opacity: 1; transform: none; transition-delay: 0.66s; }
.stagger.is-visible > *:nth-child(11) { opacity: 1; transform: none; transition-delay: 0.72s; }
.stagger.is-visible > *:nth-child(12) { opacity: 1; transform: none; transition-delay: 0.78s; }
.stagger.is-visible > *:nth-child(13) { opacity: 1; transform: none; transition-delay: 0.84s; }
.stagger.is-visible > *:nth-child(14) { opacity: 1; transform: none; transition-delay: 0.90s; }
.stagger.is-visible > *:nth-child(15) { opacity: 1; transform: none; transition-delay: 0.95s; }

/* -----------------------------------------------------------
   MICRO-INTERACTIONS
   Utility classes for common hover/interaction states
----------------------------------------------------------- */

/* Subtle lift on hover */
.hover-lift {
  transition: transform var(--ease-bounce), box-shadow var(--ease);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* CTA pulse (draws attention) */
.pulse-sage {
  animation: pulseSage 2.5s infinite;
}

/* Counter animation trigger (JS-initiated) */
.counter-animated {
  animation: countUp 0.4s ease both;
}
