/* JAPI Gallery Ultimate 1.0.6 | LightGallery v1.4 | Photo-fit mode
   The full-screen modal stays full-screen. Only the photograph is constrained.
   Enabled only for modal instances carrying .japi-lg-fit. */
.lg-outer.japi-lg-fit > .lg {
    width: 100% !important;
    height: 100% !important;
}

.lg-outer.japi-lg-fit .lg-item .lg-img-wrap {
    top: var(--japi-lg-stage-top, 64px) !important;
    bottom: var(--japi-lg-stage-bottom, 100px) !important;
    height: auto !important;
    overflow: hidden;
}

.lg-outer.japi-lg-fit:not(.lg-zoomed) .lg-item .lg-image {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: min(var(--japi-lg-photo-max, 80vh), 100%) !important;
    object-fit: contain;
}

.lg-outer.japi-lg-fit .lg-sub-html {
    box-sizing: border-box;
    position: absolute !important;
    bottom: var(--japi-lg-thumbs, 0px) !important;
    left: 0;
    right: 0;
    max-height: var(--japi-lg-caption-max, 144px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 20px;
    text-align: center;
    overflow-wrap: anywhere;
}

/* Keep the photo stage away from the captions, even when the thumbnail strip opens. */
.lg-outer.japi-lg-fit.lg-has-thumb .lg-item,
.lg-outer.japi-lg-fit.lg-can-toggle .lg-item {
    padding-bottom: 0 !important;
}

.lg-outer.japi-lg-fit .lg-sub-html.lg-empty-html { display: none !important; }

@media (max-width: 767px) {
    .lg-outer.japi-lg-fit .lg-sub-html {
        padding: 9px 14px;
        font-size: 14px;
    }
}
