/* css/media-lightbox.css
   Full-screen image/video lightbox for galleries (shows, and future band/release galleries).
   Reuses the site's dark palette: #161C1D bg, #2a3133 panels, #EDC78A / #F5C56C accent. */

body.media-lightbox-locked {
    overflow: hidden;
}

.media-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 15, 0.92);
    padding: 2.5rem;
    /* dvh tracks the mobile browser's collapsing address bar */
    height: 100vh;
    height: 100dvh;
}

.media-lightbox-overlay.is-open {
    display: flex;
}

/* A caption (text, credit, link) takes up to three lines under the photo; leave room so it never covers it. */
.media-lightbox-overlay.has-caption {
    padding-bottom: 7.5rem;
}

.media-lightbox-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
    /* all gestures (pan, pinch, swipe) are handled in media-lightbox.js */
    touch-action: none;
}

.media-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.6);
    cursor: zoom-in;
    transition: transform 0.25s ease, opacity 0.2s ease;
    transform-origin: center center;
    -webkit-user-drag: none;
    user-select: none;
}

.media-lightbox-img.is-zoomed {
    cursor: zoom-out;
}

/* No easing while a finger is driving the transform. */
.media-lightbox-img.is-gesturing {
    transition: none;
}

.media-lightbox-caption {
    position: absolute;
    left: 50%;
    bottom: 3.25rem;
    transform: translateX(-50%);
    width: min(90%, 40rem);
    max-height: 7.5em;
    overflow-y: auto;
    text-align: center;
    color: #E8E8E8;
    font-size: 0.9rem;
    line-height: 1.4;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    z-index: 2001;
}

.media-lightbox-overlay.is-single .media-lightbox-nav,
.media-lightbox-overlay.is-single .media-lightbox-counter {
    display: none;
}

.media-lightbox-caption[hidden] {
    display: none;
}

.media-lightbox-caption-credit {
    font-size: 0.8rem;
    color: #B8B8B8;
}

.media-lightbox-caption-link a {
    font-size: 0.8rem;
    color: #EDC78A;
    text-decoration: underline;
}

.media-lightbox-overlay.is-loading .media-lightbox-counter::after {
    content: ' \2026';
}

.media-lightbox-video-wrapper {
    position: relative;
    width: min(100%, 960px);
    aspect-ratio: 16 / 9;
}

.media-lightbox-video-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

.media-lightbox-close,
.media-lightbox-nav {
    position: absolute;
    background: #2a3133;
    color: #E8E8E8;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    z-index: 2001;
}

.media-lightbox-close:hover,
.media-lightbox-nav:hover {
    background: #EDC78A;
    color: #161C1D;
}

.media-lightbox-close {
    top: 1rem;
    right: 1rem;
}

.media-lightbox-nav.prev {
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.media-lightbox-nav.next {
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.media-lightbox-nav:disabled {
    background: #161C1D;
    color: #2a3133;
    cursor: not-allowed;
}

.media-lightbox-counter {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(42, 49, 51, 0.85);
    color: #E8E8E8;
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    z-index: 2001;
}

/* Phones: controls move out of the image area into a bottom bar so they never
   cover the picture, and respect notches / home indicators. */
@media (max-width: 768px) {
    .media-lightbox-overlay {
        padding: calc(env(safe-area-inset-top, 0px) + 3.5rem) 0.5rem
                 calc(env(safe-area-inset-bottom, 0px) + 4.5rem);
    }

    .media-lightbox-close {
        top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
        right: 0.5rem;
        width: 48px;
        height: 48px;
    }

    .media-lightbox-overlay .media-lightbox-nav {
        width: 48px;
        height: 48px;
        top: auto;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 0.5rem);
        transform: none;
    }

    .media-lightbox-overlay .media-lightbox-nav.prev { left: 0.75rem; }
    .media-lightbox-overlay .media-lightbox-nav.next { right: 0.75rem; }

    .media-lightbox-counter {
        bottom: calc(env(safe-area-inset-bottom, 0px) + 1.1rem);
    }

    .media-lightbox-overlay.has-caption {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8rem);
    }

    .media-lightbox-caption {
        bottom: calc(env(safe-area-inset-bottom, 0px) + 4rem);
        max-height: 4.5em;
    }
}

@media (prefers-reduced-motion: reduce) {
    .media-lightbox-img {
        transition: none;
    }
}
