/* ═════════════════════════════════════════════════════════════════════
 *  assets/landing/movimiento.css — el movimiento de las landings de
 *  campaña (ahorro.php y ahorro-whatsapp.php).
 *
 *  Todo lo que se mueve tiene un porqué: llevar el ojo a la caja de la
 *  factura, enseñar que se revisan doce puntos, que la cifra se note.
 *  Con «reducir movimiento» activado en el teléfono no se mueve nada, y
 *  si el JavaScript no carga todo se ve igual, solo que quieto.
 * ═════════════════════════════════════════════════════════════════════ */

html, body { overflow-x: clip; }

/* ── Fondo vivo del primer pantallazo: dos luces que derivan despacio
   y una rejilla tenue que se desvanece hacia abajo ─────────────────── */
.hero { position: relative; isolation: isolate; }
.aurora { position: absolute; inset: -120px -10vw 0; z-index: -1; pointer-events: none; overflow: hidden; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; will-change: transform; }
.aurora i:nth-child(1) { width: 520px; height: 520px; left: 52%; top: 0; background: radial-gradient(circle, rgba(198,244,50,.32), transparent 65%); animation: deriva1 18s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { width: 640px; height: 640px; left: -8%; top: 30%; background: radial-gradient(circle, rgba(43,182,160,.35), transparent 65%); animation: deriva2 22s ease-in-out infinite alternate; }
.aurora::after { content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(244,247,242,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(244,247,242,.045) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%); }
@keyframes deriva1 { to { transform: translate(-120px, 90px) scale(1.15); } }
@keyframes deriva2 { to { transform: translate(140px, -60px) scale(.9); } }

/* ── Entrada del primer pantallazo, por orden ────────────────────────── */
.js-mov .entra { opacity: 0; transform: translateY(18px); animation: entra .8s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: var(--d, 0s); }
@keyframes entra { to { opacity: 1; transform: none; } }

/* La parte en lima del titular lleva un brillo que la cruza de vez en cuando */
.hero h1 span[style*="#C6F432"] {
  background: linear-gradient(100deg, #C6F432 0%, #C6F432 40%, #F4FFC9 50%, #C6F432 60%, #C6F432 100%);
  background-size: 250% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: brilloTexto 7s ease-in-out 1.4s infinite; }
@keyframes brilloTexto { 0%, 60% { background-position: 100% 0; } 85%, 100% { background-position: 0 0; } }

/* ── La caja de la factura: es lo único que tiene que hacer la gente ─── */
#arriba { position: relative; }
#arriba::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--giro, 0deg), transparent 0 70%, rgba(198,244,50,.9) 80%, transparent 90%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: giro 6s linear infinite; }
@property --giro { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes giro { to { --giro: 360deg; } }

#caja-factura svg { animation: flota 2.6s ease-in-out infinite; }
@keyframes flota { 50% { transform: translateY(-6px); } }
#caja-factura { animation: llama 3.2s ease-in-out 2s infinite; }
@keyframes llama { 0%, 70%, 100% { box-shadow: 0 0 0 0 rgba(198,244,50,0); } 80% { box-shadow: 0 0 0 6px rgba(198,244,50,.12); } }
#caja-factura.lista { animation: pop .45s cubic-bezier(.3,1.6,.5,1); }
#caja-factura.lista svg { animation: none; }
@keyframes pop { 0% { transform: scale(.97); } 60% { transform: scale(1.015); } 100% { transform: none; } }

/* Mientras se analiza: una línea de escáner recorre la factura */
#caja-factura.escaneando { overflow: hidden; }
#caja-factura.escaneando::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 56px; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(198,244,50,.22) 92%, transparent 100%);
  border-bottom: 3px solid #C6F432; box-shadow: 0 6px 18px rgba(198,244,50,.55);
  animation: escaner 1.5s ease-in-out infinite alternate; }
@keyframes escaner { from { transform: translateY(-56px); } to { transform: translateY(calc(var(--alto, 170px) - 4px)); } }
.progreso { height: 6px; margin-top: 14px; border-radius: 99px; background: rgba(244,247,242,.1); overflow: hidden; }
.progreso i { display: block; height: 100%; width: 4%; border-radius: inherit; background: linear-gradient(90deg, #8FD400, #C6F432); transition: width 1.2s ease; position: relative; }
.progreso i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: barrido 1.1s linear infinite; }
@keyframes barrido { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ── El botón principal: un destello que lo cruza cada pocos segundos ── */
.brillo { position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.brillo:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(198,244,50,.25); }
.brillo::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent); transform: skewX(-20deg);
  animation: destello 4.5s ease-in-out 2.5s infinite; }
@keyframes destello { 0%, 75% { left: -60%; } 95%, 100% { left: 130%; } }

/* ── Aparecer al hacer scroll ────────────────────────────────────────── */
.js-mov .rev { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
.js-mov .rev.in { opacity: 1; transform: none; }

/* Tarjetas: se levantan un poco al pasar el ratón */
.levanta { transition: transform .25s ease, border-color .25s ease, background .25s ease; }
.levanta:hover { transform: translateY(-4px); border-color: rgba(198,244,50,.45) !important; }

/* ── Los doce puntos: un escáner los recorre uno a uno ──────────────── */
.doce li b { transition: color .2s; }
.doce li.pasa b { animation: punto .7s ease; }
@keyframes punto { 0% { color: rgba(244,247,242,.45); } 35% { color: #C6F432; text-shadow: 0 0 14px rgba(198,244,50,.8); } 100% { } }
.doce .clave { position: relative; }
.doce .clave.encendida { border-color: #C6F432 !important; box-shadow: 0 0 0 4px rgba(198,244,50,.1), 0 18px 40px rgba(0,0,0,.25); }
.doce .clave.encendida li:first-child b { color: #C6F432 !important; }

/* ── La tabla: las marcas se dibujan, la columna de Axora brilla ────── */
.tabla svg polyline { stroke-dasharray: 26; stroke-dashoffset: 26; transition: stroke-dashoffset .5s ease; transition-delay: var(--d, 0s); }
.tabla.in svg polyline { stroke-dashoffset: 0; }
.tabla > div > span:last-child { position: relative; }

/* ── El chat de ejemplo: los mensajes llegan de uno en uno ───────────── */
.js-mov .chat-demo > * { opacity: 0; transform: translateY(10px) scale(.98); transform-origin: left bottom; }
.js-mov .chat-demo > .llega { opacity: 1; transform: none; transition: opacity .35s ease, transform .45s cubic-bezier(.3,1.4,.5,1); }
.escribe { align-self: flex-start; display: inline-flex; gap: 5px; padding: 14px 16px; border-radius: 14px 14px 14px 4px; background: rgba(244,247,242,.1); }
.escribe i { width: 7px; height: 7px; border-radius: 50%; background: rgba(244,247,242,.7); animation: tecleo 1s infinite; }
.escribe i:nth-child(2) { animation-delay: .15s; } .escribe i:nth-child(3) { animation-delay: .3s; }
@keyframes tecleo { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.flota-suave { animation: flotaSuave 6s ease-in-out infinite; }
@keyframes flotaSuave { 50% { transform: translateY(-8px); } }

/* ── El resultado: barras que crecen y hallazgos que entran ──────────── */
[data-ancho] { transition: width 1.3s cubic-bezier(.2,.7,.2,1); }
#hallazgos > div { animation: entra .6s cubic-bezier(.2,.7,.2,1) both; }
#resultado:not([hidden]) > div, #abierto:not([hidden]) > div { animation: entra .7s cubic-bezier(.2,.7,.2,1) both; }

/* ── Cabecera: sombra al bajar ───────────────────────────────────────── */
header { transition: box-shadow .3s, background .3s; }
header.bajado { box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* ── Quien pide menos movimiento, no lo tiene ────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js-mov .entra, .js-mov .rev, .js-mov .chat-demo > * { opacity: 1 !important; transform: none !important; }
  .tabla svg polyline { stroke-dashoffset: 0 !important; }
  .hero h1 span[style*="#C6F432"] { -webkit-text-fill-color: #C6F432; background: none; }
}
@media (max-width: 900px) {
  .aurora i:nth-child(1) { width: 340px; height: 340px; left: 30%; }
  .aurora i:nth-child(2) { width: 380px; height: 380px; }
}

/* Al bajar hasta el resultado, que la cabecera fija no tape el principio */
#resultado, #abierto { scroll-margin-top: 96px; }

/* ── comparar.php: el resultado bajo llave ──────────────────────────── */
/* Las barras tapadas «respiran», como algo que está ahí esperando */
.tapado .barra { background: linear-gradient(90deg, rgba(244,247,242,.16) 0%, rgba(244,247,242,.34) 50%, rgba(244,247,242,.16) 100%); background-size: 200% 100%; animation: respira 1.8s linear infinite; }
@keyframes respira { from { background-position: 200% 0; } to { background-position: -200% 0; } }
/* El candado: la etiqueta de «Análisis terminado» late y el aviso entra */
#velo > span:first-child { animation: late 2.2s ease-in-out infinite; }
@keyframes late { 0%, 100% { box-shadow: 0 0 0 0 rgba(198,244,50,.35); } 50% { box-shadow: 0 0 0 8px rgba(198,244,50,0); } }
#resultado:not([hidden]) #velo > * { animation: entra .6s cubic-bezier(.2,.7,.2,1) both; }
#resultado:not([hidden]) #velo > *:nth-child(2) { animation-delay: .12s; }
#resultado:not([hidden]) #velo > *:nth-child(3) { animation-delay: .24s; }
#resultado:not([hidden]) #velo > *:nth-child(4) { animation-delay: .36s; }
/* La ventana de nombre y móvil aparece en vez de saltar */
#modal:not([hidden]) { animation: velo .25s ease both; }
#modal:not([hidden]) > div { animation: sube .35s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes velo { from { opacity: 0; } }
@keyframes sube { from { opacity: 0; transform: translateY(24px) scale(.97); } }
