/**
 * header-nav-desktop.css - Desktop Primary Nav & Dropdown Menus
 *
 * Owns the visual treatment of the primary nav at desktop
 * widths:
 *   - Top-level plain anchors (header-only override of the
 *     shared .nav-list a base from nav-toggle.css).
 *   - Dropdown trigger buttons -- styled to read identically
 *     to plain anchors so the row is visually consistent.
 *   - Dropdown caret indicator (rotates open/closed).
 *   - Floating submenu panels with hover, focus-within, and
 *     .is-open trigger states.
 *   - Submenu link styling and the highlighted CTA child
 *     (the Call Us tel: action at the bottom of the
 *     Contact Us dropdown).
 *
 * Mobile accordion treatment for the same nav lives in
 * header-nav-mobile.css. Structural layout (grid, sticky,
 * branding) lives in header-layout.css.
 *
 * @package LibrandiOutdoorPower
 * @since   0.1.0
 * @updated 0.1.1 - Top-level items (plain anchors + dropdown
 *                  triggers) gained a visible resting pill
 *                  affordance (faint primary wash + solid
 *                  border) so they read as buttons against
 *                  the busy blueprint header backdrop. Submenu
 *                  links explicitly cancel the inherited
 *                  bottom-only border-on-hover from
 *                  .nav-list a in nav-toggle.css so the
 *                  current-menu-item active state and hover
 *                  state both wrap the full pill via
 *                  background-color + border-radius rather
 *                  than reading as a stray underline.
 * @updated 0.1.2 - Top-level pill rest state rebuilt as a
 *                  frosted-glass surface using backdrop-filter:
 *                  blur() against a translucent white. The
 *                  prior 8% primary-color wash failed to
 *                  obscure the blueprint hairlines beneath the
 *                  pills; the blur treatment turns the noisy
 *                  backdrop into a quiet gray surface so the
 *                  text reads cleanly. Hover/active states
 *                  drop the blur and commit to a fully opaque
 *                  amber pill.
 *                  Submenu hover state replaced with a strong
 *                  visible affordance (amber-tinted background
 *                  + full 4-sided amber border + amber text)
 *                  so it cannot be mistaken for "no hover."
 *                  Defensive border:none rules from v0.1.1
 *                  removed because the cascade leak they
 *                  worked around was fixed at the source --
 *                  nav-toggle.css's .nav-list a base no
 *                  longer ships cosmetic rules.
 */


/* ==========================================================
   Primary nav list -- horizontal row of top-level items
   Inherits .nav-list from nav-toggle.css for the shared base.
   Rules below override or extend specifically for dropdown
   triggers. The plain anchors keep their existing component
   treatment unchanged.
   ========================================================== */
.nav-list {
    /* Slightly tighter gap than the shared default so the
       dropdown triggers do not push the row wider than the
       contained .site-header__bar at 1024-1100px viewports. */
    gap: var(--space-4);
}

/* Dropdown parent <li> -- positioning anchor for the submenu. */
.nav-item--has-children {
    position: relative;
}


/* ==========================================================
   Top-level nav items (plain anchors + dropdown triggers)

   The header sits on a busy white-and-red blueprint pattern,
   so any cosmetic styling must produce a pill silhouette that
   reads cleanly against the grid hairlines. Earlier passes
   tried a faint primary-color wash (8-12% alpha) but the
   pattern still bled through and the items disappeared.

   The fix: a TRANSLUCENT WHITE PILL with backdrop-filter: blur()
   so the blueprint behind each pill is actually obliterated by
   a frosted-glass treatment. The grid hairlines are blurred
   into a soft surface that the dark text reads against without
   competition. This is the same affordance pattern modern OS
   chrome uses (macOS menu bar, iOS headers) and it solves the
   problem decisively at the surface level rather than fighting
   the backdrop with translucency tricks.

   Both plain anchors (Home, Services, Equipment) and dropdown
   trigger <button>s share this rule via a grouped selector so
   the row reads as one consistent set of pills. The shared
   .nav-list a base in nav-toggle.css is now structural-only
   (no font, color, border, hover) so this rule does not have
   to compensate for cascade leaks.

   Hover, open, focus-within, current-menu-item, and current-
   menu-parent all escalate to the full safety-amber pill so
   the active state still wins the visual hierarchy.
   ========================================================== */
