@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@300&family=Yeseva+One&display=swap');

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

body {
    background: #678CEC;
    font-family: 'Josefin Sans', sans-serif;
    font-weight: bold;
    font-size: 130%;
    color: #272323;

}

.heading {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: row;
    gap: 1%;
    margin: 10% 5% 5% 5%;
}

.img-logo {
    width: 20%;
    height: 15%;
    margin: 0%;
    border-radius: 50%;
}

h1 {
    display: flex;
    align-items: center;
    font-family: 'Yeseva One', sans-serif;
    font-size: 150%;
}

/* Game rules section */
.container-game-rules {
    display: flex;
    flex-direction: column;
    background-color: #f4bc4f;
    width: 50%;
    height: 30%;
    margin: 0% 20% 5% 25%;
    padding: 5%;
    border-radius: 10px;
}

h2,
h3,
.p-game-rules {
    display: flex;
    align-items: flex-start;
    font-family: 'Yeseva One', sans-serif;
    margin: 2% 2% 2% 3%;
    padding-bottom: 1%;
    padding-top: 1%;

}

p {
    display: flex;
    align-items: flex-start;
    margin-left: 0%;
    margin-right: 5%;
}

ul {
    display: flex;
    align-self: center;
    flex-direction: column;
}

ul li {
    padding-top: 2%;
    font-weight: bolder;
}


/* Go to game button */
.container-btn {
    display: flex;
    justify-content: center;
}

.game-btn {
    text-decoration: none;
    color: #272323;
    background: #f4bc4f;
    border-radius: 10px;
    padding: 1% 2%;
    margin-top: 0%;
    margin-bottom: 10%;
    font-family: 'Yeseva One', sans-serif;
    font-weight: bolder;
    font-size: medium;
}

.game-btn:hover {
    background-color: #ffffff;
    border: 1px solid #f4bc4f;
}

/* **** Game Board page **** */

.heading-board-game {
    margin-top: 3%;
    margin-bottom: 0%;
}

/* Style time and moves count section */
.time-moves-count {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    margin: 0% 37% 2% 0%;
    font-family: 'Yeseva One', sans-serif;
    font-weight: bolder;
    font-size: large;
    list-style: none;
}

/* Style for board game */
.board-game-container {
    display: grid;
    grid-template-columns: repeat(4, auto);
    grid-template-rows: repeat(4, auto);
    grid-gap: 1%;
    justify-content: center;
    width: 50%;
    margin: 2% 0% 5% 25%;
}

/* 
Transform-style, transform and transition properties taken from:
https: //marina-ferreira.github.io/tutorials/js/memory-game/
*/
.flip-cards {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    transform: scale(1);
    transition: transform .6s;
    border: 3px solid #f4bc4f;
}

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

.flip-cards.flipping {
    transform: rotateY(180deg);
}

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

}

img {
    object-fit: cover;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Reset button */
.container-rst-btn {
    display: flex;
    justify-content: center;
    padding: 0%;
}

.reset-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1% 1%;
    margin-top: 0%;
    margin-bottom: 5%;
    background-color: #f4bc4f;
    border-radius: 10px;
    font-family: 'Yeseva One', sans-serif;
    font-weight: bolder;
    font-size: medium;
    color: #272323;
}

.reset-btn:hover {
    background-color: #ffffff;
    border: 1px solid #f4bc4f;
}

/* Winning message popup window (hidden until game is over) and  reset popup window */

#backgroundPop {
    position: fixed;
    background-color: #272323;
    opacity: 0.9;
    width: 100%;
    height: 100%;
    z-index: 10;
    top: 0;
    left: 0;
}

.hide {
    display: none;
}

#winPopContainer {
    background-color: #f4bc4f;
    width: 30%;
    height: 50%;
    position: relative;
    z-index: 10;
    border-radius: 10px;
    margin: 0% 0% 0% 35%;
}

#winPopup {
    width: 100%;
    height: 80%;
}

#winImg img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    margin-left: 0%;
}

#winText,
#resetPopup p {
    font-family: 'Yeseva One', sans-serif;
    font-size: large;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #272323;
    margin: 2% 0% 0% 0%;
    padding: 0%;
}

#resetPopup p {
    padding: 5% 0%;
}

#okBtn,
#resetGame,
#cancel {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2%;
}

