.header {
    background-color: #080808;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 20px;
    padding-right: 20px;
    position: sticky; /* Makes the nav bar stick to the top when you scroll down. Similar to position: fixed; */
    top: 0; /* Header will stick to the top of viewport */
    z-index: 100; /* Ensures it stays on top of other content */
    width: 100%;
    border-bottom: 1px solid #222;
}

nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap
}

.header nav ul {
    margin: 0;
    padding: 0;
    list-style: none; /* Removes the bullet points */
    display: flex; /* Makes the header a horizontal list, instead of vertical */
    justify-content: center;
    gap: 60px; /* Adding space between each item in header */
}

.header nav ul li a {
    color: white;
    text-decoration: none; /* Removes the underline from links (Since all the elements in the header are essentially links to other sections on this webpage */
    font-size: 20px;
    font-weight: bold;
    transition: color 0.3s;
    position: relative;
}

/* --- Underline Animation --- */
nav ul li a::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 0;
    height: 3px;
    background: linear-gradient(270deg, #ff004f, #4743EF, #ff004f);
    background-size: 400% 100%;
    background-position: 0% 50%;
    transform: translateX(-50%);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* This applies the style on either hover or when active */
nav ul li a:hover::after,
.header nav ul li a.nav-active::after {
    width: 100%;
    animation: gradientFlow 3s linear infinite;
}

/* Smooth continuous flow */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 100% 50%;
    }
}


/* Hide both hamburger and close icons by default on desktop */
.icon-hamburger,
.icon-close {
    display: none;
    width: 30px;
    height: 30px;
    stroke: #fff;
    cursor: pointer;
}

header nav ul li a {
    font-size: 1.5rem;
}


/* The following syntax will only run when screen size is less than 768px (Mobile screens) */
@media (max-width: 768px) {

    nav ul li a::after {
        display: none;
    }

    /* Putting the hamburger icon to the far right */
    nav {
        justify-content: flex-end;
        min-height: 30px;
    }

    .icon-hamburger {
        display: block;
    }

    .icon-close {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 101; /* Making sure it's above the menu */
    }

    .header nav ul {
        background: #111111;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
        position: fixed;
        top: 0;
        right: -300px; /* Start the menu off-screen */
        width: 300px;
        max-width: 80%;
        height: 100vh;
        flex-direction: column; /* Stacking the links vertically */
        justify-content: flex-start; /* Aligning links to top */
        align-items: flex-start;
        gap: 25px;
        padding-top: 100px;
        padding-left: 30px;
        box-sizing: border-box;
        transition: right 0.5s ease;
    }

    .header nav ul li a {
        font-size: 1.5rem;
    }

    /* Hiding the underlines in the mobile menu */
    nav ul li a::after {
        display: none;
    }

    .header nav ul.open {
        right: 0; /* Sliding the menu into view */
    }

    .header nav ul.open+.icon-hamburger {
        display: none; /* Hide hamburger icon when the side navigation menu is open*/
    }

    .header nav ul.open+.icon-hamburger+.icon-close {
        display: block;
        /* Show close icon when the side navigation menu is open*/
    }
}

/* --- Style for the active nav link (on scroll) --- */

.header nav ul li a.nav-active {
    color: #ff004f;
}
