.gallery
{
    position: relative;
    padding-top: 1em;

    display: grid;
	grid-gap: 1.5vw;
    align-items:center;
}

.gallery-grid-2 { grid-template-columns: 1fr 1fr; }
.gallery-grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.gallery .tile
{
    position: relative;
    height: fit-content;

    display: inline-block;
    overflow: hidden;

    transition: 0.3s;
}

.wide-2 { grid-column-end: span 2; }
.wide-3 { grid-column-end: span 3; }
.wide-4 { grid-column-end: span 4; }
.tall-2 { grid-row-end: span 2; }

.gallery .tile:hover
{
    transform: scale(1.05);    
}


.gallery .caption
{
    position: absolute;
    bottom: -30%;
    width: 100%;
    height: fit-content;

    text-align: left;

    opacity: 0;
    background-color: rgba(75, 44, 142, 0.9);

    transition: 0.3s;
}

.gallery .tile:hover .caption
{
    bottom: 0;
    opacity: 1.0;
}


.caption h3, .caption p
{
    font-style: normal;
    color: rgb(235, 235, 235);
    margin: 0px;
    padding: 0px 15px;
}

.caption h3
{
    font-family: "PatrickHand", sans-serif;
    font-weight: bold;
    font-size: 1.4em;
    margin-top: 10px;
}

.caption p
{
    margin-top: 5px;
    margin-bottom: 15px;
}

/* Resize event */
@media only screen and (max-width: 1000px)
{
    .caption h3
    {
        font-size: 1.2em;
    }
}

@media only screen and (max-width: 500px)
{
    .caption h3
    {
        font-size: 1em;
    }
}


.gallery img
{
    min-width: 100%;
    object-fit: cover;
}


/*** Lightbox ***/
.lightbox 
{
    position: fixed;
    width: 77.5%;
    height:100%;
    left: 22.5%;
    top:0px;

    background: rgba(75, 44, 142, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s, backdrop-filter 0.3s, -webkit-backdrop-filter 0.3s;
}

.lightbox .target
{
    position: absolute;
    height: 100%;
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    transform: scale(0);
}

/* Show lightbox */
.lightbox:has(div:target) 
{
    opacity: 1;
    z-index: 2;
}

/* Resize event */
@media all and (max-width: 1200px)
{
    .lightbox
    {
        left: 25%;
        width: 75%;
    }    
}

@media all and (max-width: 990px)
{
    .lightbox
    {
        left: 27.5%;
        width: 72.5%;
    }    
}

@media all and (max-width: 835px)
{
    .lightbox
    {
        left: 30%;
        width: 70%;
    }    
}

@media all and (max-width: 800px)
{
    .lightbox
    {
        left: 35%;
        width: 65%;
    }    
}

@media all and (max-width: 700px)
{
    .lightbox
    {
        left: 0%;
        width: 100%;
        top:20%;
        height: 80%;
    }   

}


/*** Image ***/
.lightbox .target .content 
{
    /*Flex alignment to lightbox*/
    flex: auto;
    max-height: 100%;

    /*Flex alignment of image*/
    display: flex;
    justify-content: center;
    overflow: hidden;
    
    /*Hidden settings, before show lightbox*/
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.25s ease-in-out, opacity 0.25s ease-in-out;
}

.lightbox .target .content img
{
    max-width: 100%;
    max-height: calc(100vh - 40px);
    display: block;
    margin: 0;
}

/* Resize */
@media all and (max-width: 700px)
{
    .lightbox .target .content img { max-height: calc(80vh - 40px); }
}

/* Show lightbox */
.lightbox .target:target
{
    transform: scale(1);
}

.lightbox .target:target .content 
{
    transform: scale(1);
    opacity: 1;
}


/*** Navigation ***/
.lightbox .nav
{
    color: rgb(235, 235, 235);

    font-family: "PatrickHand", sans-serif;
    font-size: 40px;
    font-weight: bold;
    font-style: normal;
    text-decoration: none;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);

    opacity: 0.5;
}

.lightbox a.nav:hover
{
    opacity: 1;
}

.lightbox .target *:first-child, .lightbox .target *:last-child 
{
    flex: 0 0 100px;
    text-align: center;
}

@media all and (max-width: 600px)
{
    .lightbox .target *:first-child, 
    .lightbox .target *:last-child 
    {
        flex: 0 0 50px;
	}
}

.lightbox .close
{
    position: fixed;
    right: 4.5%;
    top: 7.5%;
}

@media all and (max-width: 1200px)
{
    .lightbox .close { right: 5.5%; }    
}

@media all and (max-width: 800px)
{
    .lightbox .close { right: 7.5%; }    
}