/* Fix retarded scrollbar jumping */
html {
    width: 100vw;
    overflow-x: hidden;
}

/* Makes the images wrap to a new line */
.square-grid {
    display: flex;
    flex-wrap: wrap;
}

/* Makes the background image stretch to fit the cell
   This should not crop perfectly square images */
.square-grid .cell {
    background-repeat: no-repeat;
    background-size: cover;
    width:100%;
    margin-right:0px;
    margin-bottom: 0px;
}

/* Makes the height of the cell = width */
.square-grid .cell:before {
    padding-top: 100%;
    content: "";
    float: left;
}

/* Small box top left of image */
.counter {
    position: absolute;
    background-color: rgba(255,255,255,0.9);
    border: 2px solid grey;
    max-width: max-content;
}


/* Text inside counter */
.counter p {
    display: table;
    font-weight: bold;
    padding: 0px 5px;
    margin-bottom: 0;
}


/* White overlay when you hover over image */
.overlay {
    position: relative;
    height: 100%;
    background-color: rgba(255,255,255,0.8);
    display:none;
    /*
    -webkit-transition: all 0.2s ease-in-out 0s;
    -moz-transition: all 0.2s ease-in-out 0s;
    -ms-transition: all 0.2s ease-in-out 0s;
    transition: all 0.2s ease-in-out 0s;

    opacity: 0;
    visibility: hidden;
    */
}

/*
.specimen-container:hover .overlay, .specimen-container:active .overlay {
    opacity: 1;
    visibility: visible;

}
*/

/* ID: specimen text */
.overlay text {
    position: absolute;
    top: 1%;
    left: 1%;
    margin-top: -2%;
    font-size: calc(20px + 0.2vw);
    font-weight: bold;
    padding: 4px 5px 5px 4px;
    max-width: 80%;
}

/* Button size */
.overlay *[class*="-btn"] {
    width: calc(40px + 0.25vw);
    height: calc(40px + 0.25vw);
}

/* Close button top right */
.overlay .close-btn {
    position: absolute;
    top: 0;
    right: 3px;
}

/* All buttons are contained in an anchor element.
   This needed to be set so that the ID text didn't
   stop you from pressing the close button */
.overlay a {
    display: inline-block;
}

/* Edit button bottom left */
.overlay .edit-btn {
    position: absolute;
    bottom: 0;
    left: 2px;
}

/* Info button bottom right */
.overlay .del-btn {
    position: absolute;
    bottom: 1px;
    right: 2px;
}

/* Delete button */
.overlay .info-btn {
    position: absolute;
    top: 50%;
    right: 3px;
    transform: translate(0, -50%);
}

/* Add to sample or add to count button */
.overlay .add-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 45px;
}

/* Add to count button */
.overlay button[name*="count"] {
    border-radius: 50%;
    width: calc(60px + 1vw);
    height: calc(60px + 1vw);
}

/* Plus symbol inside green plus button */
.overlay .fa-plus {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(30px + 0.5vw);
    height: calc(30px + 0.5vw);
}

/* Specimen count input */
.overlay input {
    margin: 0;
    position: absolute;
    width: 75px;
    left: 50%;
    bottom: 5%;
    transform: translate(-50%, 5%);
    font-weight: bold;
}

/* How many images to display per row.
   Also makes sure counter doesn't extend past its specimen container */
@media screen and (min-width: 300px) {
    .square-grid .cell {
        width: calc(100% / 1);
    }
    .counter {
        max-width: calc(100% / 1);
    }
}

@media screen and (min-width: 600px) {
    .square-grid .cell {
        width: calc(100% / 2);
    }
    .counter {
        max-width: calc(100% / 2 - 8px);
    }
}

@media screen and (min-width: 800px) {
    .square-grid .cell {
        width: calc(100% / 3);
    }
    .counter {
        max-width: calc(100% / 3 - 8px);
    }
}

@media screen and (min-width: 1000px) {
    .square-grid .cell {
        width: calc(100% / 4);
    }
    .counter {
        max-width: calc(100% / 4 - 8px);
    }
}

@media screen and (min-width: 1300px) {
    .square-grid .cell {
        width: calc(100% / 5);
    }
    .counter {
        max-width: calc(100% / 5 - 8px);
    }
}

@media screen and (min-width: 1500px) {
    .square-grid .cell {
        width: calc(100% / 6);
    }
    .counter {
        max-width: calc(100% / 6 - 8px);
    }
}