/* ============================================================
   navigation.css — header navigation
   ============================================================
   Nav links get a hairline underline that slides in on hover. The
   underline geometry is SHARED with the footer nav in the rule below
   — one source so the two navs can't drift; footer.css only sets its
   own colours on top of it. Keep that rule here even when editing
   the footer.
   GOTCHA: keep the element's %root%:hover colour cleared in Bricks —
   it colours EVERY link when you hover the container.
   Conventions: _shared/bricks-builder/css-conventions.md

   Contents
     1. Header states — sticky shadow, on top of the photo
     2. Link underline base (shared with the footer nav)
     3. Active-page indicator at the header's top edge, one-line items
     4. CTA menu item
     5. Mobile menu drawer
     6. Header icon buttons — the house 44 px target

   Last updated: 2026-10-10 (auto-stamped by the pre-commit hook)
   ============================================================ */


/* --- 1. Header states — sticky, auto-hide, on top of the photo -- */

/* Every state is driven by classes Bricks' own sticky-header script
   sets: `scrolling` once the page has scrolled, `slide-up` while the
   reader scrolls DOWN (the template's "Slide up after" is 1 px, so it
   comes on with the first scroll), removed again the moment they
   scroll UP. From those, three looks:
     at the top = :not(.scrolling)
     hidden     = .slide-up — rolling away or gone (keyboard focus
                  brings it back as a revealed bar, see below)
     revealed   = .scrolling:not(.slide-up) — scrolled up: solid, shadow
   SEE-THROUGH (on a hero that asks for it) = at the top, or hidden
   without keyboard focus:  :is(:not(.scrolling), .slide-up:not(:has(:focus-visible)))
   That condition appears, identical, in the dark-hero remap (generated
   into dark-sections.css) and the logo swap (utility-classes.css §9) —
   change it in all three places. */

/* Revealed: the bar lifts only while floating over content. */
#brx-header.scrolling:not(.slide-up),
#brx-header.slide-up:has(:focus-visible) {
    box-shadow: var(--elevation-sticky-header);
    background-image: var(--elevation-overlay-sticky-header);
}

/* Hidden: a sticky element whose `top` is above the edge simply rolls
   away with the page from the top — no white flash, no slide — and is
   gone at once when the reader scrolls down mid-page. `top`, never
   Bricks' transform: a transform on a position: sticky element is
   unreliable (Firefox), the house rule in DESIGN-SYSTEM.md §7.3. Bricks'
   CSS sits in @layer bricks, so these unlayered rules win without
   specificity tricks. The offset also clears the shadow's reach. Bricks'
   `sliding` state (overflow: hidden, cleared only by a transform
   transition that never runs now) is neutralised so dropdowns are not
   clipped. */
#brx-header.brx-sticky.slide-up {
    transform: none;
    top: calc(-1 * (var(--header-height) + var(--space-m)));
    overflow-x: visible;
}
#brx-header.brx-sticky.sliding {
    overflow: visible;
}

/* Revealed by scrolling up: the bar FADES in at the top edge — a fade,
   not a slide (Katrine's choice). An animation, because it must run on
   entering the state while `top` jumps; the template's Transition
   setting deliberately leaves `top` out. */
@keyframes header-reveal {
    from { opacity: 0; }
    to   { opacity: 1; }
}
/* Revealed, the bar is also slimmer than at rest — Katrine's choice B on
   the trial page (15-09-2026): logo 3rem, padding --space-xs, 75 px
   instead of 104 on desktop. Both values come from tokens.css §5, where
   --header-height-revealed is derived from them for the rules that must
   know the slim height (the /design-system bar, demo-css §6). At the top
   (:not(.scrolling)) nothing here applies, so the header section's own
   Padding field and the logos' Height field still rule the resting bar.
   The size change glides in and out; the reveal fade is unchanged. */
#brx-header.brx-sticky.scrolling:not(.slide-up) {
    --logo-height: var(--logo-height-revealed);
    animation: header-reveal var(--transition-base);
}
#brx-header.brx-sticky.scrolling:not(.slide-up) > .brxe-section {
    padding-block: var(--space-xs);
}
#brx-header .bricks-site-logo {
    transition: height var(--transition-base);
}
#brx-header > .brxe-section {
    transition: padding var(--transition-base);
}

