.mo-gallery {
    display: grid;
    grid-template-columns: repeat(var(--mo-gallery-columns, 4), minmax(0, 1fr));
    gap: clamp(10px, 1.5vw, 20px);
    margin: 1.5em 0;
}

.mo-gallery-item {
    min-width: 0;
    margin: 0;
}

.mo-gallery-link {
    display: block;
    overflow: hidden;
    border-radius: 5px;
}

.mo-gallery-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 180ms ease, filter 180ms ease;
}

.mo-gallery-link:hover .mo-gallery-image,
.mo-gallery-link:focus-visible .mo-gallery-image {
    transform: scale(1.025);
    filter: brightness(.94);
}

.mo-gallery-link:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

.mo-gallery-caption {
    margin-top: 7px;
    font-size: .9em;
    line-height: 1.4;
    text-align: center;
}

.mo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    grid-template-columns: minmax(44px, 1fr) minmax(0, 1200px) minmax(44px, 1fr);
    grid-template-rows: 52px minmax(0, 1fr) auto;
    align-items: center;
    padding: 12px;
    color: #fff;
    background: rgba(0, 0, 0, .92);
}

.mo-lightbox[hidden] {
    display: none;
}

.mo-lightbox-stage {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
}

.mo-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 150px);
    width: auto;
    height: auto;
    object-fit: contain;
}

.mo-lightbox-caption {
    grid-column: 2;
    grid-row: 3;
    min-height: 24px;
    margin: 10px 0 2px;
    text-align: center;
}

.mo-lightbox-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: #fff;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.mo-lightbox-button:hover,
.mo-lightbox-button:focus-visible {
    background: rgba(255, 255, 255, .22);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.mo-lightbox-close {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
}

.mo-lightbox-prev {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
}

.mo-lightbox-next {
    grid-column: 3;
    grid-row: 2;
    justify-self: center;
}

body.mo-lightbox-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .mo-gallery {
        grid-template-columns: repeat(min(var(--mo-gallery-columns, 4), 3), minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .mo-gallery {
        grid-template-columns: repeat(min(var(--mo-gallery-columns, 4), 2), minmax(0, 1fr));
    }

    .mo-lightbox {
        grid-template-columns: 48px minmax(0, 1fr) 48px;
        padding: 6px;
    }
}
