/* Slide Drawer — Right */

/* Ported from SRD Core menu-style-1 onto SRD Site Suite markup. All selectors
   are suite-owned (.srd-*) — no theme selectors, no icon fonts (inline SVG +
   CSS chevrons). Mega panel styles live in designs/megamenus/.

   Admin-configurable values arrive as CSS variables emitted by
   srdss_dynamic_css() (SRD Site Suite → Menu); every var() below carries the
   design's own default as fallback. The 1080px/1081px values in the media
   queries are BREAKPOINT TOKENS — when the admin sets a different Mobile
   Breakpoint, srdss_enqueue_breakpoint_css() substitutes them at load time.

   Link colours are rules of their own, carrying
   :not(#srd-id-weight):not(#srd-id-weight) — two IDs of specificity that
   match every element. A theme styling links under one ID of its own
   (`#wrapper .layout a`, often only on its shop and custom-post-type
   templates) otherwise beats the Link Color settings outright. Only the
   colour is weighted; layout and typography stay at ordinary specificity
   so a site can still override them. Every colour rule on a link carries
   the same weight, so their order against each other is unchanged. */

.srd-header-wrap .srd-menu,
.srd-header-wrap .srd-item > .sub-menu {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.srd-header-wrap .srd-item {
    position: relative;
}

/* Logo/nav/CTA arrangement (menu_layout + mobile_bar) and logo sizing live in
   the shared inc/features/header/assets/layout.css, loaded as a dependency
   before this file. A design must not restate them: the Logo Max Height
   settings only work while the sizing declarations sit beside the max-height
   that reads them. */

/* Buttons reset — hamburger, close, and (mobile) accordion toggles. */
.srd-header-wrap .srd-hamburger,
.srd-header-wrap .srd-drawer-close {
    appearance: none;
    background: none;
    border: 0;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: inherit;
}

.srd-header-wrap .srd-hamburger   { color: var(--srd-mobile-hamburger, currentColor); }
.srd-header-wrap .srd-drawer-close { color: var(--srd-mobile-close, currentColor); }

/* Dropdown indicator — span.srd-dd-indicator emitted by the walker, styled
   and animated by the shared dd-icons.css (Dropdown Icon settings). */

@media (min-width: 1081px) {
    #srd-overlay,
    .srd-header-wrap .srd-drawer-top {
        display: none;
    }

    .srd-header-wrap .srd-hamburger-wrap {
        display: none;
    }

    /* Panel-source mega panels (Synced Pattern or custom HTML) — two widths, per
       item (Appearance → Menus → item → Panel width):

       full (default) — anchors to the header: the trigger li goes
       position:static so the panel's containing block becomes .srd-header
       (position:relative from the header behavior CSS). left/right 0 then
       spans the full header width and top:100% lands at the header's
       bottom edge — correct for a trigger at ANY horizontal position.

       boxed — the trigger stays position:relative (like a normal dropdown)
       so the panel anchors to the trigger li itself and sizes to its own
       content, capped so a large layout doesn't grow unbounded (same
       reasoning as the Classic Columns mega design's max-width).

       High specificity on purpose: the mega design CSS loads later and
       must not re-style these. */
    .srd-header-wrap .srd-item.srd-mega-trigger--source.srd-mega-width--full {
        position: static;
    }

    .srd-header-wrap .srd-mega-trigger--source > .srd-mega-panel--source {
        position: absolute;
        top: 100%;
        left: 0;
        background: var(--srd-mega-bg, #ffffff);
    }

    .srd-header-wrap .srd-mega-trigger--source.srd-mega-width--full > .srd-mega-panel--source {
        right: 0;
        width: auto;
        min-width: 0;
        transform: none;
        padding: 0;
        border: 0;
        border-top: var(--srd-mega-border-width, 1px) var(--srd-mega-border-style, solid) var(--srd-mega-border, #e2e2e2);
        border-bottom: var(--srd-mega-border-width, 1px) var(--srd-mega-border-style, solid) var(--srd-mega-border, #e2e2e2);
        box-shadow: 0 18px 34px rgba(0, 0, 0, 0.08);
    }

    .srd-header-wrap .srd-mega-trigger--source.srd-mega-width--boxed > .srd-mega-panel--source {
        width: max-content;
        max-width: min(760px, calc(100vw - 40px));
        padding: 24px 28px;
        border: var(--srd-mega-border-width, 1px) var(--srd-mega-border-style, solid) var(--srd-mega-border, #e2e2e2);
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.09);
    }

    /* Invisible hover bridge over the gap between the nav link and the
       panel top, so the cursor can travel down without closing the panel
       (the panel is a DOM child of the li, so hovering it keeps li:hover).
       Sized to the panel's own rendered width in both modes, since this
       pseudo-element's containing block is the panel itself. */
    .srd-header-wrap .srd-mega-trigger--source > .srd-mega-panel--source::before {
        content: "";
        position: absolute;
        top: -24px;
        height: 24px;
        left: 0;
        right: 0;
    }

    /* The children list serves mobile only (mobile: list) — never desktop. */
    .srd-header-wrap .srd-mega-trigger--source > .sub-menu {
        display: none !important;
    }

    /* Drawer becomes an inline flex row on desktop: nav | CTA. The chain
       stretches (not centers) so each top-level li spans the full header
       row — hover covers the logo's height and the dropdown (top:100% on
       the li) opens flush with the row's bottom edge. layout.css stretches
       .srd-header-side into the grid row; the active dropdown design
       re-centers the link text inside the tall li. */
    .srd-header-wrap .srd-drawer,
    .srd-header-wrap .srd-drawer-content,
    .srd-header-wrap .srd-nav {
        display: flex;
        align-items: stretch;
        flex: 1;
    }

    .srd-header-wrap .srd-nav > .srd-menu {
        display: flex;
        width: 100%;
    }

    /* HTML Slot cosmetic styling — same treatment as .srd-cta below;
       placement (grid column in Split, gap before the hamburger on mobile,
       which copy the current width shows) is a shared concern, handled in
       layout.css. */
    .srd-header-wrap .srd-html-slot-wrap {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    /* CTA cosmetic styling — placement (pinned right / centered with the nav
       / etc.) is a menu_layout concern, handled in layout.css. */
    .srd-header-wrap .srd-cta {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    /* Language Switcher slot — same vertical-centering treatment as the CTA
       slot beside it in the row. */
    .srd-header-wrap .srd-lang {
        display: flex;
        align-items: center;
    }

    .srd-header-wrap .srd-item > a {
        display: flex;
        align-items: center;
        gap: 4px;
        margin: 15px;
        padding: 0 5px;
        font-size: var(--srd-menu-font-size, inherit);
        font-weight: var(--srd-menu-font-weight, 600);
        text-transform: var(--srd-menu-text-transform, none);
        letter-spacing: var(--srd-menu-letter-spacing, normal);
        /* Hover Link Color Duration. 0s is what the nav did before this
           existed, so a blank setting is not a new behaviour.

           Repeated in every hover-animation variant below rather than left
           to inherit: transition is a single declaration, so a variant rule
           setting its own wins the whole property and the colour would stop
           transitioning on exactly the items that animate. */
        transition: color var(--srd-menu-hover-duration, 0s) ease;
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item > a {
        color: var(--srd-menu-text, inherit);
    }

    /* Hover Animation (Desktop Navigation -> Hover Animation, or inherited
       from SRD Site Suite -> General -> Link Hover Animation) — childless items
       only; a parent item shows the dropdown indicator instead. */
    .srd-header.srd-menuanim--slide .srd-header-wrap .srd-item:not(.menu-item-has-children) > a {
        background: linear-gradient(0deg, var(--srd-menuanim-color, currentColor) 0%, var(--srd-menuanim-color, currentColor) 100%) no-repeat 0 100% / 0% 2px;
        transition: background-size var(--srd-menuanim-speed, var(--srd-linkanim-speed, 0.4s)) ease, color var(--srd-menu-hover-duration, 0s) ease;
    }

    .srd-header.srd-menuanim--slide .srd-header-wrap .srd-item:not(.menu-item-has-children) > a:hover {
        background-size: 100% 2px;
    }

    .srd-header.srd-menuanim--center .srd-header-wrap .srd-item:not(.menu-item-has-children) > a {
        background: linear-gradient(0deg, var(--srd-menuanim-color, currentColor) 0%, var(--srd-menuanim-color, currentColor) 100%) no-repeat 50% 100% / 0% 2px;
        transition: background-size var(--srd-menuanim-speed, var(--srd-linkanim-speed, 0.4s)) ease, color var(--srd-menu-hover-duration, 0s) ease;
    }

    .srd-header.srd-menuanim--center .srd-header-wrap .srd-item:not(.menu-item-has-children) > a:hover {
        background-size: 100% 2px;
    }

    .srd-header.srd-menuanim--fade .srd-header-wrap .srd-item:not(.menu-item-has-children) > a {
        text-decoration-line: underline;
        text-decoration-color: transparent;
        transition: text-decoration-color var(--srd-menuanim-speed, var(--srd-linkanim-speed, 0.4s)) ease, color var(--srd-menu-hover-duration, 0s) ease;
    }

    .srd-header.srd-menuanim--fade .srd-header-wrap .srd-item:not(.menu-item-has-children) > a:hover {
        text-decoration-color: var(--srd-menuanim-color, currentColor);
    }

    .srd-header.srd-menuanim--slide-rtl .srd-header-wrap .srd-item:not(.menu-item-has-children) > a {
        background: linear-gradient(0deg, var(--srd-menuanim-color, currentColor) 0%, var(--srd-menuanim-color, currentColor) 100%) no-repeat 100% 100% / 0% 2px;
        transition: background-size var(--srd-menuanim-speed, var(--srd-linkanim-speed, 0.4s)) ease, color var(--srd-menu-hover-duration, 0s) ease;
    }

    .srd-header.srd-menuanim--slide-rtl .srd-header-wrap .srd-item:not(.menu-item-has-children) > a:hover {
        background-size: 100% 2px;
    }

    /* Comes in, stays, goes out — grows in on hover, stays, and exits the far
       side on mouse out. Only background-size transitions, so the position
       snaps between the two edges while the bar is 0% wide; see link-anim.css. */
    .srd-header.srd-menuanim--in-stay-out .srd-header-wrap .srd-item:not(.menu-item-has-children) > a {
        background: linear-gradient(0deg, var(--srd-menuanim-color, currentColor) 0%, var(--srd-menuanim-color, currentColor) 100%) no-repeat 100% 100% / 0% 2px;
        transition: background-size var(--srd-menuanim-speed, var(--srd-linkanim-speed, 0.4s)) ease, color var(--srd-menu-hover-duration, 0s) ease;
    }

    .srd-header.srd-menuanim--in-stay-out .srd-header-wrap .srd-item:not(.menu-item-has-children) > a:hover {
        background-position: 0 100%;
        background-size: 100% 2px;
    }

    .srd-header.srd-menuanim--in-stay-out-rtl .srd-header-wrap .srd-item:not(.menu-item-has-children) > a {
        background: linear-gradient(0deg, var(--srd-menuanim-color, currentColor) 0%, var(--srd-menuanim-color, currentColor) 100%) no-repeat 0 100% / 0% 2px;
        transition: background-size var(--srd-menuanim-speed, var(--srd-linkanim-speed, 0.4s)) ease, color var(--srd-menu-hover-duration, 0s) ease;
    }

    .srd-header.srd-menuanim--in-stay-out-rtl .srd-header-wrap .srd-item:not(.menu-item-has-children) > a:hover {
        background-position: 100% 100%;
        background-size: 100% 2px;
    }

    /* From the center: two half-painted layers, centred to grow outward and
       anchored to their own edges to exit through both ends — see link-anim.css. */
    .srd-header.srd-menuanim--in-stay-out-center .srd-header-wrap .srd-item:not(.menu-item-has-children) > a {
        background:
            linear-gradient(to right, var(--srd-menuanim-color, currentColor) 50%, transparent 50%) no-repeat 0 100% / 0% 2px,
            linear-gradient(to right, transparent 50%, var(--srd-menuanim-color, currentColor) 50%) no-repeat 100% 100% / 0% 2px;
        transition: background-size var(--srd-menuanim-speed, var(--srd-linkanim-speed, 0.4s)) ease, color var(--srd-menu-hover-duration, 0s) ease;
    }

    .srd-header.srd-menuanim--in-stay-out-center .srd-header-wrap .srd-item:not(.menu-item-has-children) > a:hover {
        background-position: 50% 100%, 50% 100%;
        background-size: 100% 2px, 100% 2px;
    }

    @keyframes srd-menuanim-comes-in-goes-out {
        0%     { transform: scaleX(0); transform-origin: left; }
        50%    { transform: scaleX(1); transform-origin: left; }
        50.01% { transform-origin: right; }
        100%   { transform: scaleX(0); transform-origin: right; }
    }

    .srd-header.srd-menuanim--comes-in-goes-out .srd-header-wrap .srd-item:not(.menu-item-has-children) > a {
        position: relative;
    }

    .srd-header.srd-menuanim--comes-in-goes-out .srd-header-wrap .srd-item:not(.menu-item-has-children) > a::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 2px;
        background: var(--srd-menuanim-color, currentColor);
        transform: scaleX(0);
        transform-origin: left;
    }

    .srd-header.srd-menuanim--comes-in-goes-out .srd-header-wrap .srd-item:not(.menu-item-has-children) > a:hover::after {
        animation: srd-menuanim-comes-in-goes-out var(--srd-menuanim-speed, var(--srd-linkanim-speed, 0.9s)) ease-in-out;
    }

    @keyframes srd-menuanim-comes-in-goes-out-rtl {
        0%     { transform: scaleX(0); transform-origin: right; }
        50%    { transform: scaleX(1); transform-origin: right; }
        50.01% { transform-origin: left; }
        100%   { transform: scaleX(0); transform-origin: left; }
    }

    .srd-header.srd-menuanim--comes-in-goes-out-rtl .srd-header-wrap .srd-item:not(.menu-item-has-children) > a {
        position: relative;
    }

    .srd-header.srd-menuanim--comes-in-goes-out-rtl .srd-header-wrap .srd-item:not(.menu-item-has-children) > a::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 2px;
        background: var(--srd-menuanim-color, currentColor);
        transform: scaleX(0);
        transform-origin: right;
    }

    .srd-header.srd-menuanim--comes-in-goes-out-rtl .srd-header-wrap .srd-item:not(.menu-item-has-children) > a:hover::after {
        animation: srd-menuanim-comes-in-goes-out-rtl var(--srd-menuanim-speed, var(--srd-linkanim-speed, 0.9s)) ease-in-out;
    }

    @keyframes srd-menuanim-goes-out-comes-in {
        0%     { transform: scaleX(1); transform-origin: right; }
        50%    { transform: scaleX(0); transform-origin: right; }
        50.01% { transform-origin: left; }
        100%   { transform: scaleX(1); transform-origin: left; }
    }

    .srd-header.srd-menuanim--goes-out-comes-in .srd-header-wrap .srd-item:not(.menu-item-has-children) > a {
        position: relative;
    }

    .srd-header.srd-menuanim--goes-out-comes-in .srd-header-wrap .srd-item:not(.menu-item-has-children) > a::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 2px;
        background: var(--srd-menuanim-color, currentColor);
        transform: scaleX(1);
        transform-origin: left;
    }

    .srd-header.srd-menuanim--goes-out-comes-in .srd-header-wrap .srd-item:not(.menu-item-has-children) > a:hover::after {
        animation: srd-menuanim-goes-out-comes-in var(--srd-menuanim-speed, var(--srd-linkanim-speed, 0.9s)) ease-in-out;
    }

    @keyframes srd-menuanim-goes-out-comes-in-rtl {
        0%     { transform: scaleX(1); transform-origin: left; }
        50%    { transform: scaleX(0); transform-origin: left; }
        50.01% { transform-origin: right; }
        100%   { transform: scaleX(1); transform-origin: right; }
    }

    .srd-header.srd-menuanim--goes-out-comes-in-rtl .srd-header-wrap .srd-item:not(.menu-item-has-children) > a {
        position: relative;
    }

    .srd-header.srd-menuanim--goes-out-comes-in-rtl .srd-header-wrap .srd-item:not(.menu-item-has-children) > a::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 2px;
        background: var(--srd-menuanim-color, currentColor);
        transform: scaleX(1);
        transform-origin: right;
    }

    .srd-header.srd-menuanim--goes-out-comes-in-rtl .srd-header-wrap .srd-item:not(.menu-item-has-children) > a:hover::after {
        animation: srd-menuanim-goes-out-comes-in-rtl var(--srd-menuanim-speed, var(--srd-linkanim-speed, 0.9s)) ease-in-out;
    }

    /* Current page / hover colors — inherit when unset (theme color wins). */
    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item.current-menu-item > a,
    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item.current-menu-parent > a,
    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item.current-menu-ancestor > a {
        color: var(--srd-menu-current, var(--srd-menu-text, inherit));
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item > a:hover {
        color: var(--srd-menu-hover, var(--srd-menu-text, inherit));
    }

    /* Open-state indicator animation lives in dd-icons.css (Icon Animation
       setting). */

    /* Dropdown panel box/positioning/animation/level-3 — the Desktop Dropdown
       Design (designs/dropdowns/), enqueued as a dependent stylesheet right
       after this one, owns all of that. */
}

@media (max-width: 1080px) {
    .srd-header-wrap .srd-header-side {
        justify-content: flex-end;
    }

    #srd-overlay {
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        background: var(--srd-mobile-overlay-bg, rgba(0, 0, 0, 0.5));
        opacity: 0;
        visibility: hidden;
        transition: 0.2s;
        z-index: 999;
    }

    body.srd-drawer-open #srd-overlay {
        opacity: 1;
        visibility: visible;
    }

    body.srd-drawer-open {
        height: 100%;
        overflow: hidden;
        touch-action: none;
    }

    /* Drawer — off-canvas right. */
    .srd-header-wrap .srd-drawer {
        width: 100%;
        max-width: 420px;
        height: 100vh;
        height: 100dvh;
        position: fixed;
        top: 0;
        right: -100%;
        bottom: 0;
        padding: 27px 25px;
        background: var(--srd-mobile-bg, #ffffff);
        /* visibility in the transition list (not just right) so the browser's
           built-in visibility-transition rule applies: switches to visible
           instantly on open, but only to hidden at the END of the slide-out
           on close — otherwise the drawer vanishes the instant the class is
           removed, before "right" has a chance to animate back. */
        transition: right 0.4s ease, visibility 0.4s ease;
        overflow-y: auto;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        visibility: hidden;
    }

    .srd-header-wrap .srd-drawer.srd-drawer--open {
        right: 0;
        visibility: visible;
    }

    .srd-header-wrap .srd-drawer-top {
        display: flex;
        justify-content: flex-end;
        margin-bottom: var(--srd-mobile-close-margin, 10px);
    }

    .srd-header-wrap .srd-drawer-content {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    /* CTA position in the drawer — modifier from the cta_position setting.
       "Above the menu" (--cta-top) is reordered in header/assets/layout.css,
       because it has to move the Drawer Slot with it. */
    .srd-header-wrap .srd-drawer-content--cta-bottom .srd-cta {
        margin-top: auto;
        padding-top: 24px;
    }

    /* Breathing room below the CTA slot, regardless of cta_position — the
       switcher always follows directly after it in DOM. */
    .srd-header-wrap .srd-drawer-content .srd-lang {
        margin-top: 16px;
    }

    /* The link indicator is a desktop-only affordance (hover mode); mobile is
       unconditionally toggle-based via the real .srd-dd-toggle button below —
       dd-icons.css hides .srd-dd-indicator at this breakpoint. */

    .srd-header-wrap .srd-item {
        margin-bottom: 20px;
        padding-bottom: 20px;
        border-bottom: 1px solid var(--srd-mobile-divider, #dddddd);
    }

    /* Drawer Hover Duration. Every drawer anchor at every level, which is why
       the rule is here rather than repeated on each of the three link blocks
       below — and why nothing below declares a transition of its own, since a
       second one would win the whole property rather than adding to this.

       ONE fallback, not two. The indent already slid over 0.3s while the
       colour snapped, and 0s/0.3s would have reproduced that exactly — but
       then a blank field has two answers and its placeholder can only show
       one, so the number an admin reads would be wrong about the colour.
       Both take the indent's own 0.3s instead, which is also the pairing the
       row was already half doing: a row that moves and recolours should do
       both together. */
    .srd-header-wrap .srd-menu a {
        transition: margin-left var(--srd-mobile-hover-duration, 0.3s) ease-in-out,
                    color var(--srd-mobile-hover-duration, 0.3s) ease-in-out;
    }

    .srd-header-wrap .srd-item > a {
        display: flex;
        align-items: center;
        margin-left: 15px;
        font-size: var(--srd-mobile-parent-size, clamp(20px, 3vw, 24px));
        font-weight: var(--srd-mobile-parent-weight, 600);
        text-transform: var(--srd-mobile-text-transform, none);
        letter-spacing: var(--srd-mobile-letter-spacing, normal);
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item > a {
        color: var(--srd-mobile-text, #333333);
    }

    .srd-header-wrap .srd-item > a:hover {
        margin-left: 10px;
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item > a:hover {
        color: var(--srd-mobile-parent-hover, var(--srd-mobile-text, #333333));
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item.current-menu-item > a,
    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item.current-menu-parent > a,
    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item.current-menu-ancestor > a {
        color: var(--srd-mobile-parent-current, var(--srd-mobile-text, #333333));
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item.current-menu-item > a:hover,
    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item.current-menu-parent > a:hover,
    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item.current-menu-ancestor > a:hover {
        color: var(--srd-mobile-parent-hover, var(--srd-mobile-parent-current, var(--srd-mobile-text, #333333)));
    }

    /* Dropdown accordion — .srd-acc-open + inline max-height from script.js. */
    .srd-header-wrap .srd-item > .sub-menu {
        max-height: 0;
        overflow: hidden;
        padding-top: 0;
        transition: max-height 0.4s ease-in-out, opacity 0.35s ease-in-out, padding-top 0.4s ease-in-out;
        opacity: 0;
    }

    .srd-header-wrap .srd-item > .sub-menu.srd-acc-open {
        padding-top: 12px;
        opacity: 1;
        transition: max-height 0.4s ease-in-out, opacity 0.35s ease-in-out;
    }

    .srd-header-wrap .srd-item > .sub-menu a {
        display: block;
        padding: 15px 10px 5px 25px;
        font-size: var(--srd-mobile-sub-size, 20px);
        font-weight: var(--srd-mobile-sub-weight, 600);
        text-transform: var(--srd-mobile-text-transform, none);
        letter-spacing: var(--srd-mobile-letter-spacing, normal);
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item > .sub-menu a {
        color: var(--srd-mobile-sub-text, var(--srd-mobile-text, #333333));
    }

    .srd-header-wrap .srd-item > .sub-menu > li > a:hover {
        margin-left: -5px;
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item > .sub-menu > li > a:hover {
        color: var(--srd-mobile-sub-hover, var(--srd-mobile-sub-text, var(--srd-mobile-text, #333333)));
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item > .sub-menu a[aria-current="page"] {
        color: var(--srd-mobile-sub-current, var(--srd-mobile-sub-text, var(--srd-mobile-text, #333333)));
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-item > .sub-menu a[aria-current="page"]:hover {
        color: var(--srd-mobile-sub-hover, var(--srd-mobile-sub-current, var(--srd-mobile-sub-text, var(--srd-mobile-text, #333333))));
    }

    /* Toggle button — the accordion's click target at every level (mobile is
       unconditionally toggle-based; there's no hover on touch). A sibling of
       <a>, so the row needs to be a flex container to place them side by
       side. */
    .srd-header-wrap .srd-item,
    .srd-header-wrap .srd-subitem {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }

    .srd-header-wrap .srd-item > a,
    .srd-header-wrap .srd-subitem > a {
        flex: 1 1 auto;
    }

    /* Row-breaking children: an open accordion panel is a flex sibling of the
       link and the toggle button, so without a full basis it lays out BESIDE
       them instead of below. Level 3 carries its own copy of this further
       down; drill mode sets it in drill.css. */
    .srd-header-wrap .srd-item > .sub-menu,
    .srd-header-wrap .srd-item > .srd-mega-panel {
        width: 100%;
        flex-basis: 100%;
    }

    .srd-header-wrap .srd-dd-toggle {
        display: flex;
        appearance: none;
        background: none;
        border: 0;
        padding: 4px;
        cursor: pointer;
        color: var(--srd-mobile-arrow, currentColor);
        flex: 0 0 auto;
    }

    /* Toggle icon open-state animation lives in dd-icons.css (Mobile Icon
       Animation setting). */

    /* Level 3 — a sub-item's own nested list, same inline-accordion mechanic
       as level 2 above, one step further indented. */
    .srd-header-wrap .srd-subitem > .sub-menu {
        width: 100%;
        flex-basis: 100%;
        max-height: 0;
        overflow: hidden;
        padding-top: 0;
        padding-left: 15px;
        transition: max-height 0.4s ease-in-out, opacity 0.35s ease-in-out, padding-top 0.4s ease-in-out;
        opacity: 0;
    }

    .srd-header-wrap .srd-subitem > .sub-menu.srd-acc-open {
        padding-top: 8px;
        opacity: 1;
        transition: max-height 0.4s ease-in-out, opacity 0.35s ease-in-out;
    }

    .srd-header-wrap .srd-subitem > .sub-menu a {
        display: block;
        padding: 10px 10px 5px 20px;
        font-size: var(--srd-mobile-sub-size, 18px);
        font-weight: var(--srd-mobile-sub-weight, 500);
        text-transform: var(--srd-mobile-text-transform, none);
        letter-spacing: var(--srd-mobile-letter-spacing, normal);
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-subitem > .sub-menu a {
        color: var(--srd-mobile-sub-text, var(--srd-mobile-text, #333333));
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-subitem > .sub-menu a:hover {
        color: var(--srd-mobile-sub-hover, var(--srd-mobile-sub-text, var(--srd-mobile-text, #333333)));
    }

    .srd-header-wrap:not(#srd-id-weight):not(#srd-id-weight) .srd-subitem > .sub-menu a[aria-current="page"] {
        color: var(--srd-mobile-sub-current, var(--srd-mobile-sub-text, var(--srd-mobile-text, #333333)));
    }
}

@media (max-width: 1080px) {
    /* Layout mega panels in the drawer — behavior per the item's mobile mode. */

    /* list / hide: the layout panel never shows on mobile (list mode shows the
       children as a normal accordion instead). */
    .srd-header-wrap .srd-mega-mobile--list > .srd-mega-panel--source,
    .srd-header-wrap .srd-mega-mobile--hide > .srd-mega-panel--source {
        display: none !important;
    }

    /* stack: the panel joins the accordion (mega design CSS provides the
       max-height mechanics) — neutralize the desktop chrome. */
    .srd-header-wrap .srd-mega-mobile--stack > .srd-mega-panel--source {
        position: static;
        width: auto;
        transform: none;
        border: 0;
        box-shadow: none;
        background: transparent;
        padding: 0;
    }
}

/* WP admin bar offsets for the fixed drawer. */
@media (min-width: 783px) and (max-width: 1080px) {
    .admin-bar .srd-header-wrap .srd-drawer { top: 32px; }
}

@media (max-width: 782px) {
    .admin-bar .srd-header-wrap .srd-drawer { top: 46px; }
}
