/**
 * GVI Carrusel Autoplay — front-end
 *
 * Todo vive bajo `.gvi-auto`. No hay ninguna regla global: los resets se
 * aplican solo dentro del contenedor para no pelear con el theme fuera de el.
 */

.gvi-auto {
    --gvi-auto-transition: 520ms;
    --gvi-auto-drag-x: 0px;

    position: relative;
    left: 50%;
    /* --gvi-sbw lo calcula el plugin: sin restar el ancho de la barra de
       scroll, 100vw provoca scroll horizontal fantasma en Windows. */
    width: calc(100vw - var(--gvi-sbw, 0px)) !important;
    max-width: none !important;
    height: 100vh;
    height: 100svh;
    margin-left: calc(-50vw + (var(--gvi-sbw, 0px) / 2)) !important;
    margin-right: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    background: #000;
    color: #fff;
    isolation: isolate;
    contain: layout paint;
}

/* ------------------------------------------------------------------ *
 * Reset local (evita que el theme herede tipografia, margenes o color)
 * ------------------------------------------------------------------ */

.gvi-auto *,
.gvi-auto *::before,
.gvi-auto *::after {
    box-sizing: border-box;
}

.gvi-auto h2,
.gvi-auto p {
    margin: 0;
    padding: 0;
    text-transform: none;
    text-shadow: none;
}

.gvi-auto h2::before,
.gvi-auto h2::after,
.gvi-auto p::before,
.gvi-auto p::after,
.gvi-auto a::before,
.gvi-auto a::after {
    content: none;
}

.gvi-auto button {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-transform: none;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
}

.gvi-auto a {
    box-shadow: none;
    text-decoration: none;
}

.gvi-auto video,
.gvi-auto img {
    display: block;
    max-width: none;
    border-radius: 0;
}

.gvi-auto :focus-visible {
    outline: 1px solid rgba(255, 255, 255, .85);
    outline-offset: 3px;
    border-radius: 4px;
}

.gvi-auto__live {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------------------------------------------ *
 * Estructura
 * ------------------------------------------------------------------ */

.gvi-auto__viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

.gvi-auto__visual {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #000;
    cursor: grab;
    /* Deja pasar el scroll vertical de la pagina; solo capturamos el eje X. */
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transform: translate3d(var(--gvi-auto-drag-x), 0, 0);
    transition: transform .34s cubic-bezier(.22, .8, .24, 1), filter .25s ease;
}

.gvi-auto.is-dragging .gvi-auto__visual {
    cursor: grabbing;
    transition: none;
    filter: brightness(.9);
}

.gvi-auto__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
    background: #000;
    opacity: 0;
    transform: scale(1.012);
    transition: opacity var(--gvi-auto-transition) ease,
                transform var(--gvi-auto-transition) cubic-bezier(.22, .8, .24, 1);
    pointer-events: none;
    /* Sin esto, Safari mantiene la capa de atras pintada durante el
       crossfade y se percibe un segundo video. */
    backface-visibility: hidden;
}

.gvi-auto__video.is-visible {
    opacity: 1;
    transform: scale(1);
    z-index: 1;
}

.gvi-auto__shade {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, .48) 0%, rgba(0, 0, 0, .18) 24%, rgba(0, 0, 0, .02) 54%, rgba(0, 0, 0, 0) 72%),
        linear-gradient(0deg, rgba(0, 0, 0, .16), transparent 34%);
}

/* ------------------------------------------------------------------ *
 * Contenido
 * ------------------------------------------------------------------ */

.gvi-auto__content {
    position: absolute;
    z-index: 5;
    left: clamp(24px, 4vw, 68px);
    bottom: clamp(50px, 8vh, 92px);
    width: min(390px, 34vw);
    pointer-events: none;
}

.gvi-auto__content-inner {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    transition: opacity .3s ease, transform .42s cubic-bezier(.22, .8, .24, 1);
}

