/*
 * The site header, transcribed from the React one.
 *
 * `/` is not a React page. apps/storefront/src/app/route.ts reads
 * public/landing/index.html off disk and returns it raw, so the homepage never
 * renders components/chrome/store-header.tsx the way every other page does. It
 * had a header of its own, built by a template string in commerce.js and
 * styled by flagship.css, and the two drifted exactly as two independent
 * implementations of one thing do. Measured at 1280px on 7 September 2026:
 *
 *                      landing                 every other page
 *   announcement bar   #C8196A                 #7A1337 (berry)
 *   row padding        32px                    40px
 *   header tools       Search Profile          Search Profile Bag
 *                      Saved Bag
 *   "Collections"      a dialog trigger        a link to /collections
 *   "Gifting"          /#gifting               /jewellery?occasion=gifting
 *   "Our care"         /#care                  /policies/warranty-care
 *
 * The two bar heights already agreed (26px over a 72px row at this width, since
 * trimmed to 60px on both);
 * what did not agree is everything above.
 *
 * #C8196A is not one of the eight colours in DESIGN.md at all - the palette
 * has signature #E61E6E and berry #7A1337 - so the landing bar was off-brand,
 * not merely inconsistent, and the React header is the one to unify toward.
 *
 * Every value below is the computed value of the corresponding Tailwind class
 * in store-header.tsx. The landing does not load Tailwind, so the class names
 * cannot be shared; the numbers are what is shared, and e2e/brand.spec.ts
 * measures both pages at the same eight widths so they cannot drift again.
 * If you change one header, change the other, and let that test prove it.
 */

/* Tokens the React side gets from packages/ui/src/globals.css. */
.store-header {
  --store-berry: #7a1337;
  --store-offwhite: #faf8f4;
  --store-champagne: #e5d6c6;
  --store-charcoal: #2b2b2d;
  --store-blush: #fae4ea;
  --store-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* `sticky top-0 z-30 border-b border-champagne bg-offwhite/95 backdrop-blur-md` */
.store-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--store-champagne);
  background: rgb(250 248 244 / 0.95);
  backdrop-filter: blur(12px);
}

/* `flex h-6 items-center justify-center bg-berry px-4 text-center
    font-display text-[11px] font-medium tracking-[0.14em] text-offwhite` */
.store-announcement {
  display: flex;
  height: 24px;
  align-items: center;
  justify-content: center;
  padding-inline: 16px;
  background: var(--store-berry);
  color: var(--store-offwhite);
  font-family: var(--font-display, "Jost", system-ui, sans-serif);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-align: center;
}

/* `max-[375px]:tracking-[0.08em]`: the short line at 11px is 9px too long for a 320px phone with its full tracking. */
@media (max-width: 374px) {
  .store-announcement {
    letter-spacing: 0.08em;
  }
}

.store-announcement > span,
.store-announcement-line i {
  margin-inline: 8px;
  color: rgb(250 248 244 / 0.55);
  font-style: normal;
}

/* The festive offer's line, and the brand line it stands in for: `uppercase`,
   with one clause on a phone (`md:hidden`) and the date beside it from 768px
   (`hidden md:inline`). */
.store-announcement-line {
  margin: 0;
  text-transform: uppercase;
}

.store-announcement-long {
  display: none;
}

/* `mx-auto grid h-14 max-w-[1360px] grid-cols-[1fr_auto_1fr] items-center px-3` */
.store-header-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 56px;
  max-width: 1360px;
  margin-inline: auto;
  padding-inline: 12px;
}

/* `hidden justify-self-start lg:block` + `flex items-center gap-7 text-[12px]` */
.store-nav {
  display: none;
  justify-self: start;
}

.store-nav ul {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--store-charcoal);
}

/* globals.css `.store-nav-link`, character for character. */
.store-header .store-nav-link {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: color 220ms var(--store-ease);
}

.store-header .store-nav-link::after {
  position: absolute;
  right: 0;
  bottom: 4px;
  left: 0;
  height: 1px;
  content: "";
  background: var(--store-berry);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 280ms var(--store-ease);
}

.store-header .store-nav-link:hover,
.store-header .store-nav-link[aria-current="page"] {
  color: var(--store-berry);
}

.store-header .store-nav-link:hover::after,
.store-header .store-nav-link[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* globals.css `.store-header-action` + `grid min-h-11 min-w-11 place-items-center gap-1 px-0.5` */
.store-header .store-header-action {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 44px;
  min-width: 44px;
  /* `px-0.5`: at 11px "Search" is 38px wide, and with 4px a side its tool was 46px, not 44. */
  padding-inline: 2px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--store-charcoal);
  text-decoration: none;
  cursor: pointer;
  transition:
    color 180ms var(--store-ease),
    background 180ms var(--store-ease),
    transform 180ms var(--store-ease);
}