/* Keyboard users: tabbing to anything in a hidden bar brings it back —
   at the admin bar's height for logged-in users, 0 for everyone else.
   :focus-visible, not :focus-within: a mouse click on the mode toggle
   or the menu button also leaves focus in the bar, and that must not
   pin it open (found in testing). */
#brx-header.brx-sticky.slide-up:has(:focus-visible) {
    /* stylelint-disable-next-line custom-property-pattern -- WordPress's own variable name */
    top: var(--wp-admin--admin-bar--height, 0);
}

/* Reduced motion: no fade, the bar simply appears and disappears. */
@media (prefers-reduced-motion: reduce) {
    #brx-header.brx-sticky,
    #brx-header .bricks-site-logo,
    #brx-header > .brxe-section {
        transition: none;
        animation: none;
    }
}

/* Header on top of the photo — the Hero panel's "Header: On top of the
   photo" choice puts .header-over-hero on the hero photo, and the page
   reads it here with :has(). The bar keeps its place and height in the
   flow; a negative margin the size of the bar lets the hero start at
   the top edge underneath it (the hero adds the same amount of top
   padding — hero.css §10). The background sits on the header's inner
   section, so that is what goes transparent: at the top and while
   rolling away. Revealed by scrolling up it is the normal bar, also
   over the photo, and turns see-through again only at the very top
   (Katrine's choice). The builder canvas shows the see-through state
   too — the editor must see the panel choice work — everything here is
   class-driven; only scrolling is missing there. */
body:has(.header-over-hero) #brx-header {
    margin-block-end: calc(-1 * var(--header-height));
}
body:has(.header-over-hero) #brx-header:is(:not(.scrolling), .slide-up:not(:has(:focus-visible))) > .brxe-section {
    background-color: transparent;
}

/* Over a DARK hero in Light Mode the see-through bar takes the
   dark-section text tokens (generated into dark-sections.css) and swaps
   the logo (utility-classes.css §9). The colour is re-read here because
   body passes the COLOUR down, not the token. The other three mode/hero
   pairings already match the page mode. */
html:not([data-brx-theme="dark"]) body:has(.section--dark-neutral > .header-over-hero) #brx-header:is(:not(.scrolling), .slide-up:not(:has(:focus-visible))) {
    color: var(--text-base);
}

/* Colour voice follows the hero: while the bar is see-through on an
   ACCENT hero, its button and link colours take the accent tokens, so
   the bar's "Kontakt" matches the hero's. Set on the inner section: a
   value set on the element itself beats the tokens the dark-hero remap
   above puts on the header, while --text-highlight-accent is still read
   from that remap — dark-context orange over a dark hero, light-context
   orange over a light one. Primary heroes need no rule: the bar is
   primary already. Revealed = the normal bar. */
body:has(.section--hero-accent > .header-over-hero) #brx-header:is(:not(.scrolling), .slide-up:not(:has(:focus-visible))) > .brxe-section {
    --action-primary: var(--action-accent);
    --action-primary-hover: var(--action-accent-hover);
    --action-primary-text: var(--action-accent-text);
    --text-link: var(--text-highlight-accent);
}

/* Same for a NEUTRAL hero: the bar's button goes grey-900 / white and
   its links take the strong text colour (hero.css §9a, 14-09-2026). */
body:has(.section--hero-neutral > .header-over-hero) #brx-header:is(:not(.scrolling), .slide-up:not(:has(:focus-visible))) > .brxe-section {
    --action-primary: var(--action-neutral);
    --action-primary-hover: var(--action-neutral-hover);
    --action-primary-text: var(--action-neutral-text);
    --text-link: var(--text-strong);
}

