/* Legacy `header nav ul li a` rule directly targets nav links and beats
   inherited theme.json typography. Override it explicitly per menu. */
header .wp-block-navigation .wp-block-navigation-item__content {
    text-decoration: none !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
}

header .top-menu-nav .wp-block-navigation-item__content {
    font-family: var(--wp--preset--font-family--proxima-nova) !important;
    font-size: var(--wp--preset--font-size--nav-secondary) !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
    line-height: 1.692 !important;
    text-transform: none !important;
}

header .main-menu-nav .wp-block-navigation-item__content {
    font-family: var(--wp--preset--font-family--urw-din-condensed) !important;
    font-size: var(--wp--preset--font-size--nav) !important;
    font-weight: 700 !important;
    letter-spacing: 0.75px !important;
    line-height: 1.467 !important;
    text-transform: uppercase !important;
}

/* Scoped to direct children of the container (top-level triggers only).
   Unscoped, `:hover` bubbles up from ANY hovered descendant to every
   ancestor `<li>` — so hovering a 3rd-level link (e.g. "Compliance Code
   of Conduct") also matched its 2nd-level parent ("Compliance Reports",
   itself a `.has-child` submenu item) and painted it this same lime,
   which is illegible against the tan panel. `.current-menu-ancestor` has
   the identical problem: WP marks every ancestor of the current page's
   link with it, not just the top-level trigger. */
header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item:hover > .wp-block-navigation-item__content,
header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.current-menu-item > .wp-block-navigation-item__content,
header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.current-menu-ancestor > .wp-block-navigation-item__content,
header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item:hover > .wp-block-navigation-item__content,
header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.current-menu-item > .wp-block-navigation-item__content,
header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.current-menu-ancestor > .wp-block-navigation-item__content {
    color: var(--wp--preset--color--tertiary-lime) !important;
}

/* The toggle icon's path is a thin chevron outline (stroke-based), not a
   filled shape — filling it with currentColor turns the chevron into a
   solid wedge that reads as a triangle. Stroke it instead. */
header .wp-block-navigation .wp-block-navigation__submenu-icon svg {
    fill: none;
    stroke: currentColor;
}

header .wp-block-navigation .wp-block-navigation__submenu-icon svg path {
    fill: none;
    stroke: currentColor;
}

/* Core gives the icon's svg a `margin-top: .075em` (baseline-alignment
   nudge meant for inline text flow), which leaves the glyph sitting
   slightly off-center inside its own toggle button. Rotating the button
   180deg (open/closed chevron state below) pivots around the BUTTON's
   center, not the glyph's, so that leftover offset flips sides on
   rotation and the chevron visibly jumps a couple pixels between its
   open and closed positions. Centering the svg in its box with flex
   removes the offset so both states pivot around the same point. */
header .wp-block-navigation .wp-block-navigation__submenu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

header .wp-block-navigation .wp-block-navigation__submenu-icon svg {
    margin-top: 0;
}

/* Submenu dropdown: cream background + dark green text per Figma. */
header .wp-block-navigation__submenu-container {
    background-color: var(--wp--preset--color--primary-light-tan) !important;
    border: none !important;
    padding: 1.5rem !important;
}

/* Top Menu sits above the Main Menu in the header and its dropdowns
   hang down over the main menu row below. WP core's default submenu
   z-index (2) loses to the main-menu-nav mega-panel's z-index (20), so
   if the cursor crosses a main-menu trigger while heading toward an
   open top-menu dropdown, the mega-panel pops up and paints over it —
   looking like the top menu closed. The top menu should always win. */
header .top-menu-nav .wp-block-navigation__submenu-container {
    z-index: 30 !important;
}

/* Top Menu's dropdowns: same horizontal multi-column grid panel as the
   Main Menu's mega-nav (see the `.main-menu-nav` block below) rather than
   WP core's default single-column flyout list — mirrors that block's
   positioning/column CSS exactly, just re-anchored to Top Menu's own
   (shorter, thinner) header bar.

   The `34px` dead-zone/offset the Main Menu block uses comes from the
   Kadence row padding around ITS trigger; Top Menu sits in a separate,
   shorter bar with its own padding, so the equivalent gap here is
   smaller — measured live at ~9.7px, rounded to 10px. */
