/* ==========================================================================
   appHeader.css

   Default generated DOM (all elements shown; each one is optional):

   <div id="app-header" class="ui-app-header ui-app-header-bg-{surface|brand} [ui-app-header-pinned]">        (placeholder root)
     <header class="ui-app-header-inner" aria-label="Application header">
       <a class="ui-app-header-skip" href="#main">Skip to main content</a>                                 (skipLinkTarget)
       <div class="ui-app-header-level ui-app-header-announcement [ui-app-header-sticky]"> → Message (BANNER) </div>  (announcement)
       <div class="ui-app-header-level ui-app-header-top [ui-app-header-sticky]" data-level="top">
         <div class="ui-app-header-start">
           <span class="ui-app-header-menu-host"> ← SideNavigation's menu Button </span>
           <a class="ui-app-header-brand" href="/"><img class="ui-app-header-logo" alt=""><span class="ui-app-header-name">Orders</span></a>
           <span class="ui-app-header-environment ui-app-header-tone-warning">TEST</span>
         </div>
         <div class="ui-app-header-middle">
           <div class="ui-app-header-search-host"> → SearchBox </div>
         </div>
         <div class="ui-app-header-end">
           <span class="ui-app-header-notifications-host"> → Notification (bell with count) </span>
           <a class="ui-app-header-icon-link ui-app-header-help">…</a> <a class="ui-app-header-icon-link ui-app-header-settings">…</a>
           <span class="ui-app-header-user-host"> → Badge (avatar or initials, name, role, link) </span>
           <span class="ui-app-header-auth-host"> → Button (Sign in / Sign out) </span>
         </div>
       </div>
       <div class="ui-app-header-level ui-app-header-navigation [ui-app-header-sticky]"> → TopNavigation </div>
       <div class="ui-app-header-level ui-app-header-breadcrumbs [ui-app-header-sticky]"> → Breadcrumbs </div>
     </header>
   </div>

   Pinning: .ui-app-header-pinned keeps the root at the header's natural height (--ui-app-header-space) and fixes
   the header at the top (left/width from --ui-app-header-left/-width; physical "left" because the component measures
   physical coordinates), showing only sticky levels. z-index 30 keeps it above page content and below NotificationsPanel (35), the SideNavigation drawer (38/39), toasts (40) and dialogs.
   BRAND colours the top level with the accent (navigation and breadcrumbs keep their own look). Below 48rem (a
   literal: custom properties cannot be used in media queries) the application name next to a logo and the user's name
   and role hide (kept for screen readers; the photo or initials stay), and search moves to its own line.

   STYLE GROUPS. The rules are in three parts; a class can appear in more than one part, each time with
   different properties. Values are design tokens written directly in the rules (no component variables).
     1. APPEARANCE  colours, borders, corners, type, motion. Change freely: only the look changes.
     2. DIMENSIONS  sizes, spacing, widths. Change with care: the component keeps working, its size changes.
     3. STRUCTURE   layout, behaviour, states, accessibility (focus ring, hidden text). Do not change.
   Text uses the typography roles of design-system.css (--font-ui, --fw-ui, --fw-ui-strong, …), never --font-sans
   or --fw-* directly, so a change of a role reaches every component.
   To restyle, change a value in part 1 or 2 (client/local-styling marks app values [APP]), or write the same
   selector with the new value in a stylesheet that loads later, in @layer overrides.
   ui-catalog source and client/local-styling use this file with the app look; client/showcase-styling keeps
   the original values, which the lines marked [APP] name in brackets (library / original).
   Borders use physical sides (top, right, bottom, left): a value set for one side only does not mirror in
   right-to-left languages.
   ========================================================================== */