/* Image ABOVE the text on a stacked hero (hero.css §8b): the bar is solid
   again and sits above the image, as Katrine chose (09-10-2026) — nothing
   is painted on an image that stands alone. `revert-layer` hands each
   property back to the value below this file's own rules, so the bar's
   values stay in ONE home — except the background: Bricks writes the
   Header template's background (`#brxe-…`, Header › Style › Background)
   OUTSIDE its CSS layer, where revert-layer cannot reach it, so the same
   token is named here. Change the template's token and this line
   together. The logo swap is restated, because its rules are
   `!important` (utility-classes.css §9). A @media, not a @container: the bar sits
   outside the hero, so no container query of the hero can reach it; the
   hero spans the viewport, so the viewport's width is the hero's — the
   same stand-in hero-media.php's <source> uses. 56rem is the stacking
   point in hero.css §8; change all of them together. */
@media (width < 56rem) {
    body:has(.hero-image-position--above > .header-over-hero) #brx-header {
        margin-block-end: revert-layer;
    }
    body:has(.hero-image-position--above > .header-over-hero) #brx-header:is(:not(.scrolling), .slide-up:not(:has(:focus-visible))) > .brxe-section {
        background-color: var(--surface-base);

        --action-primary: revert-layer;
        --action-primary-hover: revert-layer;
        --action-primary-text: revert-layer;
        --text-link: revert-layer;
    }
    /* The dark-hero tokens on the bar go back in the generated
       dark-sections.css (same media query); only the colour set here does. */
    html:not([data-brx-theme="dark"]) body:has(.section--dark-neutral.hero-image-position--above > .header-over-hero) #brx-header:is(:not(.scrolling), .slide-up:not(:has(:focus-visible))) {
        color: revert-layer;
    }
    html:not([data-brx-theme="dark"]) body:has(.section--dark-neutral.hero-image-position--above > .header-over-hero) #brx-header:is(:not(.scrolling), .slide-up:not(:has(:focus-visible))) .hide-on-dark {
        display: block !important;
    }
    html:not([data-brx-theme="dark"]) body:has(.section--dark-neutral.hero-image-position--above > .header-over-hero) #brx-header:is(:not(.scrolling), .slide-up:not(:has(:focus-visible))) .hide-on-light {
        display: none !important;
    }
}

/* --- 2. Link underline base (shared with the footer nav) ------ */

.nav-menu .bricks-nav-menu-wrapper a,
.footer-nav a {
    width: fit-content;                          /* underline matches the word */
    text-decoration: none;
    border: 0;
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0% var(--border-width-thin);      /* hidden until hover */
    transition: color var(--transition-base),
                background-size var(--transition-base);
}
/* The hairline's air under the word, 0.15em. Footer links carry it as
   padding. Header links get their padding from Theme Style › Nav menu ›
   Padding instead (var(--space-2xs) top and bottom — the house 44 px
   target, 50 px here), so their hairline is lifted to the same spot under
   the word by the same token. */
.footer-nav a {
    padding-block-end: 0.15em;
}
.nav-menu .bricks-nav-menu-wrapper a {
    background-position: 0 calc(100% - var(--space-2xs) + 0.15em);
}
/* Hover + keyboard focus → brand link colour, hairline slides in. The
   current page's link is excluded on HOVER (it already carries the top
   indicator below; a second line under it is noise) but kept on keyboard
   FOCUS — the hairline doubles as the focus indicator. */
.nav-menu .bricks-nav-menu-wrapper a:not([aria-current="page"]):hover,
.nav-menu .bricks-nav-menu-wrapper a:focus-visible {
    color: var(--text-link);
    background-size: 100% var(--border-width-thin);
}

/* Current page + a dropdown parent with an open sub-page → brand link
   colour (the "you are here" line sits on the <li>, see below). Both
   selector families are needed: aria-current hits the open page's own
   link; the WordPress ancestor classes catch a dropdown parent while
   you browse its sub-pages. */
.nav-menu .bricks-nav-menu-wrapper a[aria-current="page"],
.nav-menu .bricks-nav-menu-wrapper .current-menu-ancestor > .brx-submenu-toggle > a,
.nav-menu .bricks-nav-menu-wrapper .current-menu-parent > .brx-submenu-toggle > a {
    color: var(--text-link);
}

