/* /css/before-after.css - PROPERLY FIXED VERSION */

.before-after-section {
    padding: var(--space-6) 0;
    text-align: center;
    background-color: var(--clr-white);
}

.before-after-subtitle {
    font-family: var(--font-headings);
    color: var(--clr-text);
    margin-bottom: var(--space-5);
    font-size: 0.9rem;
}

.before-after-wrapper {
	position:relative;
    background-color: #d7c2a7;
    padding: 0;
    max-width: 1200px;
    margin: 0 auto;
}

.before-after-slider {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
    line-height: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    overflow: hidden;
}

/* The before image should be the base layer - completely static */
.before-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
    z-index: 1;
}

/* Container that clips the after image */
.after-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    /* Initial state - this is what gets resized by JS */
    height: 100%;
    overflow: hidden;
    z-index: 2;
}

/* The after image should fill the entire slider area but be clipped by its container */
.after-image {
    position: absolute;
    top: 0;
    left: 0;
    /* CRITICAL: The after image must be sized relative to the SLIDER, not its container */
    width: calc(var(--slider-width, 100vw));
    /* We'll set this with CSS custom property */
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
}

.slider-divider {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: var(--clr-primary);
    cursor: ew-resize;
    z-index: 20;
}

.slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: var(--clr-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.slider-handle svg {
    stroke: var(--clr-white);
    width: 18px;
    height: 18px;
}

.before-after-info {
	position:absolute;
	bottom:0px;
	width:100%;
	z-index:99;
	padding:var(--space-3);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    color: var(--clr-white);
    font-family: var(--font-primary);
    font-size: 1rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.after-content {
    display: flex;
    flex-direction: column;

    align-items: flex-end;
    gap: var(--space-2);
}

.before-after-button {
    background-color: var(--clr-primary);
    color: var(--clr-white);
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    font-weight: var(--fw-light);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-speed);
    font-size: 0.9rem;
    white-space: nowrap;
}

.before-after-button:hover {
    background-color: var(--clr-secondary);
}

@media (max-width: 768px) {
    .before-after-wrapper {
        padding: var(--space-1);
    }

    .before-after-slider {
        height: 50vh;
    }

    .before-after-info {

        gap: 0;
        padding-top: 0;
    }

    .after-content {
        flex-direction: column;
        gap: 0;
        width: 50%;
    }

    .before-after-button {
        width: 100%;
    }
}
