.thumbnail-gallery {
    display: flex;
    /* Allows easy alignment and wrapping */
    flex-wrap: wrap;
    /* Thumbnails will wrap to the next line if not enough space */
    gap: 15px;
    /* Space between thumbnails */
    justify-content: center;
    /* Center thumbnails in the container */
    padding: 10px;
}

.thumbnail {
    width: 300px;
    /* Or your desired thumbnail width */
    height: 212px;
    /* Or your desired thumbnail height */
    object-fit: cover;
    /* Ensures image covers the area, cropping if necessary */
    padding: 3px;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Lightbox Styles */
#lightbox-overlay {
    position: fixed;
    /* Stay in place during scroll */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    /* Semi-transparent black background */
    z-index: 999999999;
    /* Ensure it's on top of other content */

    display: flex;
    /* Use flexbox to center the image */
    align-items: center;
    justify-content: center;

    opacity: 0;
    /* Start fully transparent for fade-in effect */
    visibility: hidden;
    /* Start hidden for accessibility and performance */
    transition: opacity 0.3s ease-in-out, visibility 0s linear 0.3s;
    /* Smooth fade */
}

#lightbox-overlay.lightbox-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease-in-out, visibility 0s linear 0s;
}


#lightbox-image {
    max-width: 90%;
    /* Max width relative to viewport */
    max-height: 90%;
    /* Max height relative to viewport */
    border: 3px solid white;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    /* Ensure entire image is visible without cropping */
}

#lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 35px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

#lightbox-close:hover {
    color: #bbb;
}

/* Helper class for hiding/showing lightbox (alternative to direct style manipulation) */
.lightbox-hidden {
    /* These styles are already applied to #lightbox-overlay by default,
       but explicitly defining them for the hidden state can be clearer.
       The key is opacity and visibility. */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0s linear 0.3s;
}