/* Lightbox Overlay */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    background: transparent;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox-overlay.active .lightbox-content {
    transform: scale(1);
}

.lightbox-image-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    min-width: 200px;
    overflow: hidden;
    background: transparent;
    /* allow vertical page scroll hints but let JS handle horizontal swipe */
    touch-action: pan-y;
}

.lightbox-image {
    max-width: 80vw;
    max-height: 75vh;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    background: transparent;
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: zoom-in;
    transform-origin: center center;
}

.lightbox-image.zoomed {
    transform: scale(2);
    cursor: zoom-out;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    background: none;
    border: none;
    transition: color 0.3s;
}

.lightbox-close:hover {
    color: #D4AF37;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px 2px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 4.5rem;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: all 0.25s ease;
    z-index: 2010;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-nav:hover {
    color: #D4AF37;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

.lightbox-nav.hidden {
    display: none !important;
}

.lightbox-dots {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.lightbox-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: all 0.2s;
}

.lightbox-dot.active {
    background: #D4AF37 !important;
    box-shadow: 0 0 8px #D4AF37;
    transform: scale(1.4);
}

.lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    color: var(--primary-color);
    z-index: 10;
}

@media (max-width: 768px) {
    /* Nav buttons are hidden on mobile — swipe gestures handle navigation */
    .lightbox-nav {
        display: none !important;
    }
    
    /* Extreme specificity to kill any persistent 90% or 80vw desktop rules */
    html body #lightbox.lightbox-overlay.active .lightbox-content {
        width: 100vw !important; 
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        left: 0 !important;
        right: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    html body #lightbox.lightbox-overlay .lightbox-image-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    html body #lightbox.lightbox-overlay .lightbox-image {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 85vh !important;
        object-fit: contain !important;
        border-radius: 0 !important;
        display: block !important;
    }

    .lightbox-close {
        position: fixed !important;
        top: 20px !important;
        right: 20px !important;
        z-index: 2100;
        background: rgba(0, 0, 0, 0.5) !important;
        width: 44px !important;
        height: 44px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 50% !important;
        color: #fff !important;
        font-size: 30px !important;
    }

    .lightbox-dots {
        position: fixed !important;
        bottom: 30px !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        z-index: 2100;
    }
}
