/* Anahata v2 — desktop header (990px+). Row 1: logo centred, nav icons +
   search right (v1 type: Aboreto caps, slate). Row 2: the main categories,
   each opening its mega panel (component-ui-mega-panel.css). Hidden below
   990px, where v2's phone header and tab bar stay. */

.site-header {
  display: none;
}

@media screen and (min-width: 990px) {
  /* the header — and the category panels hanging from it — sit above
     everything on the page: the section wrapper is its own layer (Dawn's
     header group gives it z-index 4), which put the open panel under the
     product page's back / share / bag pills (z-index 11). Kept under the
     fixed search state (59/60, which stacks inside this layer anyway). */
  .section-site-header {
    position: relative;
    z-index: 40;
  }

  .site-header {
    position: relative;   /* the mega panels hang from its bottom edge */
    display: block;
    background: var(--a-surface);
    border-bottom: 1px solid var(--a-rule-faint);
  }
}

.site-header__top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 120px;
  padding-inline: calc(var(--a-space-5) * 2);
}

/* ---- row 2: categories ---- */
.site-header__cat-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0;
  padding: 0 var(--a-space-5);
  list-style: none;
}

/* No gaps between categories: each <li> owns half of the old 40px gap on
   either side, so the cursor is always over some category while moving along
   the row (the panel used to start closing in the gap). The underline stays
   under the label — the link — not the wider hover area. */
.site-header__cat {
  padding-inline: var(--a-space-5);
}

/* narrower desktops: nine categories stay on one line */
@media screen and (max-width: 1365px) {
  .site-header__cat {
    padding-inline: var(--a-space-3);
  }
}

@media screen and (max-width: 1199px) {
  .site-header__cat {
    padding-inline: var(--a-space-2);
  }

  .site-header .site-header__cat-link {
    letter-spacing: var(--a-ls-caps);
  }
}

@media screen and (max-width: 1099px) {
  .site-header .site-header__cat-link {
    font-size: var(--a-fs-label);
  }
}

.site-header__cat-link {
  position: relative;
  display: block;
  padding: var(--a-space-4) 0 calc(var(--a-space-4) + 2px);
  font-family: var(--a-font-display);
  font-weight: 600;
  font-size: var(--a-fs-header-link);
  line-height: 24px;
  letter-spacing: var(--a-ls-header-link);
  text-transform: uppercase;
  color: var(--a-ink-slate);
  text-decoration: none;
}

/* hover / open / current: a 2px rule under the label (Cartier cue, v2 ink) */
.site-header__cat-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--a-ink);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.site-header__cat:hover .site-header__cat-link::after,
.site-header__cat:focus-within .site-header__cat-link::after,
.site-header__cat-link[aria-current='page']::after {
  transform: scaleX(1);
}

.site-header__cat:hover .site-header__cat-link,
.site-header__cat:focus-within .site-header__cat-link {
  color: var(--a-ink);
}

/* one level: hovering or tabbing into a category opens its panel. Without
   JS it's plain CSS; with it (mega-menu.js sets data-mega-js) the script
   runs the 0.5s open / close and the swap between categories. */
.site-header:not([data-mega-js]) .site-header__cat:hover > .mega-panel,
.site-header:not([data-mega-js]) .site-header__cat:focus-within > .mega-panel {
  display: flex;
}

.site-header[data-mega-js] .site-header__cat.is-open .site-header__cat-link::after {
  transform: scaleX(1);
}

.site-header[data-mega-js] .site-header__cat.is-open .site-header__cat-link {
  color: var(--a-ink);
}

/* while a panel is open only its category is underlined — the current
   page's rule steps aside and comes back when the panel closes */
.site-header[data-mega-js]:has(.site-header__cat.is-open) .site-header__cat:not(.is-open) .site-header__cat-link::after {
  transform: scaleX(0);
}

/* a closed search state shouldn't leave a panel open behind it */
.site-header.is-searching .mega-panel {
  display: none !important;
}


.site-header__side {
  display: flex;
  align-items: center;
  gap: calc(var(--a-space-5) * 2);
}

.site-header__side--end {
  justify-content: flex-end;
}

.site-header__link {
  display: inline-flex;
  align-items: center;
  gap: var(--a-space-2);
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--a-font-display);
  font-weight: 600;
  font-size: var(--a-fs-header-link);
  letter-spacing: var(--a-ls-header-link);
  text-transform: uppercase;
  color: var(--a-ink-slate);
  text-decoration: none;
  cursor: pointer;
}

.site-header__icon {
  display: flex;
  padding: var(--a-space-2);   /* same box as the nav icons beside it */
  color: var(--a-ink-slate);
}

.site-header__logo {
  display: flex;
  justify-content: center;
  color: var(--a-ink-pure);
  text-decoration: none;
}

.site-header__logo-img {
  width: 100px;
  height: 100px;
  object-fit: contain;
}

.site-header__wordmark {
  font-family: var(--a-font-display);
  font-size: var(--a-fs-display-l);
  letter-spacing: var(--a-ls-header-link);
  text-transform: uppercase;
}

.site-header__link:focus-visible,
.site-header__icon:focus-visible,
.site-header__logo:focus-visible {
  outline: 2px solid var(--a-ink);
  outline-offset: 4px;
}

/* ---- two states (2026-09-28): normal · search ---- */
.site-header__normal {
  display: flex;
  align-items: center;
  gap: var(--a-space-5);   /* cart · search: the nav icons' own spacing */
}

.site-header__normal[hidden],
.site-header__close[hidden] {
  display: none;
}

/* search state: the header stays put above the panel */
@media screen and (min-width: 990px) {
  .site-header.is-searching {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
  }
}

/* the panel: v2's /search page, under the header, scrolling on its own */
.site-search {
  position: fixed;
  top: var(--a-header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 59;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--a-bg);
  border-top: 1px solid var(--a-rule-faint);
}

.site-search[hidden] {
  display: none;
}

.site-search[aria-busy='true'] .site-search__body {
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.site-search__body {
  max-width: 1200px;
  margin-inline: auto;
}

/* the page behind stays still while searching */
html.site-search-open,
html.site-search-open body {
  overflow: hidden;
}
