.ekko-lightbox {
    display: -ms-flexbox !important;
    display: flex !important;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding-right: 0 !important;
    z-index: 3;
}

.ekko-lightbox-container {
    position: relative
}

.ekko-lightbox-container > div.ekko-lightbox-item {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    width: 100%
}

.ekko-lightbox iframe {
    width: 100%;
    height: 100%
}

.ekko-lightbox-nav-overlay {
    z-index: 1;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: -ms-flexbox;
    display: flex
}

.ekko-lightbox-nav-overlay a {
    -ms-flex: 1;
    flex: 1;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
    opacity: 0;
    transition: opacity .5s;
    color: #fff;
    font-size: 30px;
    z-index: 1
}

.ekko-lightbox-nav-overlay a > * {
    -ms-flex-positive: 1;
    flex-grow: 1
}

.ekko-lightbox-nav-overlay a > :focus {
    outline: none
}

.ekko-lightbox-nav-overlay a span {
    padding: 0 30px
}

.ekko-lightbox-nav-overlay a:last-child span {
    text-align: right
}

.ekko-lightbox-nav-overlay a:hover {
    text-decoration: none
}

.ekko-lightbox-nav-overlay a:focus {
    outline: none
}

.ekko-lightbox-nav-overlay a.disabled {
    cursor: default;
    visibility: hidden
}

.ekko-lightbox a:hover {
    opacity: 1;
    text-decoration: none
}

.ekko-lightbox .modal-dialog {
    display: none
}

.ekko-lightbox .modal-footer {
    text-align: center;
    justify-content: center;
}

.ekko-lightbox-loader {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    width: 100%;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
    -ms-flex-pack: center;
    justify-content: center;
    -ms-flex-align: center;
    align-items: center
}

.ekko-lightbox-loader > div {
    width: 40px;
    height: 40px;
    position: relative;
    text-align: center
}

.ekko-lightbox-loader > div > div {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #fff;
    opacity: .6;
    position: absolute;
    top: 0;
    left: 0;
    animation: a 2s infinite ease-in-out
}

.ekko-lightbox-loader > div > div:last-child {
    animation-delay: -1s
}

.modal-dialog .ekko-lightbox-loader > div > div {
    background-color: #333
}

@keyframes a {
    0%, to {
        transform: scale(0);
        -webkit-transform: scale(0)
    }
    50% {
        transform: scale(1);
        -webkit-transform: scale(1)
    }
}

/* On schemas that load bootstrap, .modal-dialog is a 500-600px-wide, 0-height box with a
   transform near the viewport top, so the absolutely-positioned content below centers on the
   dialog's top edge and tall popups clip above the viewport (the modal is overflow:hidden —
   unreachable by scroll). Make the dialog fill the fixed #popupModal on every schema so
   top:50% means the middle of the viewport. */
body #popupModal .modal-dialog {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    transform: none !important;
    /* clicks beside the content must reach #popupModal itself (click-outside-to-close) */
    pointer-events: none;
}

body #popupModal .modal-dialog .modal-content {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    background: #fff;
    color: black;
    padding: 5px 30px 30px 30px;
    text-align: center;
    position:absolute;
    width: max-content;
    max-width: 50%;
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    pointer-events: auto;
    /* the 60px side padding and the 35px top+bottom padding are part of the box the
       width/max-height above cap - without this the box overhangs the viewport by
       ~7px top and bottom and ~10px each side on mobile, clipping title and text */
    box-sizing: border-box;
}

body #popupModal .modal-dialog .modal-content img {
    max-width: 100%;
    /* leave room for the title, paddings and the close button under the image */
    max-height: calc(100vh - 220px);
    max-height: calc(100dvh - 220px);
    object-fit: contain;
    /* block-level imgs (bootstrap .img-responsive) ignore the text-align:center above */
    margin-left: auto;
    margin-right: auto;
}

.modal-dialog .modal-content .modal-header {
    border-bottom: unset;
}