@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@300;400&family=Nunito:wght@300;400;500&family=Permanent+Marker&display=swap');

:root {
    --spacing-xss: 0.5rem;
    --spacing-xs: 1rem;
    --spacing-s: 1.5rem;
    --spacing-m: 2rem;
    --spacing-l: 3rem;
    --spacing-xl: 4rem;
    --primary-color: rgb(255, 203, 30);
    --secondary-color: black ;
    --tertiary-color: skyblue;
    --highlight-color: whitesmoke;
    --correct-color: #3AAF3C;
    --incorrect-color: #EB0100;
    --font-size-reg: 1rem;
    --font-size-medium: 1.5rem;
    --font-size-large: 2rem;
    --font-size-xl: 2.5rem;
    --font-size-xxl: 4rem;
    --font-size-xxxl: 5rem;
}

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

/* Solution to making font size responsive found at https://matthewjamestaylor.com/responsive-font-size */
body {
    font-family: 'Nunito Sans', sans-serif;
    font-size: calc(15px + 0.390625vw);
    color: var(--secondary-color);
    line-height: 1.6;
    background-color: var(--tertiary-color);
}

ul {
    list-style-type: none;
    margin-top: var(--spacing-m);
    line-height: 1.9;    
}

a {
    text-decoration: none;
    color: inherit;
}

h1, h2 {
    font-family: 'Nunito', sans-serif;
    font-size: calc(var(--font-size-medium) + 0.390625vw);
    font-weight: 500;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 3px;    
}

h2 {
    margin-bottom: var(--spacing-xs);
    line-height: normal;
}

i {
    font-size: var(--font-size-xl);
    color: var(--secondary-color);
}

img {
    height: 100%;
    width: 100%;
}

/* Code to overide default button styling from user agent stylesheet */
button {
    display: block;
    border: none;
    text-decoration: none;
    cursor: pointer;
}

/* UTILITIES */

/* Using css grid to keep footer stuck to bottom of the page.  Referenced this article for the solution:
https://dev.to/niorad/keeping-the-footer-at-the-bottom-with-css-grid-15mf */
.master-container {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 100%;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    overflow: visible;
    padding: 0 30px;
}

.grid-wrapper {
    width: 100%;
    height: 100%;
}

.grid {
    display:grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 var(--spacing-xs);
    width: 100%;
    height: 100%;
    place-items: center;
}

.grid-tiles-1 {
    grid-template-columns: repeat(1, 1fr);
}

.grid-tiles-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 0 var(--spacing-m);
}

.grid-tiles-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-tiles-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-tiles-5 {
    grid-template-columns: repeat(5, 1fr);
}

.grid-tiles-6 {
    grid-template-columns: repeat(6, 1fr);
}

.grid-settings-table {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, min-content);
    gap: var(--spacing-xss) var(--spacing-xs);
    margin-top: var(--spacing-m);
}

.flex {
    display: flex;
    justify-content:space-between;
    align-items: center;
    height: 100%;
}

.flex-rows {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

#answer-tiles , #scramble-tiles .scramble-button , .answer-letter {
    font-size: calc(var(--font-size-reg) + 0.390625vw);
    text-transform: uppercase;
    line-height: normal;
    margin: auto;    
} 

.button-container {
    position: relative;
    width: 100%;
    height: 100%;
    padding-top: 100%;
    border-radius: 5px;
    text-align: center;
}

.button-container img {
    max-width: 90%;
    max-height: 90%;
    position: absolute;
    top: 5%;
    right: 0;
    left: 5%;
    bottom: 0;
}

.btn {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0 auto;
    font-family: 'Nunito', sans-serif;
    color: var(--secondary-color);
    border-radius: 5px;
}

.btn:disabled {
    color: #696969;
}

.control-button {
    background-color: transparent;
    max-width: 100%;
    max-height: 100%;
}

.player-control {
    transition: transform 0.5s ease-out;
}

.player-control:hover {
    transform: scale(1.1);
}

.hand-writing {
    font-family: 'Permanent Marker', cursive;
}

.menu {
    background-color: var(--primary-color);
    padding-top: var(--spacing-s);
    height: auto;
}

.hidden {
    display: none;
}

.invisible {
    visibility: hidden;
}

/* NAVIGATION MENU */

