/* =============================================
   Before / After Slider Widget — Frontend CSS
   v2: auto-height, image-bounded overlay
   ============================================= */

/* ── Wrapper: position context for all overlaid elements ── */
.baw-wrapper {
    display: block;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    line-height: 0;
    cursor: col-resize;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    overflow: hidden;
}

/* ── Base image — defines the natural height of the whole block ── */
.baw-img-base {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    pointer-events: none;
}

/* ── Overlay image (Before) — absolute, same dimensions, clipped left ── */
.baw-img-overlay {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
    clip-path: inset(0 50% 0 0);
    will-change: clip-path;
}

/* ── Divider line ── */
.baw-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: #fff;
    transform: translateX(-50%);
    will-change: left;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(0,0,0,.35);
    z-index: 3;
}

/* ── Handle circle ── */
.baw-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    margin-left: -24px;
    background: #fff;
    border-radius: 50%;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: col-resize;
    box-shadow: 0 2px 10px rgba(0,0,0,.30), 0 0 0 2px rgba(255,255,255,.5);
    transition: box-shadow .15s ease, transform .15s ease;
    will-change: left;
    outline: none;
}

.baw-handle:hover,
.baw-handle:focus {
    box-shadow: 0 4px 16px rgba(0,0,0,.40), 0 0 0 3px rgba(255,255,255,.8);
}

/* Arrow icon inside handle */
.baw-arrows {
    width: 60%;
    height: 60%;
    color: #444;
    pointer-events: none;
    flex-shrink: 0;
}

/* ── Labels ── */
.baw-label {
    position: absolute;
    z-index: 5;
    line-height: 1.2;
    pointer-events: none;
    white-space: nowrap;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .03em;
    top: 14px;
    left: 14px;
}

.baw-label--hover {
    opacity: 0;
    transition: opacity .25s ease;
}

.baw-wrapper:hover .baw-label--hover,
.baw-wrapper.baw-dragging .baw-label--hover {
    opacity: 1;
}

.baw-label--always {
    opacity: 1;
}

.baw-handle:focus-visible {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

@media (max-width: 767px) {
    .baw-handle {
        width: 36px;
        height: 36px;
        margin-top: -18px;
        margin-left: -18px;
    }
}
