.gallery_wrapper {
    position: relative;
}

.gallery {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    border-radius: 10px;
    overflow: hidden;
}

.gallery::-webkit-scrollbar {
    display: none;
}

.gallery_item {
    flex: 0 0 calc((100% - 60px) / 4);
    aspect-ratio: 4 / 3;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #eee;
    scroll-snap-align: start;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.gallery_item picture {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
}

.gallery_item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    transform: translateZ(0);
    transition: transform .35s ease;
}

.gallery_item:hover img {
    transform: translateZ(0) scale(1.04);
}

/* arrow */
.gallery_arrow {
    position: absolute;
    z-index: 5;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .7);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, opacity .2s ease;
}

.gallery_arrow:hover {
    background: #000;
}

.gallery_prev {
    left: 12px;
}

.gallery_next {
    right: 12px;
}

/* lightbox */
.lightbox {
    position: fixed;
    z-index: 99999;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 80px;
    background: rgba(0, 0, 0, .92);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
}

.lightbox.is_open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lightbox_content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

.lightbox_picture {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: calc(100vh - 120px);
}

.lightbox_image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 120px);
    width: auto;
    height: auto;
    object-fit: contain;
}

.lightbox_counter {
    margin-top: 14px;
    color: rgba(255, 255, 255, .8);
    font-size: 14px;
}

.lightbox_close {
    position: absolute;
    top: 20px;
    right: 25px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 46px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
}

/* lightbox arrows */
.lightbox_arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease;
}

.lightbox_arrow:hover {
    background: rgba(255, 255, 255, .25);
}

.lightbox_prev {
    left: 20px;
}

.lightbox_next {
    right: 20px;
}

/* arrows fix */
.gallery_arrow,
.lightbox_arrow {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery_arrow::before,
.lightbox_arrow::before {
    content: '';
    display: block;
    width: 11px;
    height: 11px;
    border-top: 3px solid currentColor;
    border-right: 3px solid currentColor;
}

.gallery_next::before,
.lightbox_next::before {
    transform: rotate(45deg);
    margin-left: -4px;
}

.gallery_prev::before,
.lightbox_prev::before {
    transform: rotate(-135deg);
    margin-left: 4px;
}

/* rwd */
@media (max-width: 1100px) {
    .gallery_item {
        flex-basis: calc((100% - 40px) / 3);
    }
}

@media (max-width: 768px) {
    .gallery {
        gap: 15px;
    }

    .gallery_item {
        flex-basis: calc((100% - 15px) / 2);
    }

    .lightbox {
        padding: 50px 55px;
    }
}

@media (max-width: 480px) {
    .gallery_item {
        flex-basis: 100%;
    }

    .gallery_arrow {
        width: 40px;
        height: 40px;
    }

    .lightbox {
        padding: 50px 15px;
    }

    .lightbox_arrow {
        width: 42px;
        height: 42px;
        top: auto;
        bottom: 20px;
    }

    .lightbox_prev {
        left: 20px;
    }

    .lightbox_next {
        right: 20px;
    }
}