﻿/* Lightbox */
.gallery-grid .gallery-item {
    cursor: zoom-in;
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 15px;
    break-inside: avoid;
    transition: transform 0.3s ease;
}
.gallery-grid .gallery-item:hover { transform: scale(1.02); }
.gallery-grid .gallery-item img {
    width: 100%; height: auto; display: block;
    border-radius: 4px; margin-bottom: 0;
}

#lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    cursor: zoom-out;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
#lightbox-overlay.active { display: flex; }
#lightbox-overlay img {
    max-width: min(92vw, 1400px);
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.8);
    transition: opacity 0.25s ease;
    cursor: default;
}
#lightbox-overlay.loading img { opacity: 0; }

#lightbox-close {
    position: fixed; top: 1.25rem; right: 1.5rem;
    color: #fff; font-size: 1.5rem; cursor: pointer;
    background: rgba(255,255,255,0.15); border: none;
    width: 2.5rem; height: 2.5rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s; z-index: 10000;
}
#lightbox-close:hover { background: rgba(255,255,255,0.28); }

#lightbox-prev, #lightbox-next {
    position: fixed; top: 50%; transform: translateY(-50%);
    color: #fff; font-size: 2rem; cursor: pointer;
    background: rgba(255,255,255,0.12); border: none;
    width: 3rem; height: 3rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s; z-index: 10000; user-select: none;
}
#lightbox-prev { left: 1.25rem; }
#lightbox-next { right: 1.25rem; }
#lightbox-prev:hover, #lightbox-next:hover { background: rgba(255,255,255,0.28); }

#lightbox-spinner {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none; z-index: 10001;
}
#lightbox-spinner .spinner-ring {
    width: 48px; height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #fff; border-radius: 50%;
    animation: lb-spin 0.75s linear infinite;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }
#lightbox-overlay:not(.loading) #lightbox-spinner { display: none; }

@media (max-width: 600px) {
    #lightbox-prev { left: 0.5rem; }
    #lightbox-next { right: 0.5rem; }
    #lightbox-close { top: 0.75rem; right: 0.75rem; }
}