/* Site header: the frosted bar over every shop page — the shop's name or
   logo on the left, the page's one call to action on the right. */
.site-header {
  align-items: center;
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  background: color-mix(in oklch, var(--color-surface-0) 78%, transparent);
  border-block-end: var(--border-width) solid color-mix(in oklch, var(--color-subtle) 60%, transparent);
  color: var(--color-text);
  display: flex;
  gap: var(--space-s);
  inline-size: 100%;
  justify-content: space-between;
  min-block-size: 4rem;
  padding-inline: var(--gutter);
  position: sticky;
  inset-block-start: 0;
  z-index: var(--z-nav);
}

.site-header__brand {
  align-items: center;
  color: var(--color-text);
  display: flex;
  font-size: var(--step-0);
  font-weight: var(--weight-semibold);
  gap: var(--space-xs);
  min-inline-size: 0;
  text-decoration: none;
}

.site-header__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-header__logo {
  block-size: 2.5rem;
  border-radius: var(--radius-s);
  inline-size: auto;
  max-inline-size: 10rem;
  object-fit: contain;
}

/* Once the checkout dock is up it carries the purchase, so the header's
   button steps back and the page asks for one thing at a time */
body:has(.checkout-bar--visible) .site-header .button[data-variant="primary"] {
  --button-bg: var(--color-surface-2);
  --button-bg-hover: var(--color-surface-3);
  --button-fg: var(--color-text);

  filter: none;
}

/* ── The style's header (data-look-header) ────────────────────────────────
   frosted   the page shows through the bar (above)
   solid     an opaque bar in the cards' colour
   centered  the name or logo in the middle, from a tablet's width */
[data-look-header="solid"] .site-header {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--color-surface-1);
  border-block-end-color: var(--color-subtle);
}

@media (min-width: 40em) {
  [data-look-header="centered"] .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);

    .site-header__brand {
      grid-column: 2;
    }

    > .cluster {
      grid-column: 3;
      justify-self: end;
    }
  }
}

/* ── The shop's menu (ShopMenu) ───────────────────────────────────────────
   In the bar once it fits (data-menu: a short menu from a tablet's width, a
   medium one from a laptop's), behind the toggle on anything narrower, and
   always behind it once the menu is long. The links sit centred between the
   name and the actions. */
.site-header__menu {
  display: none;
  flex: 1;
  flex-wrap: wrap;
  gap: var(--space-3xs) var(--space-s);
  justify-content: center;
  min-inline-size: 0;
}

.site-header__link {
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: var(--step--1);
  font-weight: var(--weight-medium);
  padding: var(--space-3xs) var(--space-xs);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out);

  &:hover {
    background: color-mix(in oklch, var(--color-text) 8%, transparent);
    color: var(--color-text);
  }

  &[aria-current="page"] {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.4em;
  }
}

.site-header__actions {
  flex-wrap: nowrap;
}

.site-header__toggle {
  --button-padding-inline: var(--space-xs);
}

@media (min-width: 48rem) {
  .site-header[data-menu="short"] {
    .site-header__menu {
      display: flex;
    }

    .site-header__toggle {
      display: none;
    }
  }

  [data-look-header="centered"] .site-header[data-menu="short"] .site-header__menu {
    grid-column: 1;
    grid-row: 1;
    justify-content: flex-start;
  }
}

@media (min-width: 64rem) {
  .site-header[data-menu="medium"] {
    .site-header__menu {
      display: flex;
    }

    .site-header__toggle {
      display: none;
    }
  }

  [data-look-header="centered"] .site-header[data-menu="medium"] .site-header__menu {
    grid-column: 1;
    grid-row: 1;
    justify-content: flex-start;
  }
}