@media (min-width: 990px) {
    header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child {
        position: relative;
    }

    header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child::after {
        content: "";
        position: absolute;
        top: 100%;
        left: 0;
        width: calc(100vw - 3rem);
        height: 10px;
    }

    header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container {
        position: absolute !important;
        top: calc(100% + 10px);
        left: 0;
        /* Was `width: max-content` — sized to each trigger's own content,
           so the panel's width (and therefore its right edge) changed
           per item, which read as jarring per design feedback: these
           panels were never meant to resize, only their height should
           vary with line count. An earlier fix pinned this to a narrower
           2-column footprint instead, reasoning from this menu's real
           (sparser) content rather than the design reference — but the
           Figma wireframe (node 6:933; both its Top Menu panels, e.g.
           "About Us", and its Main Menu mega-panels use the same 836px /
           3-column footprint) makes every dropdown on the site one
           consistent size, panel width isn't meant to track how much
           content a given menu happens to have. Matches the Main Menu
           mega-panel's own fixed-width rule below exactly, so both menus'
           panels are now identical footprints, not two different sizes. */
        width: calc(3 * 14rem + 2 * 3rem + 2 * clamp(1.5rem, 3vw, 2.5rem));
        max-width: calc(100vw - 3rem);
        margin-left: 0 !important;
        display: block !important;
        column-count: 3;
        column-width: 14rem;
        column-gap: 3rem;
        padding: 2rem clamp(1.5rem, 3vw, 2.5rem) !important;
        z-index: 30;
    }

    /* 1.5rem (main-menu-nav's own value below) measured wider than the
       design reference — Figma spaces consecutive single-line items
       ~37px apart top-to-top, and against these links' 20px line-height
       that's roughly a 1rem gap, not 1.5rem. li.has-child keeps the same
       +0.5rem it already had over the base value, now 1rem + 0.5rem.

       min-height: Figma reserves the same two-line-tall slot for every
       item regardless of its own actual line count — see e.g. node
       6:1633 ("Locates Overview"), a single-line label still given a
       second, empty line's worth of height beneath it. Without this, a
       short label's <li> only takes up one line-height's worth of
       space while a wrapped neighbour takes two, so consecutive items
       read as unevenly spaced/misaligned even though each one's own
       internal spacing is individually correct. 2 * 20px line-height. */
    header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container > li {
        break-inside: avoid;
        min-height: 40px;
        margin-bottom: 1rem;
    }

    header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container > li.has-child {
        margin-bottom: 1.5rem;
    }

    header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container > li:last-child {
        margin-bottom: 0;
    }

    header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child::before {
        content: "";
        position: absolute;
        top: calc(100% + 10px);
        left: 50%;
        transform: translate(-50%, -10px);
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-bottom: 10px solid var(--wp--preset--color--primary-light-tan);
        opacity: 0;
        visibility: hidden;
        z-index: 31;
    }

    header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:hover::before,
    header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:focus-within::before {
        opacity: 1;
        visibility: visible;
    }
}

/* This override doesn't touch line-height, so it fell through to
   whichever top-level-trigger rule further up the cascade happens to
   tie on specificity for this element (line-height isn't set again
   here to override it) — `header .top-menu-nav .wp-block-navigation-
   item__content`'s 1.692, tuned for THAT rule's own trigger-label
   context, not this one. Against this element's actual font-size
   (nav-secondary, 13px) that computes to ~22px, vs. Figma's flat 20px
   leading for dropdown items — a couple of extra px per row that
   compounds down a multi-item column, reading as "too much space
   between items" even though the margin-bottom below is already
   correctly tuned. Set explicitly here instead of left to inherit. */
header .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
    color: var(--wp--preset--color--secondary-dark-green) !important;
    font-family: var(--wp--preset--font-family--proxima-nova) !important;
    font-weight: 400 !important;
    font-size: var(--wp--preset--font-size--nav-secondary) !important;
    line-height: 20px !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

/* Main Menu mega-nav panel: positioned relative to its own trigger (not
   full-bleed), multi-column link grid, chevron connector, and per-link
   external/internal arrow icons.

   `top: 100%; left: 0` anchors the panel directly to the trigger's own
   box with zero gap — no dead zone, no bridge pseudo-element needed,
   since the panel is simply the next box down in the trigger's own
   hover chain (WP core's native submenu positioning). Sized to fit its
   multi-column content rather than the viewport.

   `left: 0` here is only the CSS fallback/no-JS position (flush with
   the panel's own trigger). Per design feedback, the panel is meant to
   be one fixed size and position — never relocating or resizing per
   trigger, only its height should vary with line count — so on load,
   mega-menu.js overrides this per trigger with an inline `left` that
   aligns every panel's left edge to the same point (the menu's own
   container left edge) regardless of which trigger opened it; since
   width is already fixed above, that also fixes the right edge. It
   still nudges further left as a last-resort safety net if that
   shared position would ever push a panel off a narrow viewport, but
   that's a fallback, not its normal job now. */
