#before-and-after {
    display: flex;
    flex-direction: column;
    margin-top: 8rem;
}

.before-and-after-header-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 2rem;
    margin-left: 9.09vw;
    margin-right: 9.09vw;
    margin-bottom: 4rem;
}

@media (max-width: 50rem) {
    .before-and-after-header-wrapper {
        display: flex;
        flex-direction: column;
    }
}

.before-and-after-title-wrapper {
    grid-column: 1 / 2;
}

.before-and-after-title-wrapper h1 {
    text-align: left;
    margin-bottom: 1rem;
}

.before-and-after-title-wrapper p {
    max-width: 25em;
    color: var(--dark-grey);
}

.before-and-after-title-wrapper p:not(:first-child) {
    margin-top: .5rem;
}

.process-photos-wrapper-three {
    width: 100%;
    grid-column: 2 / 3;
    display: grid;
    grid-template-columns: auto auto;
    position: relative;
    gap: 1rem;
}

.process-photo {
    width: 100%;
}

#pp1 {
    grid-column: 1 / 2;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

#pp2 {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 2 / 2;
}

#pp3 {
    grid-column: 1 / 2;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

footer {
    margin-top: 8rem;
}

#before-and-after-wrapper {
    max-width: 81.8181vw;
    width: 81.8181vw;
    align-self: center;
    justify-self: center;
    position: relative;
}

#before-cutoff, #after-cutoff {
    display: flex;
    flex-direction: column;
    position: relative;
    max-width: 100%;
}

.before, .after {
    width: 81.8181vw;
    height: 61.36vw;
    max-height: 90vh;
    object-fit: cover;
    grid-row: 1;
    grid-column: 2;
    user-select: none;
}

#after-cutoff {
    position: absolute;
    z-index: 10;
    overflow: hidden;
    left: 0;
    right: 0;
    top: 0;
    width: 20%;
}

#thumb {
    position: absolute;
    z-index: 20;
    left: 20%;
    top: 50%;
    user-select: none;
    pointer-events: none;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: var(--pink);
    color: var(--white);
    transform: translate(-50%, -50%);
    line-height: 2rem;
    text-align: center;
}

#range {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;

    position: absolute;
    z-index: 20;
    width: 81.8181vw;
    margin: 0;
    justify-self: center;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--pink);
    height: 61.363vw;
    max-height: 90vh;
    width: 2px;    
}

@media (max-width: 480px) {
    #before-and-after-wrapper {
        align-self: first baseline;
        max-width: 100vw;
        width: 100vw;
    }

    .before, .after {
        width: 100vw;
        height: 75vw;
        grid-column: 1;
    }

    input[type="range"]::-webkit-slider-thumb {
        height: 75vw;
    }

    #range {
        width: 100vw;
    }
}

/* Stage Rotation Animation */

.stage-wrapper {
    width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    perspective: 200px;
    color: var(--medium-grey);
}

.before-stage {
    position: absolute;
}

.after-stage {
    opacity: 0%;
    transform: rotate3d(1, 0, 0, 180deg);
}

.before-show-after {
    animation: 0.3s rotate-show-after, 0.3s invisible-show-after;
    animation-timing-function: linear, steps(1);
    animation-fill-mode: forwards;
}

.after-show-after {
    animation: 0.3s destructive-rotate-show-after, 0.3s destructive-invisible-show-after;
    animation-timing-function: linear, steps(1);
    animation-fill-mode: forwards;
}

@keyframes rotate-show-after {
    from {
        transform: rotate3d(1, 0, 0, 0deg);
    }

    to {
        transform: rotate3d(1, 0, 0, 180deg);
    }
}

@keyframes invisible-show-after {
    from {
        opacity: 100%;
    }

    50% {
        opacity: 0%;
    }

    to {
        opacity: 0%;
    }
}

@keyframes destructive-rotate-show-after {
    from {
        transform: rotate3d(1, 0, 0, 180deg);
    }

    to {
        transform: rotate3d(1, 0, 0, 360deg);
    }
}

@keyframes destructive-invisible-show-after {
    from {
        opacity: 0%;
    }

    50% {
        opacity: 100%;
    }

    to {
        opacity: 100%;
    }
}

.before-show-before {
    animation: 0.3s rotate-show-before, 0.3s invisible-show-before;
    animation-timing-function: linear, steps(1);
    animation-fill-mode: forwards;
}

.after-show-before {
    animation: 0.3s destructive-rotate-show-before, 0.3s destructive-invisible-show-before;
    animation-timing-function: linear, steps(1);
    animation-fill-mode: forwards;
}

@keyframes rotate-show-before {
    from {
        transform: rotate3d(1, 0, 0, 180deg);
    }

    to {
        transform: rotate3d(1, 0, 0, 360deg);
    }
}

@keyframes invisible-show-before {
    from {
        opacity: 0%;
    }

    50% {
        opacity: 100%;
    }

    to {
        opacity: 100%;
    }
}

@keyframes destructive-rotate-show-before {
    from {
        transform: rotate3d(1, 0, 0, 360deg);
    }

    to {
        transform: rotate3d(1, 0, 0, 540deg);
    }
}

@keyframes destructive-invisible-show-before {
    from {
        opacity: 100%;
    }

    50% {
        opacity: 0%;
    }

    to {
        opacity: 0%;
    }
}