/* @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;0,900;1,400;1,700;1,900&display=swap'); */
/* @import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,400;0,700;0,900;1,400;1,700;1,900&display=swap'); */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap');
@import url('https://use.fontawesome.com/releases/v5.11.2/css/all.css');

:root{
    --primary: #ff9944;
    --secondary: #ee5555;
    --light: #c7d6e5;
    --medium: #282828;
    --dark: #111111;
}

*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body {
    font-family: "Open Sans";
    display: flex;
    height: 100vh;
    color: var(--light);
    background-color: var(--dark);
}

.game-container{
    margin: auto;

    max-width: 43vw;
    display: flex;
    flex-direction: column;

    position: relative;

    background-color: var(--medium);
    padding: 1em;
    /* border: 2px solid red; */
}

.game-title{
    text-align: center;
}

.stat{
    /* border: 2px solid var(--secondary); */
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    color: var(--primary);
    padding: 10px 0px;
}

.stat span{
    color: var(--secondary);
    font-weight: bold;
}

.game-board{
    /* border: 2px solid green; */
    /* width: 100%; */
    /* height: 100%; */
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    perspective: 1000px;
}

.card{
    /* border: 2px solid blue; */
    margin: 0.4vw;
    /* width: calc(25% - 10px);
    height: calc(33.333% - 10px); */
    width: 9vw;
    height: 18vh;
    position: relative;
    transform: scale(1);
    transform-style: preserve-3d;
    transition: transform 0.5s;
}

.card:hover{
    cursor: pointer;
}

.card:active{
    transform: scale(0.97);
    transition: transform 0.2s;
}

.card.flipped{
    transform: rotateY(180deg);
}

.hidden{
    animation-name: fadeout;
    animation-duration: 0.5s;
    animation-fill-mode: forwards;
}

.hidden:hover{
    cursor: default;
}

.hidden .card-front{
    backface-visibility: visible;
}

.card-front, .card-back{
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 10px;
    border-radius: 5px;
    background-color: var(--light);
    /* I don't think this is necessary. This could be applied to .card-back only. In that case transform of card-front is also not necessary.*/
    backface-visibility: hidden;
}

.card-front{
    transform: rotateY(180deg);
}

.card-back{
    /* backface-visibility: hidden; */
}

img {
    /* width: 100px; */
}

.reset{
    visibility: hidden;
    text-align: center;
    display: flex;
    margin: auto;
}

.reset.visible{
    color: var(--primary);
    border-radius: 5px;
    visibility: visible;
    /* transform: translateX(48vw) translateY(40vh); */
    cursor: pointer;
    
    transition: color .5s ease;

    /* border: 2px solid white; */
    position: absolute;
    top: 50%;
    left: 50%;
    /* margin-top: -2.6em; */
    /* margin-left: -2.6em; */
    transform: translate(-50%, -50%);
}

.reset.visible:hover{
    color: var(--secondary);
}

.reset.visible:after{
    content: "\f2f9";
    font-family: "Font Awesome 5 Free";
    font-weight: bold;
    font-size: 5em;
}

@media (max-width: 1024px){
    .game-container{
        max-width: 60vw;
    }
    
    .card{
        /* border: 2px solid red; */
        margin: 0.3vw;
        width: 13vw;
        height: 15vw;
    }

    .reset{
        /* background-color: green; */
    }
}

@media (max-width: 768px){
    .reset{
        /* background-color: blue; */
    }
}

@media (max-width: 600px){
    .stat{
        /* display: block; */
    }

    .game-container{
        /* background-color: red; */
        padding: 0.5em;
        max-width: 90vw;
    }

    .card{
        /* border: 2px solid red; */
        margin: 0.3vw;
        width: 19vw;
        height: 19vw;
    }

    .reset{
        /* background-color: red; */
    }
}

@media (max-width: 400px){
    .stat{
        display: block;
        text-align: right;
    }

    .stat span{
        display: inline-block;
        color: green;
        width: 3em;
    }
}

@keyframes fadeout {
    from{
        opacity: 1;
    }

    to{
        opacity: 0;
    }
}