/* The mega-nav panels below are hidden when closed via opacity/visibility
   (not display:none) so they can transition smoothly on open — but that
   means their full absolutely-positioned box still occupies layout space
   even while closed. A panel resting under a trigger far enough into the
   header can extend past the right edge of the viewport at rest, which
   without this rule inflates the whole document's scrollWidth and gives
   every page a permanent horizontal scrollbar, regardless of whether any
   menu is ever opened. mega-menu.js only repositions a panel once it's
   actually opened, so it doesn't help with this at-rest case — this is
   the actual fix, clipping any resting overflow before it reaches the
   page level. */
html,
body {
    overflow-x: clip;
}

@media (min-width: 990px) {
    header .main-menu-nav .wp-block-navigation__container {
        gap: 2.75rem;
    }

    /* Figma (node 5784:3958): every item in this bar — search icon,
       Learning Centre, Initiatives, About Us, and the Request a Locate
       button — sits ~48-49px from its neighbour, a single consistent
       rhythm across the whole row. This 48px matches the row's own
       customGutter (search-to-nav and nav-to-button, set at the Kadence
       row level) so the nav's own internal item spacing lines up with
       the rest of the bar instead of reading tighter than its neighbours. */
    header .top-menu-nav .wp-block-navigation__container {
        column-gap: 48px;
    }

    header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child {
        position: relative;
    }

    /* Invisible bridge across the 34px dead zone between the trigger and
       the panel (see the `top: calc(100% + 34px)` comment below). Without
       it, moving the cursor straight down from the trigger crosses a gap
       that belongs to neither the trigger nor the panel, breaking :hover
       before the panel is ever reached and closing the menu prematurely.
       It's a sibling of the panel within the same `<li>`, so hovering it
       keeps that li's :hover — and therefore the panel — open. Width
       matches the panel's own max-width so the bridge covers the same
       footprint the open panel can occupy. */
    header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child::after {
        content: "";
        position: absolute;
        top: 100%;
        left: 0;
        width: calc(100vw - 3rem);
        height: 34px;
    }

    header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container {
        position: absolute !important;
        /* The trigger `<li>` is only as tall as its own text — the dark
           green header bar is taller because the Kadence row around it
           carries its own 16px top/bottom padding that the nav item
           knows nothing about. `top: 100%` alone anchors the panel to
           the bottom of the short text box, landing it 34px inside the
           header's true bottom edge instead of below it. */
        top: calc(100% + 34px);
        left: 0;
        /* Fixed to the widest panel's own footprint (3 columns) rather
           than `max-content`, so every trigger's panel — even one whose
           links only fill 1-2 columns — opens at this same width and
           starts/ends at the same left/right edges. Only the height
           (line count) varies per trigger now. */
        width: calc(3 * 14rem + 2 * 3rem + 2 * clamp(1.5rem, 3vw, 2.5rem));
        max-width: calc(100vw - 3rem);
        margin-left: 0 !important;
        /* A shared CSS Grid row-track would size row N to whatever its
           tallest cell needs across ALL columns — so a two-line item
           (one with a nested sub-link) in one column forces empty
           space below the shorter items sharing that row in every
           other column. Multi-column flow lets each column stack its
           own items independently, so spacing stays even regardless of
           which column happens to have the taller entry. */
        display: block !important;
        column-count: 3;
        column-width: 14rem;
        column-gap: 3rem;
        padding: 2rem clamp(1.5rem, 3vw, 2.5rem) !important;
        z-index: 20;
    }

    /* Reduced from 1.5rem — measured wider than the design reference.
       Figma spaces consecutive single-line items ~37px apart top-to-top,
       which against these links' 20px line-height comes out to roughly a
       1rem gap, not 1.5rem.

       min-height: see the matching comment on the Top Menu's own copy
       of this rule above — every item reserves a uniform two-line-tall
       slot regardless of its own actual line count, so a short label
       doesn't read as oddly cramped next to a wrapped one. */
    header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container > li {
        break-inside: avoid;
        min-height: 40px;
        margin-bottom: 1rem;
    }

    /* A single nested sub-item doesn't create as strong a visual break
       as a multi-item cluster does just from its own height — the next,
       unrelated item can read as ambiguously still part of the group
       above it. A bit of extra room after any item that has its own
       nested sub-list makes that break equally clear regardless of how
       many sub-items it has. Doesn't affect items without a sub-list, so
       columns that already read fine (no nesting at all) are untouched.
       Keeps the same +0.5rem this already had over the base value,
       just against the new, smaller base. */
    header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container > li.has-child {
        margin-bottom: 1.5rem;
    }

    header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container > li:last-child {
        margin-bottom: 0;
    }
}

