/* Destello · motor de animaciones común (web pública y app) */

/* ---------- Transición entre páginas (navegadores que la soportan) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vtSalir .26s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: vtEntrar .5s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes vtSalir { to { opacity: 0; transform: translateY(-10px) scale(.992); filter: blur(4px); } }
@keyframes vtEntrar { from { opacity: 0; transform: translateY(16px); filter: blur(6px); } }
.cabecera { view-transition-name: cabecera; }

/* ---------- Barra de progreso de lectura ---------- */
.progreso-lectura { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70; pointer-events: none; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--lima), var(--cielo), var(--coral)); box-shadow: 0 0 12px rgba(200, 242, 60, .6); }

/* ---------- Cabecera que se compacta al bajar ---------- */
.cabecera .contenedor { transition: height .35s cubic-bezier(.2, .8, .2, 1); }
.cabecera.con-borde .contenedor { height: 60px; }
.logo:hover .chispa { animation-duration: 1.2s; }
.menu a { position: relative; transition: color .2s, background .2s; }
.menu a:not(.boton)::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px; border-radius: 2px; background: var(--lima); transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.menu a:not(.boton):hover::after, .menu a[aria-current='page']::after { transform: scaleX(1); }
@media (max-width: 900px) {
  .menu { transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
  .menu.abierto > * { animation: menuEntra .45s cubic-bezier(.2, .8, .2, 1.2) both; }
  .menu.abierto > :nth-child(2) { animation-delay: .05s; } .menu.abierto > :nth-child(3) { animation-delay: .1s; }
  .menu.abierto > :nth-child(4) { animation-delay: .15s; } .menu.abierto > :nth-child(5) { animation-delay: .2s; }
  .menu a:not(.boton)::after { display: none; }
}
@keyframes menuEntra { from { opacity: 0; translate: -24px 0; } }

/* ---------- Aparición al hacer scroll (con variantes y escalonado) ---------- */
.aparece { opacity: 0; transform: none; translate: 0 34px; transition: opacity .9s cubic-bezier(.2, .8, .2, 1), translate .9s cubic-bezier(.2, .8, .2, 1), scale .9s cubic-bezier(.2, .8, .2, 1), filter .9s ease; transition-delay: var(--retraso, 0ms); }
.aparece[data-aparece='izq'] { translate: -60px 0; }
.aparece[data-aparece='der'] { translate: 60px 0; }
.aparece[data-aparece='zoom'] { translate: none; scale: .86; }
.aparece[data-aparece='desenfoque'] { translate: 0 14px; filter: blur(14px); }
.aparece.visible { opacity: 1; translate: none; scale: none; filter: none; }

/* Titulares que entran palabra a palabra */
.pal { display: inline-block; opacity: 0; translate: 0 .55em; rotate: 3deg; filter: blur(8px); transition: opacity .8s ease, translate .8s cubic-bezier(.2, .8, .2, 1.15), rotate .8s cubic-bezier(.2, .8, .2, 1), filter .8s ease; transition-delay: calc(var(--n, 0) * 55ms + 80ms); will-change: translate; }
.palabras.visible .pal { opacity: 1; translate: none; rotate: none; filter: none; }
.subrayado { background-size: 0% 100%; background-repeat: no-repeat; background-position: left; transition: background-size 1.1s cubic-bezier(.2, .8, .2, 1) .55s; }
.visible .subrayado, .subrayado.visible { background-size: 100% 100%; }

/* Palabra que va cambiando (bodas, empresas…) */
.rotar { display: inline-block; color: var(--lima); white-space: nowrap; }

/* ---------- Fondo «aurora» que se mueve ---------- */
.brillo::before { animation: deriva1 19s ease-in-out infinite alternate; }
.brillo::after { animation: deriva2 23s ease-in-out infinite alternate; }
.brillo .orbe { position: absolute; width: 380px; height: 380px; border-radius: 50%; filter: blur(100px); opacity: .5; background: rgba(255, 106, 77, .35); bottom: -140px; left: 30%; animation: deriva3 17s ease-in-out infinite alternate; }
.brillo .orbe.dos { background: rgba(125, 211, 252, .28); width: 300px; height: 300px; top: 40%; bottom: auto; left: 55%; animation-duration: 21s; animation-direction: alternate-reverse; }
@keyframes deriva1 { to { transform: translate(160px, 90px) scale(1.25); } }
@keyframes deriva2 { to { transform: translate(-140px, 70px) scale(.82); } }
@keyframes deriva3 { to { transform: translate(-180px, -90px) scale(1.2); } }

/* Chispitas que suben en el héroe */
.chispitas { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.chispitas i { position: absolute; bottom: -20px; font-style: normal; color: var(--lima); opacity: 0; animation: chispear linear infinite; text-shadow: 0 0 12px currentColor; }
@keyframes chispear { 0% { opacity: 0; transform: translateY(0) rotate(0) scale(.6); } 12% { opacity: .9; } 80% { opacity: .6; } 100% { opacity: 0; transform: translateY(-110vh) rotate(260deg) scale(1.1); } }

/* ---------- Tarjetas: luz que sigue al ratón e inclinación 3D ---------- */
.tarjeta { position: relative; }
.tarjeta::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s; background: radial-gradient(460px circle at var(--mx, 50%) var(--my, 50%), rgba(200, 242, 60, .11), transparent 42%); }
.tarjeta:hover::after { opacity: 1; }
.tarjeta:not(.aparece) { transition: border-color .35s, box-shadow .35s; }
.aparece.tarjeta { transition: opacity .9s cubic-bezier(.2, .8, .2, 1), translate .9s cubic-bezier(.2, .8, .2, 1), scale .9s cubic-bezier(.2, .8, .2, 1), filter .9s ease, border-color .35s, box-shadow .35s; transition-delay: var(--retraso, 0ms); }
.tarjeta:hover { border-color: rgba(200, 242, 60, .28); }
.inclina.inclina { transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0px)); transition: transform .6s cubic-bezier(.2, .8, .2, 1), opacity .9s cubic-bezier(.2, .8, .2, 1), translate .9s cubic-bezier(.2, .8, .2, 1), scale .9s cubic-bezier(.2, .8, .2, 1), filter .9s, border-color .35s, box-shadow .35s; }
.inclina.inclina:hover { --ty: -6px; box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .7); }
.inclina.inclina.moviendo { transition-duration: .12s, .9s, .9s, .9s, .9s, .35s, .35s; }
.plan.destacado { --ty: -8px; }
.plan.destacado.inclina:hover { --ty: -14px; box-shadow: 0 40px 90px -30px rgba(200, 242, 60, .45); }
.icono { transition: transform .5s cubic-bezier(.2, .8, .2, 1.6); }
.tarjeta:hover .icono, .tarjeta:hover .caso-emoji { transform: scale(1.15) rotate(-8deg); }
.caso-emoji { transition: transform .5s cubic-bezier(.2, .8, .2, 1.6); display: inline-block !important; }

