/* ========================================
   Before After Slider – Frontend Styles
   ======================================== */

.ba-slider {
    --ba-position: 50%;
    --ba-radius: 0px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* Intro teaser: smooth motion only while class is active */
.ba-slider--intro .ba-slider-before-wrap {
    transition: clip-path 0.45s ease-in-out;
}

.ba-slider--intro .ba-slider-divider {
    transition: left 0.45s ease-in-out, top 0.45s ease-in-out;
}

.ba-slider-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: var(--ba-radius);
    max-height: var(--ba-max-height, none);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
    line-height: 0;
    cursor: col-resize;
}

.ba-slider[data-direction="vertical"] .ba-slider-container {
    cursor: row-resize;
}

/* After image = base layer, sets container dimensions */
.ba-slider-after {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: var(--ba-max-height, none);
    object-fit: cover;
    pointer-events: none;
}

/* Before image = overlay, clipped */
.ba-slider-before-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: inset(0 calc(100% - var(--ba-position)) 0 0);
    will-change: clip-path;
}

.ba-slider[data-direction="vertical"] .ba-slider-before-wrap {
    clip-path: inset(0 0 calc(100% - var(--ba-position)) 0);
}

.ba-slider-before {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Divider line */
.ba-slider-divider {
    position: absolute;
    top: 0;
    left: var(--ba-position);
    width: 3px;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    will-change: left, top;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

.ba-slider[data-direction="vertical"] .ba-slider-divider {
    top: var(--ba-position);
    left: 0;
    width: 100%;
    height: 3px;
    transform: translateY(-50%);
}

/* Divider handle (circle with arrows) */
.ba-slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 42px;
    height: 42px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
    cursor: col-resize;
    transition: transform 0.15s ease;
    z-index: 11;
}

.ba-slider-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.ba-slider[data-direction="vertical"] .ba-slider-handle {
    cursor: row-resize;
}

.ba-slider-handle svg {
    width: 20px;
    height: 20px;
    color: #444;
    flex-shrink: 0;
}

/* Labels */
.ba-slider-label {
    position: absolute;
    bottom: 16px;
    padding: 5px 14px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    border-radius: 4px;
    pointer-events: none;
    z-index: 5;
    letter-spacing: 0.02em;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ba-slider-label-before {
    left: 16px;
}

.ba-slider-label-after {
    right: 16px;
}

/* Vertical label positions */
.ba-slider[data-direction="vertical"] .ba-slider-label-before {
    top: 16px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
}

.ba-slider[data-direction="vertical"] .ba-slider-label-after {
    bottom: 16px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
}

/* Responsive tweaks */
@media (max-width: 480px) {
    .ba-slider-handle {
        width: 36px;
        height: 36px;
    }

    .ba-slider-handle svg {
        width: 16px;
        height: 16px;
    }

    .ba-slider-label {
        font-size: 11px;
        padding: 3px 10px;
        bottom: 10px;
    }

    .ba-slider-label-before {
        left: 10px;
    }

    .ba-slider-label-after {
        right: 10px;
    }
}
