/*
|--------------------------------------------------------------------------
| The Glebe gallery lightbox
|--------------------------------------------------------------------------
| Path: themes/glebe-stoke/assets/css/glebe-gallery-lightbox.css
| Works with: themes/glebe-stoke/assets/js/glebe-gallery-lightbox.js
*/

.glebe-gallery-page .glebe-masonry a,
.glebe-gallery-page .glebe-gallery-item {
    cursor: zoom-in;
}

.glebe-gallery-page .glebe-masonry img {
    display: block;
    width: 100%;
    transition: transform .28s ease, filter .28s ease, opacity .28s ease;
}

.glebe-gallery-page .glebe-masonry a:hover img,
.glebe-gallery-page .glebe-gallery-item:focus-visible img {
    transform: scale(1.025);
    filter: brightness(1.06);
}

.glebe-gallery-page .glebe-gallery-item:focus-visible {
    outline: 3px solid rgba(214, 178, 106, .92);
    outline-offset: 5px;
    border-radius: 18px;
}

html.glebe-lightbox-open,
html.glebe-lightbox-open body {
    overflow: hidden;
}

.glebe-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: clamp(14px, 2vw, 28px);
    color: #fff;
    background:
        radial-gradient(circle at 50% 18%, rgba(210, 170, 96, .13), transparent 34rem),
        rgba(5, 5, 4, .92);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
}

.glebe-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.glebe-lightbox__topbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-height: 48px;
}

.glebe-lightbox__button {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    width: 46px;
    height: 46px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    background: rgba(255, 255, 255, .09);
    backdrop-filter: blur(12px);
    cursor: pointer;
    font: inherit;
    line-height: 1;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.glebe-lightbox__button:hover,
.glebe-lightbox__button:focus-visible {
    transform: translateY(-1px);
    background: rgba(214, 178, 106, .22);
    border-color: rgba(214, 178, 106, .7);
    outline: none;
}

.glebe-lightbox__button svg {
    width: 22px;
    height: 22px;
    pointer-events: none;
}

.glebe-lightbox__stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
}

.glebe-lightbox__figure {
    margin: 0;
    width: min(1200px, 100%);
    height: min(78vh, 820px);
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    justify-items: center;
    gap: 16px;
}

.glebe-lightbox__image-wrap {
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

.glebe-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: clamp(14px, 1.4vw, 26px);
    box-shadow: 0 26px 90px rgba(0, 0, 0, .55);
    background: rgba(255, 255, 255, .04);
    user-select: none;
}

.glebe-lightbox__caption {
    max-width: min(760px, 92vw);
    color: rgba(255, 255, 255, .82);
    font-size: clamp(.9rem, 1.15vw, 1rem);
    text-align: center;
}

.glebe-lightbox__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
}

.glebe-lightbox__nav--prev {
    left: 0;
}

.glebe-lightbox__nav--next {
    right: 0;
}

.glebe-lightbox__counter {
    padding: 10px 12px 2px;
    color: rgba(255, 255, 255, .68);
    font-size: .85rem;
    text-align: center;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.glebe-lightbox__hint {
    color: rgba(255, 255, 255, .48);
    font-size: .78rem;
    text-align: center;
}

@media (max-width: 767.98px) {
    .glebe-lightbox {
        padding: 10px;
    }

    .glebe-lightbox__topbar {
        min-height: 42px;
    }

    .glebe-lightbox__button {
        width: 42px;
        height: 42px;
    }

    .glebe-lightbox__nav {
        top: auto;
        bottom: 58px;
        transform: none;
    }

    .glebe-lightbox__nav--prev {
        left: 14px;
    }

    .glebe-lightbox__nav--next {
        right: 14px;
    }

    .glebe-lightbox__figure {
        height: min(72vh, 700px);
        gap: 12px;
    }

    .glebe-lightbox__image {
        border-radius: 16px;
    }

    .glebe-lightbox__hint {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .glebe-lightbox,
    .glebe-gallery-page .glebe-masonry img,
    .glebe-lightbox__button {
        transition: none;
    }
}
