/* Lotees - transiciones entre escenas. Las usan la TV, las pantallas del público y la vista previa
   del editor; transiciones.js pone las clases y la duración (--lt-tr-ms).
   La capa que entra va encima de la que sale, salvo en «descubrir». */

@property --lt-tr-p {
    syntax: "<percentage>";
    inherits: false;
    initial-value: 100%;
}

.lt-tr {
    --lt-tr-curva: cubic-bezier(0.65, 0, 0.35, 1);
    backface-visibility: hidden;
}

.lt-tr-espera {
    opacity: 0;
}

.lt-tr-entra,
.lt-tr-sale {
    animation-duration: var(--lt-tr-ms, 700ms);
    animation-timing-function: var(--lt-tr-curva);
    animation-fill-mode: both;
}

.lt-tr-sale {
    pointer-events: none;
}

/* Velo de color a mitad de la transición (destello) */
.lt-tr-velo {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    animation: lt-tr-velo var(--lt-tr-ms, 900ms) ease-in-out both;
}

@keyframes lt-tr-velo {
    0% { opacity: 0; }
    45%, 55% { opacity: 1; }
    100% { opacity: 0; }
}

/* ---------- Suaves ---------- */

.lt-tr--fundido.lt-tr-entra {
    --lt-tr-curva: cubic-bezier(0.4, 0, 0.2, 1);
    animation-name: lt-tr-aparecer;
}

