@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');

html {
    scroll-behavior: smooth;
}

*,
*::after,
*::before {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: transparent;
}

svg {
    height: 2em;
    width: 2em;
}

:root {
    --primary-color: hsl(284, 66%, 55%);
    --primary-hover: hsl(284, 46%, 65%);
    --text-color: hsl(0, 0%, 100%);
    --background-color: hsl(0, 0%, 7%);
    --secondary-text-color: hsl(0, 0%, 73%);

    --text-color-translucent: hsla(0, 0%, 100%, 0.5);
    --secondary-text-color-translucent: hsla(0, 0%, 73%, 0.5);
    --navbar-hover: hsla(0, 0%, 73%, 0.2);

    --navbar-bg: rgba(0, 0, 0, 1);
    --hero-bg-gradient: linear-gradient(135deg, hsl(0, 0%, 12%) 0%, hsl(0, 0%, 20%) 100%);
    --nav-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);

    --primary: hsl(46, 97%, 40%);
    --secondary: hsl(229, 37%, 40%);
    --accent: hsl(14, 90%, 40%);
    --card-background: hsl(318, 28%, 58%);
}

body.light-theme {
    --primary-color: hsl(284, 66%, 45%);
    --primary-hover: hsl(284, 46%, 55%);
    --text-color: hsl(0, 0%, 10%);
    --background-color: hsl(0, 0%, 95%);
    --secondary-text-color: hsl(0, 0%, 40%);

    --text-color-translucent: hsla(0, 0%, 10%, 0.5);
    --secondary-text-color-translucent: hsla(0, 0%, 40%, 0.5);
    --navbar-hover: hsla(0, 0%, 40%, 0.2);

    --navbar-bg: rgba(255, 255, 255, 1);
    --hero-bg-gradient: linear-gradient(135deg, hsl(0, 0, 88%) 0%, hsl(0, 0%, 80%) 100%);
    --nav-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);

    --primary: hsl(46, 97%, 50%);
    --secondary: hsl(229, 37%, 50%);
    --accent: hsl(14, 90%, 50%);
    --card-background: hsl(318, 28%, 88%);
}

:root {
    --font-family: "Inter", Helvetica, Arial, sans-serif;
    --fw-normal: 300;
    --fw-medium: 500;
    --fw-large: 700;

    --fc-light: hsl(0, 0%, 100%);
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;

    font-family: var(--font-family);
    font-weight: var(--fw-normal);
    line-height: 1.5;

    background: var(--background-color);
    color: var(--text-color);
}

a,
button {
    all: unset;
}

a,
#themeIcon {
    cursor: pointer;
}

/* Navigation Bar */

.navbar {
    position: fixed;
    width: 100%;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25em 4em;
    background-color: var(--navbar-bg);
    z-index: 999;

    & .logo a {
        font-size: 1.8rem;
        font-weight: bold;
        color: var(--text-color);
        text-decoration: none;
    }
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    transition: top 0.3s ease-in-out;
    gap: 0.5em;

    & a {
        color: var(--text-color);
        font-weight: bold;
        text-decoration: none;
        transition: color 0.3s ease;

        padding: 0.5em;
        border-radius: 5px;

        &:hover {
            background-color: var(--navbar-hover);
        }
    }
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    align-items: center;

    display: flex;
    align-items: center;
    gap: 1em;

    &:hover {
        color: var(--primary-color);
    }

    & svg {
        display: block;
        margin-right: 5px;
    }
}

.theme-text {
    display: none;
    font-weight: bold;
}

/* Mobile Menu Icon */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;

    z-index: 1000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 15px 20px;
    }

    .navbar .logo a {
        font-size: 1.5rem;
    }

    .nav-links {
        position: fixed;
        top: -100%;
        left: 0;
        width: 100%;
        height: 25vh;
        background-color: var(--background-color);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 2em;
        gap: 1em;

        box-shadow: var(--nav-shadow);
    }

    .nav-links.active {
        top: 0;
    }

    .theme-toggle svg {
        display: none;
    }

    .theme-text {
        display: inline;
    }

    .menu-toggle {
        display: block;
    }
}

