/* SGEM New's inline submenu treatment, retaining Green's menu and typography. */
/* Native fragment links remain visible beneath the persistent header/news strip. */
body.vgreen-theme [id] { scroll-margin-top: 170px; }
body.vgreen-theme #top .dropdown-link {
    white-space: normal;
    overflow-wrap: break-word;
}

@media (min-width: 1021px) {
    body.vgreen-theme #top .nav-item > .dropdown {
        top: calc(100% + 10px);
        width: max-content;
        min-width: 262px;
        max-width: min(340px, calc(100vw - 44px));
        max-height: calc(100vh - 170px);
        max-height: calc(100dvh - 170px);
        padding: 10px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: #32965a #111c17;
    }
    body.vgreen-theme #top .nav-item:nth-child(-n+5) > .dropdown {
        left: 0;
        right: auto;
        transform: translate(0, 10px);
    }
    body.vgreen-theme #top .nav-item:nth-child(6) > .dropdown {
        left: 50%;
        right: auto;
        transform: translate(-50%, 10px);
    }
    body.vgreen-theme #top .nav-item:nth-child(n+7) > .dropdown {
        left: auto;
        right: 0;
        transform: translate(0, 10px);
    }
    body.vgreen-theme #top .nav-item:hover > .dropdown,
    body.vgreen-theme #top .nav-item:focus-within > .dropdown {
        transform: translate(0, 0);
    }
    body.vgreen-theme #top .nav-item:nth-child(2) > .dropdown {
        width: 340px;
    }
    body.vgreen-theme #top .nav-item:nth-child(6):hover > .dropdown,
    body.vgreen-theme #top .nav-item:nth-child(6):focus-within > .dropdown {
        transform: translate(-50%, 0);
    }
    /* A transparent descendant bridges the header-to-panel spacing. */
    body.vgreen-theme #top .nav-item.has-dropdown::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        height: 12px;
    }
    body.vgreen-theme #top .dropdown-item {
        border-bottom: 1px solid rgba(182, 227, 194, .1);
    }
    body.vgreen-theme #top .dropdown-item:last-child {
        border-bottom: 0;
    }
    body.vgreen-theme #top .dropdown-link {
        min-height: 42px;
        padding: 10px 12px;
        line-height: 1.2;
    }
    body.vgreen-theme #top .dropdown-link span {
        min-width: 0;
    }
    body.vgreen-theme #top .dropdown-link b {
        flex: 0 0 auto;
    }
    body.vgreen-theme #top .dropdown-submenu {
        position: static;
        display: none;
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: none;
        margin: 0 8px 9px;
        padding: 5px 0;
        border: 0;
        border-left: 2px solid rgba(79, 199, 118, .72);
        background: #111f18;
        box-shadow: none;
        transform: none;
        opacity: 1;
        visibility: visible;
        transition: none;
    }
    body.vgreen-theme #top .dropdown-item.has-dropdown:hover > .dropdown-submenu,
    body.vgreen-theme #top .dropdown-item.has-dropdown:focus-within > .dropdown-submenu {
        display: block;
        transform: none;
    }
    body.vgreen-theme #top .dropdown-submenu .dropdown-link {
        min-height: 36px;
        padding: 8px 11px 8px 15px;
        color: #d9ecde;
        line-height: 1.18;
    }
    body.vgreen-theme #top .dropdown-link:focus-visible {
        outline: 2px solid #63d98b;
        outline-offset: -2px;
    }
    /* JS supplies hover intent so tiny pointer gaps cannot collapse the panel. */
    body.vgreen-theme #top .vgreen-managed-menu .nav-item > .dropdown {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translate(0, 10px);
    }
    body.vgreen-theme #top .vgreen-managed-menu .nav-item.is-menu-open > .dropdown {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translate(0, 0);
    }
    body.vgreen-theme #top .vgreen-managed-menu .nav-item:nth-child(6) > .dropdown {
        transform: translate(-50%, 10px);
    }
    body.vgreen-theme #top .vgreen-managed-menu .nav-item:nth-child(6).is-menu-open > .dropdown {
        transform: translate(-50%, 0);
    }
    body.vgreen-theme #top .vgreen-managed-menu .dropdown-item > .dropdown-submenu {
        display: none;
    }
    body.vgreen-theme #top .vgreen-managed-menu .dropdown-item.is-menu-open > .dropdown-submenu {
        display: block;
    }
}

@media (min-width: 1021px) and (max-width: 1200px) {
    /* Keep the original central-logo gap while the desktop columns narrow. */
    body.vgreen-theme #top .nav-list {
        grid-template-columns: 32px 90px 105px 90px minmax(142px, 1fr) 110px 100px 92px 78px;
    }
    body.vgreen-theme #top .nav-link {
        font-size: 12px;
        letter-spacing: 0;
    }
    body.vgreen-theme #top .nav-link em {
        font-size: 9px;
    }
    body.vgreen-theme #top .nav-item:nth-child(5) > .dropdown {
        left: 12px;
    }
}

@media (max-width: 1020px) {
    body.vgreen-theme #top {
        background: #090d0f;
    }
    /* Keep the existing stacked mobile links, with every item reachable. */
    body.vgreen-theme #top .main-nav {
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
    }
    body.vgreen-theme #top .nav-toggle {
        display: inline-flex;
        width: 44px;
        height: 40px;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        border: 1px solid var(--green-light);
        background: var(--graphite-soft);
        cursor: pointer;
    }
    body.vgreen-theme #top .nav-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        margin: 0 auto;
        background: var(--green-light);
    }
    body.vgreen-theme #top .nav-list {
        display: none;
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        margin-top: 14px;
        padding: 12px;
        background: var(--graphite);
    }
    body.vgreen-theme #top .nav-item:nth-child(5) {
        grid-column: auto;
    }
    body.vgreen-theme #top .nav-item {
        text-align: left;
    }
    body.vgreen-theme #top .nav-link {
        min-height: 34px;
        align-items: flex-start;
    }
    body.vgreen-theme #top .dropdown {
        position: static;
        display: block;
        width: auto;
        min-width: 0;
        max-width: none;
        padding: 0 0 8px 18px;
        background: transparent;
        border: 0;
        box-shadow: none;
        transform: none;
        opacity: 1;
        visibility: visible;
    }
    body.vgreen-theme #top .nav-list.is-open {
        display: grid;
        max-height: calc(100vh - 170px);
        max-height: calc(100dvh - 170px);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    body.vgreen-theme #top .dropdown-submenu {
        border-left: 1px solid rgba(79, 199, 118, .4);
        margin-left: 8px;
    }
}
