/* ============================================================
   LEOSTUDIO — animations.css
   Keyframes y clases utilitarias de animación reusables.
   Depende de: tokens.css (--ease-out-expo).
   Convención: el JS añade .ls-fade-in-paused al cargar y la
   quita cuando IntersectionObserver detecta visibilidad.
   ============================================================ */

/* === KEYFRAMES === */

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

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

@keyframes shimmer {
  from {
    background-position: -200% center;
  }
  to {
    background-position: 200% center;
  }
}

@keyframes pulse-soft {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Barrido de luz para CTAs: cruza en ~12% del ciclo y descansa el resto
   → un destello cada 5s. El salto de fin a inicio ocurre fuera de cuadro. */
@keyframes cta-shimmer {
  0% {
    transform: translateX(-150%) skewX(-20deg);
  }
  12%, 100% {
    transform: translateX(280%) skewX(-20deg);
  }
}

/* Bounce único de la mascota al cargar (no loopea) */
@keyframes mascot-bounce {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-12px) scale(1.04); }
  55%  { transform: translateY(0) scale(0.98); }
  75%  { transform: translateY(-5px) scale(1.01); }
  100% { transform: translateY(0) scale(1); }
}

/* Destello del fondo interactivo del CTA final: aparece, sube y se desvanece */
@keyframes cta-spark {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  30%  { opacity: 1; transform: translate(-50%, -90%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(0.6); }
}

/* HERO — glow púrpura pulsante en palabras clave del headline */
@keyframes ls-glow-pulse {
  0%, 100% { text-shadow: 0 0 0 transparent; }
  50%      { text-shadow: 0 0 12px rgba(123, 63, 228, 0.4); }
}

/* HERO — speed lines: cruzan el hero lentamente de izquierda a derecha */
@keyframes ls-speed-line {
  from { transform: translateX(-200px); }
  to   { transform: translateX(calc(100vw + 200px)); }
}

/* HERO — deriva sutil del tinte de fondo en mobile */
@keyframes ls-bg-shift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(-20px, 10px); }
}

/* SOLUCIONES — scan line: recorre la sección de arriba a abajo una vez */
@keyframes ls-scan-line {
  0%   { top: 0; opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* CASOS — flotación sutil de la constelación decorativa (píldoras, íconos) */
@keyframes ls-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* PROCESO — pulso de luz que recorre la línea conectora de izq. a der. */
@keyframes ls-proceso-pulse {
  0%   { left: 0; opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { left: calc(100% - 60px); opacity: 0; }
}

/* === CLASES UTILITARIAS === */

.ls-fade-in {
  animation: fadeInUp 0.65s var(--ease-out-expo) both;
}

/* Delays escalonados para entradas en cascada */
.ls-fade-in.d1 { animation-delay: 0.1s; }
.ls-fade-in.d2 { animation-delay: 0.2s; }
.ls-fade-in.d3 { animation-delay: 0.3s; }
.ls-fade-in.d4 { animation-delay: 0.4s; }

/* Estado inicial controlado por JS: invisible y en pausa
   hasta que IntersectionObserver quita esta clase */
.ls-fade-in-paused {
  opacity: 0;
  animation-play-state: paused;
}

.ls-scale-in {
  animation: scaleIn 0.5s var(--ease-out-expo) both;
}

/* Destello recurrente sobre CTAs primarios.
   El ::after se recorta al botón (overflow) y no bloquea clics. */
.ls-cta-shimmer {
  position: relative;
  overflow: hidden;
}

.ls-cta-shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 100%
  );
  transform: translateX(-150%) skewX(-20deg);
  animation: cta-shimmer 5s var(--ease-out-expo) infinite;
  pointer-events: none;
}

/* === REDUCED MOTION === */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
