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

body {
    font-family: Arial, sans-serif;
    background: #111;
    padding: 20px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, 50vh);
    gap: 10px;
    margin: 0 auto;
    overflow-y: auto;
    justify-content: center;
}

.image-wrapper {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    background: #222;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 50vh;
    aspect-ratio: 1/1;
    width: 50vh;
}

.image-wrapper.active {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    height: 75vh;
    width: 75vh;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    transition: transform 0.3s ease, height 0.3s ease, width 0.3s ease;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 50;
}

.overlay.active {
    display: block;
}

.image-wrapper img, .image-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease, filter 0.5s ease;
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
}

/* mobile styles under 700px should make the grid responsive in width but still maintain the aspect ratio */
@media (max-width: 700px) {
    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 20px;
    }
    .image-wrapper {
        width: 100%;
        height: auto;
        aspect-ratio: 1/1;
    }
}