.btn {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-inline: auto;

    padding: 0.5em 1em;
    gap: 0.5em;

    width: fit-content;
    height: fit-content;
    font-weight: var(--fw-medium);

    background: var(--secondary);
    color: var(--fc-light);

    cursor: pointer;
    border-radius: 5px;

    &:hover,
    &:focus {
        background-color: var(--accent);
    }
}

section {
    min-height: 80svh;

    display: flex;
    flex-direction: column;
    justify-content: center;

    padding-block: 3em;

    span {
        font-weight: var(--fw-large);
        font-size: 1.5em;
    }
}

.wrapper {
    max-width: min(80ch, 90%);
    margin-inline: auto;
}

/* Game options selection */
.introduction {
    text-align: center;
    text-wrap: pretty;

    background: var(--background-50);
    padding: 4em 1em;

    >.btn {
        margin-block: 1em;
    }
}

.quizIcons {
    display: flex;
    flex-wrap: wrap;

    justify-content: center;
    gap: 1em;
    margin-bottom: 1em;

    .quizIcon {
        padding: min(4vw, 2em);
        border-radius: 5px;

        &:nth-child(1) {
            background: var(--primary);
        }

        &:nth-child(2) {
            background: var(--secondary);
        }

        &:nth-child(3) {
            background: var(--accent);
        }

        &:nth-child(4) {
            background: var(--card-background);
        }

        svg {
            width: min(25vw, 5em);
            height: min(25vw, 5em);
        }
    }
}

.optionsButton {
    padding: 0.5em 1em;
    background: var(--primary);
    border-radius: 5px;

    cursor: pointer;

    &:hover,
    &:focus {
        background-color: var(--secondary);
        color: white;
    }
}

.options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;

    padding: 1em 0em;
}

.selected {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    align-items: center;

    .selectedText {
        background-color: var(--background-50);
        border-radius: 4px;
        border: 1px solid var(--text);

        pointer-events: none;
        font-weight: var(--fw-medium);

        padding: 0.5em 1em;
        opacity: 0.5;
        flex: 1 20ch;
    }
}

/* GameBoard */
#gameBoard .btn {
    margin-top: 0.75em;
}

.question {
    font-weight: var(--fw-large);
    pointer-events: none;
}

.text {
    padding: 0.5em 1em;
    border-radius: 5px;
}

.questionsOption {
    cursor: pointer;
    margin-block: 0.25em;
    border: 1px dotted var(--text);

    transform: scaleX(1);
    transition: all ease-out 200ms;

    &:hover,
    &:focus {
        background-color: var(--secondary);
        color: var(--fc-light);
    }
}

[data-selected="true"] {
    background: var(--primary);
    transform: scaleX(1.02);
}

/* Results Screen */
.results {
    background: var(--background-50);
    border-radius: 5px;
    padding: 2em 0;

    display: flex;
    flex-direction: column;
    align-items: center;

    span {
        color: var(--primary);
    }

    .score {
        margin-bottom: 0.5em;

        color: var(--accent);
        font-weight: var(--fw-large);
        font-size: 3em;
    }
}

/* Alert Messages */
.alert {
    position: fixed;

    inset: 90vh 0 0 0;
    opacity: 0.75;

    width: fit-content;
    height: fit-content;
    margin-inline: auto;

    font-weight: var(--fw-large);

    display: flex;
    align-items: center;
    gap: 0.5em;

    padding: 0.5rem 2rem;
    border-radius: 5px;
}

.info {
    color: #059;
    background-color: #bef;
}

.success {
    color: #270;
    background-color: #dff2bf;
}

.warning {
    color: #9F6000;
    background-color: #FEEFB3;
}

.error {
    color: #d8000c;
    background-color: #ffbaba;
}

.hidden {
    display: none;
    pointer-events: none;
}