/* Navigation Styles */
nav {
    background-color: seagreen;
    color: seashell;
    padding: 0;
    display: flex;
    justify-content: space-between;
    height: 120px;
}

.dev-nav {
    background-color: #2f4f4f;
}

.nav-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1vh 4vw 2vh;
}

nav ul {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: auto 0;
}

nav li {
    list-style: none;
}

nav li a {
    color: seashell;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 8px;
    margin-right: 6px;
}

nav li a,
nav li .btn {
    font-size: 1.2rem;
}

nav li a:hover:not(.btn) {
    color: white;
    text-decoration: none;
    font-weight: bolder;
}

/* Mobile-responsive navigation */
@media only screen and (max-width: 800px) {
    nav {
        display: flex;
        flex-direction: column;
        height: auto;
        padding: 0;
    }

    .nav-top-bar {
        padding: 2vh 4vw;
    }

    .head-title-logo img {
        max-height: 72px;
    }

    /* hide checkbox */
    .menu-toggle-input {
        display: none;
    }
    
    /* toggle button */
    .menu-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        width: 40px;
        height: 40px;
        margin-top: 0;
        border: 2px solid rgba(255,255,255,0.8);
        border-radius: 6px;
        background: transparent;
        cursor: pointer;
        color: seashell;
    }
    
    .menu-toggle-bar {
        display: block;
        width: 22px;
        height: 2px;
        background-color: seashell;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        transform-origin: center;
    }
    
    /* Hamburger animation - transforms into X when menu is open */
    #menu-toggle:checked + .nav-top-bar .menu-toggle-bar:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }
    
    #menu-toggle:checked + .nav-top-bar .menu-toggle-bar:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    
    #menu-toggle:checked + .nav-top-bar .menu-toggle-bar:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    nav ul {
        width: 100%;
        flex-direction: column;
        justify-content: center;
        align-items: stretch;
        gap: 8px;
        margin: 0;
        padding: 0 4vw;
        display: flex; /* Always flex, but hidden with opacity and max-height */
        background-color: rgba(0, 0, 0, 0.15); /* darker bg */
        border-top: 2px solid rgba(255, 255, 255, 0.3); /* separation line */
        
        /* Animation properties */
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        transform: translateY(-10px);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    nav li {
        width: 100%;
        text-align: center;
        opacity: 0;
        transform: translateY(-10px);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    nav li a,
    nav li .btn {
        display: block;
        width: 100%;
        padding: 12px 16px;
        font-size: 1rem; /* slightly smaller to fit */
        border-radius: 6px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Improve touch target spacing */
    nav li a + a,
    nav li .btn + .btn {
        margin-top: 4px;
    }

    /* show when toggled with smooth animations */
    #menu-toggle:checked + .nav-top-bar + #nav-menu {
        opacity: 1;
        max-height: 300px;
        padding-top: 2vh;
        padding-bottom: 2vh;
        transform: translateY(0);
    }
    
    /* Animate menu items when menu opens */
    #menu-toggle:checked + .nav-top-bar + #nav-menu li {
        opacity: 1;
        transform: translateY(0);
    }
    
    #menu-toggle:checked + .nav-top-bar + #nav-menu li:nth-child(1) {
        transition-delay: 0.1s;
    }
    
    #menu-toggle:checked + .nav-top-bar + #nav-menu li:nth-child(2) {
        transition-delay: 0.2s;
    }
    
    #menu-toggle:checked + .nav-top-bar + #nav-menu li:nth-child(3) {
        transition-delay: 0.3s;
    }
    
    #menu-toggle:checked + .nav-top-bar + #nav-menu li:nth-child(4) {
        transition-delay: 0.4s;
    }
}

/* Desktop */
@media only screen and (min-width: 800px) {
    .menu-toggle,
    .menu-toggle-input { 
        display: none; 
    }

    #nav-menu {
        padding-right: 4vw;
    }
}
