/* ==========================================================================
   Cooperación Bolivia — Animaciones y transiciones suaves
   Basadas en IntersectionObserver (clase .is-visible la añade el JS).
   Respetan prefers-reduced-motion.
   ========================================================================== */

/* Estado inicial de los elementos a revelar */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--cb-dur-slow) var(--cb-ease-out),
              transform var(--cb-dur-slow) var(--cb-ease-out);
  will-change: opacity, transform;
}
[data-reveal="left"]  { transform: translateX(-32px); }
[data-reveal="right"] { transform: translateX(32px); }
[data-reveal="zoom"]  { transform: scale(0.94); }
[data-reveal="fade"]  { transform: none; }

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Retrasos escalonados para grupos (stagger) */
[data-reveal][data-delay="1"] { transition-delay: 90ms; }
[data-reveal][data-delay="2"] { transition-delay: 180ms; }
[data-reveal][data-delay="3"] { transition-delay: 270ms; }
[data-reveal][data-delay="4"] { transition-delay: 360ms; }
[data-reveal][data-delay="5"] { transition-delay: 450ms; }
[data-reveal][data-delay="6"] { transition-delay: 540ms; }

/* Flotación sutil (elementos decorativos del hero) */
@keyframes cb-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
.cb-anim-float { animation: cb-float 7s ease-in-out infinite; }
.cb-anim-float.is-delayed { animation-delay: -3.5s; }

/* Rotación lenta del anillo del hero */
@keyframes cb-spin-slow { to { transform: rotate(360deg); } }
.cb-anim-spin { animation: cb-spin-slow 60s linear infinite; }

/* Aparición del hero al cargar (sin esperar scroll) */
@keyframes cb-hero-in {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}
.cb-hero-stagger > * {
  opacity: 0;
  animation: cb-hero-in 0.8s var(--cb-ease-out) forwards;
}
.cb-hero-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.cb-hero-stagger > *:nth-child(2) { animation-delay: 0.18s; }
.cb-hero-stagger > *:nth-child(3) { animation-delay: 0.31s; }
.cb-hero-stagger > *:nth-child(4) { animation-delay: 0.44s; }
.cb-hero-stagger > *:nth-child(5) { animation-delay: 0.57s; }

/* Barra de progreso de lectura (scroll) */
.cb-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--cb-grad-brand); z-index: calc(var(--cb-z-header) + 1);
  transition: width 60ms linear;
}

/* Contador numérico */
.cb-count { font-variant-numeric: tabular-nums; }

/* Respeto absoluto a usuarios que prefieren menos movimiento */
@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; }
  .cb-hero-stagger > * { opacity: 1 !important; animation: none !important; }
}
