/* Header 1.0.1

   Layout and behaviour are driven by axis classes on <body>. Two constraints hold
   the file together: nothing inside the header may be position:fixed (the header is
   a transformed containing block), and `contain: paint` would clip the megamenu.

   Rationale and rejected alternatives: _MD-REPOSITORY/livedesign/template-parts/header/ */

/*----------------------------- TOKENS -----------------------------*/
/* Declared on <body> because the spacer is a sibling of the header, and custom
   properties inherit downwards only. */
body {
    --lvd-header-h:      64px;   /* height at the top of the page */
    --lvd-header-h-min:  56px;   /* after the scroll threshold, when the logo shrinks */
    --lvd-topbar-h:      0px;    /* 0 unless the utility bar renders */
    --lvd-topbar-h-top:  0px;    /* the same height before it collapses — see the spacer */
    /* No -top companion: the announcement bar never retracts on scroll, so this is already
       constant across the threshold and the spacer can read it directly. */
    --lvd-announce-h:    0px;    /* 0 unless the announcement bar renders */
    --lvd-header-logo-h: 32px;
    --lvd-header-gutter: 40px;
    --lvd-header-z:      9991;
    --lvd-header-shadow: 0 8px 24px rgb(43 56 87 / 8%);
    --lvd-header-ease:   cubic-bezier(0.16, 1, 0.3, 1);

    /* Furniture of the mobile panel, invisible by default. A project that wants the
       ruled look changes these two colours. */
    --lvd-header-rule: var(--lvd-color-white);
    --lvd-header-chip: var(--lvd-color-white);

    /* Indent system for the mobile panel: the left edge of level 1, and the step each
       level moves right. */
    --lvd-header-indent: 24px;  /* left edge of level 1 */
    --lvd-header-step:   16px;  /* how much each level moves right */
}

.lvd-header-logo-size-sm { --lvd-header-logo-h: 26px; }
.lvd-header-logo-size-md { --lvd-header-logo-h: 32px; }
.lvd-header-logo-size-lg { --lvd-header-logo-h: 40px; }

/* The shrink axis exists for square logos, which need real height to read at all, so it
   runs on its own scale: a tall bar at the top collapsing to the ordinary one. The top
   height derives from the logo so the two cannot drift.

   --lvd-header-h must stay constant across the threshold — the spacer reads it — so the
   scrolled state changes --lvd-header-logo-h-min and never --lvd-header-logo-h.

   The settled sizes are the axis's own too, and larger than the ordinary ones above: those
   are set for wordmarks, where 40px of height carries a couple of hundred pixels of width.
   A square logo has only the height, and the 64px bar has room to give it — 48px leaves
   8px of breathing space, which is the real ceiling here. */
.lvd-header-logo-scroll-shrink {
    --lvd-header-h:          calc(var(--lvd-header-logo-h) + 28px);
    --lvd-header-h-min:      64px;
    --lvd-header-logo-h-min: 44px;
}

.lvd-header-logo-scroll-shrink.lvd-header-logo-size-sm { --lvd-header-logo-h: 64px;  --lvd-header-logo-h-min: 40px; }
.lvd-header-logo-scroll-shrink.lvd-header-logo-size-md { --lvd-header-logo-h: 80px;  --lvd-header-logo-h-min: 44px; }
.lvd-header-logo-scroll-shrink.lvd-header-logo-size-lg { --lvd-header-logo-h: 100px; --lvd-header-logo-h-min: 48px; }

.lvd-header-topbar-on { --lvd-topbar-h: 30px; --lvd-topbar-h-top: 30px; }
.lvd-header-announce-on { --lvd-announce-h: 40px; }

/*-------------------------- STICKY OFFSET --------------------------*/
/* Where sticky page elements stop (iTabs bar, Do / Do Not head): just under the fixed
   header, following it as the logo shrinks and as it hides on scroll. A static header
   scrolls away, so they stick to the top of the viewport. One definition, so every
   sticky component lines up with the header the same way. */
body                                                              {--lvd-sticky-top:0px;}
.lvd-header-sticky-fixed                                          {--lvd-sticky-top:calc(var(--lvd-topbar-h, 0px) + var(--lvd-header-h, 0px) + var(--lvd-announce-h, 0px));}
.lvd-header-sticky-fixed.lvd-header-logo-scroll-shrink.is-scrolled {--lvd-sticky-top:calc(var(--lvd-topbar-h, 0px) + var(--lvd-header-h-min, 0px) + var(--lvd-announce-h, 0px));}
.lvd-header-sticky-fixed.lvd-header-scroll-hide-on.is-hidden      {--lvd-sticky-top:0px;}

/*----------------------------- ROOT -----------------------------*/
.lvd-header {
    position: relative;
    width: 100%;
    z-index: var(--lvd-header-z);
    box-shadow: var(--lvd-header-shadow);
    contain: layout;
}

.lvd-header-flat .lvd-header { box-shadow: none; }

.lvd-header-sticky-fixed .lvd-header {
    position: fixed;
    top: 0;
    left: 0;
    /* Promoted on purpose: a single element, animated on nearly every scroll. */
    will-change: transform;
    transition: transform 0.35s var(--lvd-header-ease);
}

/* Reserves the height the header has at the top and never changes, so the bar can
   shrink above it without moving the page. */
.lvd-header-spacer { height: 0; }

/* Reads the -top tokens, never the live ones: --lvd-topbar-h drops to zero when the
   utility bar collapses, and a spacer following it would shorten the document mid-scroll
   and pull the page up under the fixed bar. */
.lvd-header-sticky-fixed .lvd-header-spacer {
    height: calc(var(--lvd-topbar-h-top) + var(--lvd-header-h) + var(--lvd-announce-h));
}

