/* ============================================================
   EL JAIBO UNDERGROUND — Animaciones
   Todas respetan prefers-reduced-motion (ver design-system.css).
   ============================================================ */

/* ---------- REVELADO AL HACER SCROLL ----------
   Se activa con IntersectionObserver desde custom-interactions.js.
   El estado inicial solo se aplica si JS esta activo (.js-on en <html>),
   para que sin JS el contenido sea visible. */
.js-on .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--t-slow), transform var(--t-slow);
  will-change: opacity, transform;
}
.js-on .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Retrasos escalonados para grids */
.js-on .reveal[data-delay="1"] { transition-delay: 80ms; }
.js-on .reveal[data-delay="2"] { transition-delay: 160ms; }
.js-on .reveal[data-delay="3"] { transition-delay: 240ms; }
.js-on .reveal[data-delay="4"] { transition-delay: 320ms; }

/* ---------- ENTRADA DEL HERO ---------- */
.hero__title,
.hero__sub,
.hero__text,
.hero__actions,
.hero__badge {
  animation: heroUp 700ms cubic-bezier(.22,.61,.36,1) backwards;
}
.hero__sub     { animation-delay: 100ms; }
.hero__title   { animation-delay: 180ms; }
.hero__text    { animation-delay: 300ms; }
.hero__actions { animation-delay: 400ms; }
.hero__badge   { animation-delay: 520ms; }

@keyframes heroUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- PULSO DEL CONTADOR DEL CARRITO ---------- */
.cart-badge.is-pulse { animation: pulsoBadge 500ms ease-out; }
@keyframes pulsoBadge {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* ---------- BOTON EN ESPERA ---------- */
.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.is-loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--jaibo-black);
  animation: girar 600ms linear infinite;
}
.btn-jaibo-outline.is-loading::after { color: var(--jaibo-white); }

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

/* ---------- ESQUELETO DE CARGA ---------- */
.skeleton {
  background: linear-gradient(90deg,
    var(--jaibo-surface) 25%,
    var(--jaibo-surface-2) 50%,
    var(--jaibo-surface) 75%);
  background-size: 200% 100%;
  animation: brillo 1.4s ease-in-out infinite;
  border-radius: var(--radius-md);
}
@keyframes brillo {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ---------- SUBRAYADO ANIMADO ---------- */
.link-underline {
  position: relative;
  display: inline-block;
}
.link-underline::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: var(--jaibo-yellow);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--t-base);
}
.link-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}
