.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    grid-auto-rows: auto;
    gap: 20px;
    justify-items: center;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/*
.gallery li {
    position: relative;
    overflow: hidden;
    margin: 0;
    list-style: none;
    transition: transform 0.3s ease-in-out;
    border-radius: 8px;  Gives a smooth corner to gallery items 
    overflow: hidden;
    justify-content: center;
    align-items: center;
}
*/

.gallery li {
    width: 240px; /* Set a fixed square size */
    height: 240px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: 8px;
}

/* Styles for images within the gallery */
.gallery li img {
    display: block;
    width: 100%;
    height: 100%; /* Maintain aspect ratio */
    transition: transform 0.3s ease;
    object-fit: cover; /* Ensures full coverage of the grid item */
    border-radius: inherit;
}

/* Classes to determine special positioning based on aspect ratio 
.gallery li.wide {
    grid-column-end: span 2; /* Span twice the space horizontally */
}

/*
.gallery li.normal {
    grid-column: span 1;
    grid-row: span 1;
}
*/

/* Hover effects to bring interactivity */
.gallery li:hover {
    transform: scale(1.05);
    z-index: 1; /* Bring the hovered item to the top */
}

.gallery li img:hover {
    transform: scale(1.1);
}

/* Modal styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Semi-transparent background */
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal img {
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    animation: fadeIn 0.3s;
}

.modal .close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    color: white;
    cursor: pointer;
    font-weight: bold;
}

/* Animation for modal fade-in */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