/* A 1px marker at the top of the document. The IntersectionObserver watching it is
   what reports the "scrolled" state — no scroll handler, no layout reads. */
.lvd-header-sentinel {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/*----------------------------- BAR -----------------------------*/
.lvd-header-bar {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--lvd-header-gutter);
    height: var(--lvd-header-h);
    padding: 0 var(--lvd-header-gutter);
    transition: height 0.35s var(--lvd-header-ease);
}

/*----------------------------- UTILITY BAR -----------------------------*/
/* No font-size here on purpose: the size comes from a text utility chosen in the
   Customizer and printed on this same element, and a rule here would win over it. */
.lvd-header-topbar {
    height: var(--lvd-topbar-h);
    overflow: hidden;
    transition: height 0.35s var(--lvd-header-ease);
}

.lvd-header-topbar-in {
    display: flex;
    align-items: center;
    height: var(--lvd-topbar-h);
    padding: 0 var(--lvd-header-gutter);
}

.lvd-header-topbar ul      { display: flex; flex-direction: row; align-items: center; gap: 24px; list-style: none; }
.lvd-header-topbar a       { display: inline-flex; align-items: center; gap: 6px; color: var(--lvd-cc-text); }
.lvd-header-topbar a:hover { opacity: 0.7; }

.lvd-header-topbar-align-right   .lvd-header-topbar-in    { justify-content: flex-end; }
.lvd-header-topbar-align-left    .lvd-header-topbar-in    { justify-content: flex-start; }
.lvd-header-topbar-align-between .lvd-header-topbar-in ul { width: 100%; justify-content: space-between; }

/* Collapses on scroll: the height goes to zero inside the fixed box, so the page
   below never moves. */
.lvd-header-topbar-scroll-collapses.is-scrolled { --lvd-topbar-h: 0px; }

/*----------------------------- ANNOUNCEMENTS -----------------------------*/
/* The whole bar is the control, so the reset is a button reset. Height comes from the token
   rather than the content: one line, ellipsis past it, full text in the panel. */
.lvd-header-announce {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: var(--lvd-announce-h);
    padding: 0 var(--lvd-header-gutter);
    border: none;
    /* Not the `font` shorthand: it would reset font-size too, and the size comes from a
       text utility printed on this same element — which loads earlier, so it would lose. */
    font-family: inherit;
    /* Fixed, not configurable: the bar defaults to the smallest size in the scale, and at
       11px uppercase the weight is what keeps it legible rather than decorative. */
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    overflow: hidden;
}

button.lvd-header-announce,
a.lvd-header-announce { cursor: pointer; }

.lvd-header-announce-case-upper .lvd-header-announce-titles { text-transform: uppercase; letter-spacing: 0.04em; }

.lvd-header-announce-titles {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Masked, not a background image: a mask follows --lvd-cc-text, so the chevron stays
   visible whichever surface the bar is given. */
.lvd-header-announce-chevron {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    background-color: currentColor;
    -webkit-mask-image: url('../assets/svg/bs-icons/chevron-down.svg');
            mask-image: url('../assets/svg/bs-icons/chevron-down.svg');
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-position: center;
            mask-position: center;
    -webkit-mask-size: contain;
            mask-size: contain;
    transition: transform 0.25s var(--lvd-header-ease);
}

.lvd-header-announce[aria-expanded="true"] .lvd-header-announce-chevron { transform: rotate(180deg); }

/* Absolute against the header, never fixed — the header is a transformed containing block.
   z-index clears the controls inside the bar: .lvd-header-bar is positioned without a
   z-index, so it starts no stacking context and the mobile toggle's z-index: 3 competes
   with this panel directly. */
.lvd-header-announce-panel {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 5;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--lvd-cc-surface);
    box-shadow: var(--lvd-header-shadow);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* Switched, not interpolated: at progress 0 the computed value is still hidden, and
       focus moved into the panel would land nowhere. */
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

/* The panel drops from the bar that was clicked, not from the bottom of the header. With
   the announcement bar at the top, a panel below the whole header reads as belonging to the
   menu — and lands a long way from the control that opened it. */
.lvd-header-announce-position-top .lvd-header-announce-panel {
    top: var(--lvd-announce-h);
    max-height: calc(100dvh - var(--lvd-announce-h));
}

.lvd-header-announce-position-bottom .lvd-header-announce-panel {
    top: 100%;
    max-height: calc(100dvh - var(--lvd-header-h) - var(--lvd-topbar-h) - var(--lvd-announce-h));
}

/* Look comes from .lvd-close (app-theme.css); only placement and the size override
   belong here. Smaller than the default on purpose — the panel's bar is tighter than
   a modal's corner. */
.lvd-header-announce-close {position: absolute; top: 14px; right: var(--lvd-header-gutter); z-index: 1; --lvd-cc-close-size: 20px;}


.lvd-header-announce-panel[hidden] { display: none; }

.lvd-header-announce-panel.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.25s ease, visibility 0s linear 0s;
}

/* The top padding is the close control's own band, so a card in the last column cannot run
   underneath it. */
.lvd-header-announce-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 32px;
    padding: 48px var(--lvd-header-gutter) 32px;
}

/* Three steps away from the bar, which is small, uppercase and tracked out. Without them
   the panel reads as more of the same bar rather than as its content. */
.lvd-header-announce-card-title {
    margin: 0 0 8px;
    font-size: var(--lvd-text-h5);
    font-weight: 700;
    line-height: 1.25;
    color: var(--lvd-cc-title);
}

.lvd-header-announce-card-text {
    margin: 0;
    font-size: var(--lvd-text-body);
    line-height: 1.55;
    color: var(--lvd-cc-text);
}

