.image-gallery-trigger {
    cursor: zoom-in;
}

.glightbox-container .gslide-title {
    font-family: "Open Sans", sans-serif;
    line-height: 1.45;
}

.glightbox-container .gslide-image img {
    /* Let GLightbox constrain large originals to the viewport. A fixed width
       enlarged 200px thumbnails to 1100px and made them visibly blurry. */
    width: auto;
    height: auto;
    object-fit: contain;
}

.glightbox-container .gslide-description {
    width: 100%;
    max-width: min(90vw, 1100px) !important;
}

.glightbox-container .gslide-inline:has(.gallery-motion) {
    padding: 0;
    background: transparent;
    max-width: 90vw;
}

.gallery-motion {
    display: block;
    width: 100%;
    max-height: 75vh;
    object-fit: contain;
}

@media (max-width: 767px) {
    /* Keep explicit navigation available as well as swipe on small screens. */
    .glightbox-container .gnext, .glightbox-container .gprev {
        top: 50%;
        transform: translateY(-50%);
    }
    .glightbox-container .gnext { right: 8px; }
    .glightbox-container .gprev { left: 8px; }
}

.gallery-affordance {
    position: relative;
}

.gallery-affordance::after {
    content: "Enlarge";
    position: absolute;
    inset-block-start: 6px;
    inset-inline-start: 6px;
    padding: 2px 6px;
    border-radius: 3px;
    color: #fff;
    background: #183e61;
    font-size: 1.2rem;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    .gallery-affordance:not(:hover):not(:focus-within)::after {
        visibility: hidden;
    }
}

.image-gallery-trigger:focus-visible {
    outline: 2px solid #245d90;
    outline-offset: -2px;
}

.gallery-source-action {
    position: absolute;
    z-index: 1000000;
    inset-block-start: max(10px, env(safe-area-inset-top));
    inset-inline-start: max(10px, env(safe-area-inset-left));
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 4px;
    color: #fff;
    background: #183e61;
    text-decoration: underline;
}

.gallery-source-action[hidden] {
    display: none;
}

.gallery-source-action:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (max-width: 767px) {
    .glightbox-container:has(.gallery-source-action:not([hidden])) {
        --viewer-tools-height: calc(max(10px, env(safe-area-inset-top)) + 52px);
    }

    .glightbox-container:has(.gallery-source-action:not([hidden])) #glightbox-slider {
        margin-top: var(--viewer-tools-height);
        height: calc(100% - var(--viewer-tools-height));
    }

    .glightbox-container:has(.gallery-source-action:not([hidden])) .ginner-container {
        max-height: calc(100dvh - var(--viewer-tools-height));
    }
}
