/* Google fonts import */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Macondo&family=Oswald:wght@200..700&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

/* CSS variables*/
:root {
    /*--variable-name */
    --primary-font: "Oswald", sans-serif;
    --primary-color: rgb(12, 12, 20);
    /* Dark Blue/Black */
    --secondary-color: rgb(19, 21, 38);
    /* Lighter Blue/Black */
    --highlight: #D8D7DE;
    /* Grey */
    --light-highlight: rgb(124, 104, 68);
    /* Taupe */
    --bright-highlight: rgb(169, 49, 62);
    /* Pink highlight */
}

/* General styles */
body {
    min-height: 100vh;
    display: flex;
    width: 100%;
    flex-direction: column;
    font-family: var(--primary-font);
    margin: 0;
    overflow-x: hidden;
    overflow-wrap: anywhere;
}

main {
    /* Main element to take up any surplus space to push footer down */
    flex: 1 0 auto;
    max-width: 1399px;
    margin: auto;
    position: relative;
}

header {
    width: 100%;
    background-color: var(--primary-color);
    display: flex;
    justify-content: center;
}

h1 {
    text-transform: uppercase;
    color: var(--highlight);
    text-align: center;
    margin: 10px;
}

/* Games area - container style */
.games-area {
    background-color: var(--highlight);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Controls area - container style */
.control-area {
    display: flex;
    align-items: center;
    height: 50px;
    width: 100%;
    background-color: white;
    justify-content: center;
    position: absolute;
    top: 0;
}

.start,
.new-start,
.restart-board {
    margin: 10px;
    width: 150px;
    height: 35px;
    text-align: center;
    font-weight: bold;
    background-color: white;
    cursor: pointer;
}

.start:hover,
.new-start:hover,
.restart-board:hover {
    background: var(--light-highlight);
    color: white;
    cursor: pointer;
}

.instructions:hover {
    background-color: rgba(169, 49, 62, 0.5);
    color: white;
    transform: scale(1.2);
    cursor: pointer;
}

.reset-board {
    background-color: white;
    color: white;
    border: 0px white;
}

.reset-board-shown {
    margin: 20px;
    width: 150px;
    height: 35px;
    text-align: center;
    font-weight: bold;
    background-color: var(--bright-highlight);
    text-transform: uppercase;
    cursor: pointer;
}

.reset-board-shown:hover {
    background: var(--bright-highlight);
    color: white;
    transform: scale(1.2);
    cursor: pointer;
}

/* Inspiration taken from "Coding Made Simplified" - styling and creating the 3D cards which flip */
/* Cards area - container style */
.card-container {
    display: flex;
    width: 100%;
    height: 100%;
    margin-top: 50px;
    align-items: center;
    justify-content: center;
}

.cards-area {
    display: grid;
    grid-template-columns: repeat(4, 70px);
    grid-template-rows: repeat(4, 70px);
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin: 10px;
    background-color: var(--secondary-color);
}


.card {
    display: flex;
    width: 100%;
    height: 100%;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    box-shadow: 5px 5px 2px 0px rgba(19, 21, 38, 0.6);
    transition: transform 0s;
    transform-style: preserve-3d;
}

.card.clicked .card-inner {
    transform: rotateY(180deg);
    background-color: white;
}

.card.matched .card-back {
    filter: brightness(50%);
    transform: scale(1.0);
    background-color: white;
}

.card-back,
.card-front {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    color: white;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.card-front {
    background-color: var(--secondary-color);
    font-size: larger;
}

.card-front:hover {
    background-color: var(--light-highlight);
    box-shadow: 5px 2px 2px 0px rgba(224, 201, 157, 0.4);
}

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

.card-back img {
    width: 90%;
    height: 90%;
}

/* Score and attempts left*/
footer {
    background-color: rgba(12, 12, 20, 0.8);
    color: var(--highlight);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.score-and-attempts-area {
    max-width: 1399px;
    width: 100%;
    display: flex;
    height: 60px;
}

.matched-area,
.attempts-area {
    width: 50%;
    display: flex;
    font-size: medium;
    align-items: center;
    text-align: center;
    padding: 5px;
}


.matched-area p,
.attempts-area p {
    width: 50%;
}

.matched-text,
.attempts-text {
    text-align: end;
}

.matched-cards,
.attempts-made {
    width: 100%;
    display: flex;
    justify-content: center;
    font-size: medium;
}

.github {
    display: flex;
    color: var(--highlight);
    padding: 5px;
    align-items: center;
    justify-content: center;
}


/* Media query: small devices (576px and up) */
@media screen and (min-width: 576px) {
    .cards-area {
        grid-template-columns: repeat(4, 100px);
        grid-template-rows: repeat(4, 100px);
    }

    .matched-area,
    .attempts-area {
        font-size: large;
    }

    .matched-cards,
    .attempts-made {
        font-size: large;
    }
}


/* Media query: medium devices (768px and up) */
@media screen and (min-width: 768px) {
    .cards-area {
        grid-template-columns: repeat(4, 125px);
        grid-template-rows: repeat(4, 125px);
    }

    .matched-area,
    .attempts-area {
        font-size: large;
    }

    .matched-cards,
    .attempts-made {
        font-size: large;
    }
}

/* Media query: large devices (992px and up) */
@media screen and (min-width: 992px) {
    .cards-area {
        grid-template-columns: repeat(4, 135px);
        grid-template-rows: repeat(4, 135px);
        gap: 15px;
    }

    .matched-area,
    .attempts-area {
        font-size: x-large;
    }

    .matched-cards,
    .attempts-made {
        font-size: x-large;
    }
}

/* Media query: extra large devices (1200px and up) */
@media screen and (min-width: 1200px) {
    .cards-area {
        grid-template-columns: repeat(4, 140px);
        grid-template-rows: repeat(4, 140px);
        gap: 15px;
    }
}

/* Media query: extra large devices (1400px and up) */
@media screen and (min-width: 1400px) {
    .cards-area {
        grid-template-columns: repeat(4, 160px);
        grid-template-rows: repeat(4, 160px);
        gap: 15px;
    }

    .matched-area,
    .attempts-area {
        font-size: xx-large;
    }

    .matched-cards,
    .attempts-made {
        font-size: xx-large;
    }
}