/* Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Bad+Script&family=Open+Sans&display=swap");


/* colors from ColorBrewer2.org: diverging*10 */
/* .polaroid:nth-child(1) img {border: 0.5em outset #9e0142;}
.polaroid:nth-child(2) img {border: 0.5em outset #FF002E;}
.polaroid:nth-child(3) img {border: 0.5em outset #f46d43;}
.polaroid:nth-child(4) img {border: 0.5em outset #FFDF00;}
.polaroid:nth-child(5) img {border: 0.5em outset #00ED96;}
.polaroid:nth-child(6) img {border: 0.5em outset #00A5FF;}
.polaroid:nth-child(7) img {border: 0.5em outset #5e4fa2;} */

:root {
    --red: 255, 0, 46; /* #FF002E */
    --yellow: 255, 223, 0; /* #FFDF00 */
    --green: 0, 237, 150; /* #00ED96 */
    --blue: 0, 165, 255; /* #00A5FF */
    --black: 0, 0, 0; /* #000000 */
    --white: 255, 255, 255; /* #FFFFFF */
    --ltgrey: 204, 204, 204; /* #CCCCCC */
}

/* text-colors */
.txt-red {color: rgba(var(--red), 1);}
.txt-yellow {color: rgba(var(--yellow), 1);}
.txt-green {color: rgba(var(--green), 1);}
.txt-blue {color: rgba(var(--blue), 1);}
.txt-black {color: rgba(var(--black), 1);}
.txt-white {color: rgba(var(--white), 1);}
.txt-grey {color: rgba(var(--ltgrey), 1);}

/* bg-colors */
.bg-red {background-color: rgba(var(--red), 1);}
.bg-yellow {background-color: rgba(var(--yellow), 1);}
.bg-green {background-color: rgba(var(--green), 1);}
.bg-blue {background-color: rgba(var(--blue), 1);}
.bg-black {background-color: rgba(var(--black), 1); color: rgba(var(--white), 1);}
.bg-white {background-color: rgba(var(--white), 1); color: rgba(var(--black), 1);}
.bg-grey {background-color: rgba(var(--ltgrey), 1); color: grey;}

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

html {
    scroll-behavior: smooth;
    font-family: "Open Sans", sans-serif;
}

html, body {
    height: 100%;
}

body > footer {
    position: sticky;
    top: 100vh;
}

body {
    background-color: #2c303a;
}

.font-primary {
    font-family: "Bad Script";
}

.btn {
    font-weight: bold;
    font-size: 1em;
    padding: 6px 12px;
    margin: 0.5em;
    display: block;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    border-radius: 0.5em;
    border: 1px solid transparent;
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    box-shadow: 2px 2px 4px rgba(var(--black), 0.5);
    filter: contrast(0.75);
}

/* dialogs / modals */
dialog {
    position: fixed;
    top: 0;
    margin: 3em auto;
    width: 90vw;
    background-color: rgba(33, 37, 41, 0.9);
    border-radius: 1em;
    border-color: #495057;
    box-shadow: 2px 10px 20px rgba(var(--black), 0.75);
}

dialog[open] {animation: slideDown 0.5s ease normal;}
dialog.slideUp {animation: slideUp 0.5s ease normal;}

@keyframes slideDown {
    from {transform: translateY(-125%);}
    to {transform: translateY(0%);}
}

@keyframes slideUp {
    to {transform: translateY(-125%);}
}

dialog::backdrop {
    background-color: rgba(var(--black), 0.5);
    backdrop-filter: blur(3px);
}

.dialog-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
}

.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: start;
    justify-content: space-between;
    padding: 1em 2em;
    margin: 0;
    border-bottom: 1px solid #495057;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

.modal-header h2 {
    flex-grow: 1;
    font-size: 2em;
    font-family: "Bad Script", cursive;
}

.modal-header i {
    padding: 0.5em;
    transition: all 0.2s ease-in-out;
}

.modal-header i:hover {
    color: #757575;
}

.modal-body {
    flex: 1 1 auto;
    padding: 1em;
    width: 100%;
    text-align: center;
}