.store-header .store-header-action:hover {
  color: var(--store-berry);
  background: var(--store-blush);
}

.store-header .store-header-action:active {
  transform: scale(0.96);
}

.store-header .store-header-action img {
  width: 18px;
  height: 18px;
}

/* TOOL_LABEL: `text-[11px] font-medium leading-none tracking-[0.02em] text-charcoal` */
.store-tool-label {
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--store-charcoal);
}

.store-header .store-menu-trigger {
  justify-self: start;
}

/*
 * Match store-header.tsx: reduce the logo by about 15%, while reserving
 * 204px for the two tool rails and padding at the narrowest phone widths.
 * e2e/brand.spec.ts checks centring and parity with the React header.
 */
.store-wordmark {
  /* `flex`: no inline line box above the lockup, so the logo is vertically centred. */
  display: flex;
  width: min(37.4vw, 141px, calc(100vw - 204px));
  justify-self: center;
  font-size: 23px;
  text-decoration: none;
}

.store-wordmark .brand-lockup {
  display: inline-grid;
  width: 100%;
  grid-template-columns: minmax(0,1fr) minmax(0,9.252fr);
  align-items: start;
  column-gap: 4%;
  line-height: 1;
}

.store-wordmark .brand-copy > img {
  width: 100%;
  height: auto;
}

/* BrandLockup's Singapore signature: `mt-[0.45em] w-[46.9%] text-[0.32em]` */
.store-wordmark .brand-origin {
  display: flex;
  width: 46.9%;
  margin-top: 0.45em;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display, "Jost", system-ui, sans-serif);
  font-size: 0.32em;
  font-weight: 500;
}

/* `flex items-center justify-self-end gap-0.5` */
.store-header-tools {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 2px;
}

.store-bag-button {
  position: relative;
}

/* `absolute right-0 top-0 grid h-5 min-w-5 place-items-center rounded-full
    bg-berry px-1 text-[11px] tabular-nums text-offwhite` */
.store-bag-badge {
  position: absolute;
  right: 0;
  top: 0;
  display: grid;
  place-items: center;
  height: 20px;
  min-width: 20px;
  padding-inline: 4px;
  border-radius: 9999px;
  background: var(--store-berry);
  color: var(--store-offwhite);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.store-bag-badge[hidden] {
  display: none;
}

/* `hidden md:grid` on the account tool, and `md:` on the row's own scale. */
.store-header .store-tool-account {
  display: none;
}

@media (min-width: 768px) {
  .store-announcement {
    height: 26px;
  }

  .store-announcement-short {
    display: none;
  }

  .store-announcement-long {
    display: inline;
  }

  .store-header-row {
    padding-inline: 24px;
  }

  .store-header-tools {
    gap: 4px;
  }

  .store-header .store-tool-account {
    display: grid;
  }

  .store-wordmark {
    width: 162px;
    font-size: 26px;
  }
}

@media (min-width: 1024px) {
  .store-header-row {
    height: 60px;
    padding-inline: 32px;
  }

  .store-nav {
    display: block;
  }

  .store-header .store-menu-trigger {
    display: none;
  }

  .store-wordmark {
    width: 196px;
    font-size: 30px;
  }
}

@media (min-width: 1280px) {
  .store-header-row {
    padding-inline: 40px;
  }
}

/* globals.css does the same for the React header. */
@media (prefers-reduced-transparency: reduce) {
  .store-header {
    background: var(--store-offwhite);
    backdrop-filter: none;
  }
}

/*
 * The way back into the saved drawer.
 *
 * The Saved tool used to sit in the header, inserted by flagship.js. The
 * header is a transcription of the React StoreHeader now and that component
 * has three tools - Search, Profile, Bag - so a fourth here would be the drift
 * this file exists to end. The feature itself is landing-only (sessionStorage,
 * one browser tab, never wired to /wishlist), so it keeps its drawer and moves
 * its entry point beside the toast that confirms a save.
 *
 * Anchored just above `.save-toast`, which is fixed 20px from the bottom.
 */
.save-toast-link {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--store-champagne, #e5d6c6);
  border-radius: 3px;
  background: var(--store-offwhite, #faf8f4);
  color: var(--store-charcoal, #2b2b2d);
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 10px 32px rgb(122 19 55 / 0.12);
}

.save-toast-link[hidden] {
  display: none;
}

.save-toast-link:hover {
  color: var(--store-berry, #7a1337);
  background: var(--store-blush, #fae4ea);
}
