.cms-gallery {
    margin-block: 2.5rem;
}

.cms-gallery__header {
    margin-bottom: 1rem;
}

.cms-gallery__header h2 {
    margin: 0 0 .4rem;
}

.cms-gallery__header p {
    margin: 0;
}

.cms-gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1rem;
}

.cms-gallery__item {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 4px;
    background: #e8e8ec;
}

.cms-gallery__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s ease;
}

.cms-gallery__item:hover img,
.cms-gallery__item:focus-visible img {
    transform: scale(1.035);
}

.cms-gallery__item span {
    position: absolute;
    inset: auto 0 0;
    padding: .65rem .8rem;
    background: rgba(18, 16, 22, .76);
    color: #fff;
    font-size: .9rem;
}

.cms-gallery-lightbox {
    position: relative;
    width: min(94vw, 1100px);
    max-width: none;
    max-height: 94vh;
    padding: 3rem 3.5rem 1.25rem;
    border: 0;
    border-radius: 4px;
    background: #17151b;
    color: #fff;
}

.cms-gallery-lightbox::backdrop {
    background: rgba(10, 8, 14, .88);
}

.cms-gallery-lightbox img {
    display: block;
    max-width: 100%;
    max-height: 78vh;
    margin-inline: auto;
    object-fit: contain;
}

.cms-gallery-lightbox__caption {
    min-height: 1.5rem;
    margin: .8rem 0 0;
    text-align: center;
}

.cms-gallery-lightbox button {
    position: absolute;
    display: grid;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 50%;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.cms-gallery-lightbox__close {
    inset: .5rem .5rem auto auto;
}

.cms-gallery-lightbox__previous {
    inset: 50% auto auto .5rem;
    transform: translateY(-50%);
}

.cms-gallery-lightbox__next {
    inset: 50% .5rem auto auto;
    transform: translateY(-50%);
}

@media (max-width: 600px) {
    .cms-gallery-lightbox {
        width: 100vw;
        max-height: 100vh;
        padding: 3rem 2.75rem 1rem;
        border-radius: 0;
    }

    .cms-gallery-lightbox img {
        max-height: 78vh;
    }
}