.primary-nav .nav-list > li > a,
.primary-nav .nav-list__trigger {
    /* Reset native button chrome on the trigger; harmless on
       the anchor (display:block already wins in nav-toggle.css). */
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    margin: 0;

    /* Pill geometry. inline-flex keeps the trigger's caret +
       label vertically centered; on the anchor, inline-flex
       upgrades the .nav-list a display:block default to flow
       inline within the row -- harmless because the parent
       <li> is still a flex item of .nav-list. */
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: 2px solid var(--color-primary-dark);
    border-radius: var(--radius);
    line-height: 1.2;
    white-space: nowrap;

    /* Frosted-glass surface. The 0.55 alpha base + the 10px
       backdrop blur turns the noisy blueprint underneath into
       a quiet gray wash so the dark text has a stable surface
       to read against. -webkit-backdrop-filter is the Safari
       prefix (still needed as of 2026 for full coverage). */
    background-color: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
            backdrop-filter: blur(10px) saturate(120%);

    /* Typography. Bevan at --text-lg matches the original
       header voice; primary-dark gives strong contrast against
       the frosted surface without going pure black (which would
       feel inkier than the brand language). */
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 400;
    letter-spacing: 0.01em;
    color: var(--color-primary-dark);
    text-decoration: none;

    transition: color            var(--duration) var(--ease),
                background-color var(--duration) var(--ease),
                border-color     var(--duration) var(--ease),
                box-shadow       var(--duration) var(--ease);
}

/*
 * Hover / open / focused / active states.
 *
 * Promote the pill to the safety-amber treatment used by the
 * "Home" current-menu-item so the active item has a clear
 * visual lineage with hovered items. White-ish background goes
 * fully opaque (no need for blur once the pill commits to a
 * solid surface) and the border + text both shift to the amber
 * accent.
 */
.primary-nav .nav-list > li > a:hover,
.primary-nav .nav-list > li > a:focus-visible,
.primary-nav .nav-list > li.current-menu-item > a,
.primary-nav .nav-list__trigger:hover,
.primary-nav .nav-list__trigger:focus-visible,
.primary-nav .nav-item--has-children:hover .nav-list__trigger,
.primary-nav .nav-item--has-children:focus-within .nav-list__trigger,
.primary-nav .nav-item--has-children.is-open .nav-list__trigger,
.primary-nav .current-menu-parent .nav-list__trigger {
    color: var(--color-accent);
    background-color: var(--color-white);
    border-color: var(--color-accent);
    /* Drop the blur on active states -- the pill is fully
       opaque now, no backdrop noise to suppress. */
    -webkit-backdrop-filter: none;
            backdrop-filter: none;
}

/*
 * Focus-visible escalates further with an outline ring so
 * keyboard users get an unambiguous indicator beyond the
 * hover state. Outline (not box-shadow) so the ring sits
 * outside the pill geometry without nudging the layout.
 */
.primary-nav .nav-list > li > a:focus-visible,
.primary-nav .nav-list__trigger:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/*
 * Active page indicator: full safety-amber pill plus a soft
 * accent-color drop shadow so current-menu-item reads at a
 * glance amid a row of peer pills. This intentionally
 * out-weights the hover state.
 */
.primary-nav .nav-list > li.current-menu-item > a,
.primary-nav .current-menu-parent .nav-list__trigger {
    box-shadow: 0 2px 8px rgba(var(--color-accent-rgb), 0.30);
}


/* ==========================================================
   Caret indicator on the trigger

   Rotates when the dropdown is open. Animation respects
   prefers-reduced-motion via the global rule in responsive.css
   (transition-duration is forced to 0.01ms there).
   ========================================================== */
.nav-list__caret {
    flex-shrink: 0;
    /* Slight lift so the caret optically aligns with the
       Bevan baseline rather than the bounding box. */
    margin-block-start: 2px;
    transition: transform var(--duration) var(--ease);
}

.nav-item--has-children:hover .nav-list__caret,
.nav-item--has-children:focus-within .nav-list__caret,
.nav-item--has-children.is-open .nav-list__caret,
.nav-list__trigger[aria-expanded="true"] .nav-list__caret {
    transform: rotate(180deg);
}


/* ==========================================================
   Submenu (dropdown panel) -- desktop floating variant

   Hidden by default. Revealed via :hover, :focus-within, or
   the JS-applied .is-open class on the parent <li>.
   ========================================================== */
.nav-submenu {
    /* Reset list defaults */
    list-style: none;
    margin: 0;
    padding: var(--space-2);

    /* Float beneath the trigger */
    position: absolute;
    top: 100%;
    inset-inline-start: 0;
    z-index: 110; /* above .site-header z-index 100 */
    min-width: 220px;

    /* Surface treatment */
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);

    /* Hidden state: invisible but keeps layout box for
       smooth transition. visibility:hidden also takes the
       links out of the keyboard tab order while closed. */
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity    var(--duration) var(--ease),
                visibility var(--duration) var(--ease),
                transform  var(--duration) var(--ease);
}

