/* =========================================
   Comparison Slider Styles
   ========================================= */
.comparison-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 40px;
    width: 100%;
    margin-bottom: 60px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    background-color: #f9f9f9;
    padding: 60px;
    border-radius: 0;
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.08);
}

.image-comparison-slider {
    position: relative;
    width: 100%;
    /* Standard landscape aspect ratio */
    aspect-ratio: 3/2;
    overflow: hidden;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    cursor: col-resize;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    /* Prevent scrolling while dragging on mobile */
}

.image-comparison-slider img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* Wrapper for the 'After' image (foreground) */
.img-wrapper-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    /* Default starting position */
    height: 100%;
    z-index: 2;
    overflow: hidden;
    border-right: 3px solid white;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.2);
    will-change: width;
}

/* Ensure inner image stays full width relative to the slider container */
.img-wrapper-after img {
    /* We will set width via JS to match parent container width 
       to prevent squashing */
    width: auto;
    height: 100%;
    max-width: none;
}

/* Slider Handle */
.slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Matches wrapper width */
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 0;
    z-index: 3;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    cursor: col-resize;
    pointer-events: none;
    /* Let clicks pass to container logic */
}

.slider-handle::before,
.slider-handle::after {
    content: '';
    display: block;
    border-left: 2px solid #333;
    height: 12px;
    margin: 0 2px;
}

/* Comparison Labels */
.slider-label {
    position: absolute;
    bottom: 20px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 0;
    z-index: 10;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
}

.slider-label.before {
    left: 20px;
}

.slider-label.after {
    right: 20px;
}

/* Mobile check */
@media (max-width: 768px) {
    .comparison-container {
        grid-template-columns: 1fr;
    }
}


/* Slider Tooltip */
.slider-tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -160%);
    /* Position above the handle */
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 20;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
}

.slider-tooltip.visible {
    opacity: 1;
}