.lvd-header-announce-card-cta { margin-top: 16px; }

@media (max-width: 1024px) {
    .lvd-header-announce       { padding: 0 20px; }
    .lvd-header-announce-close { top: 10px; right: 20px; }
    .lvd-header-announce-list  { grid-template-columns: 1fr; gap: 24px; padding: 44px 20px 24px; }
}

/*----------------------------- LOGO -----------------------------*/
.lvd-header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Height-driven, width free: a square logo fits the bar as well as a wide one.

   Height, not a transform: under the shrink axis the ratio is close to 1:2.5, and a
   transform would leave the anchor's box at full size — a hit area overhanging the bar
   onto the page below. This transition runs twice a visit, on the same contained
   subtree as the bar's own height change, not on every scroll frame. */
.lvd-header-logo img {
    display: block;
    height: var(--lvd-header-logo-h);
    width: auto;
    max-width: 240px;
    object-fit: contain;
    transition: height 0.35s var(--lvd-header-ease);
}

/*----------------------------- ACTIONS -----------------------------*/
.lvd-header-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    flex-shrink: 0;
}

/* The mask sits on ::before, never on the button: a mask clips everything its own
   element paints, outline included, so a masked button can never show a focus ring.
   This is the control that OPENS search, so a keyboard user reaches it before the
   close button inside the popup. Same idiom as .lvd-header-back and
   .lvd-header-submenu-toggle; see ARHITECTURA §10.3 for the shared close primitive. */
.lvd-header-search-toggle {
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    line-height: 0;
}

.lvd-header-search-toggle::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    background-color: var(--lvd-cc-text);
    transition: opacity 0.3s ease;
    -webkit-mask-image: url('../assets/svg/bs-icons/search.svg');
            mask-image: url('../assets/svg/bs-icons/search.svg');
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-size: contain;
            mask-size: contain;
    -webkit-mask-position: center;
            mask-position: center;
}

/* Geometry comes from the global :focus-visible (app-core.css); only the colour is
   overridden, to the same token that paints the icon — so the ring is exactly as
   visible as the glyph on every surface the bar can be given. */
.lvd-header-search-toggle:focus-visible { outline-color: var(--lvd-cc-text); }

/* The dim is pointer feedback, so it stays on the icon — a focused button must not
   fade its own ring. */
.lvd-header-search-toggle:hover::before { opacity: 0.7; }

/*----------------------------- LANGUAGE -----------------------------*/
/* Desktop form: last in the actions cluster, so it lands at the outer edge. The list is
   absolute against this wrapper — never fixed, the header is a transformed containing
   block — and right-aligned, since the control sits at the edge. */
.lvd-header-language {
    position: relative;
    flex-shrink: 0;
}

.lvd-header-language-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: var(--lvd-text-s1);
    font-weight: 700;
    line-height: 1;
    color: var(--lvd-cc-text);
    cursor: pointer;
}

.lvd-header-language-toggle:hover { opacity: 0.7; }

.lvd-header-language-chevron {
    width: 10px;
    height: 10px;
    background-color: currentColor;
    -webkit-mask-image: url('../assets/svg/bs-icons/chevron-down.svg');
            mask-image: url('../assets/svg/bs-icons/chevron-down.svg');
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-position: center;
            mask-position: center;
    -webkit-mask-size: contain;
            mask-size: contain;
    transition: transform 0.25s var(--lvd-header-ease);
}

.lvd-header-language-toggle[aria-expanded="true"] .lvd-header-language-chevron { transform: rotate(180deg); }

.lvd-header-language-list {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 6;
    min-width: 64px;
    padding: 6px 0;
    list-style: none;
    background: var(--lvd-cc-surface);
    border-radius: 8px;
    /* Keeps a future hover background on the first or last item from squaring the corners
       off — the rows are full-width and currently only change opacity. */
    overflow: hidden;
    box-shadow: var(--lvd-header-shadow);
}

.lvd-header-language-list[hidden] { display: none; }

.lvd-header-language-list a {
    display: block;
    padding: 8px 16px;
    font-size: var(--lvd-text-s1);
    font-weight: 700;
    line-height: 1;
    color: var(--lvd-cc-text);
    white-space: nowrap;
}

.lvd-header-language-list a:hover { opacity: 0.7; }

/* Compact form: hidden until the panel exists. */
.lvd-header-language-inline { display: none; }

/*----------------------------- SEARCH POPUP -----------------------------*/
/* Absolute, not fixed: the header is a transformed containing block. */
.lvd-header-search {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 var(--lvd-header-gutter);
    background: var(--lvd-cc-surface);
    opacity: 0;
    visibility: hidden;
    /* Switched, not interpolated: openSearch() focuses the input immediately, and an
       interpolated visibility still computes as hidden on that frame. */
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.lvd-header-search.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

/* searchform.php is a reusable template, so it keeps generic class names; they are
   scoped here rather than styled globally. */
.lvd-header-search-field {
    position: relative;
    flex: 1 1 auto;
    max-width: 80%;
    margin: 0 auto;
}

/* On the wrapper, not the input: inputs take no pseudo-elements, and a mask follows
   --lvd-cc-text where a background image could not. */
.lvd-header-search-field::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 16px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    background-color: var(--lvd-cc-text);
    pointer-events: none;
    -webkit-mask-image: url('../assets/svg/bs-icons/search.svg');
            mask-image: url('../assets/svg/bs-icons/search.svg');
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-size: contain;
            mask-size: contain;
    -webkit-mask-position: center;
            mask-position: center;
}

.lvd-header-search .lvd-search { display: flex; height: 40px; width: 100%; }

