/* ==========================================================================
   MAGNETIE — Header Shell (Function A: Core System)
   Structural + visual styling only. Interactive behavior (menu toggle,
   search submit, live nav state, cart/wishlist counts) belongs to
   Function B (Navigation & Search) and Function E (Product & Commerce).
   ========================================================================== */

.site-header {
  position: sticky;
  top: var(--announce-offset);
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  gap: var(--space-6);
  width: 100%;
  height: var(--header-height);
  padding-inline: var(--page-inset);
  background: var(--color-surface);
  /* Redesign: no hairline at rest (airy, white); it only appears once the
     page scrolls under the header (data-elevated, js/core.js). */
  border-bottom: 1px solid transparent;
  transition: top var(--duration-base) var(--ease-standard),
              border-color var(--duration-base) var(--ease-standard),
              background-color var(--duration-base) var(--ease-standard);
}

.site-header[data-elevated="true"] {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--color-line);
}

/* ---------- Announcement bar ----------
   Thin blush link above the header on every page, to the FW26 product list.
   It slides away when the visitor scrolls down and back on scrolling up, anywhere
   on the page (js/core.js). Anything sticky sits below it through
   --announce-offset: its height while shown, 0 while hidden. */

:root {
  --announce-h: 2rem;
  --announce-offset: var(--announce-h);
}

html.announce-hidden {
  --announce-offset: 0px;
}

.announce-bar {
  position: sticky;
  top: 0;
  z-index: calc(var(--z-header) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--announce-h);
  padding-inline: var(--container-pad);
  background: #FFE0F1;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--color-ink);
  transition: transform var(--duration-base) var(--ease-standard);
}

html.announce-hidden .announce-bar {
  transform: translateY(-100%);
}

.announce-bar:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 768px) {
  :root {
    --announce-h: 1.75rem;
  }

  .announce-bar {
    font-size: 0.6875rem;
  }
}

/* ---------- Logo ----------
   Was a text wordmark in Beautique Display; replaced with the supplied
   logotype image (assets/img/brand/logotype.png, cropped from
   Asset/Logotype_homepage.png — that source file has ~20% empty canvas
   padding on every side, trimmed here to its ink bounding box so the
   displayed height maps directly to the visible glyphs instead of mostly
   whitespace). Flat white background, same as the project's other
   as-supplied brand assets (category tiles) — no background/border added
   behind it. */

.site-logo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.site-logo__image {
  display: block;
  height: 50px;
  width: auto;
  /* The logotype PNG has a flat white canvas: multiply drops it out so the
     glyphs sit cleanly on the see-through header over the hero image. */
  mix-blend-mode: multiply;
}

/* ---------- Primary nav ---------- */

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex: 0 0 auto;
}

.site-nav a {
  position: relative;
  font-size: var(--fs-nav);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-ink);
  padding-block: var(--space-1);
}

.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--color-ink);
}

.site-nav a:hover {
  color: var(--color-ink-soft);
}

/* ---------- Search — collapsed icon by default, part of the utility group ----------
   Structural default only: a fixed 36px icon-sized slot (matches .icon-btn)
   so Wishlist/Account/Cart never move. The hover/focus/typing-driven expand
   interaction is desktop-only and lives in nav.css next to the rest of
   Function B's interactive header states; the pre-existing mobile
   collapse-to-icon + flyout behavior (also nav.css, @media max-width:768px)
   is unchanged by this. */

