/* ── Fullscreen Lightbox Gallery ── */

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y;
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Top bar */
.gallery-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: #fff;
    flex-shrink: 0;
    z-index: 2;
}

.gallery-counter {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
}

.gallery-close {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.gallery-close:hover,
.gallery-close:active {
    background: rgba(255, 255, 255, 0.25);
}

/* Image viewport */
.gallery-viewport {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

.gallery-slide-track {
    display: flex;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.gallery-slide-track.dragging {
    transition: none;
}

.gallery-slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
}

.gallery-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    pointer-events: none;
}

/* Nav arrows (hidden on mobile, visible on desktop) */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    z-index: 3;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.gallery-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.gallery-nav.prev { left: 16px; }
.gallery-nav.next { right: 16px; }

/* Thumbnail strip */
.gallery-thumbs {
    display: flex;
    gap: 6px;
    padding: 10px 16px 16px;
    overflow-x: auto;
    justify-content: center;
    flex-shrink: 0;
    z-index: 2;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.gallery-thumbs::-webkit-scrollbar {
    display: none;
}

.gallery-thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.gallery-thumb.active {
    opacity: 1;
    border-color: #3b82f6;
}

.gallery-thumb:hover {
    opacity: 0.8;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Swipe hint (shown briefly on first open on mobile) */
.gallery-swipe-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: gallery-hint-fade 2.5s ease forwards;
    pointer-events: none;
}

@keyframes gallery-hint-fade {
    0%, 60% { opacity: 1; }
    100% { opacity: 0; }
}

/* Desktop: show arrows, bigger thumbs */
@media (min-width: 768px) {
    .gallery-nav {
        display: flex;
    }

    .gallery-thumb {
        width: 64px;
        height: 64px;
    }

    .gallery-topbar {
        padding: 16px 24px;
    }

    .gallery-thumbs {
        padding: 12px 24px 20px;
        gap: 8px;
    }
}

/* Zoom indicator */
.gallery-zoom-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    pointer-events: none;
}