.nav-icon {
    transition: color 0.5s ease-out;
    transition: transform 0.5s ease-out;
}

.nav-icon:hover {
    color: #696969;
    transform: scale(1.1);
}

.menu.navbar {
    margin-bottom: 0;
    padding-top: 0;
}

.settings-icon {
    margin: var(--spacing-xs) var(--spacing-s);
}

.instructions-icon {
    margin: var(--spacing-xs) 0;
}

.clear-page {
    padding: var(--spacing-xs) 0;
}

/* INSTRUCTIONS SECTION */

.list-icon {
    margin-right: var(--spacing-xs);
    font-size: var(--font-size-medium);
}

/* LANDSCAPE WARNING PAGE */

#warning-icon {
    margin: var(--spacing-xs) 0;
}

/* PROGRESS SECTION */

#progress i {
    padding-bottom: var(--spacing-s)
}

/* TOP DISPLAY SECTION */

.single-image-display {
    width: 100px;
    display: block;
    margin: var(--spacing-xs) auto;
}

.single-image-display img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    margin-left: auto;
    margin-right: auto;   
}

.counters {
    font-size: var(--font-size-xl);
    background-color: var(--primary-color);
    line-height: normal;
    border-radius: 5px;
}

#answer-icon {
    height: 100%;
    width: 100%;
    padding: var(--spacing-xss) var(--spacing-xs);
}

#score {
    color: var(--correct-color);
    width: 100%;
}

#timer {
    color: var(--incorrect-color);
    width: 100%;
}

.top-window {
    height: auto;
    margin: var(--spacing-s) auto;
}

/* ANSWER BOX SECTION */

.answer-box {
    background-color: var(--highlight-color);
}

.answer-box-correct {
    animation: fadeCorrectAnswer 2s;
    -webkit-animation: fadeCorrectAnswer 2s;
    -moz-animation: fadeCorrectAnswer 2s;
    -o-animation: fadeCorrectAnswer 2s;
    -ms-animation: fadeCorrectAnswer 2s;
    animation-fill-mode:forwards;
}

@keyframes fadeCorrectAnswer {
    from {background: var(--correct-color);}
    to {background-color: var(--highlight-color);}
}

.answer-box-incorrect {
    animation: fadeIncorrectAnswer 2s;
    -webkit-animation: fadeIncorrectAnswer 2s;
    -moz-animation: fadeIncorrectAnswer 2s;
    -o-animation: fadeIncorrectAnswer 2s;
    -ms-animation: fadeIncorrectAnswer 2s;
    animation-fill-mode: forwards;
}

@keyframes fadeIncorrectAnswer {
    from {background-color: var(--incorrect-color);}
    to {background-color: var(--highlight-color);}   
}

.answer-letter {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    max-width: fit-content;
    height: fit-content;
    object-fit: cover;
    font-family: 'Permanent Marker', cursive;
    border-radius: 5px;
    display: block;
    border: none;       
}

/* IMAGE BOX SECTION */

#display {
    margin: var(--spacing-s) auto;
}

#display-main {
    align-content: center;
}

#display-main.single-image-display {
    margin: 0 auto;
}

#display-main i {
    font-size: 6rem;
}

/* SCRAMBLED WORD SECTION */

.scramble-button {
    background-color: var(--primary-color);
}

/* CONTROLS SECTION */

#control-box {
    width: auto;
    margin: var(--spacing-s) auto;
}

/* FOOTER */

#footer.menu {
    margin-top: var(--spacing-l);
    padding: var(--spacing-s) 0;
    text-align: center;
}

/* MEDIA QUERIES */

@media only screen and (min-width: 375px) {
    #answer-tiles , #scramble-tiles .scramble-button , .answer-letter {
        font-size: calc(var(--font-size-medium) + 0.390625vw);
    }    
}

@media only screen and (min-height: 1200px) {
    .single-image-display {
        width: 200px;
        margin: var(--spacing-m) auto;
    }
    .counters {
        font-size: var(--font-size-xxl);
        line-height: 2.0;
    }
}
/* These media queries are empty but serve a purpose as they are  
referenced by the landscape and portrait variables in the script.js file.
These use matchMedia which I learnt about in this article:
https://fjolt.com/article/javascript-detecting-device-orientation */

@media only screen and (max-height: 400px) {

}

@media only screen and (min-height: 400px) {

}
