/* Walupi header 2.0. Layers on app.css: .site-header/.bar/.brand,
   .header-basket, .account-menu, .suggest-box, .mobile-search all keep their
   base rules there; everything here is scoped under .hd so the two files
   cannot fight. Colour rules from tokens.css hold: indigo-950 is the trust
   surface, royal is the action colour, accent only for the alert dot. */

.hd .hd-bar {
  gap: 14px;
}
@media (min-width: 980px) {
  .hd .hd-bar {
    gap: 22px;
    min-height: 68px;
  }
}

/* Brand: wordmark with the tagline riding under it on desktop. */
.hd-brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  line-height: 1;
}
.hd-word {
  display: flex;
  flex-direction: column;
  gap: 3px;
  /* The wordmark is one of the two things Space Grotesk still does (the
     other is money). .brand in app.css sets --font-display on the anchor,
     which is Figtree now, so the name is named here rather than left to
     inherit. The tagline below keeps var(--font) on purpose: Figtree's
     tracked-out caps are cleaner than Space Grotesk's at 12px. */
  font-family: var(--font-money);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.hd-tag {
  display: none;
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--indigo-950-muted);
  white-space: nowrap;
}
@media (min-width: 980px) {
  .hd-tag {
    display: block;
  }
  .hd-brand svg {
    width: 38px;
    height: 26px;
  }
  .hd-brand {
    font-size: 21px;
  }
}

/* Search: the dominant element. Royal submit circle inside the pill. */
.hd-search {
  /* Widened from 720px (14 Sep 2026). The field is the primary way into a
     catalogue and it now carries the results as well, so the suggestion panel
     it drops inherits this width: a longer field means product titles and
     prices stop truncating in the dropdown. It still stops short of the
     account cluster rather than filling the bar edge to edge. */
  max-width: 860px;
  flex: 1 1 auto;
}
.hd-search input {
  width: 100%;
  /* Room for the leading magnifier, and no longer for a trailing button. */
  padding-left: 44px;
  font-size: var(--text-sm);
}

/* The magnifier is a MARK, not a control (14 Sep 2026). Results arrive as the
   buyer types, so a royal "go" button was an action for something that had
   already happened, and it took 44px of a 720px field to say so. As a leading
   glyph it still does the only job it was really doing: telling a glancing eye
   that this is where you search. pointer-events:none so a tap near it lands in
   the field, which is what the buyer meant. */
.hd-mag {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  color: var(--ink-40);
  pointer-events: none;
}
.hd-mag svg {
  width: 17px;
  height: 17px;
}

/* Enter submits the form; this keeps that discoverable for screen readers and
   keyboard users without painting a button. Not display:none, which would take
   it out of the accessibility tree and the tab order along with it. */
.sr-only-btn {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.sr-only-btn:focus-visible {
  /* A keyboard user who tabs to it must be able to see where they are. */
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  clip-path: none;
  padding: 0 12px;
  min-height: 36px;
  border-radius: var(--r-control);
  background: var(--royal-700);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-xs);
}
.hd-msearch .hd-mwrap {
  position: relative;
}
.hd-msearch input {
  width: 100%;
  padding-left: 44px;
}

/* Right cluster: labeled items, the big-retailer signature. The basket and
   bell share .header-basket from app.css; here they become icon-over-label
   columns with a hover wash. */
.hd-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex: none;
}
.hd .header-basket {
  width: auto;
  height: auto;
  min-width: 48px;
  flex-direction: column;
  gap: 2px;
  padding: 6px 9px 5px;
  border-radius: var(--r-control);
}
.hd .header-basket:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}
.hd .header-basket .badge {
  top: 0;
  right: 7px;
}
.hd-cluster-label {
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--indigo-950-muted);
}
.hd .header-basket:hover .hd-cluster-label {
  color: #fff;
}

/* Account: the avatar is the whole trigger. A light ring on hover and a
   royal ring while the menu is open, so the state reads without text. */
.hd .account-menu > summary {
  padding: 4px;
  border-radius: 999px;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}
.hd .account-menu > summary:hover .avatar {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}
.hd .account-menu[open] > summary .avatar {
  outline: 2px solid var(--indigo-950-soft);
  outline-offset: 2px;
}

/* The browse band: row 2. A lighter wash on the same trust surface, links
   left, the escrow chip pinned right on desktop. On mobile the whole row
   scrolls sideways with the scrollbar hidden, chip included. */
.hd-subnav {
  background: rgba(255, 255, 255, 0.06);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}
