/* ═══════════════════════════════════════════
 * ANIMACIONES · keyframes + scroll-reveal + hovers cinemáticos
 * ═══════════════════════════════════════════ */

@keyframes faro-pulso {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.15); }
}

@keyframes faro-rotar {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(360deg); }
}

@keyframes nebla-deriva {
  0%, 100% { transform: translateX(0) translateY(0); opacity: 0.55; }
  33% { transform: translateX(-3%) translateY(-1%); opacity: 0.75; }
  66% { transform: translateX(2%) translateY(1%); opacity: 0.5; }
}

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

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

@keyframes brillo-suave {
  0%, 100% { box-shadow: 0 0 20px rgba(244, 200, 122, 0.2); }
  50% { box-shadow: 0 0 40px rgba(244, 200, 122, 0.4); }
}

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

/* ═══ Scroll reveal · elementos con [data-reveal] aparecen al entrar viewport ═══ */
[data-reveal] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s var(--ease-suave), transform 1s var(--ease-suave);
}

[data-reveal].visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══ Stagger para hijos directos cuando el padre es visible ═══ */
.libros-grid [data-reveal].visible,
.kpis-grid .kpi {
  animation: fade-up 0.8s var(--ease-suave) backwards;
}

.libros-grid .libro-grande:nth-child(1) { animation-delay: 0.05s; }
.libros-grid .libro-grande:nth-child(2) { animation-delay: 0.15s; }
.libros-grid .libro-grande:nth-child(3) { animation-delay: 0.25s; }
.libros-grid .libro-grande:nth-child(4) { animation-delay: 0.35s; }
.libros-grid .libro-grande:nth-child(5) { animation-delay: 0.45s; }

.kpis-grid .kpi:nth-child(1) { animation-delay: 0.05s; }
.kpis-grid .kpi:nth-child(2) { animation-delay: 0.12s; }
.kpis-grid .kpi:nth-child(3) { animation-delay: 0.19s; }
.kpis-grid .kpi:nth-child(4) { animation-delay: 0.26s; }
.kpis-grid .kpi:nth-child(5) { animation-delay: 0.33s; }
.kpis-grid .kpi:nth-child(6) { animation-delay: 0.4s; }

/* ═══ Hero entry stagger ═══ */
.hero .hero-eyebrow { animation: fade-up 1.2s var(--ease-suave) 0.2s backwards; }
.hero .hero-titulo { animation: fade-up 1.2s var(--ease-suave) 0.5s backwards; }
.hero .hero-bajada { animation: fade-up 1.2s var(--ease-suave) 0.8s backwards; }
.hero .hero-metafora { animation: fade-up 1.2s var(--ease-suave) 1.1s backwards; }
.hero .tagline { animation: fade-up 1.2s var(--ease-suave) 1.5s backwards; }

/* ═══ Libro volando al click en biblioteca ═══ */
@keyframes libro-aterrizar {
  0% {
    transform: translate(calc(-50vw + 80px), calc(50vh - 100px)) scale(0.3) rotateY(0deg);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotateY(360deg);
  }
}

.libro-volando {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 280px;
  height: 420px;
  z-index: var(--z-modal);
  pointer-events: none;
  animation: libro-aterrizar 1.4s var(--ease-rebote) forwards;
}

/* ═══ Pulso del botón de la llave ═══ */
.boton-llave {
  animation: brillo-suave 3s ease-in-out infinite;
}
