/* Shared site header (wordmark centred, region menu on the right; an empty
   left column the same width keeps the wordmark dead centre).
   Used by index.html; colours come from the page tokens in presale.css.

   Fixed over the top of the hero photo. At the top of the page it is clear,
   with a white wordmark on a soft dark tint; once the page scrolls
   (.is-solid, set in presale.js) it settles into a frosted off-white bar, the
   wordmark turns black, the bar tightens a little and a hairline grows out
   from the centre along its bottom edge. */

.ps-header {
  --header-safe-top: env(safe-area-inset-top, 0px);
  --header-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  padding-top: max(10px, var(--header-safe-top));
  z-index: 20;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  min-height: 56px;
  background: transparent;
  color: var(--text);
  transition:
    background-color 0.45s var(--header-ease),
    backdrop-filter 0.45s var(--header-ease),
    -webkit-backdrop-filter 0.45s var(--header-ease),
    padding 0.45s var(--header-ease),
    min-height 0.45s var(--header-ease);
}

/* Clear state: a soft dark tint keeps the white wordmark readable on the
   photo. Fades out as the bar turns solid. */
.ps-header::before {
  content: "";
  position: absolute;
  inset: 0 0 -28px;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0));
  pointer-events: none;
  transition: opacity 0.45s var(--header-ease);
}

/* Hairline that grows from the centre once the bar is solid. */
.ps-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--border);
  transform: scaleX(0);
  transition: transform 0.6s var(--header-ease);
  pointer-events: none;
}

.ps-header.is-solid {
  background-color: rgba(235, 232, 226, 0.86);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  padding-top: max(6px, var(--header-safe-top));
  padding-bottom: 6px;
  min-height: 48px;
}

.ps-header.is-solid::before {
  opacity: 0;
}

.ps-header.is-solid::after {
  transform: scaleX(1);
}

.ps-header-logo {
  grid-column: 2;
  display: flex;
  align-items: center;
  text-decoration: none;
}

/* The wordmark is black artwork: inverted to white while the bar is clear. */
.ps-header-logo img {
  display: block;
  width: min(190px, 52vw);
  height: auto;
  filter: invert(1);
  transition:
    filter 0.45s var(--header-ease),
    transform 0.45s var(--header-ease);
}

.ps-header.is-solid .ps-header-logo img {
  filter: none;
  transform: scale(0.92);
}

@media (prefers-reduced-motion: reduce) {
  .ps-header,
  .ps-header::before,
  .ps-header::after,
  .ps-header-logo img {
    transition: none;
  }
}