@keyframes lt-tr-aparecer {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* A negro: la anterior se apaga y después se enciende la nueva */
.lt-tr--fundido_negro.lt-tr-sale {
    animation-name: lt-tr-negro-sale;
    animation-timing-function: ease-in;
}

.lt-tr--fundido_negro.lt-tr-entra {
    animation-name: lt-tr-negro-entra;
    animation-timing-function: ease-out;
}

@keyframes lt-tr-negro-sale {
    0% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes lt-tr-negro-entra {
    0%, 50% { opacity: 0; }
    100% { opacity: 1; }
}

/* Destello: el velo blanco tapa el cambio */
.lt-tr--destello.lt-tr-entra {
    animation-name: lt-tr-destello-entra;
    animation-timing-function: linear;
}

@keyframes lt-tr-destello-entra {
    0%, 49% { opacity: 0; }
    50%, 100% { opacity: 1; }
}

.lt-tr--desenfoque.lt-tr-entra {
    animation-name: lt-tr-desenfoque-entra;
}

.lt-tr--desenfoque.lt-tr-sale {
    animation-name: lt-tr-desenfoque-sale;
}

@keyframes lt-tr-desenfoque-entra {
    from { opacity: 0; filter: blur(24px); transform: scale(1.04); }
    to { opacity: 1; filter: blur(0); transform: none; }
}

@keyframes lt-tr-desenfoque-sale {
    from { filter: blur(0); }
    to { filter: blur(24px); }
}

/* ---------- Movimiento ---------- */

/* Deslizar: la nueva entra de lado y la anterior se retira un poco, oscureciéndose */
.lt-tr--deslizar {
    --lt-tr-curva: cubic-bezier(0.22, 0.61, 0.36, 1);
}

.lt-tr--deslizar.lt-tr-entra {
    animation-name: lt-tr-deslizar-entra;
}

.lt-tr--deslizar.lt-tr-sale {
    animation-name: lt-tr-deslizar-sale;
}

.lt-tr--deslizar.lt-tr--atras.lt-tr-entra {
    animation-name: lt-tr-deslizar-entra-atras;
}

.lt-tr--deslizar.lt-tr--atras.lt-tr-sale {
    animation-name: lt-tr-deslizar-sale-atras;
}

@keyframes lt-tr-deslizar-entra {
    from { transform: translate3d(100%, 0, 0); }
    to { transform: none; }
}

@keyframes lt-tr-deslizar-sale {
    from { transform: none; opacity: 1; }
    to { transform: translate3d(-30%, 0, 0); opacity: 0.5; }
}

@keyframes lt-tr-deslizar-entra-atras {
    from { transform: translate3d(-100%, 0, 0); }
    to { transform: none; }
}

@keyframes lt-tr-deslizar-sale-atras {
    from { transform: none; opacity: 1; }
    to { transform: translate3d(30%, 0, 0); opacity: 0.5; }
}

/* Empujar: las dos se mueven juntas */
.lt-tr--empujar.lt-tr-entra {
    animation-name: lt-tr-deslizar-entra;
}

.lt-tr--empujar.lt-tr-sale {
    animation-name: lt-tr-empujar-sale;
}

.lt-tr--empujar.lt-tr--atras.lt-tr-entra {
    animation-name: lt-tr-deslizar-entra-atras;
}

.lt-tr--empujar.lt-tr--atras.lt-tr-sale {
    animation-name: lt-tr-empujar-sale-atras;
}

@keyframes lt-tr-empujar-sale {
    from { transform: none; }
    to { transform: translate3d(-100%, 0, 0); }
}

@keyframes lt-tr-empujar-sale-atras {
    from { transform: none; }
    to { transform: translate3d(100%, 0, 0); }
}

/* Subir: la nueva entra desde abajo; hacia atrás, desde arriba */
.lt-tr--subir {
    --lt-tr-curva: cubic-bezier(0.22, 0.61, 0.36, 1);
}

.lt-tr--subir.lt-tr-entra {
    animation-name: lt-tr-subir-entra;
}

.lt-tr--subir.lt-tr-sale {
    animation-name: lt-tr-subir-sale;
}

.lt-tr--subir.lt-tr--atras.lt-tr-entra {
    animation-name: lt-tr-bajar-entra;
}

.lt-tr--subir.lt-tr--atras.lt-tr-sale {
    animation-name: lt-tr-bajar-sale;
}

@keyframes lt-tr-subir-entra {
    from { transform: translate3d(0, 100%, 0); }
    to { transform: none; }
}

@keyframes lt-tr-subir-sale {
    from { transform: none; opacity: 1; }
    to { transform: translate3d(0, -25%, 0) scale(0.96); opacity: 0.4; }
}

@keyframes lt-tr-bajar-entra {
    from { transform: translate3d(0, -100%, 0); }
    to { transform: none; }
}

@keyframes lt-tr-bajar-sale {
    from { transform: none; opacity: 1; }
    to { transform: translate3d(0, 25%, 0) scale(0.96); opacity: 0.4; }
}

/* Descubrir: la anterior se va de lado, por encima, y deja ver la nueva */
.lt-tr--descubrir.lt-tr-sale {
    z-index: 1;
    animation-name: lt-tr-empujar-sale;
    box-shadow: 0 0 6vmin rgba(0, 0, 0, 0.6);
}

.lt-tr--descubrir.lt-tr--atras.lt-tr-sale {
    animation-name: lt-tr-empujar-sale-atras;
}

.lt-tr--descubrir.lt-tr-entra {
    animation-name: lt-tr-descubrir-entra;
}

@keyframes lt-tr-descubrir-entra {
    from { transform: scale(0.94); opacity: 0.5; }
    to { transform: none; opacity: 1; }
}

/* ---------- Zoom y 3D ---------- */

.lt-tr--acercar {
    --lt-tr-curva: cubic-bezier(0.22, 0.61, 0.36, 1);
}

.lt-tr--acercar.lt-tr-entra {
    animation-name: lt-tr-acercar-entra;
}

.lt-tr--acercar.lt-tr-sale {
    animation-name: lt-tr-acercar-sale;
}

@keyframes lt-tr-acercar-entra {
    from { transform: scale(1.08); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@keyframes lt-tr-acercar-sale {
    from { transform: none; }
    to { transform: scale(0.96); }
}

/* Zoom a través: la anterior crece hacia la cámara y se desvanece; la nueva llega desde el fondo */
.lt-tr--atravesar.lt-tr-sale {
    animation-name: lt-tr-atravesar-sale;
    animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45);
}

.lt-tr--atravesar.lt-tr-entra {
    animation-name: lt-tr-atravesar-entra;
    animation-timing-function: cubic-bezier(0, 0.55, 0.45, 1);
}

@keyframes lt-tr-atravesar-sale {
    0% { transform: none; opacity: 1; }
    60%, 100% { transform: scale(1.6); opacity: 0; }
}

@keyframes lt-tr-atravesar-entra {
    0%, 30% { transform: scale(0.6); opacity: 0; }
    100% { transform: none; opacity: 1; }
}

/* Giro 3D: la anterior gira hasta ponerse de canto y la nueva termina el giro */
.lt-tr--girar.lt-tr-sale {
    animation-name: lt-tr-girar-sale;
    animation-timing-function: ease-in;
}

.lt-tr--girar.lt-tr-entra {
    animation-name: lt-tr-girar-entra;
    animation-timing-function: ease-out;
}

.lt-tr--girar.lt-tr--atras.lt-tr-sale {
    animation-name: lt-tr-girar-sale-atras;
}

.lt-tr--girar.lt-tr--atras.lt-tr-entra {
    animation-name: lt-tr-girar-entra-atras;
}

@keyframes lt-tr-girar-sale {
    0% { transform: perspective(200vmax) rotateY(0deg); opacity: 1; }
    49.9% { transform: perspective(200vmax) rotateY(-90deg); opacity: 1; }
    50%, 100% { transform: perspective(200vmax) rotateY(-90deg); opacity: 0; }
}

@keyframes lt-tr-girar-entra {
    0%, 50% { transform: perspective(200vmax) rotateY(90deg); opacity: 0; }
    50.1% { transform: perspective(200vmax) rotateY(90deg); opacity: 1; }
    100% { transform: perspective(200vmax) rotateY(0deg); opacity: 1; }
}

@keyframes lt-tr-girar-sale-atras {
    0% { transform: perspective(200vmax) rotateY(0deg); opacity: 1; }
    49.9% { transform: perspective(200vmax) rotateY(90deg); opacity: 1; }
    50%, 100% { transform: perspective(200vmax) rotateY(90deg); opacity: 0; }
}

@keyframes lt-tr-girar-entra-atras {
    0%, 50% { transform: perspective(200vmax) rotateY(-90deg); opacity: 0; }
    50.1% { transform: perspective(200vmax) rotateY(-90deg); opacity: 1; }
    100% { transform: perspective(200vmax) rotateY(0deg); opacity: 1; }
}

/* ---------- Formas y barridos (recortes sobre la anterior, que no se mueve) ---------- */

.lt-tr--barrido.lt-tr-entra {
    animation-name: lt-tr-barrido;
}

.lt-tr--barrido.lt-tr--atras.lt-tr-entra {
    animation-name: lt-tr-barrido-atras;
}

@keyframes lt-tr-barrido {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0 0 0 0); }
}

@keyframes lt-tr-barrido-atras {
    from { clip-path: inset(0 0 0 100%); }
    to { clip-path: inset(0 0 0 0); }
}

.lt-tr--cortina.lt-tr-entra {
    animation-name: lt-tr-cortina;
}

.lt-tr--cortina.lt-tr--atras.lt-tr-entra {
    animation-name: lt-tr-cortina-atras;
}

@keyframes lt-tr-cortina {
    from { clip-path: inset(100% 0 0 0); }
    to { clip-path: inset(0 0 0 0); }
}

@keyframes lt-tr-cortina-atras {
    from { clip-path: inset(0 0 100% 0); }
    to { clip-path: inset(0 0 0 0); }
}

.lt-tr--diagonal.lt-tr-entra {
    animation-name: lt-tr-diagonal;
}

@keyframes lt-tr-diagonal {
    from { clip-path: polygon(0 0, 0 0, 0 0); }
    to { clip-path: polygon(0 0, 200% 0, 0 200%); }
}

.lt-tr--circulo.lt-tr-entra {
    animation-name: lt-tr-circulo;
}

@keyframes lt-tr-circulo {
    from { clip-path: circle(0% at 50% 50%); }
    to { clip-path: circle(75% at 50% 50%); }
}

.lt-tr--rombo.lt-tr-entra {
    animation-name: lt-tr-rombo;
}

@keyframes lt-tr-rombo {
    from { clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%); }
    to { clip-path: polygon(50% -60%, 160% 50%, 50% 160%, -60% 50%); }
}

/* Persianas: franjas horizontales que se abren a la vez. Sin @property, cambia de golpe a mitad */
.lt-tr--persianas.lt-tr-entra {
    -webkit-mask-image: linear-gradient(to bottom, #000000 var(--lt-tr-p), transparent var(--lt-tr-p));
    mask-image: linear-gradient(to bottom, #000000 var(--lt-tr-p), transparent var(--lt-tr-p));
    -webkit-mask-size: 100% 12.5%;
    mask-size: 100% 12.5%;
    -webkit-mask-repeat: repeat;
    mask-repeat: repeat;
    animation-name: lt-tr-persianas;
    animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
}

@keyframes lt-tr-persianas {
    from { --lt-tr-p: 0%; }
    to { --lt-tr-p: 100%; }
}

/* ---------- Corte ---------- */

.lt-tr--corte.lt-tr-entra,
.lt-tr--corte.lt-tr-sale {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    .lt-tr-entra,
    .lt-tr-sale {
        animation-name: lt-tr-aparecer !important;
    }

    .lt-tr-sale {
        animation-name: none !important;
    }

    .lt-tr-velo {
        display: none;
    }
}
