/* ══════════════════════════════════════════════
   rhx-comparison — Before/after image comparison
   ══════════════════════════════════════════════ */

.rhx-comparison {
    position: relative;
    overflow: hidden;
    user-select: none;
    touch-action: pan-y;
    line-height: 0;
    cursor: ew-resize;
}

.rhx-comparison__before,
.rhx-comparison__after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.rhx-comparison__before {
    z-index: 0;
}

.rhx-comparison__after {
    z-index: 1;
}

.rhx-comparison__before img,
.rhx-comparison__after img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* The "before" image also establishes intrinsic size */
.rhx-comparison__before {
    position: relative;
}

/* ── Handle ── */

.rhx-comparison__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 0;
    transform: translateX(-50%);
    cursor: ew-resize;
    outline: none;
}

.rhx-comparison__handle:focus-visible .rhx-comparison__handle-grip {
    outline: 2px solid var(--rhx-color-brand-500);
    outline-offset: 2px;
}

.rhx-comparison__handle-line {
    flex: 1;
    width: 2px;
    background: #fff;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}

.rhx-comparison__handle-grip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--rhx-radius-full);
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    color: var(--rhx-color-text);
    flex-shrink: 0;
}

.rhx-comparison__handle-grip svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ── Dragging state ── */

.rhx-comparison--dragging {
    cursor: ew-resize;
}

.rhx-comparison--dragging .rhx-comparison__handle-grip {
    background: var(--rhx-color-brand-500);
    color: #fff;
}
