@keyframes navAnim {
    from{ height: 0; }
    to{ height: var(--nav); }
}

nav {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: var(--nav);
    background-color: rgb(46, 51, 51);
    animation: navAnim 0.5s;
    position: relative;
    z-index: 1000;
}

nav .nav-toggle {
    display: none; 
    font-size: 2rem;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

nav .nav-links {
    display: flex;
    gap: 15px;
}

nav a {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    font-weight: bolder;
    margin: 5px;
    text-decoration: none;
    color: white;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #fff;
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}

nav a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

@media (max-width: 768px) {
    nav {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        animation: none;
    }

    nav .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    nav .nav-links a {
        padding: 15px;
        text-align: left;
        width: 100%;
        margin: 0;
        background-color: rgb(46, 51, 51);
        border-bottom: 1px solid white;
    }

    nav .nav-links a:last-child {
        border-bottom: none;
    }

    nav .nav-toggle {
        display: block;
    }

    nav.active .nav-links {
        display: flex;
    }
}
