/* long file: the preset header's whole stylesheet, both presets, served as one file the page links once. */
/* =============================================================================
   Modern preset header — drop-in replacement for serve/assets/header.css
   (the two presets: "two-tier-classic" and "menu-button").

   Contract preserved from the shipped stylesheet (docs/headers.md):
   - Scoped to .arccos-preset-header; touches no page/theme content.
   - Brand palette flows from --ah-c1/2/3 + computed -ink pairs, which alias
     the site-style tokens (--arccos-color-N) serve emits on :root after theme
     CSS; this sheet's literals are their var() fallbacks.
   - Every part has a home in every preset; contrast rules for the c1 bars,
     mega panels, drawer projection and the menu-button hero overlay are kept.
   - Mobile is a projection: the utility + menu fold into the drawer under the
     60rem band (aligned to the 80/60/40rem grid).

   NEW in this revision (all additive, no markup change):
   - Display type via --ah-font-display (falls back to the system stack).
   - Rounded, elevated dropdown/mega panels that ANIMATE in (opacity/transform
     replaces display:none; the same :hover/:focus-within/aria show selectors).
   - Sliding accent underline on menu + mega links.
   - Pill CTA with a looping sheen.
   - Scroll-condense: header.js adds .ah-scrolled past a threshold; the utility
     bar collapses and the logo/title shrink, the header lifts a shadow.
   - prefers-reduced-motion guard disables all of the above motion.
   ============================================================================= */

