#gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;  /* Consistent spacing between items */
    max-width: 1200px;  /* Limit max width for larger screens */
    margin: 0 auto;
    padding: 20px;
    width: calc(100% - 40px);  /* Account for padding */
}

.gallery-image {
    width: 200px;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s, filter 0.3s, opacity 0.3s;
    opacity: 1;
    margin: 0;  /* Remove margin since we're using gap */
}

/* Mobile styles */
@media screen and (max-width: 768px) {
    .gallery-image {
        width: calc(30vw - 30px);  /* Reduced from 50vw to 30vw */
        height: calc(30vw - 30px);  /* Keep aspect ratio square */
    }
    
    #gallery {
        gap: 15px;  /* Slightly reduced gap for mobile */
        padding: 15px;  /* Slightly reduced padding for mobile */
        width: calc(100% - 30px);  /* Account for new padding */
    }
}

/* Small mobile styles */
@media screen and (max-width: 480px) {
    .gallery-image {
        width: calc(75vw - 30px);  /* Reduced from 100vw to 75vw */
        height: calc(75vw - 30px);  /* Keep aspect ratio square */
    }
}

.gallery-image.loading {
    filter: blur(5px);
    opacity: 0.6;
}

.gallery-image:hover {
    transform: scale(1.05);
}

/* Add this to ensure the body doesn't add unwanted margins */
body {
    margin: 0;
    padding: 0;
    background-color: black;
    font-family: "Times New Roman", Times, serif;
}

/* Popup styles */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1002;  /* Higher than header's 1001 */
    cursor: pointer;
}

.popup-image {
    position: fixed;
    top: 50%;  /* Adjusted back to center since no caption */
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90vh;  /* Increased since no caption */
    object-fit: contain;
}

/* Commented out but preserved for future use
.popup-caption {
    position: fixed;
    top: calc(45% + 43vh);
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-family: "Times New Roman", Times, serif;
    font-size: 1.2rem;
    text-align: center;
    padding: 10px;
}
*/

.gallery-title {
    color: white;
    text-align: center;
    font-size: 2rem;
    font-family: "Times New Roman", Times, serif;
    padding: 20px 0 10px 0;  /* Reduced bottom padding */
    margin: 0;
}

.gallery-subtitle {
    color: white;
    text-align: center;
    font-size: 1.2rem;
    font-family: "Times New Roman", Times, serif;
    margin: 0;
    padding-bottom: 20px;
}

header {
    width: 100%;
    display: flex;
    flex-direction: column;  /* Stack title and subtitle vertically */
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
    margin: 0.5rem 0;
    position: relative;
    z-index: 1001;
}
