/* Before/after comparison slider, shared by the Before & After page, product pages and custom landing pages.
   Markup: resources/views/components/before-after-slider.blade.php */
.ba-compare {
    --pos: 50%;
    background: #e9ecef;
    overflow: hidden;
    position: relative;
    user-select: none;
    width: 100%;
}
.ba-compare__img,
.ba-compare__top img {
    display: block;
    height: 100%;
    inset: 0;
    max-width: none;
    object-fit: cover;
    pointer-events: none;
    position: absolute;
    width: 100%;
}
.ba-compare__top {
    clip-path: inset(0 calc(100% - var(--pos)) 0 0);
    inset: 0;
    position: absolute;
    z-index: 1;
}
.ba-compare__label {
    background: var(--primary-blue, #1A4982);
    color: #fff;
    font-size: clamp(12px, 1.2vw, 16px);
    font-weight: 600;
    padding: 6px 12px;
    position: absolute;
    z-index: 1;
}
.ba-compare__label--left { border-bottom-right-radius: 4px; }
.ba-compare__label--right { right: 0; border-bottom-left-radius: 4px; }
.ba-compare__handle {
    background: #fff;
    bottom: 0;
    left: var(--pos);
    margin-left: -1.5px;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 3px;
    z-index: 2;
}
.ba-compare__knob {
    align-items: center;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .3);
    color: #212529;
    display: flex;
    height: 56px;
    justify-content: center;
    left: 50%;
    margin: -28px 0 0 -28px;
    position: absolute;
    top: 50%;
    width: 56px;
}
.ba-compare__range {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: ew-resize;
    height: 100%;
    inset: 0;
    margin: 0;
    opacity: 0;
    position: absolute;
    touch-action: pan-y;
    width: 100%;
    z-index: 3;
}
.ba-compare:focus-within .ba-compare__knob {
    box-shadow: 0 0 0 4px var(--primary-blue, #1A4982);
}


/* Full-size button (Before & After page): opens the lightbox with both photos */
.ba-compare__expand {
    align-items: center;
    background: rgba(255, 255, 255, .92);
    border: 0;
    border-radius: 50%;
    bottom: 4%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
    color: #212529;
    cursor: pointer;
    display: flex;
    height: 40px;
    justify-content: center;
    padding: 0;
    position: absolute;
    right: 4%;
    width: 40px;
    z-index: 4;
}
.ba-compare__expand:hover { background: #fff; }
.ba-compare__expand:focus-visible { outline: 3px solid var(--primary-blue, #1A4982); outline-offset: 2px; }
.ba-lightbox-links { display: none; }

@media (max-width: 767px) {
    .ba-compare__knob { height: 44px; width: 44px; margin: -22px 0 0 -22px; }
}

/* Inside the existing Before & After cards (.gallery-set) */
.gallery-set--slider > .ba-compare {
    width: 100%;
    border-radius: 4px;
}

/* Keep full border-radius if a description of the project does not exist */
.gallery-set:has(.set-heading) .ba-compare {
    border-radius: 4px 4px 0 0;
}