/* ---------- Botones: imán, onda al pulsar y destello ---------- */
.boton { position: relative; overflow: hidden; isolation: isolate; translate: var(--imx, 0px) var(--imy, 0px); transition: transform .18s cubic-bezier(.2, .8, .2, 1.4), box-shadow .2s, background .2s, translate .35s cubic-bezier(.2, .8, .2, 1); }
.onda { position: absolute; border-radius: 50%; background: currentColor; opacity: .28; transform: scale(0); animation: onda .65s cubic-bezier(.2, .8, .2, 1) forwards; pointer-events: none; z-index: -1; }
@keyframes onda { to { transform: scale(1); opacity: 0; } }
.boton.grande:not(.secundario):not(.peligro)::after, .menu .boton::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .6) 50%, transparent 65%); translate: -130% 0; animation: destelloBoton 5s ease-in-out infinite 1.5s; }
@keyframes destelloBoton { 0%, 70% { translate: -130% 0; } 100% { translate: 130% 0; } }
.boton span[aria-hidden='true'] { display: inline-block; transition: transform .3s cubic-bezier(.2, .8, .2, 1.6); }
.boton:hover span[aria-hidden='true'] { transform: translateX(5px); }

/* Luz suave que sigue al cursor (solo ordenador) */
.luz-cursor { position: fixed; left: 0; top: 0; width: 560px; height: 560px; margin: -280px 0 0 -280px; border-radius: 50%; pointer-events: none; z-index: 45; mix-blend-mode: screen; opacity: 0; transition: opacity .5s; background: radial-gradient(circle, rgba(200, 242, 60, .07), rgba(125, 211, 252, .03) 35%, transparent 62%); transform: translate3d(var(--cx, -999px), var(--cy, -999px), 0); }
.luz-cursor.activa { opacity: 1; }

