.container {
    width: 90%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(7, 1fr); /* 7 images per row */
    gap: 10px; /* Spacing between images */
}

/* Medium devices (e.g., tablets, 768px to 1024px) */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: repeat(5, 1fr); /* 5 images per row */
        gap: 8px; /* Spacing between images */
    }
}

/* Small devices (e.g., phones, less than 768px) */
@media (max-width: 768px) {
    .container {
        grid-template-columns: repeat(2, 1fr); /* 2 images per row */
        gap: 4px; /* Spacing between images */
    }
}

.image-box {
    width: 100%;
    padding-top: 100%; /* Maintain square aspect ratio */
    background-size: cover; /* Cover the box */
    background-position: center;
    background-repeat: no-repeat; /* Prevent repeating */
    border-radius: 5px; /* Optional rounded corners */
    cursor: pointer;
    transition: opacity 0.3s ease; /* Smooth hover effect */
}

.image-box:hover {
    opacity: 0.9;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8); /* Semi-transparent black background */
    display: flex;
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    opacity: 0; /* Hidden initially */
    visibility: hidden; /* Prevent interaction when hidden */
    transition: opacity 0.3s ease, visibility 0.3s ease; /* Smooth fade-in/out */
    z-index: 1000;
}

.modal.active {
    visibility: visible;
    opacity: 1; /* Fully visible */
}

.modal img {
    max-width: 90vw; /* Fit image within 90% of the viewport width */
    max-height: 90vh; /* Fit image within 90% of the viewport height */
    object-fit: contain; /* Maintain aspect ratio without cropping */
    display: block;
    margin: auto; /* Ensure the image stays centered */
}

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

.modal-close:hover {
    color: red;
}