/*
 * Sapp Media — Lightbox
 * Accessible modal lightbox for images and galleries.
 * No transitions when prefers-reduced-motion is set.
 */

/* ------------------------------------------------------------------ */
/* Body lock when open                                                   */
/* ------------------------------------------------------------------ */
body.slb-body-open {
    overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Modal backdrop + dialog                                               */
/* ------------------------------------------------------------------ */
#sapp-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    align-items: center;
    justify-content: center;
}

#sapp-lightbox.slb-open {
    display: flex;
}

.slb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
}

.slb-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 95vw;
    max-height: 95vh;
    width: 100%;
}

/* ------------------------------------------------------------------ */
/* Image                                                                 */
/* ------------------------------------------------------------------ */
.slb-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
}

.slb-img {
    display: block;
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 2px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#sapp-lightbox.slb-animate .slb-img {
    animation: slb-fadein 0.2s ease forwards;
}

@keyframes slb-fadein {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    #sapp-lightbox.slb-animate .slb-img {
        animation: none;
    }
}

/* ------------------------------------------------------------------ */
/* Caption / counter                                                     */
/* ------------------------------------------------------------------ */
.slb-caption {
    color: #fff;
    font-size: 0.9rem;
    margin-top: 0.6rem;
    text-align: center;
    max-width: 80vw;
}

.slb-counter {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    margin-top: 0.3rem;
    text-align: center;
    min-height: 1.2em;
}

/* ------------------------------------------------------------------ */
/* Buttons — close, prev, next                                           */
/* ------------------------------------------------------------------ */
.slb-close,
.slb-prev,
.slb-next {
    position: absolute;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    z-index: 2;
}

.slb-close:hover,
.slb-prev:hover,
.slb-next:hover {
    background: rgba(0, 0, 0, 0.8);
}

.slb-close:focus-visible,
.slb-prev:focus-visible,
.slb-next:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.slb-close {
    top: -1rem;
    right: -1rem;
}

.slb-prev {
    left: -3.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.slb-next {
    right: -3.5rem;
    top: 50%;
    transform: translateY(-50%);
}

@media (prefers-reduced-motion: reduce) {
    .slb-close,
    .slb-prev,
    .slb-next {
        transition: none;
    }
}

/* Mobile: stack buttons below image */
@media (max-width: 600px) {
    .slb-prev,
    .slb-next {
        top: auto;
        bottom: -3.5rem;
        transform: none;
    }
    .slb-prev { left: calc(50% - 3rem); }
    .slb-next { right: calc(50% - 3rem); }
    .slb-close { top: -0.5rem; right: -0.5rem; }
}
