/* iriabaquedano.es — capa de movimiento compartida (la usa js/motion.js)
   ------------------------------------------------------------------
   Todo lo que esconde contenido de inicio depende de html.mx-js (lo pone un
   script de una línea en el <head>) y tiene un plan B: si motion.js no llega
   a ejecutarse, el contenido aparece solo a los 2,5 s.
*/

/* ── Transición entre páginas (Chrome/Edge/Safari recientes; el resto, sin efecto) ── */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: mx-vt-out .22s ease both; }
::view-transition-new(root) { animation: mx-vt-in .5s cubic-bezier(.16,1,.3,1) both; }
@keyframes mx-vt-out { to { opacity: 0; transform: translateY(-12px); } }
@keyframes mx-vt-in  { from { opacity: 0; transform: translateY(18px); } }

/* ── Barra de progreso de lectura ── */
.mx-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10001;
    background: #6E1B28; transform-origin: 0 50%; transform: scaleX(0);
    pointer-events: none;
}

/* ── Menú: se encoge al bajar y se esconde mientras lees ── */
body > nav { transition: transform .45s cubic-bezier(.16,1,.3,1), padding .35s ease, box-shadow .35s ease; }
body > nav.mx-scrolled { padding-top: .8rem; padding-bottom: .8rem; box-shadow: 0 10px 30px rgba(0,0,0,.06); }
body > nav.mx-hide { transform: translateY(-105%); }

/* ── Titular principal: palabras que suben desde una máscara ── */
html.mx-js h1 { opacity: 0; animation: mx-show 0s 2.5s forwards; }
html.mx-js h1.mx-split { opacity: 1; animation: none; }
html.mx-js :is(.hero-tag, .hero-claim, .hero-bottom) { opacity: 0; animation: mx-show 0s 2.5s forwards; }
@keyframes mx-show { to { opacity: 1; } }

.mx-w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 .04em .12em; margin: 0 -.04em -.12em; }
.mx-wi { display: inline-block; transform: translateY(110%) rotate(4deg); transform-origin: 0 100%;
         animation: mx-rise 1s cubic-bezier(.16,1,.3,1) forwards;
         animation-delay: calc(var(--i) * 55ms + 120ms); }
@keyframes mx-rise { to { transform: none; } }

html.mx-js .mx-after { opacity: 0; transform: translateY(24px); animation: mx-after .9s cubic-bezier(.16,1,.3,1) forwards; animation-delay: var(--d); }
@keyframes mx-after { to { opacity: 1; transform: none; } }

/* ── Títulos de sección: cada línea sale de su propia máscara ── */
.mx-l  { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
.mx-li { display: block; transform: translateY(105%); transition: transform 1s cubic-bezier(.16,1,.3,1); transition-delay: calc(var(--i) * 110ms); }
.mx-in .mx-li { transform: none; }

/* ── Aparición al hacer scroll ── */
.mx-reveal { opacity: 0; transform: translateY(32px); transition: opacity .8s cubic-bezier(.16,1,.3,1), transform .8s cubic-bezier(.16,1,.3,1); transition-delay: var(--d, 0s); }
.mx-reveal.mx-in { opacity: 1; transform: none; }

/* Imágenes: cortinilla de abajo arriba con un leve zoom de salida */
.mx-wipe { clip-path: inset(100% 0 0 0); transition: clip-path 1.1s cubic-bezier(.77,0,.18,1); }
.mx-wipe img { transform: scale(1.15); transition: transform 1.6s cubic-bezier(.16,1,.3,1); }
.mx-wipe.mx-in { clip-path: inset(0 0 0 0); }
.mx-wipe.mx-in img { transform: none; }

/* ── Etiquetas «// 01 — Servicios»: se escriben letra a letra ── */
.mx-type { clip-path: inset(0 100% 0 0); }
.mx-type.mx-in { animation: mx-type calc(var(--n) * 38ms) steps(var(--n)) forwards; }
@keyframes mx-type { to { clip-path: inset(0 0 0 0); } }

/* ── Cifras que cuentan ── */
.mx-count { font-variant-numeric: tabular-nums; }

/* ── Pasos del proceso: la línea de arriba se dibuja ── */
.mx-step { position: relative; }
.mx-step::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: #6E1B28;
                  transform: scaleX(0); transform-origin: 0 50%; transition: transform 1.2s cubic-bezier(.77,0,.18,1) .2s; }
.mx-step.mx-in::after { transform: scaleX(1); }

/* ── Tarjetas: foco de luz que sigue al ratón ── */
.mx-spot { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s ease; z-index: -1;
           background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(110,27,40,.09), transparent 62%); }
.mx-card:hover > .mx-spot { opacity: 1; }
.mx-card { isolation: isolate; transition: translate .45s cubic-bezier(.16,1,.3,1); }
.mx-card:hover { translate: 0 -4px; }

/* ── Botones magnéticos con brillo ── */
.mx-mag { transition: translate .5s cubic-bezier(.16,1,.3,1), opacity .2s, border-color .2s, color .2s; }
.mx-mag.mx-pull { transition: translate .12s linear, opacity .2s, border-color .2s, color .2s; }
.mx-shine-host { position: relative; overflow: hidden; }
.mx-shine { position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; pointer-events: none;
            background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
            transform: skewX(-18deg); }
.mx-shine-host:hover .mx-shine { animation: mx-shine .8s cubic-bezier(.16,1,.3,1); }
@keyframes mx-shine { to { left: 130%; } }

/* ── Cuadrícula del hero: se enciende en granate alrededor del cursor ── */
.mx-gridspot {
    position: absolute; inset: -40px; pointer-events: none;
    background-image: linear-gradient(rgba(110,27,40,.55) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(110,27,40,.55) 1px, transparent 1px);
    background-size: 72px 72px; background-position: 40px 40px;
    -webkit-mask-image: radial-gradient(260px circle at var(--gx, 70%) var(--gy, 40%), #000 0%, transparent 70%);
            mask-image: radial-gradient(260px circle at var(--gx, 70%) var(--gy, 40%), #000 0%, transparent 70%);
}
.mx-gridglow {
    position: absolute; width: 520px; height: 520px; left: 0; top: 0; border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle, rgba(110,27,40,.10), transparent 65%);
    translate: calc(var(--gx-px, 0px) - 260px) calc(var(--gy-px, 0px) - 260px);
}

/* ── Quien prefiere menos movimiento lo ve todo quieto ── */
@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
    html.mx-js h1, html.mx-js :is(.hero-tag, .hero-claim, .hero-bottom), html.mx-js .mx-after { opacity: 1; animation: none; transform: none; }
    .mx-wi, .mx-li { transform: none; animation: none; transition: none; }
    .mx-reveal, .mx-wipe, .mx-wipe img, .mx-type { opacity: 1; transform: none; clip-path: none; transition: none; animation: none; }
    .mx-step::after { transform: scaleX(1); transition: none; }
    .mx-gridspot, .mx-gridglow, .mx-shine { display: none; }
    body > nav { transition: none; }
}