.modal-footer {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    padding: 1em;
    width: 100%;
    border-top: 1px solid #495057;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

/* header / nav */
header {
    width: 100%;
    height: 4em;
    background-color: rgba(var(--black), 0.75);
    padding: 0 1em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

h1#logo {
    font-family: "Bad Script", cursive;
    font-size: 10vw;
    margin: 0.25em 0;
    white-space: nowrap;
    border-radius: 0.5em;
    border: 1px solid transparent;
    line-height: 1;
}

/* navbar dropdown toggle */
nav {
    position: absolute;
    width: 100%;
    left: 0;
    padding: 1em;
    box-shadow: 0 2px 2px rgba(var(--white), 1);
    display: none;
    top: 4em;
    background-color: rgba(var(--black), 0.75);
    z-index: 100;
}

/* Nav toggle */
#nav-toggle:checked~nav {
    display: flex;
}

#nav-toggle {
    display: none;
}

.nav-toggle-label {
    font-size: 7vw;
    margin: 0 0.5em;
    cursor: pointer;
}

nav ul#menu {
    list-style-type: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    margin: 0 auto;
    width: 100%;
}

nav ul#menu > li {
    width: 100%;
}

/* main / sections */
main {
    width: 100%;
    padding: 1em;
}

#welcome,
#quiz-section,
#final-results,
#study-section,
#scores-section {
    margin: 1em auto;
    padding: 0.5em;
    background-color: #757575;
    border-radius: 1em;
    box-shadow: 0 8px 16px 0 rgba(var(--black), 0.5);
}

#study-container {
    column-count: 1;
    gap: 0;
}

#select-game {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    border-radius: inherit;
    padding: 2em 0;
    background-color: rgba(var(--black), 0.5);
}

#about {
    text-align: center;
    padding: 1em;
    margin-bottom: 0.5em;
    border-radius: inherit;
    background-color: rgba(var(--black), 0.5);
}

#about h2 {
    font-size: 2em;
}

#about img#flag-vexillology {
    max-height: 5em;
    max-width: 100%;
}

#about p {
    margin: 0.5em auto;
}

#about hr {
    height: 0.5em;
    width: 10%;
    margin: 1em auto;
    border: unset;
    border-radius: 1em;
}

#about .badge {
    margin: 1em auto;
    white-space: unset;
    border-radius: 0.5em;
    display: block;
}

/* polaroids */
.polaroid {
    --polaroid-width: 35vw;
    min-width: var(--polaroid-width);
    max-width: var(--polaroid-width);
    text-align: center;
    padding: 0.5em;
    margin: 0.5em auto;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(var(--black), 1);
    transition: all 0.3s ease-in-out;
}

.polaroid img {
    border-radius: 4px;
    width: 100%;
}

.polaroid figcaption {
    font-weight: bold;
    font-size: 1.5em;
    font-family: "Bad Script", cursive;
}

.polaroid:hover,
.polaroid.left:hover,
.polaroid.right:hover {
    z-index: 1;
    transform: scale(0.9) rotate(0);
}

/* question area */
#quiz-section {
    padding: 0;
}

#quiz-container {
    text-align: center;
    display: flex;
    flex-direction: column;
}

#quiz-header,
#study-header {
    padding: 1em;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

#level,
#time {
    font-size: 1.5em;
    background-color: rgba(var(--black), 0.5);
    padding: 0.5em;
    margin: 0.25em 0.5em;
    width: 100%;
    border-radius: 0.5em;
}

#level,
#time,
#question-tracker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

#game-selected,
#time-left,
#question-tally {
    width: 100%;
}

#game-selected,
#time-left,
#question-tally,
#total-correct,
#total-incorrect,
#total-points,
#time-spent {
    border-radius: 0.25em;
    font-weight: bold;
    padding: 0.1em 0.5em;
    margin: 0;
}

/* progress bar */
.progress-container {
    width: 100%;
    padding: 0;
    height: 0.5em;
    background: rgba(var(--black), 0.25);
    box-shadow: inset 0 1px 2px rgba(var(--black), 0.25), 0 1px rgba(var(--white), 0.08);
}

.progress-bar {
    width: 100%;
    height: 0.5em;
    transition: all 0.5s ease-in-out;
}

/* quiz question */
#quiz-question {
    padding: 0 1em;
    margin: 0.5em auto;
    font-size: 1.5em;
    text-shadow: 2px 2px 2px rgba(var(--black), 0.5);
}

#question-results {
    font-size: 1.25em;
    font-weight: bold;
    background-color: rgba(var(--black), 0.5);
    border-radius: 0.5em;
    padding: 1em;
    margin: 0.5em 1em;
}

#user-result span.correct {
    color: rgba(var(--green), 1);
}