/* --- 3. Active-page indicator at the header's top edge -------
   The nav cancels the header section's vertical padding with an equal
   negative margin and stretches, so each top-level <li> spans the full
   bar height and the indicator can sit at top: 0. Uses the same
   --space-s token the section's padding uses, so they can't drift. */
.nav-menu {
    display: flex;
    align-items: center;           /* keeps the mobile hamburger centred */
    align-self: stretch;
    margin-block: calc(-1 * var(--space-s));
}
.nav-menu .bricks-nav-menu-wrapper {
    height: 100%;
}
.nav-menu .bricks-nav-menu {
    height: 100%;
    align-items: stretch;          /* each top-level <li> spans the bar */
}

/* Links re-centre inside the full-height items, so a taller item (the
   CTA button) can't push the text links off the middle either. */
.nav-menu .bricks-nav-menu > li {
    display: flex;
    align-items: center;
    position: relative;            /* anchors the ::after indicator */
}

/* Each top-level item stays on one line, a dropdown parent's label with
   its caret too. When the row no longer fits, the mobile menu must take
   over: that width is the header's Nav Menu › Mobile menu › "Show at
   breakpoint", set per site to fit its own menu. */
.nav-menu .bricks-nav-menu > li > :is(a, .brx-submenu-toggle) {
    white-space: nowrap;
}

/* The line itself, on the current page's <li> (the CTA button too) and
   on the open section's dropdown parent.
   GOTCHA: must be ::after — Bricks reserves li::before on dropdown
   parents as its invisible hover bridge; painting a background on it
   turns the bridge into a giant coloured block on hover. */
.nav-menu .bricks-nav-menu > .current-menu-item::after,
.nav-menu .bricks-nav-menu > .current-menu-ancestor::after,
.nav-menu .bricks-nav-menu > .current-menu-parent::after {
    content: "";
    position: absolute;
    top: 0;
    inset-inline: 0;
    height: 5px;                   /* tuning knob — the indicator's weight */
    background-color: var(--text-link);
}

/* The caret button sits the house icon gap from its label (Bricks'
   default is 10px — buttons keep theirs, text links and this caret share
   --icon-gap). The gap is PADDING, so it is part of the button's hit
   area, with the same gap on the end side handed back by a negative
   margin so the next item stays put. The button stretches to the link's
   height (Theme Style's nav padding lands on it too), so its target
   follows the link with no number to keep in sync: 27 × 50 px, the icon
   exactly where it was. 44 wide is impossible here without moving the
   icon or overlapping the link — the one documented exception to the
   house rule (DESIGN-SYSTEM.md §6.5). */
.nav-menu .brx-submenu-toggle.icon-right > button {
    align-self: stretch;
    padding-inline: var(--icon-gap);
    margin-inline: 0 calc(-1 * var(--icon-gap));
    transition: color var(--transition-base);
}

/* Label and caret read as one item: hovering or focusing either colours
   both, and the caret's hover slides the label's hairline in. */
.nav-menu .brx-submenu-toggle:is(:hover, :has(:focus-visible)) > button,
.nav-menu .brx-submenu-toggle:has(> button:hover) > a {
    color: var(--text-link);
}
.nav-menu .brx-submenu-toggle:has(> button:hover) > a:not([aria-current="page"]) {
    background-size: 100% var(--border-width-thin);
}

/* On a dropdown parent the line stops at the text, matching the
   text-wide hover underline: the caret (a 1em button plus the icon gap)
   hangs at the item's end and shouldn't be underlined. */
.nav-menu .bricks-nav-menu > li.menu-item-has-children::after {
    inset-inline-end: calc(1em + var(--icon-gap));
}

/* The dropdown panel (.sub-menu) is styled in dropdown.css (shared with the
   standalone Dropdown element). Mobile menu stays a flat accordion. */

/* --- 4. CTA menu item ----------------------------------------
   .nav-cta (set in Appearance > Menus) turns one nav item into the
   primary button. WordPress puts the class on the <li>, so the inner
   <a> is styled — shared look here, per-wrapper geometry below. */
