#gallery-container {
    width: 100%;
    height: fit-content;
    min-height: 500px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-rows: 250px;
    gap: 20px;
    grid-auto-flow: dense;
    justify-content: center;
    align-content: center;
}

#gallery-container > img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
}

.modal {
    position: fixed;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

.modalInner {
    border-radius: 4px;
    background-color: transparent;
    transform: translateY(-100vh);
    transition: all 0.5s;
    width: 100%;
    max-width: 1200px;
    height: calc(100vh - 200px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: black;
    margin: 2rem;
}

.modalInner button {
    z-index: 2;
    background: none;
    border: none;
    font-size: 4rem; 
    max-width: 50px;
    min-height: 70px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, .7);
    cursor: pointer;
    border-radius: .25rem;
    padding: 0 .5rem;
    background-color: #87A4C760;
    transition: 0.5s;
}

.modal span {
    z-index: 100;
    position: absolute;
    top: 0;
    right: 0;
    font-size: 2rem; 
    cursor: pointer;
    color: rgba(255, 255, 255, .7);
    padding: 0.5em;
    background-color: #87A4C760;
    text-align: center;
}

.prev {
    grid-area: prev;
}

.next {
    grid-area: next;
}
  
.modalInner button:hover,
.modalInner button:focus {
    color: white;
    background-color: #87A4C7;
}

.modal img {
    height: 100%;
    width: 80%;
    max-width: 900px;
    object-fit: contain;
    grid-area: image;
}

.modal.open {
    opacity: 1;
    pointer-events: all;
}

.modal.open .modalInner {
    transform: translateY(0);
}

@media (max-width: 780px) {
    .modalInner button {
        font-size: 3rem;
    }
}

@media (max-width: 600px) {
    .modalInner button {
        font-size: 2rem;
    }
}

@media (max-width: 400px) {
    .modalInner button {
        font-size: 1rem;
    }
}