/* --- Header and Navigation Base Styles --- */
.header {
    background-color: var(--white-color);
    padding: 1rem 0;
    border-bottom: 1px solid var(--medium-gray);
    position: sticky; /* Keep sticky */
    top: 0;
    z-index: 1030; /* Ensure header is above other content */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header .logo a {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--darkest-gray);
}
/* Desktop Navigation */
.navigation ul.main-menu {
    list-style: none;
    display: flex; /* Horizontal layout for desktop */
    gap: 0;
    align-items: center;
    padding-left: 0;
    margin-bottom: 0;
}
.navigation ul li {
    position: relative; /* For absolute positioning of sub-menu */
    margin-bottom: 0; /* Reset margin for nav items */
}
.navigation ul li > a {
    color: var(--darker-gray);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    display: block;
    border-radius: var(--border-radius);
}
.navigation ul li > a:hover,
.navigation ul li:focus-within > a {
    color: var(--primary-color);
    background-color: #e7f3ff;
}
/* Desktop Sub-menu */
.sub-menu {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--white-color);
    border: 1px solid var(--medium-gray);
    border-top: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    padding: 0.5rem 0;
    min-width: 200px;
    z-index: 1001; /* Above other elements */
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    list-style: none;
    margin-bottom: 0; /* Reset margin */
}
.navigation ul li:hover > .sub-menu,
.navigation ul li > a:focus + .sub-menu,
.navigation ul li .sub-menu:hover {
    display: block; /* Show on hover/focus for desktop */
}
.sub-menu li {
    width: 100%;
    margin-bottom: 0; /* Reset margin */
}
.sub-menu li a {
    padding: 0.6rem 1.25rem;
    white-space: nowrap;
    color: var(--darker-gray);
    font-size: 0.9rem;
    display: block;
    border-radius: 0;
}
.sub-menu li a:hover, .sub-menu li a:focus {
    background-color: var(--primary-color);
    color: var(--white-color);
}

/* --- Mobile Menu Toggle Button --- */
.mobile-menu-toggle {
    display: none; /* Hidden by default, shown in media query */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px; /* Clickable area */
    margin: 0; /* Reset margin */
    z-index: 1040; /* Above navigation */
}
.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--darkest-gray);
    margin: 5px 0;
    transition: all 0.3s ease;
}
/* Add animation for toggle button if needed (e.g., transform to 'X') */

/* Tablet & Mobile (992px and below) */
@media (max-width: 992px) {
    /* --- Mobile Navigation Styles --- */
    .navigation {
        display: none; /* Hide standard navigation */
        /* Styles for when the mobile menu is active (toggled by JS) */
        position: absolute;
        top: 100%; /* Position below header */
        left: 0;
        right: 0;
        background-color: var(--white-color);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        border-top: 1px solid var(--medium-gray);
        padding: 1rem 0;
        z-index: 1000;
    }

    /* JS adds this class to show the menu */
    .navigation.is-active {
        display: block;
    }

    .navigation ul {
        flex-direction: column; /* Stack items vertically */
        align-items: stretch; /* Full width items */
        gap: 0;
    }

    .navigation ul li {
       border-bottom: 1px solid var(--medium-gray);
    }
    .navigation ul li:last-child {
        border-bottom: none;
    }

    .navigation ul li > a {
        padding: 1rem 1.5rem; /* Adjust padding */
        text-align: center;
        border-radius: 0; /* Remove radius */
    }
     .navigation ul li > a:hover,
     .navigation ul li:focus-within > a {
         background-color: #e7f3ff; /* Keep hover effect */
     }

    /* Mobile Sub-menu: Hidden by default, shown via JS */
    /* Needs JS to toggle '.is-open' on the parent 'li' */
    .navigation ul li .sub-menu {
        display: none;
        position: static; /* Remove absolute positioning */
        box-shadow: none;
        border: none;
        padding: 0;
        max-height: none;
        min-width: auto;
        background-color: var(--light-gray); /* Slight indent background */
        overflow-y: visible;
    }
    .navigation ul li.is-open > .sub-menu { /* Show when parent li has .is-open (JS) */
       display: block;
    }

    .sub-menu li a {
        padding: 0.8rem 2rem; /* Indent sub-items */
        font-size: 0.9rem;
        color: var(--dark-gray);
        text-align: center;
    }
     .sub-menu li a:hover, .sub-menu li a:focus {
         background-color: var(--primary-color);
         color: var(--white-color);
     }

    /* Show the mobile toggle button */
    .mobile-menu-toggle {
        display: block;
    }

}