.gallery-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    background: transparent;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Fixed number of columns */
    grid-auto-rows: 200px; /* Set a base row height */
    gap: 20px; /* Consistent gaps between images */
}

.gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease-in-out, opacity 1s ease-in-out;
    opacity: 0;
}

.gallery img:hover {
    transform: scale(1.1);
    cursor: pointer;

}

.gallery img.loaded {
    opacity: 1;
}

.gallery img.portrait {
    grid-row: span 2; /* Portrait images span 2 rows */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 1000px) {
    .gallery {
        grid-template-columns: repeat(3, 1fr); /* Adjust columns for smaller screens */
    }
}

@media (max-width: 600px) {
    .gallery-container {
        width: 95%;
        padding: 5px;
    }

    .gallery {
        grid-template-columns: repeat(2, 1fr); /* Adjust columns for mobile screens */
        grid-auto-rows: 150px; /* Adjust base row height for mobile */
        gap: 10px; /* Reduce gap on mobile */
    }
}

/* Lightbox styles */
#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

#lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    transform: scale(0.9);
    transition: transform 0.3s ease-in-out;
}

#lightbox.active .lightbox-content img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    font-size: 40px;
    color: white;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
    font-weight: 300;
    line-height: 1;
}

.lightbox-close:hover {
    color: #ccc;
}

/* Mobile-specific lightbox adjustments */
@media (max-width: 768px) {
    #lightbox {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .lightbox-content {
        max-width: 95%;
        max-height: 95%;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .lightbox-content img {
        max-height: 85vh;
        max-width: 90vw;
    }

    .lightbox-close {
        position: fixed;
        top: 10px;
        right: 10px;
        font-size: 50px;
        background-color: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        z-index: 10000;
    }
}