.nav-menu .bricks-nav-menu-wrapper .nav-cta > a,
.nav-menu .bricks-mobile-menu-wrapper .nav-cta > a {
    background-color: var(--action-primary);
    background-image: none;                 /* clear the inherited hairline */
    border: 2px solid var(--action-primary);
    border-radius: var(--radius-full);
    color: var(--action-primary-text);   /* the button's own text token, so an accent remap flips it too */
    font-weight: 500;
    transition: background-color var(--transition-base),
                box-shadow var(--transition-base);
}

/* Desktop bar: compact inline pill. Vertical padding comes from Theme
   Style › Nav menu › Padding like every top-level link; the pill only
   adds its sides. min-block-size is the house 44 px target (the same
   pattern as .cta--*), so the pill never falls under it. */
.nav-menu .bricks-nav-menu-wrapper .nav-cta > a {
    display: inline-flex;
    align-items: center;
    padding-inline: 1.2em;
    min-block-size: 2.75rem;
    line-height: 1.2;
}

/* Mobile menu: an inset full-width pill, centred in the drawer. Two
   Bricks defaults have to be overridden or the button balloons:
   1. Bricks gives mobile menu links line-height: 60px (tall tap rows) —
      with border-radius: 9999px that turns the button into a huge blob,
      so reset it to a normal 1.2.
   2. Bricks forces the link to width: 100%, so margin-inline alone would
      overflow the drawer — width: auto lets the inset margins shrink it. */
.nav-menu .bricks-mobile-menu-wrapper .nav-cta > a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
    margin-inline: var(--space-m);
    padding: var(--space-2xs) var(--space-m);
    line-height: 1.2;
}

/* Hover + keyboard focus → lighter blue + the button hover lift. */
.nav-menu .bricks-nav-menu-wrapper .nav-cta > a:hover,
.nav-menu .bricks-nav-menu-wrapper .nav-cta > a:focus-visible,
.nav-menu .bricks-mobile-menu-wrapper .nav-cta > a:hover,
.nav-menu .bricks-mobile-menu-wrapper .nav-cta > a:focus-visible {
    background-color: var(--action-primary-hover);
    border-color: var(--action-primary-hover);
    color: var(--action-primary-text);
    box-shadow: var(--elevation-button-hover);
}

/* Pressed: the lift drops away, like every other button (buttons.css §1).
   This one needs its own rule because the menu button is a menu link,
   not a `.brxe-button`. */
.nav-menu .bricks-nav-menu-wrapper .nav-cta > a:active,
.nav-menu .bricks-mobile-menu-wrapper .nav-cta > a:active {
    box-shadow: none;
}

/* While the bar is see-through on a hero, the hero's own button is the
   page's one call to action, so the menu's button steps back to a plain
   link like its neighbours (Katrine's choice) — revealed by scrolling
   up, it is the button again. Desktop bar only; the drawer is solid and
   keeps the button. The see-through condition is the one defined in §1. */
body:has(.header-over-hero) #brx-header:is(:not(.scrolling), .slide-up:not(:has(:focus-visible))) .nav-menu .bricks-nav-menu-wrapper .nav-cta > a {
    background-color: transparent;
    background-image: linear-gradient(currentColor, currentColor);   /* the shared hairline again */
    border-color: transparent;
    color: inherit;
    font-weight: inherit;
    padding: 0 0 0.15em;                                              /* as the other links */
    box-shadow: none;
}
body:has(.header-over-hero) #brx-header:is(:not(.scrolling), .slide-up:not(:has(:focus-visible))) .nav-menu .bricks-nav-menu-wrapper .nav-cta > a:is(:hover, :focus-visible) {
    color: var(--text-link);
}

/* Current page → keep the full button look. Bricks' own "current menu
   item" Theme Style would force blue text, an underline and square
   corners onto the button — this more specific rule must re-assert
   every property that rule touches: colour, border AND radius. */