/* ---------- Cinta infinita de retos ---------- */
.marquesina { overflow: hidden; padding: 8px 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquesina + .marquesina { margin-top: 4px; }
.pista-m { display: flex; gap: 12px; width: max-content; animation: desfilar var(--vel, 45s) linear infinite; }
.marquesina.inversa .pista-m { animation-direction: reverse; }
.marquesina:hover .pista-m { animation-play-state: paused; }
.pista-m .chip { white-space: nowrap; font-size: 1rem; padding: 10px 16px; background: rgba(255, 255, 255, .05); transition: background .25s, border-color .25s, transform .25s; }
.pista-m .chip:hover { background: rgba(200, 242, 60, .14); border-color: var(--lima); transform: translateY(-3px) rotate(-2deg); }
@keyframes desfilar { to { transform: translateX(-50%); } }
.cinta-retos { padding: 26px 0 10px; }

/* ---------- Preguntas que se abren con suavidad ---------- */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  details.pregunta::details-content { height: 0; overflow: clip; transition: height .45s cubic-bezier(.2, .8, .2, 1), content-visibility .45s allow-discrete; }
  details.pregunta[open]::details-content { height: auto; }
}
details.pregunta[open] p { animation: subeSuave .5s cubic-bezier(.2, .8, .2, 1); }
details.pregunta summary { transition: color .2s, padding-left .3s cubic-bezier(.2, .8, .2, 1); }
details.pregunta summary:hover { color: var(--lima); padding-left: 6px; }
@keyframes subeSuave { from { opacity: 0; translate: 0 10px; } }

/* Contadores que suben */
[data-contar] { font-variant-numeric: tabular-nums; }

/* Avisos: entran rebotando y salen deslizando */
.aviso { animation: entrarAvisoV .5s cubic-bezier(.2, .8, .2, 1.4); }
@keyframes entrarAvisoV { from { opacity: 0; transform: translateY(30px) scale(.85) rotate(-2deg); } }

/* Pie: enlaces que se desplazan */
.pie a { display: inline-block; transition: color .2s, transform .25s cubic-bezier(.2, .8, .2, 1.4); }
.pie ul a:hover { transform: translateX(4px); }

/* Formularios: el foco brilla */
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 4px rgba(200, 242, 60, .15); }
input, select, textarea { transition: border-color .2s, background .2s, box-shadow .3s; }
.interruptor input:checked::after { box-shadow: 0 0 10px rgba(200, 242, 60, .8); }

/* ---------- Movimiento reducido: todo quieto y visible ---------- */
@media (prefers-reduced-motion: reduce) {
  .aparece, .pal { opacity: 1 !important; translate: none !important; scale: none !important; rotate: none !important; filter: none !important; }
  .subrayado { background-size: 100% 100% !important; }
  .pista-m { animation: none !important; flex-wrap: wrap; width: auto; }
  .luz-cursor, .chispitas, .progreso-lectura { display: none !important; }
  .inclina.inclina { transform: none !important; }
  @view-transition { navigation: none; }
}

/* ---------- Piezas para las pantallas de la app ---------- */
.flotante { position: fixed; z-index: 400; pointer-events: none; translate: -50% -50%; font: 800 1.6rem var(--titulo); color: var(--lima); text-shadow: 0 4px 18px rgba(0, 0, 0, .55); animation: flotarArriba 1.4s cubic-bezier(.2, .8, .2, 1) forwards; white-space: nowrap; }
.flotante.coral { color: var(--coral); }
.flotante.peque { font-size: 1.1rem; }
@keyframes flotarArriba { 0% { opacity: 0; transform: translateY(14px) scale(.5); } 20% { opacity: 1; transform: translateY(0) scale(1.2); } 100% { opacity: 0; transform: translateY(-90px) scale(1); } }
.particula { position: fixed; z-index: 400; pointer-events: none; translate: -50% -50%; font-size: 1rem; color: var(--lima); animation: estallar .95s cubic-bezier(.2, .8, .2, 1) forwards; }
@keyframes estallar { 0% { opacity: 1; transform: translate(0, 0) scale(.4) rotate(0); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(var(--g)); } }
.escalon { animation: entraEscalon .55s cubic-bezier(.2, .8, .2, 1.15) backwards; animation-delay: calc(var(--i, 0) * var(--paso, 45ms)); }
@keyframes entraEscalon { from { opacity: 0; transform: translateY(18px) scale(.94); } }
@keyframes brilloPulso { 0%, 100% { box-shadow: 0 0 0 0 rgba(200, 242, 60, .55); } 60% { box-shadow: 0 0 0 14px rgba(200, 242, 60, 0); } }
@keyframes rebote { 0%, 100% { transform: none; } 30% { transform: translateY(-8px) scale(1.08); } 55% { transform: translateY(0) scale(.96); } 75% { transform: translateY(-3px); } }
@keyframes girarSuave { to { transform: rotate(360deg); } }
@keyframes brillar { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) { .flotante, .particula { display: none !important; } .escalon { animation: none !important; } }
.ceja > span { line-height: 1.5; }
.rotar { color: #fff; }
