/* Avalon mega-menu — desktop panel + mobile accordion.
   Colours reuse main.css tokens and the .secdark treatment only; no new palette. */

/* ---- trigger ---- */
.nav-item { position: relative }
.mega-trigger { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; padding: 0; margin: 0; font-family: inherit; cursor: pointer }
.mega-caret { width: 9px; height: 9px; opacity: .7; transition: transform .2s }
.nav-item.open .mega-caret { transform: rotate(180deg) }

/* the menu sits on the right of the logo, so wide panels anchor to the nav edge */
.nav-menu > .nav-item.has-mega { position: static }

/* give the wide panel a container-width positioning context (desktop only, so the
   mobile drawer's positioning is untouched) — otherwise it anchors to the viewport */
@media (min-width: 981px) {
    #hdr nav { position: relative }
}

/* ---- panel ---- */
.mega-panel {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    max-width: 100%;
    display: grid;
    grid-template-columns: 300px 1fr;
    min-width: 920px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 26px 60px -30px rgba(34,86,130,.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .18s, transform .18s, visibility .18s;
    z-index: 60
}

.nav-item.open > .mega-panel { opacity: 1; visibility: visible; transform: translateY(0) }

/* ---- aside (reuses the site's .secdark treatment) ---- */
.mega-aside {
    background: linear-gradient(160deg,#0d1b2a,#132131);
    color: #fff;
    padding: 30px 28px;
    display: flex;
    flex-direction: column
}

.mega-aside .eyebrow {
    font-size: .68rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--champagne-gold);
    font-weight: 700;
    margin: 0 0 14px
}

.mega-aside h3 {
    font-family: var(--font-head);
    font-size: 1.7rem;
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -.01em;
    margin: 0 0 14px;
    color: #fff
}

.mega-lead {
    font-size: .86rem;
    color: rgba(255,255,255,.72);
    line-height: 1.55;
    margin: 0 0 22px
}

.mega-cta {
    align-self: flex-start;
    background: var(--champagne-gold);
    color: #1a1a1a;
    font-weight: 800;
    font-size: .85rem;
    padding: 12px 22px;
    border-radius: 100px;
    text-decoration: none
}

    .mega-cta:hover { background: #e6c14e }

.mega-ticks {
    list-style: none;
    margin: auto 0 0;
    padding: 22px 0 0;
    display: grid;
    gap: 11px;
    border-top: 1px solid rgba(255,255,255,.12)
}

    .mega-ticks li {
        font-size: .82rem;
        color: rgba(255,255,255,.72);
        padding-left: 24px;
        position: relative
    }

        .mega-ticks li::before {
            content: "\2713";
            position: absolute;
            left: 0;
            color: var(--champagne-gold);
            font-weight: 800
        }

/* ---- main ---- */
.mega-main {
    padding: 24px 30px 18px;
    display: flex;
    flex-direction: column;
    background: #fff
}

.mega-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 16px
}

    .mega-head h4 { font-size: 1.32rem; color: var(--ink); font-weight: 800; margin: 0 0 4px }
    .mega-head p { font-size: .87rem; color: var(--ink-soft); margin: 0; max-width: 48ch }

.mega-viewall {
    color: var(--gold-deep);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid var(--champagne-gold);
    padding-bottom: 2px;
    align-self: flex-start
}

    .mega-viewall:hover { color: var(--ink) }

.mega-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 34px }
.mega-cols--1 { grid-template-columns: 1fr }

/* no-aside variant (e.g. Avalon) — a compact list of plain links under its own trigger.
   :has() lets the <li> react to the panel's own "simple" state (set once by the partial),
   keeping a single source of truth instead of duplicating that state onto the <li>. Cheap
   direct-child selector; :has() is baseline-supported. */
