/**
 * HORIZONTAL SCROLL BEFORE/AFTER
 * For images that are already split (before on left, after on right)
 * 
 * @package DrNaela
 * @version 3.0.0
 */

.horizontal-before-after {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    border-radius: 20px;
    cursor: ew-resize;
    user-select: none;
    background: #f0f0f0;
    --reveal: 50%;
}

.horizontal-before-after img {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    object-fit: cover;
    object-position: left center;
    pointer-events: none;
    transform: none !important;
}

.horizontal-before-after .reveal-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    /* Will be set by JS to match the <img> src */
    background-repeat: no-repeat;
    background-size: 200% 100%;
    background-position: right center; /* show AFTER half (right side of combined image) */
    clip-path: inset(0 0 0 var(--reveal)); /* reveal from handle to the right */
    border-left: 3px solid rgba(136, 201, 193, 0.9);
}

.horizontal-before-after .scroll-handle {
    position: absolute;
    top: 0;
    left: var(--reveal);
    width: 4px;
    height: 100%;
    background: rgba(136, 201, 193, 0.95);
    z-index: 3;
    transform: translateX(-50%);
    cursor: ew-resize;
    pointer-events: auto;
}

.horizontal-before-after .scroll-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: rgba(136, 201, 193, 0.95);
    border: 3px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.horizontal-before-after .scroll-handle::after {
    content: '⇄';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: white;
    font-weight: bold;
    z-index: 1;
}

.horizontal-before-after .before-label,
.horizontal-before-after .after-label {
    position: absolute;
    top: 20px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 8px;
    z-index: 4;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.horizontal-before-after .before-label {
    left: 20px;
}

.horizontal-before-after .after-label {
    right: 20px;
}

@media (max-width: 768px) {
    .horizontal-before-after {
        height: 350px;
    }
    
    .horizontal-before-after .scroll-handle::before {
        width: 40px;
        height: 40px;
    }
    
    .horizontal-before-after .scroll-handle::after {
        font-size: 20px;
    }
}