/* Open states: hover (mouse), focus-within (keyboard tabbing
   through the submenu links), or .is-open (JS-applied via tap). */
.nav-item--has-children:hover .nav-submenu,
.nav-item--has-children:focus-within .nav-submenu,
.nav-item--has-children.is-open .nav-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}


/* ==========================================================
   Submenu items

   Switch to mono typography in the dropdown surface. This
   creates a clean typographic step from the Bevan triggers
   (signage) to the mono-faced submenu items (utility links)
   so the surfaces read as different layers of the same nav.

   Now that the shared .nav-list a base in nav-toggle.css is
   structural-only (cosmetic rules removed in v0.1.2), submenu
   items can declare their own visual language directly without
   playing defense against bottom-border leaks from the parent
   .nav-list ancestor. Hover and current-menu-item states are
   defined with both a colored background AND a visible solid
   border on all four sides so the affordance is unambiguous.
   ========================================================== */
.nav-submenu li {
    list-style: none;
}

.nav-submenu a {
    display: block;
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--color-gray-700);
    text-decoration: none;
    /* Transparent border at rest reserves layout space for the
       2px hover/active border below so the row geometry stays
       stable through the transition (no jiggle as items pick
       up borders). */
    border: 2px solid transparent;
    border-radius: var(--radius);
    background-color: transparent;
    transition: background-color var(--duration) var(--ease),
                border-color     var(--duration) var(--ease),
                color            var(--duration) var(--ease);
}

/*
 * Hover and keyboard-focus states.
 *
 * Strong, obviously-visible affordance: amber-tinted background
 * + matching amber border on all four sides + amber text. The
 * background alpha is high enough (~18%) to clearly stand apart
 * from the white submenu panel, and the border wraps the full
 * pill so the user has unambiguous "you are pointing at this"
 * feedback. Earlier passes (v0.1.0 and v0.1.1) under-served
 * this state by relying on a faint off-white background that
 * was barely distinguishable from the panel itself.
 */
.nav-submenu a:hover,
.nav-submenu a:focus-visible {
    background-color: rgba(var(--color-accent-rgb), 0.18);
    border-color: var(--color-accent);
    color: var(--color-accent-hover);
    outline: none;
}

/*
 * Active submenu item (the page the user is currently on).
 *
 * Full safety-amber pill -- background, border, and text all
 * commit to the accent color so it out-weights the hover
 * state on adjacent items. Mirrors the top-level
 * current-menu-item box-shadow lift so the visual vocabulary
 * stays consistent between the bar and its dropdowns.
 */
.nav-submenu .current-menu-item > a {
    color: var(--color-accent);
    font-weight: 600;
    background-color: rgba(var(--color-accent-rgb), 0.12);
    border-color: var(--color-accent);
    box-shadow: 0 2px 6px rgba(var(--color-accent-rgb), 0.20);
}


/* ==========================================================
   Submenu CTA child -- the Call Us tel: action

   Visually distinct from regular links: amber background,
   white text, phone icon. Sits at the bottom of the
   Contact Us dropdown as a peer affordance to the Contact
   page link above it.

   !important on background-color and border-color is
   intentional: the rest state would otherwise be hijacked
   by the shared .nav-submenu a styling (which carries
   higher specificity due to its element selector). Without
   the override, the CTA was rendering with no background
   fill at rest on some configurations -- white text on the
   submenu panel's white surface -- and only became visible
   on hover.
   ========================================================== */
.nav-submenu__cta {
    display: flex !important;
    align-items: center;
    gap: var(--space-2);
    margin-block-start: var(--space-1);
    padding: var(--space-3) var(--space-4) !important;
    background-color: var(--color-accent) !important;
    color: var(--color-white) !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: var(--text-xs) !important;
    border: 1px solid var(--color-accent) !important;
    border-radius: var(--radius);
    /* Subtle lift so the CTA reads as a button at rest, not
       just a colored row. Matches the .btn--primary visual
       weight pattern from buttons.css. */
    box-shadow: 0 2px 6px rgba(var(--color-accent-rgb), .25);
}

.nav-submenu__cta:hover,
.nav-submenu__cta:focus-visible {
    background-color: var(--color-accent-hover) !important;
    border-color: var(--color-accent-hover) !important;
    color: var(--color-white) !important;
    box-shadow: 0 4px 14px rgba(var(--color-accent-rgb), .35);
}

.nav-submenu__cta-icon {
    flex-shrink: 0;
}