/* Solid triangle poking up out of the panel's top edge into the header
   bar. Anchored to the TRIGGER (not the panel) and centered under it, so
   it stays lined up with the trigger's own label regardless of where the
   panel below has ended up — mega-menu.js shifts a too-wide panel left
   to keep it on-screen, and a panel-anchored triangle shifted along with
   it, drifting out from under its own trigger. Shown only on the same
   hover/focus-within condition that reveals the panel (WP core's default
   submenu visibility toggle), since it's no longer a descendant of the
   panel it points at. */
@media (min-width: 990px) {
    header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child::before {
        content: "";
        position: absolute;
        top: calc(100% + 34px);
        left: 50%;
        transform: translate(-50%, -10px);
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-bottom: 10px solid var(--wp--preset--color--primary-light-tan);
        opacity: 0;
        visibility: hidden;
        z-index: 21;
    }

    header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:hover::before,
    header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:focus-within::before {
        opacity: 1;
        visibility: visible;
    }
}

/* Active/open top-level trigger: tan label + flipped chevron. More
   specific than the generic hover-lime rule above, so it wins for items
   with a submenu while plain links keep the lime hover.

   Scoped to direct children of the container (top-level triggers only) —
   unscoped, this also matched submenu links that themselves have a
   nested child (e.g. "Locates Overview" > "How-To Videos", which is
   `.has-child` too), recoloring them tan on hover. Tan reads fine on the
   dark green header bar but is low-contrast against this light tan
   panel, making the label nearly illegible — submenu items need the
   dedicated legible hover/current color below instead. */
header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:hover > .wp-block-navigation-item__content,
header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:focus-within > .wp-block-navigation-item__content {
    color: var(--wp--preset--color--tertiary-lime) !important;
}

header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:hover > .wp-block-navigation-submenu__toggle,
header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:focus-within > .wp-block-navigation-submenu__toggle {
    color: var(--wp--preset--color--tertiary-lime);
}

/* The chevron itself rotates, not the button — the button is a 24x24 hit
   area with the chevron at its left edge (see the 2.5.8 rule below), so
   rotating the button would swing the chevron around the button's center. */
header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:hover > .wp-block-navigation-submenu__toggle svg,
header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:focus-within > .wp-block-navigation-submenu__toggle svg {
    transform: rotate(180deg);
}

/* Top Menu triggers get the same active/hover treatment as Main Menu
   (lime label + rotated chevron) — previously only Main Menu had this,
   so Top Menu's own has-child items (e.g. "About Us") showed no hover
   state at all. */
header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:hover > .wp-block-navigation-item__content,
header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:focus-within > .wp-block-navigation-item__content {
    color: var(--wp--preset--color--tertiary-lime) !important;
}

header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:hover > .wp-block-navigation-submenu__toggle,
header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:focus-within > .wp-block-navigation-submenu__toggle {
    color: var(--wp--preset--color--tertiary-lime);
}

header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:hover > .wp-block-navigation-submenu__toggle svg,
header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:focus-within > .wp-block-navigation-submenu__toggle svg {
    transform: rotate(180deg);
}

/* Submenu items inside the open panel: dark green hover/active/current
   state (darker than their default dark green base, for a clear
   interactive distinction against the tan panel background).

   The generic top-level current-menu-item/-ancestor rule above colors
   with tertiary-lime, which is fine against the header's dark green bar
   but nearly invisible against this panel's tan background (contrast
   ~1:1) — current-menu-item/-ancestor need their own override here, same
   as hover/focus, rather than falling through to that rule. */
header .main-menu-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover,
header .main-menu-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content:focus,
header .main-menu-nav .wp-block-navigation__submenu-container .wp-block-navigation-item.current-menu-item > .wp-block-navigation-item__content,
header .main-menu-nav .wp-block-navigation__submenu-container .wp-block-navigation-item.current-menu-ancestor > .wp-block-navigation-item__content {
    color: var(--wp--preset--color--primary-green) !important;
}

header .main-menu-nav .wp-block-navigation-submenu__toggle svg {
    transition: transform 0.15s ease;
}

