/* Transiciones de página (Swup) — catálogo Terxo */

.terxo-transition-main {
    background: transparent;
    opacity: 1;
    transform: none;
}

body.legal-page .terxo-transition-main,
body.guide-page .terxo-transition-main,
body.filtros-page .terxo-transition-main,
body.novedades-page .terxo-transition-main {
    min-height: calc(100dvh - var(--header-height, 76px));
}

/* Salida: fade-out (entrada se hace en JS — ver terxo-page-transitions.js) */
html.is-animating.is-leaving .terxo-transition-main {
    transition: opacity 0.22s ease, transform 0.22s ease;
    will-change: opacity, transform;
    opacity: 0;
    transform: translateY(8px);
}

@media (max-width: 768px) {
    html.is-animating.is-leaving .terxo-transition-main {
        transition: opacity 0.22s ease-out;
        transform: none;
        will-change: opacity;
    }

    body.novedades-page .novedades-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    body.novedades-page .novedad-card {
        content-visibility: auto;
        contain-intrinsic-size: auto 248px;
        contain: layout style paint;
        transition: none !important;
        height: 248px;
        min-height: 248px;
        max-height: 248px;
    }

    body.novedades-page .novedad-image {
        width: 64px;
        height: 112px;
        min-height: 112px;
        max-height: 112px;
    }
}

@media (max-width: 768px), (hover: none) {
    body.novedades-page .novedad-card:hover {
        transform: none !important;
        background: #fff !important;
        box-shadow: 4px 4px 0 #0a0a0a !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.is-animating.is-leaving .terxo-transition-main {
        transition: none !important;
        opacity: 1;
        transform: none;
    }
}

/* Interruptor «Transiciones» de Configuración apagado (terxo-sweep-nav.js pone data-no-transitions): sin fundido de salida */
html[data-no-transitions].is-animating.is-leaving .terxo-transition-main {
    transition: none !important;
    opacity: 1;
    transform: none;
}

/* Barrido al entrar en 3DMark (lo anima terxo-page-transitions.js) */
.terxo-sweep {
    /* iOS Safari recorta los «fixed» al área visible (entre las barras), también en movimiento: el panel es «absolute»
       (contenido de la página), sobresale 120px por arriba y por abajo y arranca en el scroll (--tsw-y, lo pone el JS) */
    position: absolute;
    top: calc(var(--tsw-y, 0px) - 120px);
    left: 0;
    right: 0;
    height: calc(100vh + 240px);
    height: calc(100lvh + 240px);
    box-sizing: border-box;
    padding: 120px 0;
    padding-bottom: calc(120px + 100lvh - 100dvh);
    z-index: 2147483000;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--neo-ink, #0a0a0a);
    border-left: 14px solid var(--neo-yellow, #ffe566);
    border-right: 14px solid var(--neo-yellow, #ffe566);
    transform: translateX(-112%);
    pointer-events: none;
    will-change: transform;
}

.terxo-sweep.is-active {
    display: flex;
}

/* Fondo de apoyo mientras el panel tapa: iOS recorta el panel fijo al área visible, así lo que queda bajo las barras
   también es negro con bordes amarillos (lo pone terxo-page-transitions.js) */
html.terxo-sweep-full {
    background: linear-gradient(90deg, var(--neo-yellow, #ffe566) 0, var(--neo-yellow, #ffe566) 14px, var(--neo-ink, #0a0a0a) 14px, var(--neo-ink, #0a0a0a) calc(100% - 14px), var(--neo-yellow, #ffe566) calc(100% - 14px)) !important;
}

html.terxo-sweep-full body {
    visibility: hidden !important;
}

html.terxo-sweep-full .terxo-sweep {
    visibility: visible;
}

/* El panel absoluto sale por la derecha: sin scroll horizontal ni gestos mientras dura el barrido */
html:has(.terxo-sweep.is-active) {
    overflow-x: clip;
    touch-action: none;
}

/* Al ir a 3DMark la página actual no se funde: la tapa el barrido */
html.terxo-sweeping.is-animating.is-leaving .terxo-transition-main,
html.terxo-sweeping.is-animating.is-leaving #aiBtn {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
}

.terxo-sweep__label {
    font-family: var(--font-display, Montserrat, sans-serif);
    font-size: clamp(2.5rem, 9vw, 9rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: var(--neo-yellow, #ffe566);
    max-width: 92vw;
    text-align: center;
    line-height: 0.95;
    overflow-wrap: break-word;
}

/* Nombres largos ("Juegos resultados", "Aviso legal"…) */
.terxo-sweep--long .terxo-sweep__label {
    font-size: clamp(2rem, 7vw, 6rem);
}

/* Terxo AI: vive fuera de #swup y hace el mismo fade que la página */
html.is-animating.is-leaving #aiBtn {
    transition: opacity 0.22s ease, transform 0.22s ease;
    opacity: 0;
}

/* En el index el fundido sale desde su posición: sin desplazamiento */
html:has(#heroSidebarDrawer).is-animating.is-leaving .terxo-transition-main {
    transform: none;
    /* will-change: transform haría de #swup el bloque contenedor del panel fijo y lo movería */
    will-change: opacity;
}
