/**
 * JNS Video Slider
 * Layout basado en el patron "product focus tabs" de gisou.com
 */

.jns-vs {
    --jns-vs-content-width: 25%;
    --jns-vs-ratio: 9/16;
    --jns-vs-inactive-height: 70%;
    --jns-vs-overlay: rgba(0, 0, 0, 0.5);
    --jns-vs-radius: 1rem;
    --jns-vs-dot-color: #5d331b;
    --jns-vs-dot-size: 6px;
    --jns-vs-dot-gap: 20px;
    --jns-vs-dot-align: flex-start;
    --jns-vs-cursor-size: 64px;
    --jns-vs-cursor-bg: rgba(255, 255, 255, 0.3);
    --jns-vs-cursor-color: #fff;
    position: relative;
}

/* En movil el video va arriba y el texto debajo; en escritorio van lado a lado. */
.jns-vs__block {
    display: flex;
    flex-direction: column-reverse;
}

.jns-vs__content {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 1.5rem;
}

.jns-vs__content-inner {
    max-width: 25rem;
}

.jns-vs__content-inner.is-hidden {
    display: none;
}

.jns-vs__content-pre-title {
    display: block;
    margin-bottom: 0.5rem;
}

/* Cursiva y negrita se manejan desde el control de tipografia del widget. */
.jns-vs__content-title {
    display: block;
    margin-bottom: 1rem;
    line-height: 1.15;
}

.jns-vs__content-description {
    margin-bottom: 1.5rem;
}

.jns-vs__content-description p:last-child {
    margin-bottom: 0;
}

.jns-vs__button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    line-height: 1;
}

.jns-vs__button:hover,
.jns-vs__button:focus {
    text-decoration: none;
}

.jns-vs__slider {
    width: 100%;
    min-width: 0;
}

/* La altura de la pista la define la proporcion del slide activo. */
.jns-vs__slide {
    width: 100%;
    aspect-ratio: var(--jns-vs-ratio);
    display: flex;
    align-items: flex-end;
}

.jns-vs__slide-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: var(--jns-vs-radius);
    background-color: transparent;
    transition: height 0.3s ease-in-out;
}

.jns-vs__video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* YouTube: el iframe se recorta tipo object-fit:cover con unidades de contenedor. */
.jns-vs__yt {
    position: absolute;
    inset: 0;
    overflow: hidden;
    container-type: size;
    background-color: #000;
}

.jns-vs__yt iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 0;
    width: max(100cqw, 100cqh * 16 / 9);
    height: max(100cqh, 100cqw * 9 / 16);
    /* Deja pasar el arrastre y el clic a Splide: el iframe se los tragaria. */
    pointer-events: none;
}

/* Instagram: sin API de reproduccion; el iframe se crea al activar el slide
   y se quita al desactivarlo, que es la unica forma de frenar video y audio. */
.jns-vs__ig {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background-color: #fff;
}

.jns-vs__ig iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Solo el slide activo es interactivo: el resto deja pasar el arrastre a Splide. */
.jns-vs .splide__slide:not(.is-active) .jns-vs__ig iframe {
    pointer-events: none;
}

/* Slides inactivos: mas bajos, anclados abajo y oscurecidos. */
.jns-vs .splide__slide:not(.is-active) .jns-vs__slide-inner {
    height: var(--jns-vs-inactive-height);
    cursor: pointer;
}

.jns-vs .splide__slide:not(.is-active) .jns-vs__slide-inner::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: var(--jns-vs-overlay);
}

.jns-vs .splide__pagination {
    padding: 0;
    margin-top: 1.5rem;
    position: static;
    justify-content: var(--jns-vs-dot-align);
    gap: var(--jns-vs-dot-gap);
}

.jns-vs .splide__pagination li {
    line-height: 0;
}

/* splide-core no estiliza los puntos: sin este reset gana el CSS de button del tema. */
.jns-vs .splide__pagination__page {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: content-box;
    width: var(--jns-vs-dot-size);
    height: var(--jns-vs-dot-size);
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 50%;
    box-shadow: none;
    background-color: var(--jns-vs-dot-color);
    background-image: none;
    opacity: 1;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.jns-vs .splide__pagination__page:hover,
.jns-vs .splide__pagination__page:focus {
    background-color: var(--jns-vs-dot-color);
    outline: none;
    box-shadow: none;
}

.jns-vs .splide__pagination__page:focus-visible {
    outline: 2px solid var(--jns-vs-dot-color);
    outline-offset: 4px;
}

.jns-vs .splide__pagination__page.is-active {
    transform: scale(1.8);
    background-color: var(--jns-vs-dot-color);
}

/* Cursor "DRAG": circulo que sigue al mouse sobre la pista arrastrable. */
.jns-vs__cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1005;
    width: var(--jns-vs-cursor-size);
    height: var(--jns-vs-cursor-size);
    padding: 10px;
    border-radius: 100%;
    background: var(--jns-vs-cursor-bg);
    color: var(--jns-vs-cursor-color);
    font-size: 12px;
    text-align: center;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
    display: none;
}

.jns-vs__cursor.is-visible {
    display: flex;
}

.jns-vs--custom-cursor .splide__list {
    cursor: none;
}

/* Sin puntero fino no hay cursor que seguir. */
@media (hover: none) {
    .jns-vs__cursor {
        display: none !important;
    }

    .jns-vs--custom-cursor .splide__list {
        cursor: default;
    }
}

@media screen and (max-width: 749px) {
    .jns-vs__cursor {
        display: none !important;
    }

    .jns-vs--custom-cursor .splide__list {
        cursor: default;
    }
}

.jns-vs .splide__arrow {
    background-color: #fff;
    opacity: 0.9;
}

@media screen and (min-width: 768px) {
    .jns-vs__block {
        flex-direction: row;
        align-items: center;
    }

    .jns-vs__content {
        width: var(--jns-vs-content-width);
        flex: 0 0 var(--jns-vs-content-width);
        padding-top: 0;
        padding-right: 1.5rem;
    }

    .jns-vs__slider {
        width: calc(100% - var(--jns-vs-content-width));
        flex: 1 1 auto;
    }
}