.arccos-preset-header {
  /* Brand palette + computed inks. The NAMES are unchanged; the SOURCE moved
     (docs/site-style.md § Derived tokens): each is now an alias of
     the site-style token the district actually sets, with the literal it used
     to hold as the var() fallback. So a site that sets nothing renders these
     exact bytes, and a site that sets color_1/2/3 gets them from the one
     :root block serve emits AFTER theme CSS — which is what makes a district's
     chosen color outrank a theme, where the old header-only block (emitted
     BEFORE theme CSS) did not. */
  --ah-c1: var(--arccos-color-1, #141b26);
  --ah-c1-ink: var(--arccos-color-1-ink, #ffffff);
  --ah-c2: var(--arccos-color-2, #ffffff);
  --ah-c2-ink: var(--arccos-color-2-ink, #14161a);
  --ah-c3: var(--arccos-color-3, #2f6bff);
  --ah-c3-ink: var(--arccos-color-3-ink, #ffffff);
  --ah-line: color-mix(in srgb, var(--ah-c2-ink) 12%, var(--ah-c2));
  --ah-muted: color-mix(in srgb, var(--ah-c2-ink) 60%, var(--ah-c2));

  /* NEW tokens. --ah-font-display defaults to the system stack, so a platform
     that has not wired a webfont still gets the finished look; point it at
     "Space Grotesk" (or any display face) in composeDocument to match the
     reference design exactly. --ah-radius is the shared panel/CTA rounding. */
  --ah-font-display: system-ui, -apple-system, "Segoe UI", sans-serif;
  --ah-radius: 14px;
  --ah-ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  --ah-bg: var(--ah-c2);
  --ah-fg: var(--ah-c2-ink);
  --ah-accent: var(--ah-c3);

  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--ah-bg);
  color: var(--ah-fg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  border-bottom: 1px solid var(--ah-line);
  animation: ah-drop 0.5s var(--ah-ease) both;
  transition: box-shadow 0.35s ease;
}

.arccos-preset-header a { color: inherit; text-decoration: none; }
.arccos-preset-header ul { list-style: none; margin: 0; padding: 0; }
.arccos-preset-header button { font: inherit; color: inherit; cursor: pointer; }

/* --- Utility bar (c1 brand strip) --- */
.ah-utility {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem clamp(1rem, 4vw, 2.5rem);
  background: var(--ah-c1);
  color: var(--ah-c1-ink);
  font-size: 0.8125rem;
  max-height: 3rem;
  overflow: visible;
  transition: max-height 0.4s var(--ah-ease), opacity 0.3s ease, padding-block 0.4s var(--ah-ease);
}
.ah-utility-start, .ah-utility-end { display: flex; align-items: center; gap: 1.25rem; }
.ah-utility .ah-part { position: relative; display: inline-flex; align-items: center; }

/* Utility links + disclosures: quiet by default, sliding underline on hover. */
.ah-utility a,
.ah-utility .ah-disclosure {
  font-weight: 600;
  opacity: 0.92;
  background-image: linear-gradient(var(--ah-c1-ink), var(--ah-c1-ink));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1.5px;
  transition: background-size 0.3s var(--ah-ease), opacity 0.2s ease;
}
.ah-utility a:hover,
.ah-utility .ah-disclosure:hover,
.ah-utility a:focus-visible,
.ah-utility .ah-disclosure:focus-visible { opacity: 1; background-size: 100% 1.5px; }
.ah-disclosure { background-color: transparent; border: 0; padding: 0.2rem 0; display: inline-flex; align-items: center; gap: 0.35rem; }
.ah-disclosure::after {
  content: "";
  width: 0.5rem; height: 0.5rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.26s var(--ah-ease);
}
.ah-disclosure[aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-1px); }

/* --- Identity row --- */
.ah-identity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  transition: padding-block 0.35s var(--ah-ease);
}
.ah-identity { display: grid; grid-auto-flow: row; align-items: center; gap: 0.1rem; }
.ah-identity .ah-logo {
  display: block; width: auto; max-height: 3.25rem;
  transition: max-height 0.35s var(--ah-ease);
}
.ah-title {
  font-family: var(--ah-font-display);
  font-size: 1.4rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.015em;
  transition: font-size 0.35s var(--ah-ease);
}
.ah-tagline { font-size: 0.8125rem; color: var(--ah-muted); font-weight: 500; }
.ah-identity-end { display: flex; align-items: center; gap: 0.75rem; }

/* --- Main menu --- */
.ah-menu { padding: 0 clamp(1rem, 4vw, 2.5rem); border-top: 1px solid var(--ah-line); }
.ah-menu-list { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.15rem; }
.ah-menu-item { position: relative; flex: 0 0 auto; }
.ah-menu-link {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.85rem 0.95rem;
  font-weight: 600; font-size: 0.9375rem;
  position: relative;
  background-image: linear-gradient(var(--ah-c3), var(--ah-c3));
  background-repeat: no-repeat;
  background-position: 0.95rem calc(100% - 0.5rem);
  background-size: 0% 2.5px;
  transition: background-size 0.28s var(--ah-ease), color 0.2s ease;
}
.ah-menu-item:hover > .ah-menu-link,
.ah-menu-link:focus-visible { background-size: calc(100% - 1.9rem) 2.5px; }
.ah-menu-link > svg,
.ah-menu-item.ah-has-panel > .ah-menu-link::after {
  transition: transform 0.26s var(--ah-ease);
}
/* caret for items with a panel (rendered as a trailing glyph) */
.ah-has-panel > .ah-menu-link::after {
  content: "";
  width: 0.42rem; height: 0.42rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
}
.ah-has-panel:hover > .ah-menu-link::after,
.ah-has-panel.ah-panel-open > .ah-menu-link::after { transform: rotate(-135deg) translateY(1px); }

/* Tiered presets paint the menu line as a c1 bar; links carry c1 ink and the
   underline switches to that ink (accent can fail contrast on the dark bar). */
.arccos-preset-header[data-preset="two-tier-classic"] .ah-menu {
  background: var(--ah-c1); color: var(--ah-c1-ink); border-top: 0;
}
.arccos-preset-header[data-preset="two-tier-classic"] .ah-menu-link {
  background-image: linear-gradient(var(--ah-c1-ink), var(--ah-c1-ink));
}

/* --- Mega panel (rounded, elevated, animates in) --- */
.ah-mega {
  position: absolute;
  top: calc(100% - 2px);
  left: 0;
  min-width: 16rem;
  max-width: 44rem;
  background: var(--ah-c2);
  color: var(--ah-c2-ink);
  --ah-muted: color-mix(in srgb, var(--ah-c2-ink) 60%, var(--ah-c2));
  border: 1px solid var(--ah-line);
  border-top: 3px solid var(--ah-c3);
  border-radius: var(--ah-radius);
  box-shadow: 0 26px 60px rgba(10, 14, 22, 0.22);
  padding: 1rem 1.1rem;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.28s var(--ah-ease), transform 0.28s var(--ah-ease), visibility 0.28s;
}
.ah-has-panel:hover > .ah-mega,
.ah-has-panel:focus-within > .ah-mega,
.ah-has-panel.ah-panel-open > .ah-mega {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.ah-mega-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.35rem 1.25rem;
}
.ah-mega-col > .ah-menu-link { padding: 0.35rem 0; font-size: 0.9375rem; background-position: 0 calc(100% - 0.15rem); }
.ah-mega-col > .ah-menu-link:hover { background-size: 100% 2px; }
.ah-mega-sub { margin-top: 0.15rem; }
.ah-mega-sub a {
  display: block; padding: 0.28rem 0.4rem; font-size: 0.85rem; color: var(--ah-muted);
  border-radius: 8px; transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.ah-mega-sub a:hover {
  color: var(--ah-c2-ink);
  background: color-mix(in srgb, var(--ah-c3) 9%, var(--ah-c2));
  transform: translateX(3px);
}

/* --- Disclosure panels (the bar's section dropdowns) --- */
.ah-part { position: relative; display: inline-flex; align-items: center; }
.ah-panel {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 0;
  min-width: 13rem;
  background: var(--ah-c2);
  color: var(--ah-c2-ink);
  border: 1px solid var(--ah-line);
  border-top: 3px solid var(--ah-c3);
  border-radius: var(--ah-radius);
  box-shadow: 0 22px 50px rgba(10, 14, 22, 0.2);
  padding: 0.4rem;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.26s var(--ah-ease), transform 0.26s var(--ah-ease), visibility 0.26s;
}
.ah-panel li a {
  display: block; padding: 0.5rem 0.75rem; font-size: 0.875rem; font-weight: 500;
  border-radius: 9px; transition: background 0.18s ease, transform 0.18s ease;
}
.ah-panel li a:hover {
  background: #f4f4f5;
  background: color-mix(in srgb, var(--ah-c3) 10%, var(--ah-c2));
  transform: translateX(3px);
}
.ah-part:hover > .ah-panel,
.ah-part:focus-within > .ah-panel,
.ah-disclosure[aria-expanded="true"] + .ah-panel {
  opacity: 1; visibility: visible; transform: translateY(0);
}

/* --- CTA (pill + looping sheen) --- */
.arccos-preset-header .ah-cta {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.15rem;
  background: var(--ah-c3);
  color: var(--ah-c3-ink);
  border-radius: 999px;
  font-weight: 700; font-size: 0.9rem;
  overflow: hidden;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--ah-c3) 32%, transparent);
  transition: transform 0.2s var(--ah-ease), box-shadow 0.2s ease;
}
.arccos-preset-header .ah-cta::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: 0; width: 45%;
  background: linear-gradient(100deg, transparent, color-mix(in srgb, var(--ah-c3-ink) 55%, transparent), transparent);
  transform: translateX(-140%);
  animation: ah-shine 3.8s ease-in-out infinite;
}
.ah-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 28px color-mix(in srgb, var(--ah-c3) 45%, transparent); }

/* --- Social --- */
.ah-social { gap: 0.6rem; }
.ah-social-link { display: inline-flex; color: inherit; opacity: 0.82; transition: opacity 0.2s ease, transform 0.2s ease; }
.ah-social-link:hover { opacity: 1; transform: translateY(-2px); }

/* --- Search --- */
.ah-search { min-width: 0; }

/* The search box: a static input the search panel island opens from
   (docs/headers.md § Search). No script styles it, so this is the whole field.
   The background is a currentColor tint, so ONE rule reads correctly on the c1
   utility bar, the c2 identity row, the drawer, and the palette-independent
   hero overlay: no per-surface variant. Pages published before the panel still
   carry the frozen widget, whose field takes the same classes. */
.arccos-preset-header .ah-search .arccos-search-form { margin: 0; }
.arccos-preset-header .ah-search .arccos-search-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  background: color-mix(in srgb, currentColor 14%, transparent);
  font-size: 0.8125rem;
}
.arccos-preset-header .ah-search .arccos-search-icon { opacity: 0.7; }
/* A compact fixed width, wide enough for "Search or ask a question", so the
   pill sizes to its content on the bar instead of stretching the whole part. */
