/* ────────────────────────────────────────────────────────
   Before After Carousel — estilos v1.1
──────────────────────────────────────────────────────── */

.bac-carousel-wrapper {
    position: relative;
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Slide ── */
.bac-carousel-wrapper .swiper-slide {
    overflow: hidden;
    /* sin height fijo: el .bac-item dentro lo controla */
}

/* ── Item ── */
.bac-item {
    position: relative;
    width: 100%;
    height: 480px;
    overflow: hidden;
    isolation: isolate;         /* stacking context propio → z-index de hijos funciona bien */
    cursor: col-resize;
    border-radius: 8px;
    background: transparent;   /* sin negro detrás de las imágenes */
    display: block;
}

/* ── Capas before / after ── */
.bac-before,
.bac-after {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 0;   /* elimina gap inline debajo de <img> */
    line-height: 0;
}

.bac-before img,
.bac-after img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    pointer-events: none;
    display: block;
}

/* After = fondo completo */
.bac-after {
    z-index: 1;
}

/* Before = encima, recortado desde la derecha (muestra izquierda) */
.bac-before {
    z-index: 2;
    clip-path: inset(0 50% 0 0);
    will-change: clip-path;
}

/* ── Etiquetas ── */
.bac-label {
    position: absolute;
    bottom: 14px;
    z-index: 5;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 700;
    letter-spacing: 0.04em;
    pointer-events: none;
    text-transform: uppercase;
    background: rgba(0,0,0,0.45);
    color: #fff;
    display: block;
}

.bac-label-before { left: 14px; }
.bac-label-after  { right: 14px; }

/* Switch global "Ver etiquetas" — se aplica en TODOS los tamaños */
.bac-no-labels .bac-label {
    display: none !important;
    visibility: hidden !important;
}

/* ── Handle ── */

/*
 * Línea: hijo directo de .bac-item, top+bottom = misma altura que la imagen.
 * overflow:hidden del item la recorta al borde exacto de la imagen.
 */
.bac-handle-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #fff;
    /* translateZ(0) crea una capa GPU propia → fix para Safari/iOS donde
       clip-path en .bac-before rompe el orden de z-index entre hermanos */
    transform: translateX(-50%) translateZ(0);
    z-index: 3;
    pointer-events: none;
    will-change: left;
}

/*
 * Círculo: centrado verticalmente, z-index por encima de la línea.
 */
.bac-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) translateZ(0);
    z-index: 4;
    pointer-events: none;
    will-change: left;
}

.bac-handle-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
    pointer-events: all;
    cursor: col-resize;
}

.bac-handle-circle svg {
    width: 20px;
    height: 20px;
    color: #444;
    display: block;
}

/* ── Flechas — viven FUERA del .swiper para poder posicionarse libremente ── */
.bac-carousel-wrapper .swiper-button-prev,
.bac-carousel-wrapper .swiper-button-next {
    position: absolute;   /* relativo al wrapper, no al swiper */
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 42px;
    height: 42px;
    margin-top: 0;
    border-radius: 50%;
    background: rgba(0,0,0,0.35);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

/* Posición por defecto: fuera del carrusel, centradas verticalmente */
.bac-carousel-wrapper .swiper-button-prev { left: -60px; }
.bac-carousel-wrapper .swiper-button-next { right: -60px; }

/* Ocultar el ::after de Swiper: usamos el icono de Elementor */
.bac-carousel-wrapper .swiper-button-prev::after,
.bac-carousel-wrapper .swiper-button-next::after {
    display: none !important;
}

/* Icono renderizado por Elementor */
.bac-arrow svg,
.bac-arrow i {
    width: 18px;
    height: 18px;
    font-size: 18px;
    display: block;
    line-height: 1;
}

/* Swiper base — solo clips los slides, no las flechas */
.bac-carousel-wrapper .swiper {
    overflow: hidden;
}

/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */

@media (max-width: 767px) {

    /* Altura default en mobile */
    .bac-item {
        height: 300px;
    }

    /* Flechas más pequeñas en mobile (el usuario puede sobreescribir desde Elementor) */
    .bac-carousel-wrapper .swiper-button-prev,
    .bac-carousel-wrapper .swiper-button-next {
        width: 34px;
        height: 34px;
    }

    .bac-arrow svg,
    .bac-arrow i {
        width: 14px;
        height: 14px;
        font-size: 14px;
    }

    /* Etiquetas más pequeñas */
    .bac-label {
        font-size: 11px;
        padding: 3px 9px;
        bottom: 10px;
    }

    .bac-label-before { left: 10px; }
    .bac-label-after  { right: 10px; }

    /* Handle más pequeño */
    .bac-handle-circle {
        width: 34px;
        height: 34px;
    }

    .bac-handle-circle svg {
        width: 16px;
        height: 16px;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .bac-item {
        height: 380px;
    }
}
