/* Comparison container */
.comparison {
    position: relative;
    display: inline-block;  /* keeps container size to images */
    overflow: hidden;
    background: #222;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    user-select: none;
    touch-action: none;
}

/* Base image (left) */
.base {
    position: relative; /* natural positioning */
    display: block;
}

.base img {
    display: block;
    width: auto;       /* preserve aspect ratio */
    height: auto;
    max-width: none;
    max-height: none;
}

/* Overlay container (right image) */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;       /* slider-controlled */
    height: 100%;
    overflow: hidden; /* clips image horizontally */
}

.overlay img {
    display: block;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    position: relative;
}

/* Divider line */
.divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    background: linear-gradient(180deg, transparent, var(--line-color, #fff), transparent);
    z-index: 3;
    pointer-events: none;
}

/* Draggable handle */
.handle {
    width: 36px;
    height: 36px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #66ccff;
    border: 3px solid #fff;
    cursor: ew-resize;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    display: grid;
    place-items: center;
    z-index: 4;
}

.handle:hover {
    box-shadow: 0 0 12px rgba(102,204,255,0.8), 0 4px 12px rgba(0,0,0,0.6);
}

/* Labels */
.label {
    position: absolute;
    z-index: 5;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.45);
    color: #fff;
    top: 8px;
    font-weight: 600;
}

.label.left { left: 12px; }
.label.right { right: 12px; }

/* Slider controls */
.controls {
    width: min(900px, 95vw);
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.controls input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 12px;
    background: rgba(255,255,255,0.2);
    border-radius: 999px;
    cursor: pointer;
}

.controls input[type="range"]::-webkit-slider-runnable-track {
    height: 12px;
    background: #66ccff;
    border-radius: 999px;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.3);
}

.controls input[type="range"]::-moz-range-track {
    height: 12px;
    background: #66ccff;
    border-radius: 999px;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.3);
}

.controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #66ccff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    margin-top: -8px;
    cursor: pointer;
}

.controls input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #66ccff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    cursor: pointer;
}

.controls input[type="range"]:focus {
    outline: none;
}

/* Responsive for mobile */
@media (max-width: 420px) {
    .handle { width: 28px; height: 28px; }
    .controls input[type="range"] { height: 10px; }
    .controls input[type="range"]::-webkit-slider-thumb,
    .controls input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }
    .label { font-size: 12px; padding: 4px 8px; }
}

.comparison-container {
    display: flex;
    justify-content: space-between; /* images spread evenly */
    width: 1000px; /* total width of container */
    margin: 2rem auto; /* center on page */
    gap: 0; /* optional spacing between images */
}

.comparison-item {
    position: relative;
    flex: 1; /* images take equal width */
    max-width: 49%; /* optional, prevent overflow */
}

.comparison-item img {
    width: 100%;  /* scale to fit container */
    height: auto; /* preserve aspect ratio */
    display: block;
}