/* WCAG 2.5.8 Target Size (Minimum): the chevron renders at ~9x9px (Main
   Menu) / ~7.8x7.8px (Top Menu), well under the 24x24 CSS-px floor. The
   button itself is sized to 24x24 — rather than enlarging the hit area
   with an invisible pseudo-element, which automated checkers (axe-core)
   can't see, so they kept flagging it, and which the Top Menu row clipped
   to ~23.5px tall anyway. The box grows only right and vertically: the
   label sits ~3.5px to the left, the next item ~44px to the right.
   Negative margins cancel the growth so nothing else moves, the chevron
   keeps its original .6em size at the button's left edge, vertically
   centered, and the focus ring is drawn on the chevron as before.
   position/z-index keep the button above its item's transparent hover
   bridge (the has-child ::after above), which otherwise covers its
   bottom edge. */
header .main-menu-nav .wp-block-navigation-submenu__toggle,
header .top-menu-nav .wp-block-navigation-submenu__toggle {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    width: 24px;
    height: 24px;
    padding: 0;
    justify-content: flex-start;
    margin-top: calc((24px - .6em) / -2);
    margin-bottom: calc((24px - .6em) / -2);
    margin-right: calc((24px - .6em) * -1);
}

header .main-menu-nav .wp-block-navigation-submenu__toggle svg,
header .top-menu-nav .wp-block-navigation-submenu__toggle svg {
    flex: none;
    width: .6em;
    height: .6em;
}

header .main-menu-nav .wp-block-navigation-submenu__toggle:focus-visible,
header .top-menu-nav .wp-block-navigation-submenu__toggle:focus-visible {
    outline: none;
}

header .main-menu-nav .wp-block-navigation-submenu__toggle:focus-visible svg,
header .top-menu-nav .wp-block-navigation-submenu__toggle:focus-visible svg {
    outline: 2px solid var(--wp--preset--color--tertiary-lime);
    outline-offset: 2px;
}

/* WP core marks this block "open-on-hover-click", which — by core's own
   CSS (navigation/style.css) — deliberately excludes :focus-within from
   the rule that reveals the panel; core expects keyboard users to press
   Enter/Space on the toggle (setting aria-expanded, the OTHER rule that
   reveals it) rather than just tabbing to it. But the theme's own hover
   styling above already reacts to :focus-within for the trigger's color
   and chevron/triangle state, so a keyboard user tabbing here sees every
   "open" signal except the panel itself. Forcing the panel to match on
   :focus-within keeps tab-only navigation consistent with those signals.
   Applies to both Main Menu and Top Menu — Top Menu already got the
   matching :focus-within triangle rule above (line 164), but not this
   one, so tabbing onto a Top Menu trigger showed every "open" signal
   except the panel itself, same gap this originally closed for Main Menu. */
header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:focus-within > .wp-block-navigation__submenu-container,
header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child:focus-within > .wp-block-navigation__submenu-container {
    opacity: 1;
    visibility: visible;
    height: auto;
    overflow: visible;
}

