#body-media-images #div-content {
    padding-bottom: 7rem;
}

#body-media-images h1 {
    margin-bottom: .5rem;
}

#body-media-images .gallery-intro {
    margin: 0 0 2rem;
    font-size: var(--caption-text-size);
}

#body-media-images .image-gallery {
    column-count: 3;
    column-gap: 1rem;
}

#body-media-images .gallery-image {
    display: block;
    break-inside: avoid;
    margin-bottom: 1rem;
    cursor: zoom-in;
}

#body-media-images .gallery-image img {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    border: 1px solid #fff;
}

#body-media-images .gallery-image img,
#body-media-images .lightbox-image {
    image-orientation: from-image;
}

#body-media-images a:focus-visible,
#body-media-images button:focus-visible {
    outline: 2px solid var(--mark-color);
    outline-offset: 5px;
}

#body-media-images #div-content.gallery-locked {
    overflow: hidden;
}

#body-media-images nav {
    box-sizing: border-box;
}

#body-media-images nav > div {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    max-width: 100%;
    padding-block: .3rem;
}

#body-media-images .image-lightbox {
    box-sizing: border-box;
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100%;
    margin: 0;
    padding: 4rem 5rem;
    border: 0;
    background: transparent;
    color: #fff;
    overflow: auto;
}

#body-media-images .image-lightbox[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

#body-media-images .image-lightbox::backdrop {
    background: rgba(0, 0, 0, .94);
}

#body-media-images .image-lightbox figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    gap: .75rem;
}

#body-media-images .lightbox-image {
    display: block;
    box-sizing: border-box;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 10rem);
    max-height: calc(100dvh - 10rem);
    object-fit: contain;
    border: 1px solid #fff;
}

#body-media-images #lightbox-caption {
    max-width: 100%;
    text-align: center;
    overflow-wrap: anywhere;
    font-size: 1.1rem;
}

#body-media-images .image-lightbox button {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid #fff;
    background: #111;
    color: #fff;
    font: inherit;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

#body-media-images .image-lightbox button[hidden] {
    display: none;
}

#body-media-images .image-lightbox button:hover {
    background: #333;
}

#body-media-images .lightbox-close {
    top: 1rem;
    right: 1rem;
}

#body-media-images .lightbox-previous,
#body-media-images .lightbox-next {
    top: calc(50% - 1.375rem);
}

#body-media-images .lightbox-previous {
    left: 1rem;
}

#body-media-images .lightbox-next {
    right: 1rem;
}

@media (max-width: 1100px) {
    #body-media-images .image-gallery {
        column-count: 2;
    }
}

@media (max-width: 700px) {
    #body-media-images {
        --normal-text-size: 1.4rem;
        --caption-text-size: 1.1rem;
    }

    #body-media-images #div-content {
        padding-left: 6vw;
        padding-right: 6vw;
    }

    #body-media-images .image-lightbox {
        padding: 4.5rem 1rem 5rem;
    }

    #body-media-images .lightbox-previous,
    #body-media-images .lightbox-next {
        top: auto;
        bottom: 1rem;
    }
}

@media (max-width: 450px) {
    #body-media-images .image-gallery {
        column-count: 1;
    }
}