.lvd-header-search .lvd-search-input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 44px;
    margin: 0;
    border: 0;
    border-radius: 20px;
    background: var(--lvd-color-gray-200);
    color: var(--lvd-cc-text);
    font-size: 16px;
    line-height: 40px;
    -webkit-appearance: none;
            appearance: none;
    transition: background-color ease-in-out .15s, box-shadow ease-in-out .15s;
}

.lvd-header-search .lvd-search-input::placeholder { color: var(--lvd-color-text); }

/* The pill has no border of its own, so focus is carried by the ring plus a lift out
   of the grey fill. */
.lvd-header-search .lvd-search-input:focus-visible { background-color: var(--lvd-color-white); }

/* The native controls go: this popup has its own close button, and Safari's
   magnifier would sit on top of ours. */
.lvd-header-search .lvd-search-input::-webkit-search-decoration,
.lvd-header-search .lvd-search-input::-webkit-search-results-decoration,
.lvd-header-search .lvd-search-input::-webkit-search-results-button,
.lvd-header-search .lvd-search-input::-webkit-search-cancel-button { display: none; }

/* Look comes from .lvd-close (app-theme.css); this only keeps it from being
   squeezed by the input beside it. */
.lvd-header-search-close {flex-shrink: 0;}


/*----------------------------- OVERLAY -----------------------------*/
/* Outside the header on purpose — it is fixed, and the header is a transformed
   containing block. */