.gvi-auto.is-content-out .gvi-auto__content-inner {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
}

.gvi-auto .gvi-auto__title {
    margin: 0 0 8px;
    color: #fff;
    font-size: clamp(19px, 1.65vw, 30px);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -.025em;
    text-wrap: balance;
}

.gvi-auto .gvi-auto__paragraph {
    max-width: 43ch;
    margin: 0 0 15px;
    color: rgba(255, 255, 255, .82);
    font-size: clamp(11px, .76vw, 14px);
    line-height: 1.48;
    white-space: pre-line;
}

.gvi-auto .gvi-auto__button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 999px;
    background: rgba(0, 0, 0, .22);
    color: #fff;
    font-size: 9px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
    pointer-events: auto;
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.gvi-auto .gvi-auto__button:hover,
.gvi-auto .gvi-auto__button:focus-visible {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .72);
    color: #fff;
    transform: translateY(-1px);
}

.gvi-auto .gvi-auto__button.is-hidden {
    display: none;
}

.gvi-auto__button svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ------------------------------------------------------------------ *
 * Controles
 * ------------------------------------------------------------------ */

.gvi-auto__arrow {
    position: absolute;
    z-index: 7;
    top: 50%;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 50%;
    background: rgba(0, 0, 0, .28);
    color: #fff;
    transform: translateY(-50%);
    cursor: pointer;
    backdrop-filter: blur(11px);
    -webkit-backdrop-filter: blur(11px);
    transition: background .2s ease, border-color .2s ease, transform .2s ease, opacity .2s ease;
}

.gvi-auto__arrow:hover {
    background: rgba(0, 0, 0, .58);
    border-color: rgba(255, 255, 255, .64);
}

.gvi-auto__arrow:active {
    transform: translateY(-50%) scale(.94);
}

.gvi-auto__arrow svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gvi-auto__arrow--prev { left: clamp(12px, 1.6vw, 26px); }
.gvi-auto__arrow--next { right: clamp(12px, 1.6vw, 26px); }

.gvi-auto__dots {
    position: absolute;
    z-index: 7;
    left: 50%;
    bottom: clamp(16px, 2.4vh, 27px);
    display: flex;
    align-items: center;
    gap: 7px;
    transform: translateX(-50%);
}

.gvi-auto__dot {
    position: relative;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.gvi-auto__dot::before {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .4);
    transition: inset .2s ease, background .2s ease, border-radius .2s ease;
}

.gvi-auto__dot:hover::before {
    background: #fff;
}

.gvi-auto__dot.is-active::before {
    inset: 7px 2px;
    border-radius: 999px;
    background: #fff;
}

.gvi-auto__progress {
    position: absolute;
    z-index: 7;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: rgba(255, 255, 255, .14);
    pointer-events: none;
}

.gvi-auto__progress i {
    display: block;
    width: 0;
    height: 100%;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 0 12px rgba(255, 255, 255, .28);
    transition: width .09s linear;
}

/* Durante el cambio de clip la barra salta a 0: sin transicion se lee como
   corte limpio en vez de como retroceso animado. */
.gvi-auto.is-switching .gvi-auto__progress i {
    transition: none;
}

.gvi-auto__hint {
    position: absolute;
    z-index: 7;
    right: clamp(18px, 2.3vw, 38px);
    bottom: clamp(54px, 7vh, 82px);
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, .72);
    font-size: 8px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    pointer-events: none;
    opacity: 1;
    transition: opacity .4s ease, transform .4s ease;
}

.gvi-auto.has-interacted .gvi-auto__hint,
.gvi-auto.is-hint-hidden .gvi-auto__hint {
    opacity: 0;
    transform: translateY(5px);
}

.gvi-auto__hint svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.25;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: gvi-auto-swipe 1.7s ease-in-out infinite;
}

.gvi-auto__loader {
    position: absolute;
    inset: 0;
    z-index: 9;
    display: grid;
    place-items: center;
    pointer-events: none;
    opacity: 1;
    transition: opacity .2s ease;
}