.ps-header-right {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---------- Shop link (left) and bag icon (right) ---------- */
.ps-header-left {
  grid-column: 1;
  justify-self: start;
  display: flex;
  align-items: center;
}

.ps-header-link {
  position: relative;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
  transition: color 0.45s var(--header-ease);
}

/* ~44px tap target around the small text. */
.ps-header-link::before {
  content: "";
  position: absolute;
  inset: -14px -10px;
}

.ps-header-link:hover,
.ps-header-link:focus-visible,
.ps-header-link[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cart-icon-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  /* Pulled in from the page edge, next to the currency switcher. */
  margin-right: 8px;
  color: var(--text);
  text-decoration: none;
  transition: color 0.45s var(--header-ease);
}

.cart-icon-link::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.cart-icon-svg {
  width: 25px;
  height: 25px;
}

.cart-icon-count {
  position: absolute;
  top: -1px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  transition:
    background-color 0.45s var(--header-ease),
    color 0.45s var(--header-ease);
}

.cart-icon-count[hidden] {
  display: none;
}

.ps-header-link:focus-visible,
.cart-icon-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Clear bar over the photo: white, like the wordmark. On desktop only the
   Shop link sits over the photo; the bag sits over the light panel. */
.ps-header:not(.is-solid) .ps-header-link {
  color: #ffffff;
}

@media (max-width: 899px) {
  .ps-header:not(.is-solid) .cart-icon-link {
    color: #ffffff;
  }

  .ps-header:not(.is-solid) .cart-icon-count {
    background: #ffffff;
    color: #1a1a1a;
  }

  /* No inset from the edge: the header's side columns are narrow here. */
  .cart-icon-link {
    margin-right: 0;
  }
}

/* Narrow phones: a slightly smaller wordmark and tighter gaps so the
   currency menu and bag fit inside the right column (they used to run
   past the screen edge at 390px). */
@media (max-width: 480px) {
  .ps-header {
    gap: 8px;
  }

  .ps-header-logo img {
    width: min(190px, 38vw);
  }

  .ps-header-right {
    gap: 6px;
  }

  .cart-icon-link {
    width: 30px;
    height: 30px;
  }

  .cart-icon-svg {
    width: 23px;
    height: 23px;
  }
}

/* Pages without a hero: always the solid bar, but at the homepage's
   full (unscrolled) size, so the wordmark matches it exactly. */
.ps-header.is-static {
  position: sticky;
}

.ps-header.is-static.is-solid {
  padding-top: max(10px, var(--header-safe-top));
  padding-bottom: 10px;
  min-height: 56px;
}

.ps-header.is-static.is-solid .ps-header-logo img {
  transform: none;
}

/* Instagram / TikTok icon rows (used by the footers). */
.ps-social {
  display: flex;
  gap: 10px;
}

.ps-social img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.ps-social a:hover img,
.ps-social a:focus-visible img {
  opacity: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Region menu ---------- */
.currency-menu {
  position: relative;
}

/* Desktop: the same three buttons in a row as before; no dropdown toggle. */
.currency-menu-toggle {
  display: none;
}

.ps-header .currency-btn {
  opacity: 1;
  color: var(--faint, #767676);
}

.ps-header .currency-btn[aria-pressed="true"] {
  color: var(--text);
}

.currency-check {
  display: none;
}

/* Phones and tablets: "GBP ⌄" opens a small dropdown listing all three, with
   a tick by the selected one. */
@media (max-width: 899px) {
  .currency-menu-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 24px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* Small to look at, but still a ~44px tap target. */
  .currency-menu-toggle::before {
    content: "";
    position: absolute;
    inset: -10px -8px;
  }

  .currency-menu-chevron {
    width: 8px;
    height: 8px;
    transition: transform 0.2s ease;
  }

  .currency-menu.is-open .currency-menu-chevron {
    transform: rotate(180deg);
  }

  /* Clear bar over the photo: a light outline button. */
  .ps-header:not(.is-solid) .currency-menu-toggle {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(0, 0, 0, 0.18);
  }

  .currency-menu-toggle {
    transition:
      color 0.45s var(--header-ease),
      border-color 0.45s var(--header-ease),
      background-color 0.45s var(--header-ease);
  }

  .currency-menu-toggle:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
  }

  .ps-header .currency-switch.currency-switch--header {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 112px;
    flex-direction: column;
    gap: 0;
    padding: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  }

  .currency-menu.is-open .currency-switch.currency-switch--header {
    display: flex;
  }

  .ps-header .currency-switch--header .currency-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: 5px;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text);
    text-align: left;
  }

  .ps-header .currency-switch--header .currency-btn[aria-pressed="true"] {
    font-weight: 600;
    background: var(--section-bg, rgba(0, 0, 0, 0.03));
  }

  .currency-check {
    display: block;
    width: 10px;
    height: 6px;
    margin-left: 14px;
    border-left: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(-45deg);
    visibility: hidden;
  }

  .currency-btn[aria-pressed="true"] .currency-check {
    visibility: visible;
  }
}

/* Narrow phones: a little less side padding. */
@media (max-width: 389px) {
  .ps-header {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Folding phones' cover screens: 1fr auto 1fr holds the bar at about 316px
   wide, which scrolls the page sideways. The wordmark takes what's left. */
@media (max-width: 319px) {
  .ps-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .ps-header-logo {
    min-width: 0;
    justify-content: center;
  }

  .ps-header-logo img {
    width: 100%;
    max-width: 106px;
  }
}

/* Desktop: a slightly taller bar and larger wordmark. The region buttons sit
   over the light product panel, so they stay dark in both states; the tint
   only darkens the hero side. */
@media (min-width: 900px) {
  .ps-header {
    min-height: 64px;
    padding-top: 6px;
    padding-bottom: 6px;
    padding-right: 32px;
  }

  .ps-header.is-solid {
    min-height: 54px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .ps-header.is-static.is-solid {
    min-height: 64px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  /* Same width as the hero column (see .ps-main in presale.css). */
  .ps-header::before {
    right: calc(100% - clamp(60%, 100svh * 1.5, 100% - 520px));
  }

  .ps-header-logo img {
    width: 240px;
  }
}