.arccos-preset-header .ah-search .arccos-search-field input {
  flex: none;
  width: 14rem;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
}
.arccos-preset-header .ah-search .arccos-search-field input::placeholder { color: inherit; opacity: 0.75; }

.ah-menu-item[hidden] { display: none; }

/* --- Scroll condense (added by header.js as .ah-scrolled) --- */
.arccos-preset-header.ah-scrolled { box-shadow: 0 10px 34px rgba(10, 14, 22, 0.16); }
.arccos-preset-header.ah-scrolled .ah-utility {
  max-height: 0; opacity: 0; padding-block: 0; overflow: hidden; pointer-events: none;
}
.arccos-preset-header.ah-scrolled .ah-identity-row { padding-block: 0.5rem; }
.arccos-preset-header.ah-scrolled .ah-logo { max-height: 2.4rem; }
.arccos-preset-header.ah-scrolled .ah-title { font-size: 1.1rem; }
.arccos-preset-header.ah-scrolled .ah-tagline { display: none; }

/* --- Hero overlay (menu-button over a banner hero) --- */
.arccos-preset-header[data-transparent="true"] {
  position: absolute; inset: 0 0 auto 0;
  background: transparent; border-bottom: 0; color: #fff;
  --ah-fg: #fff; --ah-muted: rgba(255, 255, 255, 0.85);
  box-shadow: none;
}
.arccos-preset-header[data-transparent="true"] .ah-utility { background: rgba(0, 0, 0, 0.25); color: #fff; }
.arccos-preset-header[data-transparent="true"] .ah-menu {
  background: rgba(0, 0, 0, 0.2); color: #fff; border-top: 0;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.arccos-preset-header[data-transparent="true"] .ah-menu-link { background-image: linear-gradient(#fff, #fff); }
.arccos-preset-header[data-transparent="true"].ah-solid {
  position: fixed;
  background: var(--ah-c2); color: var(--ah-c2-ink);
  --ah-fg: var(--ah-c2-ink);
  --ah-muted: color-mix(in srgb, var(--ah-c2-ink) 60%, var(--ah-c2));
  box-shadow: 0 10px 34px rgba(10, 14, 22, 0.16);
}
.arccos-preset-header[data-transparent="true"].ah-solid .ah-utility { background: var(--ah-c1); color: var(--ah-c1-ink); }
.arccos-preset-header[data-transparent="true"].ah-solid .ah-menu { background: var(--ah-c1); color: var(--ah-c1-ink); -webkit-backdrop-filter: none; backdrop-filter: none; }
.arccos-preset-header[data-transparent="true"].ah-solid .ah-menu-link { background-image: linear-gradient(var(--ah-c1-ink), var(--ah-c1-ink)); }

/* =============================================================================
   Menu button (docs/headers.md § The library): one hairline bar —
   identity left; search, section 1 and a c1-filled hamburger button right (c1, not
   the CTA's c3: the c3 fallback pair is under 4.5:1 at this size) — over a
   full-sheet panel. The sheet is `position: absolute` under the header, never
   `fixed`: the header's `ah-drop` entrance ends on a transform, which makes the
   header the containing block for fixed descendants anyway.
   ============================================================================= */
.arccos-preset-header[data-preset="menu-button"] { --ah-mb-h: 4.5rem; }
.ah-mb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--ah-mb-h);
  box-sizing: border-box;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  border-top: 3px solid var(--ah-c1);
}
.ah-mb-bar .ah-identity { min-width: 0; }
.ah-mb-bar .ah-logo { max-height: 2.75rem; }
.ah-mb-end { display: flex; align-items: center; gap: 1.25rem; flex-shrink: 0; }
.ah-mb-section > ul { display: flex; align-items: center; gap: 1.25rem; }
.ah-mb-link,
.ah-mb-section .ah-disclosure {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 2px;
  transition: background-size 0.28s var(--ah-ease);
}
.ah-mb-link:hover,
.ah-mb-link:focus-visible,
.ah-mb-section .ah-disclosure:hover,
.ah-mb-section .ah-disclosure:focus-visible { background-size: 100% 2px; }
/* The bar sits at the right edge: its dropdowns open leftward so they never clip. */
.ah-mb-section .ah-panel { left: auto; right: 0; }
/* Opening shows the panel at once — visibility does not wait out the fade —
   so ArrowDown on a closed dropdown can focus its first link in the same tick
   (a link still `visibility: hidden` refuses focus). Closing keeps the fade. */
