/* =====================================================================
   MOTION — todas las animaciones de la web en un solo sitio.
   Se carga al final para poder sobrescribir. Respeta la preferencia
   del sistema "reducir movimiento" (bloque final).
   Lógica asociada: js/modules/reveal.js y js/modules/motion.js
   ===================================================================== */

@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

/* ---------- Barra de progreso de scroll ---------- */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 101; pointer-events: none;
  transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--red), var(--red2));
  box-shadow: 0 0 12px rgba(255,122,26,.7);
}

/* ---------- Luz ambiental que se desplaza despacio ---------- */
.ambient { animation: aurora 18s ease-in-out infinite alternate; }
@keyframes aurora { to { transform: translate3d(-3%,2%,0) scale(1.08); } }

/* ---------- Entrada del hero ---------- */
.hero-grid > div:first-child > * { animation: heroIn .9s cubic-bezier(.2,.7,.2,1) backwards; }
.hero-grid > div:first-child > :nth-child(2) { animation-delay: .08s; }
.hero-grid > div:first-child > :nth-child(3) { animation-delay: .16s; }
.hero-grid > div:first-child > :nth-child(4) { animation-delay: .24s; }
.hero-grid > div:first-child > :nth-child(5) { animation-delay: .32s; }
.hero-visual { animation: heroIn 1.1s .2s cubic-bezier(.2,.7,.2,1) backwards; }
@keyframes heroIn { from { opacity: 0; transform: translateY(28px); filter: blur(6px); } }

/* brillo que recorre la palabra destacada del titular */
.hero h1 .red {
  background-image: linear-gradient(90deg, #ffab4a, #ff7a1a 30%, #ffd29a 50%, #ff7a1a 70%, #ffab4a);
  background-size: 200% auto;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% center; } }

/* ---------- Parallax del hero (--px/--py los pone motion.js) ---------- */
.candle, .movers, .term-bg { transition: translate .5s cubic-bezier(.2,.7,.2,1); }
.c1 { translate: calc(var(--px,0) * -18px) calc(var(--py,0) * -12px); }
.c2 { translate: calc(var(--px,0) * -30px) calc(var(--py,0) * -20px); }
.term-bg { translate: calc(var(--px,0) * 8px) calc(var(--py,0) * 6px); }
.movers { translate: calc(var(--px,0) * 14px) calc(var(--py,0) * 10px); }

/* ---------- Aparición al hacer scroll (.rv → .rv.in en reveal.js) ---------- */
.rv { opacity: 0; transform: translateY(26px); transition: opacity .7s, transform .7s; }
.rv.in { opacity: 1; transform: none; }
/* las tarjetas de cada grid entran escalonadas (--i = posición) */
.rv.in :is(.feat-grid, .eco-grid, .price-grid, .doc-grid, .contact-grid, .kv) > * {
  animation: riseIn .7s cubic-bezier(.2,.7,.2,1) backwards;
  animation-delay: calc(var(--i,0) * 90ms + .1s);
}
@keyframes riseIn { from { opacity: 0; transform: translateY(24px) scale(.98); } }

/* minigráficas que se dibujan solas */
.spark path { stroke-dasharray: 320; stroke-dashoffset: 320; transition: stroke-dashoffset 1.6s cubic-bezier(.4,0,.2,1) .5s; }
.rv.in .spark path { stroke-dashoffset: 0; }

/* capturas que hacen un leve zoom-out al aparecer */
.showcase img { transform: scale(1.06); transition: transform 1.4s cubic-bezier(.2,.7,.2,1); }
.in .showcase img, .showcase.in img { transform: none; }

/* ---------- Foco de luz que sigue al cursor en las tarjetas ---------- */
:is(.feat, .eco-card, .price, .doc, .c-card, .stat) { position: relative; }
:is(.feat, .eco-card, .price, .doc, .c-card, .stat, .card) { isolation: isolate; }
:is(.feat, .eco-card, .price, .doc, .c-card, .stat, .card)::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(420px circle at var(--mx,50%) var(--my,50%), rgba(255,122,26,.13), transparent 45%);
}
:is(.feat, .eco-card, .price, .doc, .c-card, .stat, .card):hover::before { opacity: 1; }

/* ---------- Borde de luz giratorio en el plan destacado ---------- */
.price.hot::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--ang), transparent 0 62%, rgba(255,176,92,.9) 78%, #ff7a1a 88%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spinAng 4.5s linear infinite;
}
@keyframes spinAng { to { --ang: 360deg; } }

/* ---------- Reflejo en los botones principales ---------- */
.btn-red { position: relative; overflow: hidden; }
.btn-red::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.38) 50%, transparent 70%);
}
.btn-red:hover::after { transform: translateX(120%); transition: transform .75s ease; }

/* ---------- Iconos que "saltan" al pasar el ratón ---------- */
.feat .ic, .eco-ic, .c-card .ic { transition: transform .35s cubic-bezier(.2,.9,.3,1.4), box-shadow .35s; }
:is(.feat, .eco-card, .c-card):hover :is(.ic, .eco-ic) { transform: translateY(-2px) rotate(-6deg) scale(1.08); box-shadow: 0 0 22px rgba(255,122,26,.35); }

/* ---------- Filas del panel de movers ---------- */
.mv-row { animation: rowIn .5s cubic-bezier(.2,.7,.2,1) backwards; animation-delay: calc(var(--i,0) * 70ms); }
@keyframes rowIn { from { opacity: 0; transform: translateX(12px); } }

/* ---------- Fundido al cambiar de idioma (View Transitions) ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }

/* ---------- Accesibilidad: reducir movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
    transition-duration: .01ms !important; transition-delay: 0s !important;
  }
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; }
  .particle { display: none; }
}
