/* ============================================================
   Nav v2 — compact header navigation with dropdown support.
   Scoped to body.nav-v2 so it can be adopted page-by-page.

   Changes from the original nav:
   - Desktop menu appears at 992px instead of 768px, so tablets
     use the hamburger menu and items never overflow the header.
   - Slightly tighter spacing between items.
   - Support for dropdown submenus ("Documents") that open on
     hover and on keyboard focus.
   ============================================================ */

/* Tablets (768–991px) keep the hamburger menu instead of the
   desktop nav, which is too wide to fit at those sizes. */
@media (min-width: 768px) and (max-width: 991.98px) {
    body.nav-v2 .main-navigation,
    body.nav-v2 .header-cta {
        display: none;
    }

    body.nav-v2 .mobile-menu-toggle {
        display: flex;
    }

    body.nav-v2 .mobile-menu-dropdown {
        display: block;
    }
}

@media (min-width: 992px) {
    body.nav-v2 .nav-menu {
        gap: 1.4rem;
    }
}

/* ---------- Dropdown submenus ---------- */
body.nav-v2 .nav-menu li.menu-item-has-children {
    position: relative;
}

body.nav-v2 .nav-menu li.menu-item-has-children > a > .caret {
    display: inline-block;
    font-size: 0.6em;
    margin-left: 0.3em;
    vertical-align: middle;
}

body.nav-v2 .nav-menu .sub-menu {
    list-style: none;
    position: absolute;
    top: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    margin: 0;
    padding: 0.5rem 0;
    background: rgba(255, 254, 249, 0.99);
    border: 1px solid rgba(61, 79, 61, 0.12);
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1002;
}

/* Invisible bridge so the pointer can travel from the menu item
   down to the submenu without it closing. */
body.nav-v2 .nav-menu .sub-menu::before {
    content: "";
    position: absolute;
    top: -16px;
    left: 0;
    right: 0;
    height: 16px;
}

body.nav-v2 .nav-menu li.menu-item-has-children:hover > .sub-menu,
body.nav-v2 .nav-menu li.menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
}

body.nav-v2 .nav-menu .sub-menu li {
    display: block;
}

body.nav-v2 .nav-menu .sub-menu a {
    display: block;
    padding: 0.5rem 1.25rem;
    white-space: nowrap;
    border-bottom: none;
    font-weight: 500;
}

body.nav-v2 .nav-menu .sub-menu a:hover {
    background-color: rgba(88, 168, 140, 0.12);
}

/* Indented sub-items in the mobile menu */
body.nav-v2 .mobile-nav-menu li.mobile-subitem a {
    padding-left: 3.25rem;
    font-size: 0.95rem;
}
