/* =========================================================
   SL Lightbox
   Vanilla CSS lightbox for gallery images and comment photos.
   ========================================================= */

/* Overlay */
.sl-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

/* Inner container */
.sl-lightbox__inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 60px 70px;
    box-sizing: border-box;
}

/* Image */
.sl-lightbox__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    transform: scale(0.95);
    transition: transform 0.25s ease, opacity 0.2s ease;
    opacity: 0;
    user-select: none;
    display: block;
}

.sl-lightbox.is-open .sl-lightbox__img {
    transform: scale(1);
    opacity: 1;
}

.sl-lightbox__img.is-loading {
    opacity: 0;
    transform: scale(0.95);
}

/* Caption */
.sl-lightbox__caption {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 20px;
    white-space: nowrap;
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* Counter */
.sl-lightbox__counter {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    pointer-events: none;
}

/* Buttons base */
.sl-lightbox__btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.sl-lightbox__btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.08);
}

.sl-lightbox__btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Close button */
.sl-lightbox__close {
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
}

/* Prev / Next */
.sl-lightbox__prev,
.sl-lightbox__next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
}

.sl-lightbox__prev:hover,
.sl-lightbox__next:hover {
    transform: translateY(-50%) scale(1.08);
}

.sl-lightbox__prev {
    left: 14px;
}

.sl-lightbox__next {
    right: 14px;
}

/* Hidden when single image */
.sl-lightbox--single .sl-lightbox__prev,
.sl-lightbox--single .sl-lightbox__next,
.sl-lightbox--single .sl-lightbox__counter {
    display: none;
}

/* Spinner while loading */
.sl-lightbox__spinner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sl-spin 0.7s linear infinite;
}

@keyframes sl-spin {
    to { transform: rotate(360deg); }
}

/* Thumbnails strip (optional, shown only when > 1 image) */
.sl-lightbox__thumbs {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    max-width: calc(100vw - 120px);
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px;
}

.sl-lightbox__thumbs::-webkit-scrollbar {
    display: none;
}

.sl-lightbox__thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.sl-lightbox__thumb.is-active,
.sl-lightbox__thumb:hover {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.8);
}

/* Comment images get a lightbox cursor cue */
.sl-comment-images a,
.gallery-link {
    cursor: zoom-in;
}

/* Responsive */
@media (max-width: 640px) {
    .sl-lightbox__inner {
        padding: 50px 44px;
    }

    .sl-lightbox__prev {
        left: 6px;
    }

    .sl-lightbox__next {
        right: 6px;
    }

    .sl-lightbox__prev,
    .sl-lightbox__next {
        width: 38px;
        height: 38px;
    }

    .sl-lightbox__thumb {
        width: 38px;
        height: 38px;
    }
}