.site-search {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.site-search__icon {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  color: var(--color-ink);
}

.site-search__icon svg {
  width: 20px;
  height: 20px;
}

.site-search__input {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  width: 0;
  height: 36px;
  padding-inline: 0;
  background: var(--color-surface);
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  font-size: var(--fs-body);
  color: var(--color-ink);
  opacity: 0;
  pointer-events: none;
  /* padding-inline is 0 at rest and only grows with width (see nav.css's
     desktop expand rules) — otherwise box-sizing: border-box can't shrink
     the box below its own padding, so a fixed padding here would leave a
     several-pixel-wide (invisible but present) box even when "collapsed". */
  transition: width var(--duration-base) var(--ease-standard),
              padding-inline var(--duration-base) var(--ease-standard),
              opacity var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
}

.site-search__input::placeholder {
  color: var(--color-ink-muted);
}

/* ---------- Utility icon group (search / wishlist / account / cart) ---------- */

.site-utility {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 0 0 auto;
  margin-left: auto;
}

.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--color-ink);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn__count {
  position: absolute;
  top: -2px;
  right: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding-inline: 3px;
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-surface);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
}

.icon-btn__count[data-count="0"] {
  display: none;
}

/* ---------- Language switcher (VN | EN) ----------
   Sits as the last child of .site-utility, i.e. immediately right of the
   Cart icon, on both desktop and mobile (this group is never collapsed
   into the hamburger menu — see nav.css / the @media rule below, which
   only hides .site-nav). Wired by js/i18n.js. */

.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  margin-left: var(--space-2);
  padding-left: var(--space-3);
  border-left: var(--border-hairline);
  font-size: var(--fs-nav);
  letter-spacing: var(--tracking-wide);
}

.lang-switch__btn {
  padding: 2px 1px;
  color: var(--color-ink-soft);
  font-weight: 500;
}

.lang-switch__btn.is-active {
  color: var(--color-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lang-switch__btn:hover {
  color: var(--color-ink);
}

.lang-switch__sep {
  color: var(--color-line-strong);
  font-size: 0.7em;
}

/* ---------- Desktop balance (frontend redesign) ----------
   >=1440px: three-zone grid — logo at the content edge, the primary nav
   centred on the page, the utility group (permanent search field + icons +
   VN|EN) at the opposite content edge; both sides sit inward of the
   viewport edge via --page-inset. 1025–1439px: the utility group is too
   wide for equal side columns, so the flex row centres the nav in the
   free space between logo and utility (auto margins) instead of letting
   it hug the logo. <=1024px is unchanged. menu-toggle is display:none
   here, so it is not a grid/flex item. */

@media (min-width: 1440px) {
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    column-gap: var(--space-6);
  }

  .site-logo {
    justify-self: start;
  }

  .site-nav {
    justify-self: center;
    gap: var(--space-7);
  }

  .site-utility {
    justify-self: end;
    margin-left: 0;
  }
}

@media (min-width: 1025px) and (max-width: 1439px) {
  .site-nav {
    margin-inline: auto;
    gap: var(--space-5);
  }

  .site-utility {
    margin-left: 0;
    gap: var(--space-3);
  }
}

/* Small tablets: the full row (nav + icons + language) needs ~870px at the
   default spacing, so it is tightened to stay inside the screen. */
@media (min-width: 769px) and (max-width: 900px) {
  .site-header {
    gap: var(--space-3);
    padding-inline: 1.25rem;
  }

  .site-nav {
    gap: var(--space-4);
  }

  .site-utility {
    gap: var(--space-2);
  }
}

/* ---------- Responsive baseline (refined further by Function F) ---------- */

@media (max-width: 768px) {
  .site-header {
    gap: var(--space-3);
  }

  .site-nav {
    display: none;
  }

  /* Compact "VN/EN" presentation so the icon row never wraps/overflows
     on narrow phones — this header row's width budget is tuned to the
     hamburger/logo/icon sizes with near-zero slack (see nav.css's
     ~768px/480px/360px rules), so this stays as small as it can. */
  .lang-switch {
    gap: 1px;
    margin-left: 2px;
    padding-left: 4px;
    font-size: 0.625rem;
  }

  .lang-switch__btn {
    padding: 2px 0;
  }
}

@media (max-width: 400px) {
  /* Drop the separator and divider border on the narrowest phones —
     just "VN EN", a few px tighter still. */
  .lang-switch {
    margin-left: 0;
    padding-left: 2px;
    border-left: none;
  }

  .lang-switch__sep {
    display: none;
  }
}