.nav-menu .bricks-nav-menu-wrapper .nav-cta.current-menu-item > a,
.nav-menu .bricks-mobile-menu-wrapper .nav-cta.current-menu-item > a {
    color: var(--text-on-dark);
    background-color: var(--action-primary);
    background-image: none;
    border: 2px solid var(--action-primary);   /* over the Theme Style border-bottom */
    border-radius: var(--radius-full);          /* over the Theme Style 1px */
}


/* --- 5. Mobile menu drawer — surface, elevation, dividers ----
   GOTCHA: Bricks forces the drawer's dark background with higher
   specificity than this file can beat, so the background is set ON THE
   NAV MENU ELEMENT (overwritten to var(--surface-base), which still
   flips with the mode) — the one accepted element-level style.
   Everything else here is in CSS. */

/* Drawer elevation. (Background lives on the element — see note above.) */
.nav-menu .bricks-mobile-menu-wrapper {
    box-shadow: var(--elevation-drawer);
    background-image: var(--elevation-overlay-drawer);
}

/* Menu text + the submenu toggle chevron → readable and mode-aware
   (override Bricks' always-white default). The .nav-cta button keeps its
   white-on-blue via the more specific CTA rules above. */
.nav-menu .bricks-mobile-menu-wrapper a,
.nav-menu .bricks-mobile-menu-wrapper .brx-submenu-toggle {
    color: var(--text-base);
}
.nav-menu .bricks-mobile-menu-wrapper a:hover,
.nav-menu .bricks-mobile-menu-wrapper a:focus-visible,
.nav-menu .bricks-mobile-menu-wrapper a[aria-current="page"] {
    color: var(--text-link);
}

/* Breathing room at the top of the list. */
.nav-menu .bricks-mobile-menu-wrapper ul.bricks-mobile-menu {
    padding-block-start: var(--space-l);
}

/* Gradient hairline divider between TOP-LEVEL items only. Sub-menu items
   are nested inside their parent <li>, so they get no divider and stay
   visually grouped under their parent. The CTA is excluded (it gets its
   own spacing below). --border-divider adapts to the drawer surface. */
.nav-menu .bricks-mobile-menu-wrapper ul.bricks-mobile-menu > li + li:not(.nav-cta) {
    border-top: 1px solid transparent;
    border-image: linear-gradient(90deg, transparent, var(--border-divider), transparent) 1;
}

/* Extra space before the CTA so it reads as a separate action. The mobile
   menu list is display:block, so margin (not gap) is the right tool. */
.nav-menu .bricks-mobile-menu-wrapper .nav-cta {
    margin-block-start: var(--space-l);
}


/* --- 6. Header icon buttons — the house 44 px target -----------
   The mode toggle's hit area lives in its own fields (Style › Layout:
   padding 0.875rem = 44 × 44 around the 16 px icon, margin -0.875rem so
   the space is handed back and the header keeps its layout — without it
   the phone header runs out of width and the menu button wraps to a
   second line). Only its hover look is here: the link colour, like the
   menu items. #brx-header outranks the core's `all: unset`. */
#brx-header .brxe-toggle-mode {
    transition: color var(--transition-base);
}
#brx-header .brxe-toggle-mode:is(:hover, :focus-visible) {
    color: var(--text-link);
}

/* The mobile-menu button — the one header button whose hit area lives
   in CSS: Bricks' Nav Menu
   has no padding field for its hamburger, only "Toggle width", which
   grows the bars too (house rule: never enlarge the icon). A transparent
   border grows the box from 20 × 16 to 44 × 44 while the bars — which
   Bricks positions absolutely inside the padding box — stay put, and
   the matching negative margin hands the space back, so the bars stay
   flush with the header's edge and nothing wraps at phone width.
   content-box keeps the element's own Toggle width field in charge of
   the bar width. 0.875rem / 0.75rem = (44 − 16) / 2 and (44 − 20) / 2. */
.nav-menu .bricks-mobile-menu-toggle {
    box-sizing: content-box;
    border: 0.875rem solid transparent;
    border-inline-width: 0.75rem;
    margin-block: -0.875rem;
    margin-inline: -0.75rem;
}
