/*
 * wb-header-restyle-a.css — T523: the shared site header (search bar, ☰
 * account/menu dropdown — plan card, My Home/My account/Catalogue/Market/
 * Bourbon Log/Brands/Guides/About/Log out — the price-alert bell, and the
 * Buddy opener) never received the T483 restyle-A treatment on its own: it
 * only inherited restyled paint on the handful of pages whose OWN sheet
 * (wb-account-restyle-a.css, wb-catalog-restyle-a.css, wb-bottle-restyle-a.css)
 * happened to copy the header block in verbatim. Every other page (About,
 * Market, Guides, Brands, the landing grid, Terms/Privacy/Contact, Activity,
 * Deals, Collection, Family, Hub, Retailer) kept the old header paint even
 * for a restyle-A user — Robert's 2026-08-29 "missed formatting updates"
 * report. This sheet is the header's OWN restyle round, linked once in
 * base.html (see the base template) so every page built on that shell gets
 * the same header paint, instead of relying on each page's sheet to carry a
 * copy that can drift.
 *
 * Gated by the SAME flag as every other restyle-A surface
 * (auth.resolve_restyle_a / auth.is_restyle_a_user — allow-list, the
 * wb_restyle_a cookie, or ?restyle=a). APPEARANCE ONLY: every selector below
 * already exists in the shipped DOM (site_chrome.py's `_site_header` /
 * `_menu_markup` — the single builder shared by every page and the card2
 * bottle-page fragment); nothing here adds, removes, reorders or rewords a
 * menu item, link or route.
 *
 * The tokens, dark-mode values, font and cascade-lever technique
 * (`html:not(#_)` + `!important`) are copied verbatim from the account round
 * (wb-account-restyle-a.css's own "Header" block, itself copied from the
 * catalogue round) so the header cannot drift into a fourth paint on top of
 * the three that already exist. See sprint-state/ui-rebuild/TOKENS.md and
 * RULEBOOK.md for what each role means.
 */

:root {
  --r2h-paper:   #FBF9F6;
  --r2h-surface: #FBF9F6;
  --r2h-sunk:    var(--sk-q-sunk);
  --r2h-ink:     var(--sk-q-dark);
  --r2h-ink-2:   #5C5651;
  --r2h-hair:    var(--sk-q-hair-2);
  --r2h-hair-2:  #CFC9C0;
  --r2h-accent:  var(--sk-deep-accent);
  --r2h-accent-ink: #FFFFFF;
  --r2h-focus:   var(--sk-q-dark);

  --r2h-display: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r2h-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
              "Liberation Sans", Helvetica, Arial, sans-serif;

  --r2h-t-micro: 0.8125rem;
  --r2h-t-body:  1rem;
  --r2h-t-sub:   1.1875rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --r2h-paper:   #14120F;
    --r2h-surface: #1C1916;
    --r2h-sunk:    #211D19;
    --r2h-ink:     #F3EFE9;
    --r2h-ink-2:   #B4ADA4;
    --r2h-hair:    #2E2A25;
    --r2h-hair-2:  #423C35;
    --r2h-accent:  #E5A25C;
    --r2h-accent-ink: #1A1409;
    --r2h-focus:   #F3EFE9;
  }
}

/* Focus: 2px ring in ink (paper in dark), 2px offset — header controls only;
   the rest of a given page's own focus treatment is unaffected. */