/* Per-link arrow icons inside the dropdown panel: clay-colored diagonal
   external-link arrow for links that open in a new tab, dark green
   straight arrow for everything else (internal). Shared between the Main
   Menu's mega-nav and the Top Menu's own (smaller) dropdown panels.

   This icon is real markup (a trailing <span class="nav-dropdown-arrow">
   inside a <span class="nav-dropdown-arrow-wrap"> around the label's own
   last word), injected by dig_authority_add_navigation_link_arrow() in
   functions.php — not a generated ::after pseudo-element, and not a
   word-joiner character either. Both of those were tried first:

   - A generated ::after, with the link as inline-flex, had the icon (a
     separate flex item) center itself across a wrapped label's FULL
     two-line height via align-items instead of following the last line.
   - Switching to plain inline flow plus a word joiner (U+2060) fixed
     that, but a live-browser check of the actual line-box rects showed
     it STILL failed: the word joiner reliably glues itself to the
     PRECEDING text (confirmed — no break between "Toolkit" and the
     joiner), but Chromium still allowed a break between that joiner and
     the FOLLOWING element (the icon span) — the boundary between a text
     run and a following atomic inline-level box is apparently its own
     break opportunity, independent of what character precedes it. So
     the icon still ended up orphaned alone on the next line. (This
     doesn't contradict critical.css's own word-joiner fix for the
     external-link icon — there the joiner and the icon are the SAME
     `::after` box, not a text node followed by a separate element, so
     there's no such boundary to break at.)

   `.nav-dropdown-arrow-wrap` is the actual fix: white-space: nowrap is a
   direct layout instruction ("never break inside this box"), not a
   Unicode line-break-class hint a browser can partially honor — so the
   label's last word and the icon are guaranteed to always move to the
   next line together, never separately.

   The PHP side injects this icon into EVERY nav link sitewide, not just
   dropdown ones — simpler than working out link nesting depth in PHP,
   since the descendant selector below already does that job for free:
   hidden by default, and only made visible for links actually inside a
   Main Menu/Top Menu dropdown panel. Top-level triggers, the footer
   menu, and the mobile drawer all carry the same markup but just never
   match this selector, so their copy stays harmlessly invisible.

   `display: inline` on the link (rather than its unset default, or a
   flex value some other rule might set) is still required for this to
   work: the icon must be able to flow and wrap as ordinary inline
   content alongside the label text, which an inline-flex/flex container
   would prevent (see above).

   !important is required here, confirmed by inspecting the actual
   matched rules in a live browser (not just reasoning about
   specificity): WP core's own navigation block stylesheet
   (wp-includes/blocks/navigation/style.min.css) ships `.wp-block-
   navigation .has-child .wp-block-navigation__submenu-container >
   .wp-block-navigation-item > .wp-block-navigation-item__content {
   display: flex; ... }` — five chained class selectors, which beats
   this rule's three classes (plus a type selector, which doesn't help)
   on raw specificity regardless of source order. Every previous attempt
   at this fix (the generated ::after version, then the first pass at
   this real-markup version) was silently losing to that core rule the
   entire time — the link was flex all along, which is exactly why the
   icon kept floating independently of the wrapped text instead of
   following it, no matter how the icon itself was built. */
header .main-menu-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content,
header .top-menu-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
    display: inline !important;
}

/* See dig_authority_add_navigation_link_arrow() in functions.php — this
   is the wrapper around the label's last word + the icon that actually
   keeps them glued together across a line wrap (a word joiner alone
   wasn't reliable — see the comment above). No display/visibility rule
   needed here specifically: it's a plain inline span everywhere,
   including outside a dropdown panel, since nowrap-ing an ordinary
   label's own last word is harmless with no visible icon attached. */
.nav-dropdown-arrow-wrap {
    white-space: nowrap;
}

.nav-dropdown-arrow {
    display: none;
}

header .main-menu-nav .wp-block-navigation__submenu-container .nav-dropdown-arrow,
header .top-menu-nav .wp-block-navigation__submenu-container .nav-dropdown-arrow {
    display: inline-block;
    position: relative;
    top: -1px;
    vertical-align: middle;
    width: 0.65em;
    height: 0.65em;
    margin-left: 0.6rem;
    background-image: url("../images/icons/icon-arrow-right.svg");
    background-size: contain;
    background-repeat: no-repeat;
}

/* Figma's "external link" arrow (mega-nav node 5812:1259/1264) is NOT a
   separately-drawn glyph — pulling its exported SVG shows the identical
   path data and stroke-width as icon-arrow-right.svg, just recolored
   clay and rotated on the instance, at ~1.4x the internal arrow's size
   (11.77px vs 8.4px in the source). icon-external-link-clay.svg is a
   different (L-shaped/elbow) glyph entirely and was the wrong icon
   family for this — reusing icon-arrow-right.svg via mask + rotate
   matches Figma exactly and mirrors the same technique already used for
   the secondary button's diagonal arrow (buttons.css). Applied to a
   dedicated modifier class rather than an attribute selector, since
   dig_authority_add_navigation_link_arrow() already determines
   internal-vs-external server-side (from the link's own opensInNewTab
   attribute) and reflects that as this class, instead of every browser
   re-deriving it per paint via [target="_blank"]. */
header .main-menu-nav .wp-block-navigation__submenu-container .nav-dropdown-arrow--external,
header .top-menu-nav .wp-block-navigation__submenu-container .nav-dropdown-arrow--external {
    width: 0.91em;
    height: 0.91em;
    background-image: none;
    background-color: var(--wp--preset--color--secondary-clay);
    -webkit-mask-image: url("../images/icons/icon-arrow-right.svg");
    mask-image: url("../images/icons/icon-arrow-right.svg");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    transform: rotate(-45deg);
}