.gvi-auto.is-ready .gvi-auto__loader {
    opacity: 0;
}

.gvi-auto__loader::before {
    content: "";
    width: 26px;
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, .22);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gvi-auto-spin .8s linear infinite;
}

.gvi-auto__noscript img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes gvi-auto-spin {
    to { transform: rotate(1turn); }
}

@keyframes gvi-auto-swipe {
    0%, 100% { transform: translateX(-3px); opacity: .45; }
    50%      { transform: translateX(3px);  opacity: 1; }
}

/* ------------------------------------------------------------------ *
 * Movil retrato — layout aprobado: texto arriba, video abajo
 * ------------------------------------------------------------------ */

@media (max-width: 767px) {
    .gvi-auto {
        height: 100vh;
        height: 100svh;
    }

    .gvi-auto__viewport {
        display: grid;
        grid-template-rows: minmax(132px, 28svh) minmax(0, 1fr);
        background: #000;
    }

    .gvi-auto__content {
        position: relative;
        z-index: 5;
        grid-row: 1;
        left: auto;
        bottom: auto;
        width: 100%;
        padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 13px;
        display: flex;
        align-items: flex-end;
        background: #000;
        pointer-events: auto;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .gvi-auto__content-inner {
        width: 100%;
        max-width: 560px;
        padding-right: 44px;
    }

    .gvi-auto .gvi-auto__title {
        margin-bottom: 5px;
        font-size: clamp(18px, 5.2vw, 24px);
    }

    .gvi-auto .gvi-auto__paragraph {
        margin-bottom: 10px;
        font-size: 11px;
        line-height: 1.4;
    }

    .gvi-auto .gvi-auto__button {
        min-height: 32px;
        padding: 0 12px;
        font-size: 8px;
    }

    .gvi-auto__visual {
        position: relative;
        grid-row: 2;
        inset: auto;
        width: 100%;
        height: 100%;
        background: #000;
        display: grid;
        place-items: center;
    }

    .gvi-auto__shade {
        background: linear-gradient(0deg, rgba(0, 0, 0, .12), transparent 32%);
    }

    .gvi-auto__arrow {
        top: calc(28svh + (72svh / 2));
        width: 36px;
        height: 36px;
    }

    .gvi-auto__arrow--prev { left: 9px; }
    .gvi-auto__arrow--next { right: 9px; }

    .gvi-auto__dots {
        bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) + 8px));
    }

    .gvi-auto__hint {
        right: 14px;
        bottom: max(39px, calc(env(safe-area-inset-bottom, 0px) + 38px));
        font-size: 6.5px;
    }
}

/* Movil apaisado — vuelve al layout full-bleed con texto sobrepuesto. */
@media (max-width: 767px) and (orientation: landscape) {
    .gvi-auto__viewport {
        display: block;
    }

    .gvi-auto__visual {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
    }

    .gvi-auto__video {
        object-fit: cover !important;
    }

    .gvi-auto__content {
        position: absolute;
        left: 24px;
        bottom: 48px;
        width: min(350px, 45vw);
        padding: 0;
        background: transparent;
        overflow: visible;
        pointer-events: none;
    }

    .gvi-auto__content-inner {
        padding-right: 0;
    }

    .gvi-auto__arrow {
        top: 50%;
    }
}

/* ------------------------------------------------------------------ *
 * Reduced motion — se apagan animaciones decorativas, no el contenido
 * ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
    .gvi-auto__video,
    .gvi-auto__visual,
    .gvi-auto__content-inner,
    .gvi-auto__hint,
    .gvi-auto__progress i {
        transition: none;
    }

    .gvi-auto__video {
        transform: none;
    }

    .gvi-auto__video.is-visible {
        transform: none;
    }

    .gvi-auto__hint svg,
    .gvi-auto__loader::before {
        animation: none;
    }
}
