/* ==========================================================================
   animations.css
   Keyframes + scroll-reveal utility classes. Respects reduced-motion.
   ========================================================================== */

/* ---- Keyframes ---------------------------------------------------------- */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-16px);
  }
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-500) 70%, transparent);
  }
  70% {
    box-shadow: 0 0 0 10px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

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

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

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

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }
  100% {
    background-position: 400px 0;
  }
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  60% {
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---- Animated gradient text (used on hero highlight) -------------------- */
.animate-gradient {
  background-size: 200% auto;
  animation: gradient-shift 6s ease infinite;
}

/* ---- Loading spinner ---------------------------------------------------- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---- Skeleton shimmer (lazy image placeholder) -------------------------- */
.is-lazy {
  background: linear-gradient(
    100deg,
    var(--bg-muted) 30%,
    color-mix(in srgb, var(--bg-muted) 60%, #fff) 50%,
    var(--bg-muted) 70%
  );
  background-size: 400px 100%;
  animation: shimmer 1.4s ease infinite;
}
img.is-loaded {
  animation: fade-in 0.5s var(--ease-out);
}

/* ==========================================================================
   Scroll-reveal system
   Elements get [data-reveal]; JS adds .is-visible via IntersectionObserver.
   ========================================================================== */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  will-change: opacity, transform;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* Direction / style variants */
[data-reveal='left'] {
  transform: translateX(-40px);
}
[data-reveal='right'] {
  transform: translateX(40px);
}
[data-reveal='zoom'] {
  transform: scale(0.9);
}

/* On phones/tablets the containers are full-width, so a horizontal offset
   pushes them past the viewport and the page can be panned sideways.
   Reveal them vertically instead. */
@media (max-width: 899px) {
  [data-reveal='left'],
  [data-reveal='right'] {
    transform: translateY(28px);
  }
}
[data-reveal='fade'] {
  transform: none;
}

/* Stagger children via inline --delay set in HTML or JS */
[data-reveal] {
  transition-delay: var(--delay, 0s);
}

/* ---- Reduced motion: disable all the fancy stuff ------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
  .hero__visual {
    animation: none;
  }
}