@layer components {

    /* ======================================================================
       1. APPEARANCE — change freely
       ====================================================================== */
    /* component font and normal weight; header background, text and line below; shadow while pinned; skip link */
    .ui-app-header { font-family:var(--font-ui); font-weight:var(--fw-ui); }
    .ui-app-header-inner { background-color:var(--c-surface); color:var(--c-text); border-bottom:var(--border-thin) solid var(--c-border); }
    .ui-app-header-pinned .ui-app-header-inner { box-shadow:var(--shadow-sm); }
    .ui-app-header-skip { border-top-left-radius:var(--radius-control); border-top-right-radius:var(--radius-control); border-bottom-right-radius:var(--radius-control); border-bottom-left-radius:var(--radius-control); background-color:var(--c-surface); color:var(--c-accent); font-weight:var(--fw-ui-strong); }
    /* line between levels; brand (logo + name) corners and name text; environment label and its tones */
    .ui-app-header-level + .ui-app-header-level { border-top:var(--border-thin) solid var(--c-border); }
    .ui-app-header-brand { border-top-left-radius:var(--radius-control); border-top-right-radius:var(--radius-control); border-bottom-right-radius:var(--radius-control); border-bottom-left-radius:var(--radius-control); }
    .ui-app-header-name { font-size:var(--fs-block-title); font-weight:var(--fw-ui-strong); }
    .ui-app-header-environment { border-top-left-radius:var(--radius-pill); border-top-right-radius:var(--radius-pill); border-bottom-right-radius:var(--radius-pill); border-bottom-left-radius:var(--radius-pill); font-size:var(--fs-caption); font-weight:var(--fw-ui-strong); }
    .ui-app-header-tone-info { background-color:var(--c-info-soft); color:var(--c-info-text); }
    .ui-app-header-tone-success { background-color:var(--c-success-soft); color:var(--c-success-text); }
    .ui-app-header-tone-warning { background-color:var(--c-warning-soft); color:var(--c-warning-text); }
    .ui-app-header-tone-danger { background-color:var(--c-danger-soft); color:var(--c-danger-text); }
    /* round icon links (help, settings…) and their hover; brand background of the top level (background:BRAND) */
    .ui-app-header-icon-link { border-top-left-radius:var(--radius-pill); border-top-right-radius:var(--radius-pill); border-bottom-right-radius:var(--radius-pill); border-bottom-left-radius:var(--radius-pill); font-size:var(--icon-size-medium); }
    .ui-app-header-icon-link:hover { background-color:var(--c-surface-hover); }
    .ui-app-header-bg-brand .ui-app-header-top { background-color:var(--c-accent); color:var(--c-on-accent); }
    .ui-app-header-bg-brand .ui-app-header-top .ui-app-header-icon-link:hover { background-color:color-mix(in srgb, var(--c-on-accent) 15%, transparent); }

    /* ======================================================================
       2. DIMENSIONS — change with care
       ====================================================================== */
    /* skip link position; left and right padding of every level; top level height (control height + padding) and gaps;
       the middle area (search position: justify-content normal = start | center | flex-end); logo, environment, search
       and icon link sizes */
    .ui-app-header-skip { inset-block-start:var(--gap-tight); inset-inline-start:var(--gap-tight); padding:var(--gap-tight) var(--gap-inline-items); }
    .ui-app-header-level { padding-inline:var(--workspace-gutter); }   /* [APP] aligned with the working area (library: var(--gap-block)) */
    .ui-app-header-top { gap:var(--gap-inline-items) var(--gap-block); min-block-size:calc(var(--control-height) + var(--space-lg-1) + 2 * var(--gap-tight)); padding-block:var(--gap-tight); }   /* [APP] taller (library: calc(var(--control-height) + 2 * var(--gap-tight))) */
    .ui-app-header-announcement { padding:0; }   /* the announcement Message spans the full width (narrow screens keep the level padding) */
    .ui-app-header-start, .ui-app-header-end { gap:var(--gap-inline-items); }
    .ui-app-header-middle { flex:1 1 var(--size-md-2); justify-content:flex-end; gap:var(--gap-block); }   /* [APP] search on the right (library: normal) */
    .ui-app-header-navigation, .ui-app-header-breadcrumbs { padding-block:var(--space-sm-2); }
    .ui-app-header-brand { gap:var(--space-xl-1); } /*APP: --gap-inline-items */
    .ui-app-header-logo { block-size:calc(var(--control-height)  + var(--space-sm-2)); max-inline-size:var(--size-md-1); }   /* [APP] (library: var(--control-height)) */
    .ui-app-header-environment { gap:var(--gap-tight); padding:var(--space-sm-1) var(--gap-inline-items); }
    .ui-app-header-search-host { flex:1 1 var(--size-md-2); max-inline-size:var(--size-md-4); }
    .ui-app-header-icon-link { inline-size:calc(var(--control-height) + var(--space-lg-1)); block-size:calc(var(--control-height) + var(--space-lg-1)); }   /* [APP] (library: var(--control-height)) */
    @media (max-width:48rem) { .ui-app-header-level { padding-inline:var(--workspace-gutter); } }   /* below 48rem (literal: custom properties cannot be used in media queries)  [APP] (library: var(--gap-inline-items)) */

    /* ======================================================================
       3. STRUCTURE — do not change
       ====================================================================== */
    .ui-app-header { min-inline-size:0; }
    /* pinned: the component writes --ui-app-header-space / -left / -width (measured) */
    .ui-app-header-pinned { min-block-size:var(--ui-app-header-space,auto); }
    .ui-app-header-inner { position:relative; display:block; }
    .ui-app-header-pinned .ui-app-header-inner { position:fixed; inset-block-start:0; left:var(--ui-app-header-left,0); inline-size:var(--ui-app-header-width,100%); z-index:30; }
    .ui-app-header-pinned .ui-app-header-level:not(.ui-app-header-sticky) { display:none; }
    .ui-app-header-skip { position:absolute; z-index:31; transform:translateY(-200%); }
    .ui-app-header-skip:focus { transform:none; outline:var(--focus-outline); outline-offset:var(--focus-offset); }
    .ui-app-header-visually-hidden { position:absolute; inline-size:1px; block-size:1px; margin:-1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
    .ui-app-header-top { display:flex; flex-wrap:wrap; align-items:center; }
    .ui-app-header-start, .ui-app-header-end { display:flex; flex:0 0 auto; align-items:center; }
    .ui-app-header-end { margin-inline-start:auto; }
    .ui-app-header-end:empty { display:none; }
    /* no empty slot (and gap) after the search when nothing is configured at the end */
    .ui-app-header-middle { display:flex; align-items:center; min-inline-size:0; }
    .ui-app-header-level[hidden] { display:none; }
    .ui-app-header-brand { display:inline-flex; align-items:center; color:inherit; text-decoration:none; }
    .ui-app-header-brand:focus-visible, .ui-app-header-icon-link:focus-visible { outline:var(--focus-outline); outline-offset:var(--focus-offset); }
    .ui-app-header-logo { display:block; inline-size:auto; object-fit:contain; }
    .ui-app-header-name { white-space:nowrap; }
    .ui-app-header-environment { display:inline-flex; align-items:center; white-space:nowrap; }
    .ui-app-header-search-host { min-inline-size:0; }
    .ui-app-header-search-host .ui-search-box { margin:0; }
    .ui-app-header-icon-link { display:inline-flex; align-items:center; justify-content:center; color:inherit; text-decoration:none; }
    /* below 48rem: the name hides when there is a logo, the user's name and role hide (kept for screen readers);
       the middle area (search) moves to its own row */
    @media (max-width:48rem) {
        .ui-app-header-logo + .ui-app-header-name { display:none; }
        .ui-app-header-user-host .ui-badge-text { position:absolute; inline-size:1px; block-size:1px; margin:-1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
        .ui-app-header-middle { order:3; flex-basis:100%; flex-wrap:wrap; }
        .ui-app-header-search-host { max-inline-size:none; }
    }
}