.lvd-header-overlay {
    position: fixed;
    inset: 0;
    z-index: 9990;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lvd-header-overlay.is-active { opacity: 1; visibility: visible; }

/* Tinted, and kept on compact layouts where the plain overlay is suppressed: the
   announcement panel is meant to isolate what is under it, not just catch clicks. Two
   classes, so it outranks the `display: none` in the compact block without depending on
   source order. */
.lvd-header-overlay.is-tinted {
    display: block;
    background: rgb(16 18 24 / 45%);
}

/*----------------------------- MENU (SHARED) -----------------------------*/
.lvd-header-nav      { display: flex; flex-grow: 1; min-width: 0; }
.lvd-header-menu ul  { list-style: none; }
.lvd-header-menu a   { color: var(--lvd-cc-text); }
.lvd-header-menu a:hover { color: var(--lvd-cc-link-hover); }

/* The submenu toggle is a real <button> emitted by MenuWalker — see that class for
   why a pseudo-element could not work as a tap target. */
.lvd-header-submenu-toggle {
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

/*----------------------------- DESKTOP -----------------------------*/
@media (min-width: 1025px) {

    .lvd-header-toggle { display: none; }

    /* Hover and :focus-within drive the dropdowns here, so the button has nothing
       left to do — and display:none keeps it out of the accessibility tree too. */
    .lvd-header-submenu-toggle { display: none; }

    /* Panel copies of the bar's contents. Exactly one of each pair renders per
       breakpoint; display:none also keeps the other out of the accessibility tree. */
    .lvd-header-nav-cta,
    .lvd-header-nav-utility { display: none; }

    /* Only needed on touch, where tapping the parent opens the submenu. Hidden rather
       than removed: the markup is shared and a crawler reads this same HTML. */
    .lvd-header-submenu-all { display: none; }

    /* Full height down the chain. The dropdown opens at the bottom of the bar, so an
       item only as tall as its text leaves a dead band where :hover is lost. */
    .lvd-header-nav {
        flex-direction: row;
        justify-content: space-between;
        align-items: stretch;
        align-self: stretch;
    }

    .lvd-header-menu { display: flex; align-items: stretch; }

    .lvd-header-menu > ul {
        display: flex;
        flex-direction: row;
        align-items: stretch;
    }

    /* static so a megamenu's containing block is the bar. The narrow list dropdown is
       the exception and gets positioned. */
    .lvd-header-menu > ul > li {
        position: static;
        display: flex;
        align-items: center;
        margin-right: 24px;
        font-size: 16px;
        font-weight: 700;
    }

    .lvd-header-menu > ul > li.lvd-menu-list { position: relative; }

    /* The link fills the row, so the whole height is hoverable, not just the text. */
    .lvd-header-menu > ul > li > a {
        display: flex;
        align-items: center;
        height: 100%;
    }

    /* Decorative chevron on the parent link. Safe as a pseudo-element here: nothing
       needs to tell a click on it apart from a click on the label. */
    .lvd-header-menu .menu-item-has-children > a::after {
        content: "";
        display: inline-block;
        width: 12px;
        height: 12px;
        margin-left: 6px;
        vertical-align: middle;
        background-color: currentColor;
        transition: transform 0.3s ease;
        -webkit-mask-image: url('../assets/svg/bs-icons/chevron-down.svg');
                mask-image: url('../assets/svg/bs-icons/chevron-down.svg');
        -webkit-mask-repeat: no-repeat;
                mask-repeat: no-repeat;
        -webkit-mask-size: contain;
                mask-size: contain;
        -webkit-mask-position: center;
                mask-position: center;
    }

    /* Opened by :hover and :focus-within, with no JavaScript; :focus-within is what
       makes them reachable by keyboard.

           Scoped to the first level. Matching nested submenus too would force them back to
           visibility:visible, which a descendant can do — leaving them hit-testable while
           the panel itself is hidden. */
    .lvd-header-menu > ul > li > .sub-menu {
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 9999;
        display: block;
        padding: 24px;
        border-radius: 16px;
        /* No border: the shadow alone lifts the panel off the page. An outline plus a
           shadow reads as a boxed-in widget rather than a floating surface. */
        background-color: var(--lvd-cc-surface);
        box-shadow: var(--lvd-shadow-200);
        opacity: 0;
        visibility: hidden;
        /* Belt and braces beside `visibility`: even if something inside ever turns
           itself visible again, a closed panel cannot catch the pointer. */
        pointer-events: none;
        transform: translateY(-8px);
        transition: opacity 0.25s var(--lvd-header-ease),
                    visibility 0.25s var(--lvd-header-ease),
                    transform 0.25s var(--lvd-header-ease);
        transition-delay: 0.15s; /* grace period when leaving, matching the old timer */
    }

    .lvd-header-menu > ul > li:hover > .sub-menu,
    .lvd-header-menu > ul > li:focus-within > .sub-menu {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
        transition-delay: 0s;
    }

    .lvd-header-menu > ul > li:hover > a::after,
    .lvd-header-menu > ul > li:focus-within > a::after { transform: rotate(180deg); }

    /* Megamenu is the default shape; the column count is set per menu item. Stretched
           between the bar's gutters so it tracks the container at any width. */
    .lvd-header-menu > ul > li > .sub-menu {
        left: var(--lvd-header-gutter);
        right: var(--lvd-header-gutter);
        width: auto;
        padding: 40px;
    }

    .lvd-header-menu > ul > li > .sub-menu > .lvd-header-submenu-inner {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 24px;
    }

    .lvd-header-menu > ul > li.lvd-menu-cols3 > .sub-menu > .lvd-header-submenu-inner { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lvd-header-menu > ul > li.lvd-menu-cols2 > .sub-menu > .lvd-header-submenu-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* List view: a narrow single-column dropdown instead of the full-width sheet. */
    .lvd-header-menu > ul > li.lvd-menu-list > .sub-menu {
        left: 0;
        right: auto;
        width: 300px;
        padding: 24px;
    }

    .lvd-header-menu > ul > li.lvd-menu-list > .sub-menu > .lvd-header-submenu-inner {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* The list dropdown is a flat set of links, so weight carries no information here and
       a column of bold rows reads as shouting. In the mega menu the same level-2 item IS
       a column heading above its own children, which is why the rule below keeps it bold. */
    .lvd-header-menu > ul > li.lvd-menu-list > .sub-menu li { font-weight: 400; }

    .lvd-header-menu .sub-menu li   { line-height: 1.2; font-size: 16px; font-weight: 700; }
    .lvd-header-menu .sub-menu li a { display: block; width: 100%; }

    /* Level 3 is a plain list inside its parent column, so it carries no state of its
           own and inherits visibility from the panel above. */
    .lvd-header-menu .sub-menu .sub-menu {
        display: block;
        margin-top: 8px;
    }

    .lvd-header-menu .sub-menu .sub-menu li { font-weight: 400; margin-bottom: 8px; }
    .lvd-header-menu .sub-menu .menu-item-has-children > a::after { display: none; }
}

/*----------------------------- MOBILE -----------------------------*/
@media (max-width: 1024px) {

    body { --lvd-header-gutter: 20px; }

    /* The utility bar does not render here; its links move into the open panel, and the
           token goes with them so the spacer stops reserving room. */
    .lvd-header-topbar-on { --lvd-topbar-h: 0px; --lvd-topbar-h-top: 0px; }
    .lvd-header-topbar    { display: none; }

    /* Room for the toggle on whichever side it sits. */
    .lvd-header-toggle-side-right .lvd-header-bar { padding-right: 70px; }
    .lvd-header-toggle-side-left  .lvd-header-bar { padding-left: 70px; }

    /* The compact bar for wordmarks, which is what `static` keeps at every width. `shrink`
       is untouched here: its bar is the same 64px once settled, so its settled logo sizes
       fit unchanged, and its top state runs on the scale set further down.

       The rule repeats the class shape of its desktop counterpart — a media query adds no
       specificity, so a one-class override would lose to a two-class rule outside it. */
    .lvd-header-logo-size-sm,
    .lvd-header-logo-size-md,
    .lvd-header-logo-size-lg { --lvd-header-logo-h: 28px; }

    .lvd-header-actions { gap: 12px; }
    .lvd-header-cta     { font-size: var(--lvd-text-s1); }

    /* Applies only to styles that have a pill. Text styles are drawn with no padding by
           design, and forcing it would push their label off the optical line. */
    .lvd-header-cta:not([class*="lvd-button-text"]) {
        height: 38px;
        line-height: 36px;
        padding: 0 12px;
    }

    /* A button assigned to the open menu leaves the bar here and appears inside the
       panel instead — the pair is completed by .lvd-header-nav-cta below. */
    .lvd-header-actions .lvd-header-cta-mobile-in-menu { display: none; }

    /* --- Language --- */
    /* The dropdown gives way to the inline row inside the panel. display:none, not just the
       visibility the cluster already inherits when the menu opens: with two switchers in the
       markup, only one may reach the accessibility tree. */
    .lvd-header-language { display: none; }

    /* First row of the panel: every language at once, the current one bold. Regular weight
       and body size, deliberately quieter than the level-1 links below it — it is a setting,
       not a destination. */
    .lvd-header-language-inline {
        display: flex;
        gap: 20px;
        list-style: none;
        padding: 4px var(--lvd-header-indent) 16px;
    }

    .lvd-header-language-inline a,
    .lvd-header-language-inline span {
        font-size: var(--lvd-text-body);
        font-weight: 400;
        color: var(--lvd-cc-text);
    }

    .lvd-header-language-inline [aria-current] { font-weight: 700; color: var(--lvd-cc-title); }

    /* The field gets the whole width here; 80% would waste a narrow screen. */
    .lvd-header-search-field { max-width: 100%; }

    /* --- Toggle --- */
    /* Centred against the bar's own box, not computed from --lvd-header-h: under the
       shrink axis that token holds the top height, so a control derived from it would
       stay put while the bar collapsed around it. */
    .lvd-header-toggle {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 3;
        display: block;
        width: 24px;
        height: 18px;
        padding: 0;
        border: none;
        background: transparent;
        cursor: pointer;
    }

    .lvd-header-toggle-side-right .lvd-header-toggle { right: 20px; }
    .lvd-header-toggle-side-left  .lvd-header-toggle { left: 20px; }

    /* The search popup covers the bar and brings its own close button to the same
       corner. Two buttons in one place, both live — so this one steps aside. */
    .lvd-header.is-searching .lvd-header-toggle { display: none; }

    /* Back, mirroring the close control: same box, same offset, opposite side. It
           appears only once a level is open. */
    .lvd-header-back {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 20px;
        z-index: 3;
        width: 24px;
        height: 18px;
        padding: 0;
        border: none;
        background: transparent;
        cursor: pointer;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    .lvd-header-back::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        /* 24px, matching the close control. A chevron carries less ink than an X at
           the same box size, so equal boxes are what makes the pair look balanced. */
        width: 24px;
        height: 24px;
        margin: -12px 0 0 -12px;
        background-color: var(--lvd-cc-text);
        /* Chevron, not a full arrow: the same mark the rows use to lead deeper,
           mirrored — so forward and back read as one pair rather than two vocabularies. */
        -webkit-mask-image: url('../assets/svg/bs-icons/chevron-left.svg');
                mask-image: url('../assets/svg/bs-icons/chevron-left.svg');
        -webkit-mask-repeat: no-repeat;
                mask-repeat: no-repeat;
        -webkit-mask-size: contain;
                mask-size: contain;
        -webkit-mask-position: center;
                mask-position: center;
    }

    /* `hidden` comes off in JS the moment drill-down is wired; until a level is open
       the control stays out of the tab order as well as out of sight. */
    .lvd-header.is-drilled .lvd-header-back[hidden] { display: block; }

    .lvd-header.is-drilled .lvd-header-back {
        opacity: 1;
        visibility: visible;
    }

    /* No gutter is reserved for the back control: it is absolutely positioned, and the
           logo and actions are already hidden whenever it is visible. */

    /* With the panel open the bar empties to the close control. The actions cluster goes
           as a whole — a lone button on an empty bar reads as the first row of the menu.

           visibility rather than display: the elements keep their space, so nothing
           reflows, and they leave the tab order while hidden. */
    .lvd-header-logo,
    .lvd-header-actions {
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    .lvd-header.is-menu-open .lvd-header-logo,
    .lvd-header.is-menu-open .lvd-header-actions {
        opacity: 0;
        visibility: hidden;
    }

    /* The disc behind the close state, as a pseudo-element rather than the extra
           fixed-position element the old markup carried. */
    .lvd-header-toggle::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 41px;
        height: 41px;
        margin: -20px 0 0 -20px;
        border-radius: 50%;
        background: var(--lvd-header-chip);
        opacity: 0;
        transition: opacity 0.25s ease;
    }

    .lvd-header-toggle[aria-expanded="true"]::before { opacity: 1; }

    .lvd-header-toggle span {
        position: absolute;
        left: 0;
        display: block;
        width: 100%;
        height: 2px;
        background: var(--lvd-cc-text);
        transition: transform 0.25s ease-in-out, opacity 0.25s ease-in-out, top 0.25s ease-in-out;
    }

    .lvd-header-toggle span:nth-child(1) { top: 0; }
    .lvd-header-toggle span:nth-child(2) { top: 8px; }
    .lvd-header-toggle span:nth-child(3) { top: 16px; }

    .lvd-header-toggle[aria-expanded="true"] span:nth-child(1) { top: 8px; transform: rotate(135deg); }
    .lvd-header-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: translateX(-40px); }
    .lvd-header-toggle[aria-expanded="true"] span:nth-child(3) { top: 8px; transform: rotate(-135deg); }

    /* Panel. Absolute against the header, which is a transformed containing block, and
           sized with dvh so the collapsing URL bar in mobile Safari cannot cut it off. */
    .lvd-header-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        height: calc(100dvh - var(--lvd-header-h) - var(--lvd-topbar-h));
        display: block;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 12px 0;
        background: var(--lvd-cc-surface);
        opacity: 0;
        visibility: hidden;
        /* Switched, not interpolated: an interpolated visibility still computes as hidden on
                   the frame the class lands, and focus moved into the panel would go nowhere. */
        transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    }

    /* The panel starts below the bar, so its height has to follow the bar's, not the
       constant the spacer uses. Only the shrink axis makes the two differ. */
    .lvd-header-logo-scroll-shrink.is-scrolled .lvd-header-nav {
        height: calc(100dvh - var(--lvd-header-h-min) - var(--lvd-topbar-h));
    }

    .lvd-header-nav.is-open {
        opacity: 1;
        visibility: visible;
        transition: opacity 0.3s ease, visibility 0s linear 0s;
    }

    .lvd-header-menu > ul { display: block; width: 100%; }

    /* The arrow is a flex item rather than an absolute overlay, so it centres on rows of
           any height, occupies real space, and needs no per-level offsets. */
    .lvd-header-menu li {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }

    /* flex-basis 0, not auto: lines are assigned by base size before shrinking, so a
           link based on its unwrapped width would claim the line and push the arrow off it. */
    /* overflow-wrap covers a single unbreakable word longer than the row. min-height
           expresses the 44px tap-target floor directly, so padding only adds to it. */
    .lvd-header-menu li > a {
        flex: 1 1 0;
        min-width: 0;
        overflow-wrap: break-word;
        display: flex;
        align-items: center;
        min-height: 44px;
    }
    .lvd-header-menu li > .sub-menu { flex: 0 0 100%; }

    /* Hierarchy: size, weight and indent step together, one move per level. Colour stays
           black until the deepest level, where size and indent already carry the depth. */
    /* The indent is on the link, not the row. On the row, each nested level would sit
           inside the previous one's content box and the arrows would never line up. */
    .lvd-header-menu > ul > li {
        padding: 0;
        border-bottom: 1px solid var(--lvd-header-rule);
    }

    .lvd-header-menu > ul > li > a {
        min-height: 48px; /* the primary level sits a touch taller than the floor */
        padding: 6px var(--lvd-header-indent);
        font-size: 20px;
        font-weight: 700;
        line-height: 1.2;
        letter-spacing: -0.01em; /* large bold text sets tighter */
        color: var(--lvd-cc-title);
    }

    /* A tap target separate from the link. Tapping the label still opens the submenu,
           which is why the parent page gets its own row inside. */
    /* The chip is invisible by default and the whole row is the real tap target, so a
           smaller control reads better at this density. */
    .lvd-header-submenu-toggle {
        position: relative;
        flex: 0 0 30px;
        width: 30px;
        height: 30px;
        margin-right: var(--lvd-header-indent);
        border-radius: 50%;
        background-color: var(--lvd-header-chip);
    }

    .lvd-header-submenu-toggle::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 14px;
        height: 14px;
        margin: -7px 0 0 -7px;
        background-color: var(--lvd-cc-text);
        transition: transform 0.3s ease;
        -webkit-mask-image: url('../assets/svg/bs-icons/chevron-down.svg');
                mask-image: url('../assets/svg/bs-icons/chevron-down.svg');
        -webkit-mask-repeat: no-repeat;
                mask-repeat: no-repeat;
        -webkit-mask-size: contain;
                mask-size: contain;
        -webkit-mask-position: center;
                mask-position: center;
    }

    .lvd-header-submenu-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }

    /* Accordion. grid-template-rows 0fr to 1fr is the only way to animate to an automatic
           height without measuring it, and it needs the single grid child MenuWalker emits.
           It costs layout while animating, which drill-down mode avoids entirely. */
    /* No background of its own: the submenu sits on the panel's surface and stays
       there, at every level. One flat plane instead of stacked grey trays. */
    .lvd-header-menu .sub-menu {
        display: grid;
        grid-template-rows: 0fr;
        padding: 0;
        background: transparent;
        transition: grid-template-rows 0.4s var(--lvd-header-ease);
    }

    .lvd-header-menu li.is-open > .sub-menu { grid-template-rows: 1fr; }

    .lvd-header-submenu-inner { overflow: hidden; min-height: 0; }

    .lvd-header-menu .sub-menu li            { border-bottom: 1px solid var(--lvd-header-rule); }
    .lvd-header-menu .sub-menu li:last-child { border-bottom: none; }

    /* Level 2 is flush with level 1: 22/700 against 16/500 carries the hierarchy, and a
           continuous left rail reads as navigation where a stepped one reads as a tree. */
    .lvd-header-menu .sub-menu li a {
        padding: 6px var(--lvd-header-indent);
        font-size: 16px;
        font-weight: 500;
        line-height: 1.3;
        color: var(--lvd-cc-title);
    }

    /* Level 3 steps in, because against level 2 the type alone is thin evidence. */
    .lvd-header-menu .sub-menu .sub-menu li a {
        padding: 4px var(--lvd-header-indent) 4px calc(var(--lvd-header-indent) + var(--lvd-header-step));
        font-size: 14px;
        font-weight: 400;
        color: var(--lvd-cc-text);
    }

    /* Breathing room around an open level, so the panel does not read as one dense
       column of rows. */
    .lvd-header-menu li.is-open > .sub-menu > .lvd-header-submenu-inner { padding: 0 0 4px; }

    /* Drill-down: each submenu becomes a full panel that slides over its parent. Markup
           is identical to the accordion, so every level stays in the source either way.

           Panels resolve against .lvd-header-nav; menu rows are deliberately unpositioned,
           or each panel would size itself to the row that owns it. */
    /* hidden on x clips the parked panels, auto on y keeps the root list scrollable.
           Scrolling is frozen while a panel is open, since panels sit inside this scroller. */
    .lvd-header-mobile-nav-drilldown .lvd-header-nav { overflow: hidden auto; padding: 0; }
    .lvd-header-mobile-nav-drilldown .lvd-header.is-drilled .lvd-header-nav { overflow: hidden; }
    .lvd-header-mobile-nav-drilldown .lvd-header-menu > ul { padding: 12px 0; }

    .lvd-header-mobile-nav-drilldown .lvd-header-menu .sub-menu {
        position: absolute;
        inset: 0;
        z-index: 1;
        display: block;
        padding: 12px 0;
        background: var(--lvd-cc-surface);
        /* Both axes named: overflow-y alone leaves x visible, and the resulting pair is
                   resolved by forcing x to auto, which made the parked panels scrollable width. */
        overflow: hidden auto;
        overscroll-behavior: contain;
        visibility: hidden;
        transform: translateX(100%);
        /* visibility is switched rather than interpolated: delayed by the slide on close,
                   immediate on open. Interpolated, it still computes as hidden on the opening
                   frame and focus into the panel fails silently. */
        transition: transform 0.32s var(--lvd-header-ease),
                    visibility 0s linear 0.32s;
    }

    .lvd-header-mobile-nav-drilldown .lvd-header-menu li.is-open > .sub-menu {
        visibility: visible;
        transform: translateX(0);
        transition: transform 0.32s var(--lvd-header-ease),
                    visibility 0s linear 0s;
    }

    /* The accordion's clipping wrapper has no job here. */
    .lvd-header-mobile-nav-drilldown .lvd-header-submenu-inner { overflow: visible; }

    /* Rightwards, because the row leads elsewhere rather than unfolding in place. No
           rotation on open: by then the panel covers the row. */
    .lvd-header-mobile-nav-drilldown .lvd-header-submenu-toggle::after {
        -webkit-mask-image: url('../assets/svg/bs-icons/chevron-right.svg');
                mask-image: url('../assets/svg/bs-icons/chevron-right.svg');
    }

    .lvd-header-mobile-nav-drilldown .lvd-header-submenu-toggle[aria-expanded="true"]::after {
        transform: none;
    }

    /* Covered rows leave the tab order as well as the screen. The open branch's panel is
           a sibling of these, so it stays. */
    .lvd-header-mobile-nav-drilldown .lvd-header.is-drilled .lvd-header-menu > ul > li > a,
    .lvd-header-mobile-nav-drilldown .lvd-header.is-drilled .lvd-header-menu > ul > li > .lvd-header-submenu-toggle,
    .lvd-header.is-drilled .lvd-header-nav-cta,
    .lvd-header.is-drilled .lvd-header-nav-utility { visibility: hidden; }

    /* The parent at the head of its own panel: context and the route to its page in one
           row. Same element the accordion shows as an ordinary first row. */
    /* Specificity kept above the row rule below, which also matches this element. */
    .lvd-header-mobile-nav-drilldown .lvd-header-menu .sub-menu li.lvd-header-submenu-all > a,
    .lvd-header-mobile-nav-drilldown .lvd-header-menu .sub-menu li.lvd-header-submenu-all > span {
        display: block;
        min-height: 0;
        padding: 6px var(--lvd-header-indent) 16px;
        font-size: 22px;
        font-weight: 700;
        letter-spacing: -0.01em;
        color: var(--lvd-cc-title);
    }

    /* A grouping parent has no page, so its title is plain text — no pointer, nothing
       that looks tappable and then does nothing. */
    .lvd-header-menu .lvd-header-submenu-all > span { cursor: default; }

    /* Every panel is its own context, so its rows read the same whatever their depth —
       no staircase of sizes, unlike the accordion where levels are visible at once. */
    .lvd-header-mobile-nav-drilldown .lvd-header-menu .sub-menu li a,
    .lvd-header-mobile-nav-drilldown .lvd-header-menu .sub-menu .sub-menu li a {
        padding: 9px var(--lvd-header-indent);
        font-size: 16px;
        font-weight: 500;
        color: var(--lvd-cc-title);
    }

    /* --- Panel extras --- */
    .lvd-header-nav-cta {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 28px var(--lvd-header-indent) 8px;
    }

    .lvd-header-nav-cta .lvd-header-cta { text-align: center; }

    /* Utility links at the foot of the panel — quieter than the main menu, which is
       what they are. */
    .lvd-header-nav-utility         { padding: 8px var(--lvd-header-indent) 24px; }
    .lvd-header-nav-utility ul      { display: flex; flex-direction: column; gap: 4px; }
    .lvd-header-nav-utility a       { display: inline-flex; align-items: center; gap: 8px; padding: 10px 0; font-size: var(--lvd-text-s1); color: var(--lvd-cc-text); }
    .lvd-header-nav-utility a:hover { opacity: 0.7; }

    .lvd-header-overlay { display: none; }
}