.hd-subnav-row {
  display: flex;
  align-items: stretch;
  /* 20px between eight items read as a scattered row rather than a bar.
     14px keeps them distinct while letting the strip feel like one thing. */
  gap: 14px;
  /* The primary navigation is thumb-sized: 44px, six more than the strip used
     to be, and the links fill it rather than sitting in a 27px band inside it. */
  min-height: 44px;
  overflow-x: auto;
  scrollbar-width: none;
}
.hd-subnav-row::-webkit-scrollbar {
  display: none;
}
.hd-subnav-row a {
  display: inline-flex;
  align-items: center;
  /* An icon with its label, so the strip is scannable by shape at a glance
     rather than read word by word. Deliberately the SAME shapes the bottom
     tab bar uses for Shelf, Runs and Orders: two navigations to the same
     places should not speak two icon languages. */
  gap: 7px;
  color: var(--indigo-950-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  flex: none;
}
.hd-subnav-row a svg {
  width: 16px;
  height: 16px;
  flex: none;
  /* The icon carries the row; the label is the confirmation. Slightly dimmer
     so the two read as one object instead of competing. */
  opacity: 0.82;
}
.hd-subnav-row a:hover svg,
.hd-subnav-row a[aria-current="page"] svg {
  opacity: 1;
}
.hd-subnav-row a:hover {
  color: #fff;
  text-decoration: none;
}
.hd-subnav-row a[aria-current="page"] {
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--royal-500);
}
.hd-trust {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 6px;
  color: var(--indigo-950-soft);
}
.hd-trust svg {
  width: 13px;
  height: 13px;
  flex: none;
}
.hd-subnav-row .hd-trust:hover {
  color: #fff;
}
@media (min-width: 980px) {
  .hd-subnav-row {
    min-height: 40px;
  }
  .hd-subnav-row a {
    font-size: 13px;
  }
  .hd-trust {
    margin-left: auto;
  }
}

/* The two-row header is taller than the old bar, so the sticky side rail
   (app.css) needs a deeper offset and the full remaining viewport; the
   overflow stays as a safety valve for short laptop screens, but the rail's
   content is sized to fit without ever showing its own scrollbar. */
@media (min-width: 980px) {
  .col-side-sticky {
    top: 122px;
    max-height: calc(100dvh - 134px);
  }
}

/* The status entry: a stack of ringed faces where the other header actions
   carry an icon, so it sits in the same 24px-of-glyph, label-underneath rhythm
   as Alerts and Basket rather than looking bolted on.

   Overlapped rather than spaced, because three spaced avatars would be wider
   than the search box on a phone. The ring is the signal, and it only lights
   while something is unseen; a ring that is always on is decoration. */
.hd .hd-rings {
  min-width: 52px;
}
.hd-rings-stack {
  display: flex;
  align-items: center;
  height: 24px;
}
.hd-ring {
  display: block;
  border-radius: 50%;
  padding: 1.5px;
  /* The quiet state, for a viewer who has seen everything: a hairline that
     still separates the overlapped faces from each other. */
  background: rgba(255, 255, 255, 0.28);
}
.hd-ring + .hd-ring {
  /* Overlap, and the later face sits on top, which reads as a stack. */
  margin-left: -9px;
}
.hd-rings.is-fresh .hd-ring {
  background: linear-gradient(140deg, var(--royal-500), var(--accent-600));
}
.hd-ring .avatar {
  width: 21px;
  height: 21px;
  font-size: 11px;
  /* The gap that makes it a ring rather than a border, in the header's own
     colour so the overlap does not smear. */
  box-shadow: 0 0 0 1.5px var(--indigo-950, #171040);
}
.hd .hd-rings.is-fresh .hd-cluster-label {
  color: #fff;
}
@media (max-width: 560px) {
  /* Two faces on a narrow phone: the third costs 12px that the search box
     needs more than the stack does. */
  .hd-ring:nth-child(3) {
    display: none;
  }
}

/* On a phone only the brand row stays pinned (22 Sep 2026). Measured at
   390x844 on every buyer and runner page: the header is 161px (brand row,
   search, browse band) and the whole of it was position: sticky, so with
   the 61px tab bar a quarter of the screen was chrome for the entire
   scroll of every page, and on a 667px phone a third. The brand row keeps
   Drops, Alerts, Basket and Account under the thumb; the search field and
   the browse band are one flick up, where every store app a buyer already
   uses keeps them.

   How, and why a wrapper: a sticky element can never leave its parent's
   box, so the brand row could not be pinned from INSIDE the header (first
   attempt measured: bar at -599px after a 700px scroll, gone with its
   parent). components/header.html therefore wraps the three rows in
   .hd-shell. Desktop: the shell pins and carries the indigo ground, the
   header inside it is static. Phone: the shell is display: contents, the
   header is a child of body and app.css's own sticky rule pins it, with
   the status-bar inset already on it; the two rows below carry their own
   ground because there is no longer a header behind them. The browse band
   keeps its 6% lighter wash as a mixed colour with a flat fallback. */
@media (min-width: 980px) {
  .hd-shell {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--indigo-950);
  }
  .hd-shell > .site-header {
    position: static;
  }
}
@media (max-width: 979.98px) {
  .hd-shell {
    display: contents;
  }
  .hd-msearch {
    background: var(--indigo-950);
    padding-left: calc(16px + env(safe-area-inset-left, 0px));
    padding-right: calc(16px + env(safe-area-inset-right, 0px));
  }
  .hd-subnav {
    background: var(--indigo-950);
    background: color-mix(in srgb, var(--indigo-950), #fff 6%);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
}

/* Nothing live: the same compass the tab bar carries, in the ring's place,
   so the way into Drops is in the header on every day of the week. */
.hd-rings.is-quiet .hd-rings-stack {
  display: none;
}
.hd-rings.is-quiet svg {
  width: 24px;
  height: 24px;
}
