.case-studies-archive {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5rem;

    .case-study {
        display: flex;
        flex-direction: column;
        grid-column: span 2;
        text-decoration: none;

        &:nth-child(4n),
        &:nth-child(4n - 3) {
            grid-column: span 3;
        }

        img {
            width: 100%;
            aspect-ratio: 12 / 7;
            margin-bottom: .5rem;
            object-fit: cover;
        }

        p {
            color: white;
            font-size: 17px;
            margin: 0;
            font-weight: 700;
        }

        h3 {
            color: white;
            font-size: var(--wp--preset--font-size--tiny);
            margin: 0;
            font-weight: 400;
        }
    }

    &.has-light-background {
        .case-study {
            p {
                color: var(--wp--preset--color--contrast);
            }

            h3 {
                color: var(--wp--preset--color--contrast);
            }
        }
    }
}

.case-studies-viewport {
    overflow: hidden;
    padding-inline: calc(50vw - 800px + 4rem);

    .case-studies-slider {
        overflow: visible;
        position: relative;

        .case-study {
            display: flex;
            flex-direction: column;
            text-decoration: none;
            width: calc((100% - 4rem) / 3);
            margin: auto 0;
    
            img {
                width: 100%;
                aspect-ratio: 12 / 7;
                margin-bottom: .5rem;
                object-fit: cover;
            }

            p, h3 {
                opacity: 0;
                transition: none;
            }

            p {
                font-size: 17px;
                margin: 0;
                font-weight: 700;
            }
    
            h3 {
                font-size: var(--wp--preset--font-size--tiny);
                margin: 0;
                font-weight: 400;
            }
        }

        .swiper-slide-active {
            width: calc((100% - 4rem) * 2 / 3);

            p, h3 {
                opacity: 1;
                transition: opacity 500ms ease-out 500ms;
            }

            img {
                transform-origin: right center;
                animation: case-study-image-grow 500ms ease-out both;
            }
        }

        .is-leaving:not(.swiper-slide-active) img {
            transform-origin: left center;
            animation: case-study-image-shrink 500ms ease-out both;
        }

        .case-studies-controls {
            position: absolute;
            bottom: 0;
            left: 68%;

            .swiper-button-prev,
            .swiper-button-next {
                margin: 0 !important;
            }
        }
    }
}

@keyframes case-study-image-grow {
    from {
        transform: scale(0.5);
    }

    to {
        transform: scale(1);
    }
}

@keyframes case-study-image-shrink {
    from {
        transform: scale(2);
    }

    to {
        transform: scale(1);
    }
}