.hide-image {
    opacity: 0;
    position: absolute;
    height: 0;
    width: 0;
}

.opacity-0 {
    opacity: 0;
}

.gallery-overlay {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    background-color: rgba(0,0,0,0.5);
    transition: .5s ease-in-out all;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}
.gallery-overlay.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

#gallery {
    display: grid;
    /*grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));*/
    grid-auto-rows: 350px;
    grid-auto-flow: row dense;
    overflow: hidden;
    margin: 0 auto;
}

#gallery figure {
    position: relative;
    color: rgba(255, 255, 255, 0.7);
    font-size: 2rem;
    font-family: sans-serif;
    margin: 0;
    background-size: cover;
    background-position: center;
}
#gallery figure figcaption {
    height: 100%;
    background: linear-gradient(0deg, rgba(0,0,0,0.7287115529805672) 43%, rgba(0,0,0,0.31974796754639356) 100%);
    color: white;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 0;
    cursor: pointer;
    transition: .3s ease-in-out;
}
#gallery figure:hover figcaption {
    opacity: 1;
}
#gallery figure figcaption small {
    font-size: 12px;
    padding-top: 5px;
}


.tall {
    grid-column: span 1;
    grid-row: span 2;
}

.wide {
    grid-row: span 1;
    grid-column: span 2;
}

.square {
    grid-row: span 1;
    grid-column: span 1;
}

.gallery-modal {

}

.close-gallery-modal {
    color: white;
    position: absolute;
    right: 15px;
    top: 11px;
    font-size: 28px;
    transition: .2s ease-in-out;
    text-shadow: 1px 1px 6px black;
}
.close-gallery-modal:hover {
    color: white;
    opacity: .7;
}

.gallery-modal .modal-content {
    width: fit-content;
    padding: 0;
    background-color: unset;
    border: unset;
    transition: .2s ease-in-out;
}
#picture-replace {
    border-radius: 1em;
    max-height: 80vh;
    display: block;
    object-fit: cover;
    width: 100%;
}

.previous, .next {
    position: absolute;
    color: var(--primary);
    font-size: 50px;
    cursor: pointer;
}
.previous {
    left: -50px;
    top: 50%;
}
.next {
    right: -50px;
    top: 50%;
}

@media screen and (max-width: 900px) {
    .gallery-modal .modal-content {
        width: 80%;
    }
}

@media (max-width: 600px) {
    #gallery {
        grid-template-columns: 1fr;
    }

    .wide {
        grid-column: span 1;
    }
    .previous {
        left: -18px;
    }
    .next {
        right: -18px;
    }
}


@media screen and (max-width: 600px) and (orientation: landscape) {
    #gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    .previous {
        left: -50px;
    }
    .next {
        right: -50px;
    }
}
