/* ==========================================================================
   Movimiento — todo suave, nada brusco, nada que sobresalte
   ========================================================================== */

/* ---- Keyframes ---------------------------------------------------------- */

@keyframes respirar-aurora {
  0%, 100% { transform: scale(1) translate3d(0, 0, 0); opacity: 0.95; }
  50%      { transform: scale(1.07) translate3d(0, -1.5%, 0); opacity: 1; }
}

@keyframes latir {
  0%, 100% { opacity: 0.55; transform: scale(0.97); }
  50%      { opacity: 1;    transform: scale(1.05); }
}

@keyframes aparecer {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes subir {
  from { opacity: 0; transform: translate3d(0, 18px, 0); }
  to   { opacity: 1; transform: none; }
}

@keyframes subir-corto {
  from { opacity: 0; transform: translate3d(0, 9px, 0); }
  to   { opacity: 1; transform: none; }
}

@keyframes bajar {
  from { opacity: 0; transform: translate3d(0, -14px, 0); }
  to   { opacity: 1; transform: none; }
}

@keyframes escalar-entrada {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes brotar {
  0%   { opacity: 0; transform: scale(0.7); }
  62%  { opacity: 1; transform: scale(1.045); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes hoja-entra {
  from { transform: translate3d(0, 100%, 0); }
  to   { transform: none; }
}

@keyframes deslizar-derecha {
  from { opacity: 0; transform: translate3d(22px, 0, 0); }
  to   { opacity: 1; transform: none; }
}

@keyframes deslizar-izquierda {
  from { opacity: 0; transform: translate3d(-22px, 0, 0); }
  to   { opacity: 1; transform: none; }
}

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

/* Confirmación amable: un asentimiento, no un rebote de dibujos animados */
@keyframes asentir {
  0%   { transform: scale(1); }
  38%  { transform: scale(1.085); }
  100% { transform: scale(1); }
}

/* "Casi": un vaivén leve y lento. Nunca un temblor nervioso */
@keyframes vaiven {
  0%, 100% { transform: translate3d(0, 0, 0); }
  25%      { transform: translate3d(-5px, 0, 0); }
  75%      { transform: translate3d(5px, 0, 0); }
}

@keyframes destello {
  0%   { opacity: 0; transform: scale(0.6); }
  45%  { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.9); }
}

@keyframes brillo-pasa {
  from { transform: translate3d(-120%, 0, 0) skewX(-14deg); }
  to   { transform: translate3d(320%, 0, 0) skewX(-14deg); }
}

@keyframes contar-arriba {
  from { opacity: 0; transform: translate3d(0, 60%, 0); }
  to   { opacity: 1; transform: none; }
}

@keyframes ondear {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(0, -7px, 0); }
}

@keyframes progreso-indeterminado {
  0%   { transform: translate3d(-100%, 0, 0); }
  100% { transform: translate3d(400%, 0, 0); }
}

/* ---- Clases de animación ------------------------------------------------ */

.anim-aparecer   { animation: aparecer var(--d-media) var(--ease-suave) both; }
.anim-subir      { animation: subir var(--d-lenta) var(--ease-entrada) both; }
.anim-subir-corto{ animation: subir-corto var(--d-media) var(--ease-entrada) both; }
.anim-bajar      { animation: bajar var(--d-media) var(--ease-entrada) both; }
.anim-escalar    { animation: escalar-entrada var(--d-media) var(--ease-entrada) both; }
.anim-brotar     { animation: brotar var(--d-lenta) var(--ease-elastico) both; }
.anim-asentir    { animation: asentir var(--d-media) var(--ease-elastico); }
.anim-vaiven     { animation: vaiven var(--d-lenta) var(--ease-suave); }
.anim-ondear     { animation: ondear 3.2s var(--ease-respiro) infinite; }
.anim-latir      { animation: latir 4.5s var(--ease-respiro) infinite; }

/* Entrada escalonada de listas: el contenido "cae" en cascada */
.cascada > * {
  animation: subir-corto var(--d-lenta) var(--ease-entrada) both;
}
.cascada > *:nth-child(1) { animation-delay: 40ms; }
.cascada > *:nth-child(2) { animation-delay: 90ms; }
.cascada > *:nth-child(3) { animation-delay: 140ms; }
.cascada > *:nth-child(4) { animation-delay: 190ms; }
.cascada > *:nth-child(5) { animation-delay: 240ms; }
.cascada > *:nth-child(6) { animation-delay: 290ms; }
.cascada > *:nth-child(7) { animation-delay: 340ms; }
.cascada > *:nth-child(8) { animation-delay: 390ms; }
.cascada > *:nth-child(n+9) { animation-delay: 430ms; }

/* Retardos manuales */
.retardo-1 { animation-delay: 70ms !important; }
.retardo-2 { animation-delay: 140ms !important; }
.retardo-3 { animation-delay: 220ms !important; }
.retardo-4 { animation-delay: 300ms !important; }
.retardo-5 { animation-delay: 400ms !important; }

/* ---- Transición entre pantallas ----------------------------------------- */

.pantalla {
  animation: subir-corto var(--d-media) var(--ease-entrada) both;
}
.pantalla[data-direccion="atras"] {
  animation-name: deslizar-izquierda;
}
.pantalla[data-direccion="adelante"] {
  animation-name: deslizar-derecha;
}

/* ---- Esqueletos de carga ------------------------------------------------ */

.esqueleto {
  position: relative;
  overflow: hidden;
  background: rgb(var(--verde-100-rgb) / 0.06);
  border-radius: var(--r-md);
}
.esqueleto::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgb(var(--verde-100-rgb) / 0.12), transparent);
  animation: brillo-pasa 1.6s var(--ease-respiro) infinite;
}

/* ---- Respeto por prefers-reduced-motion --------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .cascada > * { animation-delay: 0ms !important; }
  body::before { animation: none; }
}
