/** CSS @ Rules **/

@font-face {
    font-family: "DM Sans";
    src: url("../fonts/DMSans-Regular.woff2") format("woff2");
    font-display: swap;
}

@keyframes profileCard {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@view-transition {
    navigation: auto;
}

/** CSS Variables **/

:root {
    --background-color: linear-gradient(45deg, rgb(0, 0, 0) 0%, rgb(69, 69, 96) 100%);
    --text-color: #ffffff;
    --primary-color: #a9ffff;
    --accent-color: #ff0045;
    --shadow: 5px 5px 10px rgba(0, 0, 0, 0.5);
}

:root[data-theme="light"] {
    --background-color: linear-gradient(20deg, rgb(255, 255, 255) 0%, rgb(255, 255, 255) 80%, rgb(69, 255, 169) 100%);
    --text-color: #000000;
    --primary-color: #ff00a9;
    --accent-color: #45ffa9;
}


@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --background-color: linear-gradient(20deg, rgb(255, 255, 255) 0%, rgb(255, 255, 255) 80%, rgb(69, 255, 169) 100%);
        --text-color: #000000;
        --primary-color: #ff00a9;
        --accent-color: #45ffa9;
    }
}

/** Global Styles **/

* {
    font-family: "DM Sans", Arial, Helvetica, sans-serif;
    font-size: 1.05rem;
    line-height: 2;

    /* Reset default browser styles */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas: "header main";
    height: 100vh;
    height: 100dvh;
    background: var(--background-color, #1c1c1c);
    color: var(--text-color, #ffffff);
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
    margin: 1.5rem 0;
}

h4 {
    &::before {
        content: "- ";
        color: var(--primary-color, #a9ffff);
    }

    &::after {
        content: " -";
        color: var(--primary-color, #a9ffff);
    }
}

h1,
h2,
h3,
h4 {
    font-weight: bold;
    line-height: 1;
    margin: 1.5rem 0;
}

ul,
ol {
    padding-left: 2rem;
    list-style-position: inside;
}

a {
    transition: background-color 1s ease, color 1s ease;
    background-color: transparent;
    color: var(--primary-color, #a9ffff);

    &:hover {
        transition: background-color 0s, color 0s;
        background-color: var(--accent-color, #ff0045);
        color: var(--text-color, #ffffff);
    }
}

button {
    background-color: var(--accent-color, #ff0045);
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    margin: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 1s ease;

    &:hover {
        background-color: var(--primary-color, #a9ffff);
        transition: background-color 0.1s ease;
    }
}

header {
    grid-area: header;
    padding: 0 1.5rem;
    border-right: 1px dashed var(--text-color, #ffffff);
}

nav {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;

    a {
        text-decoration: none;
    }

    ul {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 1rem 0;
        padding: 0;

        li {
            list-style: none;
            margin: 0.5rem 0;
        }
    }

    label {
        display: none;
    }
}

#homepage {
    display: flex;
    text-decoration: none;
    align-items: center;
    gap: 0.5rem;

    &>span {
        display: flex;
        flex-direction: column;
        font-size: 2.5rem;
        font-weight: bold;
        line-height: 1;
    }
}

.spinner {
    transition: transform 1s ease;

    &:hover {
        transition: transform 0.2s ease-in-out;
        transform: rotate(360deg);
    }
}

main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;

    /* Main content area */
    &>div {
        will-change: opacity;
        flex: 1;
        overflow-y: auto;
        margin: auto;
        padding: 1rem 2rem;
        width: 90%;
        max-width: 800px;

        p {
            margin: 0.5rem 0;
        }

        main-header {
            margin: 2rem;
        }

        hgroup {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin: 5rem 0;

            h2 {
                font-size: 2.5rem;
                margin: 0 1rem;
            }
        }
    }

    &>footer {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1rem;
        border-top: 1px dashed var(--text-color, #ffffff);

        ul {
            display: flex;
            flex-direction: row;
            margin: 0;
            gap: 1rem;
        }
    }
}

#profile {
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: var(--shadow, 5px 5px 10px rgba(0, 0, 0, 0.5));
    border-radius: 1rem;
    padding: 1rem;
    animation-name: profileCard;
    animation-duration: 0.5s;
    animation-iteration-count: 1;
}

.wishlist {
    list-style: none;

    a {
        transition: background-color 1s ease-in, color 1s ease-in;
        background-color: transparent;
        color: var(--primary-color, #a9ffff);
        display: block;

        &:hover {
            transition: background-color 0.1s ease-out, color 0.1s ease-out;
            background-color: var(--accent-color, #ff0045);
            color: var(--text-color, #ffffff);
        }
    }
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #2a2a33;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color, #baffe7);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color, #ff0059);
}

@media screen and (max-width: 1200px) {
    body {
        &>main {
            &>div {
                min-width: 100%;
            }
        }
    }

    #profile {
        flex-direction: column;
        text-align: center;
    }
}

@media screen and (max-width: 768px) {
    body {
        display: flex;
        flex-direction: column;
    }

    header {
        border-right: 0;
        border-bottom: 1px dashed var(--text-color, #ffffff);
    }

    nav {
        padding-top: 1rem;

        &>a {
            margin-block-end: 1rem;
        }

        bottom-nav {
            display: flex;
            flex-direction: column;
            align-items: center;

            label {
                display: flex;

            }
        }

        .menu {
            display: none;
        }

        .hamburger {
            display: inline-block;
            cursor: pointer;
        }

        #menu-toggle:checked~.menu {
            display: flex;
        }

        .hamburger svg rect {
            fill: var(--text-color, #ffffff);
            transition: opacity 0.2s;
        }

        #menu-toggle:checked+.hamburger svg rect:nth-child(2) {
            opacity: 0;
        }
    }

    main {
        main-header hgroup {
            display: flex;
            flex-direction: column;
        }

        &>div {
            padding: 1rem;
        }

        footer nav {
            padding: 0;
        }
    }
}