#user-result span.incorrect {
    color: rgba(var(--red), 1);
}

#quiz-question .question-number::after {
    content: ".";
}

/* flags x4 */
#flags {
    display: grid;
    align-items: center;
    justify-content: center;
    grid-gap: 0 1em;
    padding: 0 1em;
    margin: 0.5em auto;
}

#flags figure {
    display: flex;
    margin: 0.5em auto;
    position: relative;
    cursor: pointer;
    padding: 0.75em;
    width: 100%;
    border-radius: 0.5em;
    box-shadow: 0px 2px 13px 2px rgba(34, 60, 80, 0.2);
    background-color: #efefef;
    background: linear-gradient(to left, #aaaaaa, #efefef);
    transition: all 0.3s ease-in-out;
}

#flags figure:hover {
    box-shadow: 0 8px 16px 0 rgba(var(--black), 0.5);
}

#flags figure img {
    min-height: 100px;
    max-height: 100px;
    max-width: 100%;
    object-fit: contain;
}

#flags figure figcaption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    width: 100%;
    height: 0;
    border-radius: 0.5em;
}

#flags figure.hover:hover figcaption {
    height: 100%;
    opacity: 0.9;
}

#flags figure span {
    text-align: center;
    font-size: 6vw;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 90%;
    transform: translate(-50%, -50%);
}

/* quiz footer */
#quiz-footer {
    padding: 1em;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 1.5em;
    border-top: 0.25em solid rgba(var(--black), 0.25);
}

#question-tracker {
    width: 100%;
    margin: 0.25em 0.5em;
    padding: 0.5em;
    border-radius: 0.5em;
    background-color: rgba(var(--black), 0.5);
}

#next-btn,
#results-btn {
    font-weight: bold;
    padding: 0.5em 0.75em;
    margin: 0.25em 0.5em;
    width: 100%;
}

/* quiz results */
#results-header,
#study-header,
#scores-header {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
    padding: 1em;
    text-align: center;
}

#results-header,
#study-header {
    text-shadow: 2px 2px 2px rgba(var(--black), 1);
}

#scores-header {
    text-shadow: 2px 2px 2px rgba(var(--white), 1);
}

#results-container {
    display: flex;
    flex-direction: column;
    border-radius: 0.5em;
}

.result-row,
.study-row,
.scores-row {
    width: 100%;
    padding: 0.5em 1em;
    background-color: #212529;
}

.result-row:nth-child(even) {
    background-color: #313539;
}

.study-row {
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

.study-row:hover {
    background-color: rgba(var(--blue), 0.5);
}

img#study-flag {
    max-height: 35vh;
    max-width: 100%;
}

.result-row-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.result-row-content h3 {
    margin: 0;
    width: 100%;
}

/* badges */
.badge {
    margin: 0.5em;
    padding: 0.25em 0.75em;
    width: 100%;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
    border-radius: 50em;
}

.badge.correct {
    color: rgba(var(--black), 1);
    background-color: rgba(var(--green), 1);
}

.badge.incorrect {
    color: rgba(var(--white), 1);
    background-color: rgba(var(--red), 1);
}

.study-badge {
    margin: 0.5em auto;
    padding: 0.5em 2em;
    font-weight: bold;
    white-space: unset;
    border-radius: 2em;
    background-color: rgba(var(--black), 0.5);
}

#results-footer,
#scores-footer {
    border-bottom-right-radius: inherit;
    border-bottom-left-radius: inherit;
    padding: 1em;
}

#results-footer h2 {
    font-size: 1.5em;
    background-color: rgba(var(--black), 0.5);
    padding: 0.5em;
    margin: 0.5em auto;
    border-radius: 0.5em;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

#results-footer h2 span {
    width: 100%;
    text-align: center;
}

.scores-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: 1em 0;
    text-align: center;
}

.scores-row .scores-col {
    width: 100%;
    margin: 0.5em auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

#score-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
}

.score-card {
    display: flex;
    flex-direction: column;
    border-radius: 0.5em;
    margin: 1em auto;
}

.score-card-row {
    display: grid;
}

.score-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.score-card-body {
    width: 100%;
    padding: 0.5em;
    background-color: rgba(var(--black), 0.5);
}

.score-card-results {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    align-items: center;
    justify-content: space-between;
}

.score-card-results .score-badge:first-child,
.score-card-results .score-badge:last-child {
    display: inline-block;
}