.ah-mb-section .ah-part:hover > .ah-panel,
.ah-mb-section .ah-part:focus-within > .ah-panel,
.ah-mb-section .ah-disclosure[aria-expanded="true"] + .ah-panel { transition-property: opacity, transform; }
.arccos-preset-header[data-preset="menu-button"] .ah-search .arccos-search-field input { width: 10rem; }

/* Prefixed with the header class: the base `.arccos-preset-header button`
   rule's `color: inherit` would otherwise turn the icon to the bar's ink. */
.arccos-preset-header .ah-mb-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--ah-c1);
  color: var(--ah-c1-ink);
}
.ah-mb-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.ah-mb-close { display: none; }
.arccos-preset-header.ah-sheet-open .ah-mb-open { display: none; }
.arccos-preset-header.ah-sheet-open .ah-mb-close { display: block; }

/* The fold: section 1 holds at most 4 menus (its cap); past the band's count
   the bar hides the tail and the sheet's copy shows exactly those, so the
   same static markup folds the same way pre-JS, in the Edit frame and live. */
.ah-mb-section > ul > li:nth-child(n + 5) { display: none; }
.ah-sheet-bar > ul > li:nth-child(-n + 4) { display: none; }

/* --- The sheet --- */
.ah-sheet {
  position: absolute;
  top: 100%;
  inset-inline: 0;
  height: calc(100dvh - var(--ah-mb-h));
  box-sizing: border-box;
  overflow: auto;
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 3rem;
  background: var(--ah-c2);
  color: var(--ah-c2-ink);
  --ah-muted: color-mix(in srgb, var(--ah-c2-ink) 60%, var(--ah-c2));
  border-top: 1px solid var(--ah-line);
  animation: ah-slide-down 0.32s var(--ah-ease) both;
}
.ah-sheet[hidden] { display: none; }
.arccos-preset-header .ah-sheet-label {
  display: block;
  padding: 0.35rem 0;
  border: 0;
  background: none;
  text-align: left;
  font-family: var(--ah-font-display);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.ah-sheet-label[aria-expanded="true"] {
  text-decoration: underline 3px var(--ah-c1);
  text-underline-offset: 0.2em;
}
.arccos-preset-header .ah-sheet-bar .ah-sheet-label { font-size: 1.125rem; }
.ah-sheet-bar > ul > li { border-bottom: 1px solid var(--ah-line); }
/* Items show only for the expanded label: the sheet never opens without
   header.js, and hover/focus set the expansion there, so one rule keeps the
   column exclusive instead of :hover and :focus-within showing two at once. */
.arccos-preset-header .ah-sheet-items { display: none; padding: 0 0 0.75rem 1rem; }
.arccos-preset-header .ah-sheet-label[aria-expanded="true"] + .ah-sheet-items { display: block; }
.ah-sheet-items a { display: block; padding: 0.4rem 0; font-size: 1.0625rem; font-weight: 600; }
.ah-sheet-items a:hover,
.ah-sheet-items a:focus-visible { text-decoration: underline 2px var(--ah-c1); text-underline-offset: 0.2em; }
.ah-sheet-items ul { padding-left: 0.75rem; }
.ah-sheet-items ul a { font-size: 0.9375rem; font-weight: 400; color: var(--ah-muted); }

/* Desktop: main's labels down the left, the open menu's items in a column of
   their own on the right, under a c1 rail. */
.ah-sheet-main > ul { position: relative; max-width: 72rem; }
/* A row is as wide as its label, so the pointer's path from a lower label to
   its items (top of the right column) crosses as little of the rows above as
   it can; header.js delays the hover switch for the rest. */
.ah-sheet-main > ul > li { width: fit-content; max-width: 40%; }
.ah-sheet-main .ah-sheet-items {
  position: absolute;
  top: 0;
  left: 45%;
  right: 0;
  padding: 1rem 0 0;
  border-top: 3px solid var(--ah-c1);
}

/* --- Solid, open, transparent --- */
.arccos-preset-header[data-preset="menu-button"].ah-solid { box-shadow: 0 10px 34px rgba(10, 14, 22, 0.16); }
/* Over a hero: transparent with white ink, and sticky with a negative bottom
   margin so the hero rises under the bar. Sticky throughout — the generic
   overlay's absolute→fixed flip would jump the page when the bar turns solid. */
.arccos-preset-header[data-preset="menu-button"][data-transparent="true"] {
  position: sticky;
  inset: 0 0 auto 0;
  margin-bottom: calc(-1 * var(--ah-mb-h));
}
.arccos-preset-header[data-preset="menu-button"][data-transparent="true"].ah-solid,
.arccos-preset-header[data-preset="menu-button"][data-transparent="true"].ah-sheet-open {
  position: sticky;
  background: var(--ah-c2);
  color: var(--ah-c2-ink);
  --ah-fg: var(--ah-c2-ink);
  --ah-muted: color-mix(in srgb, var(--ah-c2-ink) 60%, var(--ah-c2));
}

@media (max-width: 80rem) {
  .ah-mb-section > ul > li:nth-child(n + 4) { display: none; }
  /* Unhide what the wide band's `-n + 4` hid past the third, or the menu the
     bar just folded away is in neither place. */
  .ah-sheet-bar > ul > li:nth-child(n + 4) { display: list-item; }
}

/* Phone: identity + the menu button only; the sheet holds section 1 above main, one
   column, each menu's items stacked under its label. Solid, never an overlay
   (translucency over media kills legibility). */
@media (max-width: 60rem) {
  .ah-mb-section,
  .ah-mb-end .ah-search { display: none; }
  .ah-sheet-bar > ul > li,
  .ah-sheet-bar > ul > li:nth-child(-n + 4) { display: list-item; }
  .ah-sheet-main > ul > li { width: auto; max-width: none; }
  .ah-sheet-main .ah-sheet-items { position: static; padding: 0 0 0.75rem 1rem; border-top: 0; }
  .arccos-preset-header[data-preset="menu-button"][data-transparent="true"] {
    margin-bottom: 0;
    background: var(--ah-c2);
    color: var(--ah-c2-ink);
    --ah-fg: var(--ah-c2-ink);
    --ah-muted: color-mix(in srgb, var(--ah-c2-ink) 60%, var(--ah-c2));
    border-bottom: 1px solid var(--ah-line);
  }
}

/* --- Drawer toggle --- */
.ah-drawer-toggle {
  display: none;
  background: color-mix(in srgb, var(--ah-c1) 8%, var(--ah-c2));
  border: 1px solid var(--ah-line);
  border-radius: 12px;
  padding: 0.55rem; margin-left: auto;
  color: var(--ah-c2-ink);
}

/* =============================================================================
   Mobile projection (<= 60rem): fold utility + menu into an animated drawer.
   ============================================================================= */
@media (max-width: 60rem) {
  .ah-utility, .ah-menu, .ah-identity-end { display: none; }
  .ah-drawer-toggle { display: inline-flex; }
  .arccos-preset-header.ah-scrolled .ah-utility { display: none; }

  /* The open drawer: the folded parts slide down as a full-width panel. */
  .arccos-preset-header.ah-drawer-open .ah-utility,
  .arccos-preset-header.ah-drawer-open .ah-menu {
    display: block;
    padding: 0.5rem clamp(1rem, 4vw, 2.5rem);
    animation: ah-slide-down 0.32s var(--ah-ease) both;
  }
  .arccos-preset-header.ah-drawer-open .ah-identity-end {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
    padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  }
  .arccos-preset-header.ah-drawer-open .ah-menu-list { flex-direction: column; align-items: stretch; gap: 0; }
  .arccos-preset-header.ah-drawer-open .ah-menu-item { border-bottom: 1px solid color-mix(in srgb, var(--ah-c1-ink) 15%, transparent); }
  .arccos-preset-header.ah-drawer-open .ah-menu-link { padding: 0.85rem 0.25rem; background-image: none; }

  .arccos-preset-header.ah-drawer-open .ah-mega {
    position: static; opacity: 1; visibility: visible; transform: none;
    display: block; box-shadow: none; border: 0; padding: 0 0 0.6rem 1rem;
    background: transparent; color: inherit; border-radius: 0;
    --ah-muted: color-mix(in srgb, var(--ah-c1-ink) 60%, var(--ah-c1));
  }
  .arccos-preset-header.ah-drawer-open .ah-mega-sub a:hover { color: var(--ah-c1-ink); background: transparent; }
  .arccos-preset-header.ah-drawer-open .ah-utility { display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem; }

  /* A toggle inside .ah-identity-row (two-tier-classic) stays on that row:
     closed, the row never wraps and the name shrinks instead; open, the CTA
     takes its own row below so it cannot squeeze the name or move the toggle
     off the right edge. */
  .ah-identity-row:has(> .ah-drawer-toggle) .ah-identity { flex: 1 1 0; min-width: 0; }
  .ah-identity-row > .ah-drawer-toggle { flex-shrink: 0; }
  .arccos-preset-header.ah-drawer-open .ah-identity-row:has(> .ah-drawer-toggle) { flex-wrap: wrap; }
  .arccos-preset-header.ah-drawer-open .ah-identity-row:has(> .ah-drawer-toggle) .ah-identity-end {
    order: 1;
    flex-basis: 100%;
    padding-inline: 0;
  }
  /* The hero overlay is solid on mobile (translucency over media kills legibility). */
  .arccos-preset-header[data-transparent="true"] {
    position: static; background: var(--ah-c2); color: var(--ah-c2-ink);
    --ah-fg: var(--ah-c2-ink);
    --ah-muted: color-mix(in srgb, var(--ah-c2-ink) 60%, var(--ah-c2));
  }
  .arccos-preset-header[data-transparent="true"] .ah-utility,
  .arccos-preset-header[data-transparent="true"] .ah-menu {
    background: var(--ah-c1); color: var(--ah-c1-ink); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}

/* --- Keyframes --- */
@keyframes ah-drop { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes ah-shine { 0% { transform: translateX(-140%); } 55%, 100% { transform: translateX(260%); } }
@keyframes ah-slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* --- Reduced motion: keep the layout, drop the movement. --- */
@media (prefers-reduced-motion: reduce) {
  .arccos-preset-header,
  .arccos-preset-header * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .arccos-preset-header .ah-cta::after { display: none; }
}
