/* ─────────────────────────────────────────
   animations.css — Keyframes & motion styles
───────────────────────────────────────── */

/* ══════════════════ KEYFRAMES ══════════════════ */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes sparkle-float {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 1; }
  50%       { transform: translateY(-8px) rotate(20deg); opacity: 0.7; }
}

@keyframes dash-draw {
  from { stroke-dashoffset: 200; }
  to   { stroke-dashoffset: 0; }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 92, 252, 0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(124, 92, 252, 0); }
}

@keyframes logo-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

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

/* ══════════════════ SCROLL-TRIGGERED CLASSES ══════════════════ */
/* Elements start hidden; JS adds .is-visible to trigger animation */

.animate-fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity var(--duration-slower) var(--ease-out),
    transform var(--duration-slower) var(--ease-out);
}

.animate-fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-delay-150 { transition-delay: 150ms; }
.animate-delay-200 { transition-delay: 200ms; }
.animate-delay-300 { transition-delay: 300ms; }
.animate-delay-450 { transition-delay: 450ms; }

/* ══════════════════ HERO ENTRANCE ══════════════════ */

.hero__content.is-visible {
  animation: none; /* handled by fade-up class above */
}

/* Mockup floats gently once visible */
.hero__mockup.is-visible .mockup-card {
  animation: float 5s ease-in-out infinite;
  animation-delay: 0.8s;
}

/* ══════════════════ DASHBOARD CHART LINES ══════════════════ */

.preview__dashboard polyline,
.preview__dashboard polygon {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  transition: stroke-dashoffset 1.4s var(--ease-out);
}

.preview.is-visible .preview__dashboard polyline,
.preview.is-visible .preview__dashboard polygon {
  stroke-dashoffset: 0;
}

/* Donut ring animation */
.preview__dashboard circle[stroke-dasharray] {
  transform-origin: center;
}

/* ══════════════════ FEATURE CARD STAGGER ══════════════════ */

.features__grid .feature-card:nth-child(1) { transition-delay: 0ms; }
.features__grid .feature-card:nth-child(2) { transition-delay: 120ms; }
.features__grid .feature-card:nth-child(3) { transition-delay: 240ms; }

/* ══════════════════ BUTTON RIPPLE ══════════════════ */

.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0);
  animation: ripple-anim 0.5s linear;
  pointer-events: none;
}

@keyframes ripple-anim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ══════════════════ STAR PULSE (testimonial) ══════════════════ */

.testimonial__card.is-visible .star--filled {
  animation: star-pop 0.3s var(--ease-spring) both;
}

.testimonial__card.is-visible .star--filled:nth-child(1) { animation-delay: 0.3s; }
.testimonial__card.is-visible .star--filled:nth-child(2) { animation-delay: 0.4s; }
.testimonial__card.is-visible .star--filled:nth-child(3) { animation-delay: 0.5s; }
.testimonial__card.is-visible .star--filled:nth-child(4) { animation-delay: 0.6s; }

@keyframes star-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  80%  { transform: scale(1.3); }
  100% { transform: scale(1);   opacity: 1; }
}

/* ══════════════════ CTA CARD ══════════════════ */

.cta__illustration.is-visible .cta-card {
  animation: float 4s ease-in-out infinite;
  animation-delay: 0.5s;
}

/* ══════════════════ FOCUS STYLES (accessibility) ══════════════════ */

:focus-visible {
  outline: 2px solid var(--color-accent-purple);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ══════════════════ MODAL ANIMATIONS ══════════════════ */

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ══════════════════ REDUCED MOTION ══════════════════ */

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

  .animate-fade-up {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
