/* =====================================================
   BEFORE / AFTER COMPARISON SLIDER
===================================================== */

.comparison {
    padding: 120px 0;
    position: relative;
}

.compare-wrapper {
    margin-top: 70px;
    display: flex;
    justify-content: center;
}

/* =====================================================
   MAIN CONTAINER
===================================================== */

.compare-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    height: 600px;

    border-radius: 24px;
    overflow: hidden;

    background: #111827;

    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.40);

    user-select: none;
    -webkit-user-select: none;

    touch-action: pan-y;
}

/* =====================================================
   BOTH IMAGES
===================================================== */

.compare-image {
    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;

    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* =====================================================
   BEFORE IMAGE OVERLAY
   IMPORTANT:
   Overlay changes width, but image DOES NOT resize.
===================================================== */

.compare-overlay {
    position: absolute;

    top: 0;
    left: 0;

    width: 50%;
    height: 100%;

    overflow: hidden;

    z-index: 2;
}

/*
   VERY IMPORTANT FIX

   BEFORE image always keeps the same size
   as the main comparison container.
*/

.compare-overlay .compare-image {
    width: 100%;
    height: 100%;

    max-width: none;

    object-fit: cover;
}

/* =====================================================
   LABELS
===================================================== */

.label {
    position: absolute;

    top: 20px;

    padding: 10px 18px;

    border-radius: 30px;

    font-size: 14px;
    font-weight: 700;

    color: #fff;

    z-index: 5;

    pointer-events: none;
}

.label.before {
    left: 20px;
    background: #111827;
}

.label.after {
    right: 20px;
    background: var(--primary);
}

/* =====================================================
   SLIDER LINE
===================================================== */

.slider {
    position: absolute;

    left: 50%;
    top: 0;

    width: 4px;
    height: 100%;

    background: #fff;

    transform: translateX(-50%);

    cursor: ew-resize;

    z-index: 10;

    touch-action: none;
}

/* =====================================================
   SLIDER LINE
===================================================== */

.slider-line {
    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 100%;

    background: #fff;
}

/* =====================================================
   SLIDER BUTTON
===================================================== */

.slider-button {
    position: absolute;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    width: 56px;
    height: 56px;

    border-radius: 50%;

    background: var(--primary);

    color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 22px;
    font-weight: bold;

    border: 4px solid #fff;

    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.35);

    cursor: ew-resize;

    touch-action: none;
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 992px) {

    .compare-container {
        height: 450px;
    }

}

@media (max-width: 768px) {

    .comparison {
        padding: 70px 0;
    }

    .compare-wrapper {
        margin-top: 40px;
    }

    .compare-container {
        width: 100%;
        height: 320px;

        border-radius: 16px;
    }

    .slider-button {
        width: 46px;
        height: 46px;

        font-size: 18px;
    }

    .label {
        top: 12px;

        font-size: 11px;

        padding: 7px 12px;
    }

    .label.before {
        left: 12px;
    }

    .label.after {
        right: 12px;
    }

}

/* =====================================================
   SMALL PHONES
===================================================== */

@media (max-width: 480px) {

    .compare-container {
        height: 260px;
        border-radius: 12px;
    }

    .slider {
        width: 3px;
    }

    .slider-button {
        width: 40px;
        height: 40px;

        font-size: 16px;

        border-width: 3px;
    }

}