/*----------------------------- PHONE -----------------------------*/
/* A tablet keeps the desktop scale — it has more vertical room than a laptop, and a square
   logo is no more legible at 28px there. A phone is where the enlarged state has to earn
   its height, so it runs one scale down.

   It cannot run much further down: the settled sizes are the same at every width, so too
   small a top state leaves nothing to shrink. These keep the drop at 29–40%, against
   38–52% on desktop — the effect stays legible, and the tallest bar is 108px, the same
   share of a phone screen that 128px is of a laptop's. */
@media (max-width: 767px) {
    .lvd-header-logo-scroll-shrink.lvd-header-logo-size-sm { --lvd-header-logo-h: 56px; }
    .lvd-header-logo-scroll-shrink.lvd-header-logo-size-md { --lvd-header-logo-h: 68px; }
    .lvd-header-logo-scroll-shrink.lvd-header-logo-size-lg { --lvd-header-logo-h: 80px; }
}

/*----------------------------- SCROLL STATES -----------------------------*/
/* State classes live on <body> alongside the axes, so a rule can combine the two
   without reaching across the tree. */
.lvd-header-scroll-hide-on.is-hidden .lvd-header { transform: translateY(-100%); }

.lvd-header-logo-scroll-shrink.is-scrolled .lvd-header-bar      { height: var(--lvd-header-h-min); }
.lvd-header-logo-scroll-shrink.is-scrolled .lvd-header-logo img { height: var(--lvd-header-logo-h-min); }

/*----------------------------- REDUCED MOTION -----------------------------*/
@media (prefers-reduced-motion: reduce) {
    .lvd-header,
    .lvd-header-bar,
    .lvd-header-topbar,
    .lvd-header-logo img,
    .lvd-header-nav,
    .lvd-header-search,
    .lvd-header-overlay,
    .lvd-header-toggle::before,
    .lvd-header-announce-panel,
    .lvd-header-announce-chevron,
    .lvd-header-announce-close,
    .lvd-header-language-chevron,
    .lvd-header-menu .sub-menu {
        transition: none;
    }
}
