.gallery {
    display: grid;
    max-width: 100%;
    margin: 20px;
    grid-template-columns: repeat(auto-fit, 300px);
    /* grid-template-rows: minmax(310px 310px); */
    grid-auto-flow: dense;
    column-gap: 20px;
    row-gap: 20px;
    justify-content: space-evenly;
    align-content: start;
    justify-items: center;
    align-items: center;
    user-select: none;
}

.gallery img {
    max-width: 300px;
    border-radius: 3px;
    cursor: pointer;
    /* transform: scale(0, 0); */
    transition: transform 0.2s ease-in-out;
}

.gallery img:hover {
    transform: scale(1.08);
}

#imagedisplaydiv {
    position: fixed;
    z-index: 402;
    display: none;
    width: 100vw;
    height: 100vh;
    grid-template-columns: 90px 1fr 1fr 90px;
    grid-template-rows: 90px 1fr 32px;
    grid-template-areas: 'title title title close' 'nav1 pic pic nav2' 'sub sub sub sub';
    justify-items: center;
    align-items: center;
    overflow: hidden;
    transition: ease-out 0.5s;
    background-size: cover;
    background-position: center;
    /* filter: blur(10px); */
    --interface: #1d1d1d77;
    animation: fade-enter-image 1.0s 1;
}

#imagedisplaydiv h3, #imagedisplaydiv h2 {
    margin: 0px;
}

#imagedisplaydiv .subleft {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    align-items: center;
    /* position: relative; */
    width: 95%;
    z-index: 404;
    /* top: 50px; */
    text-align: left;
    grid-area: sub;
    /* justify-self: left; */
    /* align-self: flex-end; */
    /* margin-left: 0px;
    margin-bottom: 0px; */
    padding: 5px 2.5%;
    background-color: #000000BB;
    border-radius: 0px;
    backdrop-filter: blur(5px);
}

#imagedisplaydiv .subleft h2, #imagedisplaydiv .subleft h3 {
    margin-left: 20px;
    margin-bottom: 5px;
}

#imagedisplaydiv .subleft h3:last-child, #imagedisplaydiv .subleft h3:nth-child(2) {
    justify-self: end;
    margin-right: 20px;
}

/* #imagedisplaydiv a {
    width: 100vw;
    height: 100vh;
    display: block;
    position: fixed;
    background-color: #00000088;
    z-index: 400;
} */

#imagedisplaydiv .gallerybutton {
    width: 60px;
    height: 60px;
    display: grid;
    justify-items: center;
    align-items: center;
    background: var(--interface);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(5px);
}

#imagedisplaydiv .gallerybutton img {
    width: 60px;
}

#imagedisplaydiv #closea {
    grid-area: close;
    height: 60px;
    width: 60px;
    z-index: 405;
}

#imagedisplaydiv .gallerynav {
    z-index: 404;
}

#imagedisplaydiv #prevbtn {
    /* left: 0px; */
    grid-area: nav1;
}

#imagedisplaydiv #nextbtn {
    /* right: 0px; */
    grid-area: nav2;
}

#imagedisplaydiv #nextbtn img {
    transform: rotate(180deg);
}

#imagedisplaycontainer {
    /* grid-area: pic; */
    z-index: 403;
    position: fixed;
    top: 0px;
    left: 0px;
    overflow: auto;
    /* padding-bottom: 32px; */
    /* margin-bottom: 32px; */
    width: 100vw;
    height: 100vh;
    /* height: 100%; */
    /* height: calc(100vh - 32px); */
    max-width: 100vw;
    /* max-width: calc(100vw - 180px); */
    /* max-height: calc(100vh - 32px); */
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    display: grid;
    justify-items: center;
    /* align-items: center; */
    -webkit-backdrop-filter: blur(20px) brightness(40%);
    backdrop-filter: blur(20px) brightness(40%);
}

#imagedisplaycontainer::-webkit-scrollbar {
    display: none;
}

#imagedisplay {
    /* grid-area: pic; */
    max-width: 100vw;
    /* max-height: 100vh; */
    max-height: calc(100vh - 40px);
    /* max-width: calc(100vw - 180px); */
    /* max-height: calc(100vh - 220px); */
    /* position: fixed; */
    /* top: 50%; */
    /* left: 50%; */
    /* transform: translate(-50%, -50%); */
    border-radius: 3px;
    box-shadow: 0px 0px 25px 5px #000000FF;
    background-image: url(/img/loader.gif);
    background-repeat: no-repeat;
    background-position: center;
    animation: wipe-enter-image 0.6s 1;
    /* animation: fade-enter-image 1.8s 1; */
}

.filterbuttons {
    padding: 10px;
}

.filter {
    display: grid;
    /* width: 90vw; */
    grid-template-columns: repeat(auto-fit, minmax(80px, auto));
    justify-content: center;
    padding: 10px;
    gap: 10px;
    user-select: none;
}

.filter a {
    display: grid;
    color: #8493A8;
    text-align: center;
    padding: 5.5px 20px;
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
    border: solid;
    border-width: 2px;
    border-radius: 20px;
    border-color: #8493A8;
    justify-content: center;
    align-content: center;
}

.filter a:hover:not(.selected) {
    border-color: var(--accentcolor);
    background-color: var(--accentcolor);
    color: var(--frontcolor);
}

.filter a.selected {
    border-color: var(--accentcolor);
    color: var(--accentcolor);
}

.filter #clearbtn {
    border-color: var(--redcolor2);
    color: var(--redcolor2);
}

.filter #clearbtn:hover {
    border-color: var(--redcolor2);
    background-color: var(--redcolor2);
    color: var(--frontcolor);
}

@keyframes wipe-enter-imagex {
	0% {
		transform: scale(0, .025);
	}
	50% {
		transform: scale(1, .025);
	}
}

@keyframes wipe-enter-image {
	0% {
		transform: scale(.95, .95);
	}
}

@keyframes fade-enter-image {
	0% {
		opacity: 0;
	}
	100% {
		opacity: 1;
	}
}


/*-----Mobile-----*/

@media only screen and (max-width: 768px) {
    
    .gallery {
        /* max-width: 80vw !important; */
        grid-template-columns: repeat(auto-fit, 100%);
    }

    .gallery img {
        max-width: 200px;
        transition: none;
    }
    
    .gallery img:hover {
        transform: none;
    }
    
    #imagedisplaydiv {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: 1fr auto;
        grid-template-areas: 'pic pic pic' 'nav1 close nav2';
        justify-items: center;
        align-items: center;
        /* padding: 10px; */
        width: 100vw;
        height: 100vh;
        overflow: hidden;
    }
    
    #imagedisplaydiv .gallerybutton {
        /* margin: 30px; */
        margin-bottom: 14vh; /* Safari fix */
    }
    
    #imagedisplaydiv .gallerybutton img {
        width: 30px;
    }

    #imagedisplaydiv .subleft {
        display: none;
    }
    
    #imagedisplaydiv .subright {
        display: none;
    }

    #imagedisplaycontainer {
        max-width: 100%;
        max-height: 100%;
        overflow: auto;
        align-items: center;
    }

    #imagedisplay {
        max-width: 100%;
        max-height: 100%;
    }

}