/* A link inside the mega-nav grid can itself have a child (e.g. "Locates
   Overview" > "How-To Videos"). WP core's default nested-flyout CSS
   positions that child at `left:100%` of its parent's own box, which
   assumes a normal single-column list — inside a multi-column grid it
   lands in the gap *between* columns instead, floating disconnected
   from its parent (with its toggle icon, rotated -90deg for flyouts,
   showing as a stray "‹"/"›"). Flatten it into a always-visible,
   indented line directly under its parent instead of a positioned
   flyout — simplest fix for what's typically just one or two links. */
header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container .wp-block-navigation-item.has-child {
    display: block;
}

header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container .wp-block-navigation-item.has-child > .wp-block-navigation-submenu__toggle {
    display: none;
}

/* Only the top two levels (top-level trigger + mega-panel grid link) are
   meant to be output at all — a 3rd-level child (e.g. "Locates Overview"
   > "How-To Videos") should not appear in the Main Menu. Hiding the
   level-3 container rather than trimming the menu itself keeps this a
   pure display concern, independent of however the menu is structured
   in the editor. */
header .main-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container {
    display: none !important;
}

/* Only the top two levels are meant to be output at all here either —
   a 3rd-level child (e.g. "Stakeholder Advisory Council" > "...Terms of
   Reference") should not appear in the Top Menu, same as the Main Menu
   above. Hiding the level-3 container alone still leaves the level-2
   item's own toggle chevron rendered (it still technically "has a
   child" in the markup, just a hidden one) — hide that too, same as
   Main Menu does. */
header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container .wp-block-navigation-item.has-child > .wp-block-navigation-submenu__toggle {
    display: none;
}

header .top-menu-nav .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container {
    display: none !important;
}

/* Footer Menu: single dynamic nav block, laid out as a 2-column x 2-row
   grid (column-first) to match the Figma "Footer Column" pairs.
   column-gap already matched Figma's measured 40px exactly; row-gap
   (1.7rem = 27.2px) was roughly double Figma's own ~13-16px vertical
   gap between each column's two links (node 5905:1161's "Support" /
   "Glossary" and "Contact Us" / "Careers" pairs) — tightened to match. */
footer .footer-menu-nav .wp-block-navigation__container {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, auto);
    column-gap: 2.5rem;
    row-gap: 0.875rem;
}

footer .footer-menu-nav .wp-block-navigation-item__content {
    font-family: var(--wp--preset--font-family--proxima-nova) !important;
    font-size: var(--wp--preset--font-size--body) !important;
    font-weight: 700 !important;
    color: var(--wp--preset--color--primary-green);
    letter-spacing: 0.14px !important;
    text-transform: none !important;
}

/* Mobile combined nav drawer (see mobile-nav.js). Top Menu and Main Menu
   are two independent core/navigation blocks, each with its own native
   overlay — WP has no way to make two separate nav blocks share one
   overlay panel. Both are set to overlayMenu:"never" (parts/header.html)
   so core's own per-block toggle never fires; this hamburger + drawer
   replace it, and the JS physically moves both <nav> elements into the
   drawer below the breakpoint (and back above it), so the header keeps
   its normal two-bar desktop layout untouched at 990px and up. The
   breakpoint matches the theme's existing desktop mega-panel breakpoint
   (navigation.css `@media (min-width: 990px)`) rather than core's fixed
   600px overlay breakpoint, since that's where this header's horizontal
   layout actually stops fitting. */
.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 100001;
}

.mobile-nav-toggle__bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: currentColor;
    transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

.mobile-nav-toggle[aria-expanded="true"] .mobile-nav-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-nav-toggle[aria-expanded="true"] .mobile-nav-toggle__bar:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle[aria-expanded="true"] .mobile-nav-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 989px) {
    .mobile-nav-toggle {
        display: flex;
        color: var(--wp--preset--color--base);
    }

    /* mobile-nav.js only moves both navs into the drawer on
       DOMContentLoaded, so until then they render in the header bar at
       full height and the whole page jumps up when they leave (~0.2 CLS
       on mobile). Hide them in place from first paint instead; the
       :not() lets them show again once they're inside the drawer. */
    header nav.main-menu-nav:not(.mobile-nav-drawer *),
    header nav.top-menu-nav:not(.mobile-nav-drawer *) {
        display: none !important;
    }
}

/* While the drawer is open, pin the toggle (now showing as an X) to the
   viewport's top-right corner instead of leaving it in the header's own
   static document flow. Closed, it needs to stay in that normal flow —
   it's laid out inline with the logo in the header bar — but the drawer
   is a full-viewport `position: fixed` overlay starting at the true top
   of the page, while the header itself (and everything statically
   positioned inside it) stays wherever it naturally falls in that
   page's own document flow, which is rarely the viewport's top edge.
   Left unfixed, the toggle simply renders at that unrelated flow
   position — vertically centered relative to nothing in particular, and
   often overlapping whatever drawer content happens to fall there
   instead of the actual top-right corner. The drawer's own top padding
   (5rem, see .mobile-nav-drawer) already reserves exactly this space so
   the fixed button has clear room above the menu list. */