html:not(#_) .wb-header a:focus-visible,
html:not(#_) .wb-header button:focus-visible,
html:not(#_) .wb-header input:focus-visible,
html:not(#_) .wb-header summary:focus-visible,
html:not(#_) .wb-header details:focus-visible {
  outline: 2px solid var(--r2h-focus) !important;
  outline-offset: 2px !important;
  border-radius: 6px !important;
}

/* ══ Header shell ═══════════════════════════════════════════════════════ */
html:not(#_) .wb-header {
  background: var(--r2h-paper) !important;
  border-bottom: 1px solid var(--r2h-hair) !important;
}
html:not(#_) .wb-header-in {
  padding: 12px 16px 8px !important;
  gap: 8px !important;
}
html:not(#_) .wb-brand {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 44px !important;
  gap: 8px !important;
  color: var(--r2h-ink) !important;
  text-decoration: none !important;
}
/* The ONE serif role in the header (the rulebook's "at most three places"). */
html:not(#_) .wb-word,
html:not(#_) .wb-word .wb-w,
html:not(#_) .wb-word .wb-b,
html:not(#_) .wb-brand {
  font-family: var(--r2h-display) !important;
  font-size: var(--r2h-t-sub) !important;
  font-weight: 700 !important;
  letter-spacing: -0.011em !important;
  color: var(--r2h-ink) !important;
}
/* The "buddy" half of the wordmark and the "ai" superscript are a brass
   GRADIENT clipped to the text, so `color` alone cannot reach them. */
html:not(#_) .wb-word .wb-b,
html:not(#_) .wb-word .wb-ai {
  background: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  color: var(--r2h-ink) !important;
  -webkit-text-fill-color: var(--r2h-ink) !important;
  filter: none !important;
}
html:not(#_) .wb-word .wb-ai { font-size: var(--r2h-t-micro) !important; }
html:not(#_) .wb-word--onDark .wb-w { color: var(--r2h-ink) !important; }
html:not(#_) .wb-mark,
html:not(#_) .wb-brand img.wb-mark {
  border-radius: 6px !important;
  border: 0 !important;
}
html:not(#_) .wb-header-right { gap: 4px !important; }

/* ══ Price-alert bell ═══════════════════════════════════════════════════ */
html:not(#_) .wb-bell-btn {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  padding: 0 !important;
  background: none !important;
  border: 0 !important;
  border-radius: 6px !important;
  color: var(--r2h-ink) !important;
}
html:not(#_) .wb-bell-btn svg {
  width: 22px !important;
  height: 22px !important;
  stroke-width: 1.5 !important;
  color: var(--r2h-ink) !important;
}
html:not(#_) .wb-bell-badge,
html:not(#_) .wb-bell-dot {
  background: var(--r2h-accent) !important;
  color: var(--r2h-accent-ink) !important;
  border: 0 !important;
}
html:not(#_) .wb-bell-pop {
  background: var(--r2h-surface) !important;
  border: 1px solid var(--r2h-hair) !important;
  border-radius: 10px !important;
  color: var(--r2h-ink) !important;
}
html:not(#_) .wb-bell-head { color: var(--r2h-ink) !important; }
html:not(#_) .wb-bell-empty,
html:not(#_) .wb-bell-retention { color: var(--r2h-ink-2) !important; }

/* ══ Account ☰ menu (plan card + link list — site_chrome.py `_menu_markup`) ═ */
html:not(#_) .wb-menu-pop {
  background: var(--r2h-surface) !important;
  border: 1px solid var(--r2h-hair) !important;
  border-radius: 10px !important;
  color: var(--r2h-ink) !important;
}
html:not(#_) .wb-menu-pop a,
html:not(#_) .wb-menu-plan strong { color: var(--r2h-ink) !important; }
/* T527: the legacy quiet sheet paints .wb-nav a.active/:hover rows WHITE in
   both schemes (wb-quiet-tokens.css), while the rule above forces this
   sheet's ink — pale in dark mode. Only the foreground was overridden, so
   the active row read near-white-on-white in dark. This sheet owns the
   WHOLE row (sunk fill + ink text, both schemes — the same treatment the
   open menu button gets); it out-specifies every page sheet's own
   .wb-menu-pop a colour, so one rule fixes the menu on every page. */
html:not(#_) .wb-menu-pop a.active,
html:not(#_) .wb-menu-pop a:hover {
  background: var(--r2h-sunk) !important;
  color: var(--r2h-ink) !important;
}
html:not(#_) .wb-menu-plan-usage,
html:not(#_) .wb-menu-plan-link { color: var(--r2h-ink-2) !important; }
html:not(#_) .wb-menu-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 44px !important;
  padding: 0 8px !important;
  background: none !important;
  border: 0 !important;
  border-radius: 6px !important;
  color: var(--r2h-ink) !important;
}
html:not(#_) .wb-menu[open] .wb-menu-btn {
  background: var(--r2h-sunk) !important;
  border: 0 !important;
  color: var(--r2h-ink) !important;
}
html:not(#_) .wb-menu-burger span,
html:not(#_) .wb-menu[open] .wb-menu-burger span {
  background: var(--r2h-ink) !important;
  height: 1.5px !important;
}
html:not(#_) .wb-menu-label {
  font-family: var(--r2h-body) !important;
  font-size: var(--r2h-t-body) !important;
  font-weight: 500 !important;
  color: var(--r2h-ink) !important;
}
/* The plan chip ("ADMIN") is a label, not a badge: hairline pill, label ink. */
html:not(#_) .wb-menu-plan-chip {
  background: var(--r2h-paper) !important;
  border: 1px solid var(--r2h-hair) !important;
  color: var(--r2h-ink-2) !important;
  border-radius: 999px !important;
  font-size: var(--r2h-t-micro) !important;
  font-weight: 500 !important;
  letter-spacing: 0.06em !important;
  line-height: 1.2 !important;
  padding: 1px 8px !important;
  top: -6px !important;
}
html:not(#_) .wb-menu[open] .wb-menu-plan-chip {
  background: var(--r2h-paper) !important;
  border-color: var(--r2h-hair) !important;
  color: var(--r2h-ink-2) !important;
}
html:not(#_) .wb-menu-admin {
  border-top: 1px solid var(--r2h-hair) !important;
}

/* ══ Search + Buddy opener ══════════════════════════════════════════════ */
html:not(#_) .wb-search input {
  background: var(--r2h-sunk) !important;
  border: 1px solid var(--r2h-hair) !important;
  border-radius: 999px !important;
  color: var(--r2h-ink) !important;
  font-size: var(--r2h-t-body) !important;
  min-height: 44px !important;
}
html:not(#_) .wb-search input::placeholder { color: var(--r2h-ink-2) !important; }
html:not(#_) .wb-search .ico {
  color: var(--r2h-ink-2) !important;
  stroke-width: 1.5 !important;
}
html:not(#_) .wb-search-buddy,
html:not(#_) .wb-nav-buddy {
  background: transparent !important;
  border: 0 !important;
  color: var(--r2h-ink) !important;
  min-height: 44px !important;
}
/* The sparkle is a mask painted with background-color; ink, not brass. */
html:not(#_) .wb-spark { background-color: var(--r2h-ink) !important; }
html:not(#_) .wb-results {
  background: var(--r2h-surface) !important;
  border: 1px solid var(--r2h-hair) !important;
  border-radius: 10px !important;
  color: var(--r2h-ink) !important;
}
html:not(#_) .wb-cta-access {
  color: var(--r2h-ink) !important;
  text-decoration: underline !important;
}