.score-badge {
    width: 100%;
    margin: 0.5em 0;
    padding: 0.25em 1em;
    border-radius: 50em;
    white-space: nowrap;
    font-weight: bold;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.score-badge span {
    margin: 0;
}

.bg-black.reset-score {
    cursor: pointer;
}

.bg-grey.reset-score {
    cursor: not-allowed;
}

/* footer */
footer {
    width: 100%;
    height: 2em;
    background-color: rgba(var(--black), 0.75);
}

/* media queries */
@media screen and (min-width: 320px) {

    /* flags */
    #flags {
        grid-template-columns: 1fr 1fr;
    }

    #flags figure span {
        font-size: 4vw;
    }
}

@media screen and (min-width: 450px) {

    /* header/nav */
    h1#logo {
        font-size: 7vw;
    }

    nav ul#menu,
    #select-game,
    .result-row-content,
    #results-footer h2,
    #level,
    #time,
    #question-tracker {
        flex-direction: row;
    }

    .nav-toggle-label {
        font-size: 5vw;
    }

    #welcome,
    #final-results,
    #study-section {
        padding: 0.5em;
    }

    #game-selected,
    #time-left,
    #question-tally {
        width: unset;
        margin-left: 0.25em;
    }

    /* polaroids */
    .polaroid {
        --polaroid-width: 35vw;
    }

    /* flags */
    #flags figure span {
        font-size: 4vw;
    }

    #flags figure img {
        min-height: 150px;
        max-height: 150px;
    }

    #results-footer h2 span,
    .badge {
        width: fit-content;
    }

    /* study */
    #study-container {
        column-count: 2;
    }
}

@media screen and (min-width: 600px) {

    /* header/nav */
    h1#logo {
        font-size: 5vw;
    }

    nav {
        display: flex;
        position: unset;
        width: fit-content;
        margin: 0;
        padding: 0;
        box-shadow: none;
        background-color: unset;
    }

    #menu {
        display: flex;
    }

    .nav-toggle-label {
        display: none;
    }

    nav ul#menu > li {
        margin: 0 1em;
    }

    /* polaroids */
    .polaroid {
        --polaroid-width: 25vw;
        margin: -20px auto;
    }

    .polaroid.left {
        transform: scale(0.75) rotate(-5deg);
    }

    .polaroid.right {
        transform: scale(0.75) rotate(5deg);
    }

    #quiz-header,
    #quiz-footer {
        flex-direction: row;
    }

    #level,
    #time,
    #question-tracker,
    #next-btn,
    #results-btn {
        margin: 0;
        width: unset;
    }

    #flags figure span {
        font-size: 3vw;
    }

    /* study */
    dialog#study {
        max-width: 50vw;
    }

    #study-container {
        column-count: 3;
    }
}

@media screen and (min-width: 800px) {

    /* header/nav */
    h1#logo {
        font-size: 4vw;
    }

    /* polaroids */
    .polaroid {
        --polaroid-width: 20vw;
    }

    /* quiz section */
    #quiz-section {
        max-width: 80vw;
    }

    /* flags */
    #flags {
        max-width: 70vw;
    }

    #flags figure span {
        font-size: 3vw;
    }

    /* final results */
    #final-results {
        max-width: 75vw;
    }

    /* study */
    #study-container {
        column-count: 4;
    }

    .scores-row {
        flex-direction: row;
    }
}

@media screen and (min-width: 1000px) {

    /* header/nav */
    h1#logo {
        font-size: 3vw;
    }

    /* quiz section */
    #quiz-section {
        max-width: 60vw;
    }

    /* flags */
    #flags figure span {
        font-size: 2vw;
    }

    /* final results */
    #final-results {
        max-width: 60vw;
    }

    /* study */
    #study-container {
        column-count: 5;
    }
}

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

    /* header/nav */
    h1#logo {
        font-size: 2vw;
    }

    /* polaroids */
    .polaroid {
        --polaroid-width: 13vw;
        margin: 0 auto;
    }

    /* flags */
    #flags {
        max-width: 50vw;
    }

    /* final results */
    #final-results {
        max-width: 50vw;
    }

    /* study */
    #study-container {
        column-count: 6;
    }
}


/* hide / disable */

.hide {
    display: none;
}

.disable {
    pointer-events: none;
}

.btn.disable {
    color: lightsteelblue !important;
    background-color: lightslategray !important;
}