html.mobile-nav-open .mobile-nav-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
}

.mobile-nav-drawer {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background-color: var(--wp--preset--color--secondary-dark-green);
    color: var(--wp--preset--color--base);
    overflow-y: auto;
    padding: 5rem 1.5rem 2rem;
    transform: translateX(100%);
    transition: transform 0.25s ease-in-out;
}

.mobile-nav-drawer.is-open {
    transform: translateX(0);
}

.mobile-nav-drawer .wp-block-navigation__container {
    flex-direction: column;
    align-items: stretch;
    row-gap: 0 !important;
    column-gap: 0 !important;
}

.mobile-nav-drawer .wp-block-navigation-item__content {
    display: block;
    padding: 0.75em 0;
}

.mobile-nav-drawer .wp-block-navigation-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

/* Submenus render inline (accordion-shaped layout) instead of core's
   default absolutely-positioned dropdown, which would either overflow
   the drawer or overlap the trigger it's attached to. Also strips the
   desktop dropdown's tan card look (background/border/padding from the
   global `header .wp-block-navigation__submenu-container` rule in this
   file) so it reads as a section of the drawer, not a floating card.
   Every level is forced permanently open (opacity/visibility, ignoring
   aria-expanded) rather than behaving as an actual collapse/expand
   accordion — on mobile, someone scanning for a specific link benefits
   more from seeing the whole nav tree at once than from having to tap
   into each section first to discover what's inside it. The toggle
   button is hidden accordingly, since there's nothing left to
   expand/collapse; the label itself is still a normal, clickable link. */
.mobile-nav-drawer .has-child {
    flex-wrap: wrap;
}

.mobile-nav-drawer .has-child .wp-block-navigation__submenu-container {
    position: static !important;
    flex-basis: 100%;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    overflow: visible !important;
    opacity: 1 !important;
    visibility: visible !important;
    background-color: transparent !important;
    padding: 0 0 0 1rem !important;
}

.mobile-nav-drawer .wp-block-navigation-submenu__toggle {
    /* !important: this button doubles as `.wp-block-navigation__submenu-icon`,
       which an earlier, higher-specificity rule
       (`header .wp-block-navigation .wp-block-navigation__submenu-icon`)
       sets to `display: inline-flex` — without !important that rule
       wins over this plain two-class selector and the (now-nonfunctional)
       toggle stays visible on top-level items. */
    display: none !important;
}

.mobile-nav-drawer .wp-block-navigation-item__content,
.mobile-nav-drawer .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
    color: var(--wp--preset--color--base) !important;
}

.mobile-nav-drawer .wp-block-navigation__submenu-icon {
    margin-left: auto;
}

/* Top Menu's top-level items (Learning Centre, Initiatives, About Us)
   normally use Top Menu's own smaller, non-bold, sentence-case style
   (`header .top-menu-nav .wp-block-navigation-item__content`) at every
   level, desktop and mobile alike. In the drawer specifically, promote
   just the top-level row to Main Menu's own top-level treatment instead
   — same bold condensed uppercase already used one section up (Locates,
   Infrastructure Owners, etc.) — so both menus' section headers read
   consistently now that every section sits permanently expanded in one
   long list. Scoped to direct children of the container so nested items
   (Stakeholder Advisory Council's own sub-links, etc.) keep Top Menu's
   normal style, and scoped to `.mobile-nav-drawer` only — Top Menu's
   desktop header row is unaffected. */
.mobile-nav-drawer .top-menu-nav > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
    font-family: var(--wp--preset--font-family--urw-din-condensed) !important;
    font-size: var(--wp--preset--font-size--nav) !important;
    font-weight: 700 !important;
    letter-spacing: 0.75px !important;
    line-height: 1.467 !important;
    text-transform: uppercase !important;
}

html.mobile-nav-open {
    overflow: hidden;
}

[data-wpml="current-language-item"] .wp-block-navigation-item__label,
[data-wpml="language-item"] .wp-block-navigation-item__label {
    font-family: var(--wp--preset--font-family--proxima-nova) !important;
    font-weight: 400 !important;
}

[data-wpml="current-language-item"] {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
