body {
    background-color: white;
    font: 1.1em Arial, Helvetica, sans-serif;
}

/* css for back to index.html link */
#back {
    font-size: 0.8em;
    text-align: left;
    margin: auto;
    width: 100%;
    padding: 0.5em;
}

img {
    display: block;
}

figure {
    margin: 0;
    display: grid;
    grid-template-rows: 1fr auto;
    margin-bottom: 5px;
    break-inside: avoid;
    place-items: center;  /* Centre things in the grid (works for grids!)*/
}

figure > img {
    grid-row: 1 / -1;  /* Partly influences the caption it seems... */
    grid-column: 1;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

figcaption {
    grid-row: 0;
    grid-column: 1;
    padding: .1em .1em;
    font-size: 14px;
    color: rgb(60, 60, 60);
}

@media only screen and (min-width: 1601px){
    .gallery-container {
        column-count: 5;
        column-gap: 10px;
    }
    .prev-img, .next-img{
        font-size: 48px;
    }

    figcaption {
        font-size: 16px;
    }
}


@media only screen and (min-width: 1200px) and (max-width: 1600px){
    .gallery-container {
        column-count: 4;
        column-gap: 10px;
    }
    .prev-img, .next-img{
        font-size: 30px;
    }

    figcaption {
        font-size: 16px;
    }
}

/* For phone screens (or FHD screens... this isn't the most robust thing)*/
@media only screen and (max-width: 1199px) and (min-width: 900px){
    .gallery-container {
        column-count: 3;
        column-gap: 10px;
    }

    /* Make the figcaption smaller than what we have above */
    figcaption {
        font-size: 12px;
    }

    .prev-img, .next-img{
        font-size: 22px;
    }
}

/* For phone screens (or FHD screens... this isn't the most robust thing)*/
@media only screen and (max-width: 899px) {
    .gallery-container {
        column-count: 2;
        column-gap: 10px;
    }

    /* Make the figcaption smaller than what we have above */
    figcaption {
        font-size: 12px;
    }

    .prev-img, .next-img{
        font-size: 12px;
    }
}


.gallery-container img {
    transition: all 0.5s ease-in-out;
}

.gallery-container img:hover {
    opacity: 0.5;
    transform: scale(1.01);
    box-shadow: 0 0 10px rgba(134, 29, 146, 0.78);
    /* Make cursor change to hand when hovering over image which has onclick attribute */
    /* It must have onclick attribute to work */
    cursor: pointer;
}

/* The Modal (background) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width of the modal*/
    height: 100%; /* Full height */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    overflow: hidden;  /* Enable scroll if needed */

}

.modal-content {
    display: grid;
    height:100%;
    box-shadow: 0 0 10px rgba(250, 0, 250, 0.8);

}

#modal-image {
    max-width: 95%;
    max-height: 95vh;
    margin: auto;
    box-shadow: 0 0 10px rgba(250, 250, 250, 0.8);

    animation-name: modalopen;
    animation-duration: 0.6s;
}

/* The Close Button */
.close-btn {
    color: lightgray;
    display: block;
    font-size: 30px;
    font-weight: bold;
    float: left;
    position: absolute;
}

.close-btn:hover,
.close-btn:focus {
    text-decoration: none;
    cursor: pointer;
    background-color: rgba(200,200,200,0.3);
}

/* The previous image button*/
.prev-img, .next-img{
    color: lightgray;
    position: absolute;
}

.prev-img:hover, .next-img:hover, .prev-img:focus, .next-img:focus{
    cursor: pointer;
    background-color: rgba(200,170,170,0.4);
}

.prev-img {
    float: left;
    top: 50%;
    left: 0;
}

.next-img {
    float: right;
    top: 50%;
    right: 0;
}


@keyframes modalopen {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