#okBtn button,
#resetGame button,
#cancel button {
    width: 30%;
    height: 30px;
    margin-bottom: 5%;
    background-color: #678CEC;
    border: 1px solid #f4bc4f;
    border-radius: 10px;
    font-family: 'Yeseva One', sans-serif;
    font-weight: bolder;
    font-size: medium;
    color: #272323;
}

/* **** Media queries **** */

@media screen and (max-width: 1200px) {

    .heading {
        margin: 11% 5% 5% 15%;
    }

    .img-logo {
        width: 40%;
    }

    h1 {
        font-size: 130%;
    }

    /* Game rules section */
    .container-game-rules {
        width: 60%;
        margin: 0% 0% 5% 22%;
    }

    h2,
    h3,
    .p-game-rules {
        font-size: inherit;
    }

    p,
    ul {
        font-size: 90%;
    }

    ul {
        margin-left: 6%
    }

    /* Game Board page */
    .time-moves-count {
        margin: 0% 29% 2% 0%;
    }

    .board-game-container {
        margin: 0% 0% 6% 25%;
    }

    /* Win message popup window */
    #winPopContainer {
        width: 50%;
        height: 40%;
        margin-left: 26%;
    }
}

/* **** Media queries for iPad Air 820px **** */

@media screen and (max-width: 820px) {

    .img-logo {
        width: 60%;
    }

    .container-game-rules {
        width: 80%;
        margin: auto;
    }

    .container-btn {
        margin-top: 3%;
    }

    /* Game Board page */
    .time-moves-count {
        margin: 0% 25% 2% 0%;
    }
}

/* **** Media queries for Surface Duo 540px **** */

@media screen and (max-width: 540px) {

    /* Heading */
    .img-logo {
        width: 80%;
    }

    h1 {
        font-size: 100%;
    }

    /* Game rules section */
    .container-game-rules {
        width: 90%;
    }

    h2,
    h3,
    .p-game-rules {
        font-size: 90%;
        margin-bottom: 3%;
    }

    p,
    ul {
        font-size: 80%;
    }

    .game-btn,
    .reset-btn {
        padding: 2% 3%;
    }

    /* Game Board page */
    .time-moves-count {
        margin: 0% 12% 5% 0%;
        font-size: 90%;
    }

    /* Win message popup window */
    #winPopContainer {
        width: 85%;
        height: 55%;
        margin-left: 8%;
    }
}

/* **** Media queries for iPhone XR, Facebook forAndroid v407 on Pixel 6, Samsung Galaxy S20 Ultra/ A51/71 414px **** */

@media screen and (max-width: 414px) {

    .heading {
        margin: 20% 10% 13%;
    }

    .img-logo {
        width: 100%;
    }

    h1 {
        font-size: 90%;
    }

    .container-btn {
        margin-top: 8%;
    }

    /* Game Board page */
    .time-moves-count {
        margin: 0% 3% 5% 0%;
        font-size: 80%;
    }

    .board-game-container {
        margin: 1% 0% 20% 25%;
        grid-gap: 2%;
    }

    .flip-cards {
        width: 90px;
    }

    #winText {
        margin-top: 10%;
    }

    #okBtn {
        margin-top: 8%;
    }
}

/* **** Media queries for iPhone SE 375px **** */

@media screen and (max-width: 375px) {

    /* Game board page */
    .flip-cards {
        width: 80px;
        height: 80px;
    }

    .container-rst-btn {
        margin-bottom: 13%;
    }

    #winPopContainer {
        height: 65%;
    }
}

/* **** Media queries for Mobile S 320px, Galaxy Fold 280px **** */

@media screen and (max-width: 320px) {

    .img-logo {
        width: 150%;
    }

    h1 {
        font-size: 70%;
    }

    /* Game rules section */
    .container-game-rules {
        width: 100%;
    }

    h2,
    h3,
    .p-game-rules {
        font-size: 70%;
        margin-bottom: 3%;
    }

    p,
    ul,
    .time-moves-count {
        font-size: 65%;
    }

    .game-btn,
    .reset-btn {
        font-size: small;
        padding: 3% 5%;
    }

    /* Game Board page */
    .flip-cards {
        width: 65px;
        height: 70px;
    }

    #winPopContainer {
        width: 90%;
        margin-left: 5%;
    }

    #winText,
    #resetPopup p {
        font-size: medium;
    }
}