/* compare — this component's own styles, put in the head by the renderer where it is drawn.
   Colours and sizes only through var(--*), so the design drives these too. */

.compare {
    padding: 2.8rem 0;
}

.compare__frame {
    --compare-pos: 50%;
    position: relative;
    /* The frame has its own shape, not the photo's: a portrait shot across the
       full width stood a whole screen and more tall. Both photos fill it,
       across the whole width. */
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius, 14px);
    /* Vertical drags scroll the page; horizontal ones are ours. */
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.compare__img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.compare__img--after {
    clip-path: inset(0 0 0 var(--compare-pos));
}

.compare__divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--compare-pos);
    width: 2px;
    margin-left: -1px;
    background: #fff;
    box-shadow: 0 0 8px rgba(0, 0, 0, .45);
    pointer-events: none;
}

.compare__handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: #fff;
    color: #111;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}

/* The range input is the REAL control: invisible but full-size, so it takes
   pointer events natively and stays focusable for the keyboard. Opacity 0 —
   not display:none, which would remove it from the accessibility tree. */
.compare__range {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
}

.compare__handle svg { width: 20px; height: 20px; display: block; }

.compare__range:focus-visible ~ .compare__divider .compare__handle,
.compare__frame:has(.compare__range:focus-visible) .compare__handle {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}

.compare__label {
    position: absolute;
    top: 1rem;
    padding: .25rem .7rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: .8rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    pointer-events: none;
}

.compare__label--before { left: 1rem; }


.compare__label--after { right: 1rem; }

/* --- before / after ------------------------------------------------------ */
.section-head--center { text-align: center; justify-content: center; }


.section-head--center .section-lead { color: var(--muted); max-width: 44ch; margin: .5rem auto 0; }