.nav-menu > .nav-item.has-mega:has(> .mega-panel--simple) { position: relative }
.mega-panel--simple { grid-template-columns: 1fr; min-width: 240px; left: 0; right: auto; max-width: none }
.mega-panel--simple .mega-main { padding: 16px 16px 14px }
.mega-panel--simple .mega-badge, .mega-panel--simple .mega-desc { display: none }
.mega-panel--simple .mega-link { padding: 8px 10px }
.mega-panel--simple .mega-title { font-weight: 500; font-size: .92rem }

.mega-grouplabel {
    font-size: .7rem;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--gold-deep);
    font-weight: 700;
    margin: 0 0 6px
}

.mega-link {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    text-decoration: none;
    padding: 10px;
    border-radius: 10px
}

    a.mega-link:hover, a.mega-link:focus-visible { background: #f2f6fa }

.mega-badge {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: rgba(34,86,130,.08);
    color: var(--avion-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.02rem
}

    .mega-badge svg { width: 20px; height: 20px }

.mega-title { display: block; font-weight: 700; color: var(--ink); font-size: .94rem }
.mega-desc { display: block; font-size: .79rem; color: var(--ink-soft); margin-top: 2px; line-height: 1.4 }

.mega-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    background: var(--dove-grey);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: .82rem;
    color: var(--ink-soft)
}

    .mega-foot b { color: var(--ink) }

.mega-foot-link { color: var(--gold-deep); font-weight: 700; text-decoration: none; white-space: nowrap }
.mega-foot-link:hover { color: var(--ink) }

.mega-trigger:focus-visible,
.mega-link:focus-visible,
.mega-cta:focus-visible,
.mega-viewall:focus-visible {
    outline: 2px solid var(--avion-logo-blue);
    outline-offset: 3px;
    border-radius: 4px
}

/* ---- mobile (<= 980px): collapse to accordion, hide aside/capabilities ---- */
@media (max-width:980px) {
    /* mobile drawer: full-width, left-aligned rows with dividers (override the centered desktop bar).
       Scoped to #navMenu (id) so these win by specificity regardless of stylesheet load order. */
    #navMenu.open { align-items: stretch; gap: 0; padding: 6px 0 18px }
    #navMenu.open > li { width: 100%; border-bottom: 1px solid var(--line) }

    #navMenu.open .nav-link,
    #navMenu.open .mega-trigger {
        display: flex; align-items: center; justify-content: space-between; gap: 10px;
        width: 100%; padding: 16px 22px; font-size: 1.05rem; font-weight: 600; color: var(--ink)
    }
    #navMenu.open .mega-caret { width: 16px; height: 16px; opacity: .5; flex: 0 0 auto }

    /* CTA row → full-width pill, no divider */
    #navMenu.open > li:has(> .nav-cta) { border-bottom: 0 }
    #navMenu.open .nav-cta { display: block; text-align: center; width: auto; margin: 14px 22px 4px; padding: 13px }

    /* accordion panel */
    .nav-menu > .nav-item.has-mega { position: relative }
    .mega-panel {
        position: static;
        min-width: 0;
        max-width: none;
        display: block;
        background: var(--dove-grey);
        opacity: 1;
        visibility: hidden;
        pointer-events: none;
        transform: none;
        box-shadow: none;
        border: 0;
        border-radius: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height .3s ease, visibility .3s ease
    }

    .nav-item.has-mega.open > .mega-panel { max-height: calc(100vh - var(--nav-h)); overflow-y: auto; visibility: visible; pointer-events: auto }

    .mega-aside, .mega-foot, .mega-head h4, .mega-head p { display: none }
    .mega-head { display: block; border-bottom: 0; padding: 0; margin: 0 }
    .mega-main { padding: 6px 22px 14px }
    .mega-cols { display: block }
    .mega-grouplabel { padding: 14px 0 2px }
    .mega-link { padding: 11px 0; gap: 12px }
    .mega-link .mega-desc { display: none }   /* titles only on mobile */
    .mega-viewall { display: inline-block; border-bottom: 0; padding: 14px 0 0 }
}

@media (prefers-reduced-motion:reduce) {
    .mega-panel, .mega-caret { transition: none }
}
