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

:root{
    --nav-primary: 0, 0%, 60%;
    --nav-height: 4rem;
}

body{
    overflow-x: hidden;
}

/* Header */

header{
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 5;
}

nav{
    position: relative;
    width: 100%;
    height: 100%;
}

nav::before{
    content: "";
    display: block;
    width: 100%;
    height: 100%;  
    background-color: hsl(var(--nav-primary));  
}
nav::after{
    position: absolute;
    content: "";
    display: block;
    width: 100%;
    height: 2px;
    bottom: 0;
    background-color: hsla(0, 0%, 100%, 0.1);
}

nav .hamburger{
    position: absolute;
    top: 0rem;
    right: 0.5rem;
    aspect-ratio: 10/14;
    height: 100%;
    will-change: transform;
    transform: rotate(0deg);
    transition: transform 0.5s ease-in-out;
}

nav .hamburger.active{
    transform: rotate(-360deg);
}

nav .hamburger>svg{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.5s ease-in-out;
}


nav .hamburger>svg:nth-child(1){ opacity: 1;}
nav .hamburger.active>svg:nth-child(1){ opacity: 0;}
nav .hamburger>svg:nth-child(2){ opacity: 0;}
nav .hamburger.active>svg:nth-child(2){ opacity: 1;}

nav .hamburger, nav li{
    cursor: pointer;
}

nav ul{
    position: absolute;
    display: flex;
    flex-direction: column;
    list-style: none;
    opacity: 0;
}

nav ul, nav::before{
    will-change: transform;
    transition: transform 0.3s ease-in-out;
    transform: translateX(100%);
}

nav .hamburger.active+ul,nav h5.active+ul, nav:has(.hamburger.active)::before{
    transform: translateX(0%);
}

nav li{
    padding-left: 1rem;
    font-size: 1.5rem;
}

nav li h5.active+ul, nav .hamburger+ul{
    position: relative;
    opacity: 1;
}

nav li>h5,nav li:not(:has(h5)){
    position: relative;
    height: 3rem;
    width: 100%;
    display: flex;
    align-items: center;
}

nav li:not(:last-child){
    position: relative;
}
nav li:not(:last-child)::after{
    position: absolute;
    content: "";
    display: block;
    width: 100%;
    height: 2px;
    bottom: 0;
    background-color: hsla(0, 0%, 100%, 0.1);
}

@media screen and (min-width: 768px) {
    :root{
        --nav-height: 3rem;
    }
    nav .hamburger{
        display: none;
    }
    nav::before,nav::after{
        display: none;
    }
    nav>ul:first-of-type{
        position: relative;
        flex-direction: row;
        justify-content: center;
        gap: 2rem;
        top: 0;
        display: flex;
    }
    nav li{
        padding-left: 0;
        width: 6rem;
        text-align: center;
        transition: background-color 0.3s ease-in-out;
        position: relative;
    }
    nav li:hover{        
        background-color: hsla(0, 0%, 100%, 0.2);
    }
    nav li:hover>ul{
        display: flex;
    }
    nav li h5{
        justify-content: center;
    }
    nav ul{
        transform: initial;
        display: none;
        opacity: 1;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        min-height: var(--nav-height);
        width: 100%;
    }

    nav ul ul {
        width: 125%;
    }
    nav ul ul li{
        padding-left: 1rem;
        width: 100%;
    }
    nav ul ul li h5{
        justify-content: flex-start;
    }
    nav ul ul ul{
        top: 0;
        left: 100%;
    }
    
}