* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align items to the top instead of center */
    height: 100vh;
    background-color: black;
}

.container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Default: 4 images per row on desktop */
    gap: 10px;
    width: 80vw;
    padding-top: 20px; /* Add a small top padding */
}

.square {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* Maintain square aspect ratio */
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: transform 0.5s ease-in-out;
}

.square:hover {
    transform: scale(1.1);
}

/* Overlay for zooming */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.overlay-img {
    max-width: 90%;
    max-height: 90%;
    transition: transform 0.3s ease;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

/* Media Query for Tablets (3 images per row) */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: repeat(3, 1fr); /* 3 images per row */
    }
}

/* Media Query for Mobile Devices (2 images per row) */
@media (max-width: 600px) {
    body {
        justify-content: flex-start; /* Align items to the top on mobile */
        height: auto; /* Let content determine the height */
    }

    .container {
        grid-template-columns: repeat(2, 1fr); /* 2 images per row */
        width: 100vw; /* Use the full width of the viewport */
        padding-top: 10px; /* Reduce the top padding */
    }
}
