.gallery {
    position: relative;
}

.gallery .gallery-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 4rem;

    @media (max-width: 1023px) {
        padding: 2rem 0 2rem 2rem;
    }
}

.gallery .gallery-wrapper .text {
    display: flex;
    flex-direction: column;
    text-align: left;
    color: var(--color-coconut-husk);

    @media (max-width: 1023px) {
        padding: 0 2rem 0 0;
    }
}

.gallery .gallery-wrapper .text p {
    max-width: 50%;

    @media (max-width: 1023px) {
        max-width: 100%;
    }
}

.gallery-viewport {
    position: relative;
    isolation: isolate;
    overflow: visible;
}

.gallery-prev,
.gallery-next {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    background: white;
    border: 1px solid var(--color-coconut-husk);
    box-sizing: border-box;
    line-height: 0;
    transition: opacity .25s ease, background .3s ease, border-color .3s ease;
}

.gallery-prev {
    left: 0;
    margin-left: -24px;
    transform: translateY(-50%);

    @media (max-width: 1023px) {
        display: none;
    }
}

.gallery-next {
    right: 0;
    margin-right: -24px;
    transform: translateY(-50%);

    @media (max-width: 1023px) {
        display: none;
    }
}

.gallery-prev:active,
.gallery-next:active {
    transform: translateY(-50%);
}

.gallery-prev.is-disabled,
.gallery-next.is-disabled,
.gallery-prev:disabled,
.gallery-next:disabled {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity .25s ease;
}

.gallery-viewport .button-outline .slide-arrow-left,
.gallery-viewport .button-outline .slide-arrow-right {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-inline: 0.3rem;
    margin-block: 0.7rem 0.5rem;
    background-color: var(--color-coconut-husk);
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
    transition: background-color .3s ease;
}

.gallery-viewport .button-outline .slide-arrow-left {
    mask-image: var(--arrow-right-icon);
    -webkit-mask-image: var(--arrow-right-icon);
    rotate: -180deg;
}

.gallery-viewport .button-outline .slide-arrow-right {
    mask-image: var(--arrow-right-icon);
    -webkit-mask-image: var(--arrow-right-icon);
}

.gallery-prev:hover,
.gallery-next:hover {
    background: var(--color-coconut-husk);
    border-color: var(--color-coconut-husk);
}

.gallery-prev:hover .slide-arrow-left,
.gallery-next:hover .slide-arrow-right {
    background-color: white;
}

.gallery-track {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;

    @media (max-width: 1023px) {
        scroll-snap-type: x mandatory;
        padding-inline: 1rem;
        scroll-padding-left: 0;
        scroll-padding-right: 1rem;
    }
}

.gallery-track::-webkit-scrollbar {
    display: none;
}

.gallery-item {
    flex: 0 0 calc((100% - (0.5rem * 5)) / 6);
    aspect-ratio: 1 / 2;
    border-radius: 0;
    overflow: hidden;
    transition: border-radius 0.6s ease;

    @media (max-width: 1023px) {
        flex: 0 0 85%;
        scroll-snap-align: start;
    }
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1);
    transition: transform .6s ease;
}

.gallery-item:hover {
    border-radius: 1rem;
}

.gallery-item:hover img {
    transform: scale(1.02);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .gallery-prev,
    .gallery-next,
    .gallery-item,
    .gallery-item img {
        transition: none !important;
        transform: none !important;
    }
}