/* NOTE: COMPARISON SLIDER (inc/new/sections/comparison-slider.php). The right picture fills the frame, the left
   one lies on top of it, cut at the divider (--kmd-compare-pos, set by javascript/new/comparison-slider.js).
   The range input covers the whole frame and is invisible; the handle shows where it is. */

.kmd-compare {
    position: relative;
    overflow: hidden;
    background: var(--kmd-black);
    user-select: none;
}

.kmd-compare__image {
    display: block;
    width: 100%;
    height: auto;
}

.kmd-compare__image--left {
    position: absolute;
    inset: 0;
    height: 100%;
    object-fit: cover;
    clip-path: inset(0 calc(100% - var(--kmd-compare-pos)) 0 0);
}

.kmd-compare__label {
    position: absolute;
    bottom: 16px;
    z-index: 1;
    padding: 6px 12px;
    background: rgba(0, 0, 0, .55);
    color: var(--kmd-white);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    pointer-events: none;
}

.kmd-compare__label--left {
    left: 16px;
}

.kmd-compare__label--right {
    right: 16px;
}

.kmd-compare__range {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
    touch-action: pan-y;
}

/* the divider line with the round handle in its middle */
.kmd-compare__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--kmd-compare-pos);
    z-index: 1;
    width: 0;
    border-left: 2px solid var(--kmd-white);
    transform: translateX(-1px);
    pointer-events: none;
}

.kmd-compare__handle svg {
    position: absolute;
    top: 50%;
    left: 50%;
    box-sizing: content-box;
    padding: 9px;
    border-radius: 50%;
    background: var(--kmd-white);
    color: var(--kmd-ink);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
    transform: translate(-50%, -50%);
}

.kmd-compare__range:focus-visible + .kmd-compare__handle svg {
    outline: 3px solid var(--kmd-accent);
    outline-offset: 2px;
}

@media screen and (max-width: 767px) {
    .kmd-compare__label {
        bottom: 10px;
        padding: 4px 8px;
        font-size: 11px;
    }

    .kmd-compare__label--left {
        left: 10px;
    }

    .kmd-compare__label--right {
        right: 10px;
    }
}
