/*!
 * ITCMS lightbox (#879) — additions to GLightbox 3.3.1's "clean" skin (glightbox.min.css, MIT).
 * Scoped to .itcms-lightbox (the dialog the core runtime opens), so a theme's own GLightbox keeps its look.
 * Video tiles (#894): .itcms-lightbox-play and .itcms-lightbox-tile-blank, the same in every theme.
 */
.itcms-lightbox .gslide-image img {
    object-fit: contain;
}

.itcms-lightbox__counter {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 99999;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font: 600 14px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    letter-spacing: .02em;
    pointer-events: none;
}

.itcms-lightbox__counter[hidden] {
    display: none;
}

.itcms-lightbox .gslide-desc {
    font-size: 15px;
    line-height: 1.5;
}

.glightbox-mobile .itcms-lightbox .gslide-desc {
    color: #f1f1f1;
}

/* Phones: the image takes the full width (GLightbox alone never enlarges a smaller image), and
   prev/next stay on screen next to swipe (GLightbox moves them off-screen below 769px). */
@media (max-width: 768px) {
    .itcms-lightbox .gslide-image img {
        width: 100vw;
        max-width: 100vw;
        height: auto;
        max-height: 100vh;
        min-width: 0;
    }

    .itcms-lightbox.glightbox-clean .gprev,
    .itcms-lightbox.glightbox-clean .gnext {
        top: 50%;
        width: 40px;
        height: 56px;
        transform: translateY(-50%);
        background-color: rgba(0, 0, 0, .45);
    }

    .itcms-lightbox.glightbox-clean .gprev {
        left: 6px;
    }

    .itcms-lightbox.glightbox-clean .gnext {
        right: 6px;
    }
}

/* Video slides (#894): GLightbox's inline slide without its white box, the browser's own player inside. */
.itcms-lightbox .gslide-inline {
    background: transparent;
    max-height: none;
    overflow: visible;
}

.itcms-lightbox .gslide-inline .ginlined-content {
    padding: 0;
    overflow: visible;
}

.itcms-lightbox__media {
    position: relative;
    width: min(960px, 100vw);
    max-width: 100%;
    margin: 0 auto;
    background: #000;
}

.itcms-lightbox__media video {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 140px);
    background: #000;
}

.itcms-lightbox__media--embed {
    width: min(960px, 100vw, calc((100vh - 140px) * 16 / 9));
    aspect-ratio: 16 / 9;
}

.itcms-lightbox__media--embed img,
.itcms-lightbox__media--embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}

/* Video tiles in a grid: a play mark over the cover / first frame, a dark tile when there is no picture. */
:where(a[data-itcms-lightbox-type]) {
    position: relative;
}

.itcms-lightbox-play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}

.itcms-lightbox-play svg {
    margin-left: 3px;
}

.itcms-lightbox-tile-blank {
    display: flex;
    align-items: flex-end;
    width: 100%;
    height: 100%;
    min-height: 8rem;
    padding: 12px;
    background: linear-gradient(135deg, #1e293b, #020617);
    color: #fff;
    font: 600 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.itcms-lightbox-tile-blank__title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    padding-right: 4px;
}

/* Defaults a theme's own classes (w-full h-full object-cover…) override: :where() weighs nothing. */
:where(video[data-itcms-lightbox-frame]) {
    display: block;
    width: 100%;
    height: 100%;
    background: #0f172a;
    object-fit: cover;
}
