/**
 * Header shell — edge-pinned icons + modest logo overhang.
 *
 * Layout: burger (far left) | centred logo | cart + account (far right)
 * grid-template-columns: 1fr auto 1fr
 */

html body .pw-header,
html body .pw-mobile-header,
html body .pw-header__outer,
html body .pw-header__inner {
  overflow: visible !important;
  max-width: 100vw !important;
}

html body .pw-header,
html body .pw-mobile-header {
  position: fixed !important;
  top: calc(-1 * env(safe-area-inset-top, 0px)) !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9999 !important;
  /* Kill mobile_edge_padding gaps — icons must sit at the screen ends */
  padding-left: 0 !important;
  padding-right: 0 !important;
}

html body .pw-header__outer {
  padding-top: env(safe-area-inset-top, 0px) !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

html body,
html body.pwmsh-header-footer-control {
  --pw-header-h: 68px !important;
  /* Modest overhang — still prominent, not covering the hero */
  --pw-logo-h: 64px !important;
  --pw-logo-overhang: 8px !important;
  /* Bigger matched icons */
  --pw-header-icon: 42px !important;
  --pw-header-hit: 48px !important;
  /* V192: pull burger / cart / account slightly in from the screen edge */
  --pw-header-edge: 12px !important;
}

html body .pw-header__inner,
html body.pwmsh-header-footer-control .pw-header__inner {
  position: relative !important;
  display: grid !important;
  grid-template-columns: 1fr auto 1fr !important;
  align-items: center !important;
  column-gap: 6px !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  height: var(--pw-header-h, 68px) !important;
  min-height: var(--pw-header-h, 68px) !important;
  max-height: var(--pw-header-h, 68px) !important;
  /* Tiny inset only — no big side gutters */
  padding-left: calc(env(safe-area-inset-left, 0px) + var(--pw-header-edge, 4px)) !important;
  padding-right: calc(env(safe-area-inset-right, 0px) + var(--pw-header-edge, 4px)) !important;
  box-sizing: border-box !important;
}

/* LEFT: burger hard against the left edge */
html body .pw-header__left,
html body .pw-mobile-header__left,
html body.pwmsh-header-footer-control .pw-header__left {
  justify-self: start !important;
  align-self: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  position: relative !important;
  z-index: 3 !important;
  min-width: var(--pw-header-hit, 48px) !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* BRAND: centre grid cell — in flow (never covers icons) */
html body .pw-header__brand,
html body .pw-mobile-header__brand,
html body.pwmsh-header-footer-control .pw-header__brand,
html body.pwmsh-header-footer-control .pw-mobile-header__brand {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  transform: none !important;
  margin: 0 !important;
  justify-self: center !important;
  align-self: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: auto !important;
  max-height: none !important;
  width: auto !important;
  max-width: min(46vw, 190px) !important;
  overflow: visible !important;
  z-index: 1 !important;
  pointer-events: auto !important;
  line-height: 0 !important;
}

html body .pw-header__logo,
html body.pwmsh-header-footer-control .pw-header__logo {
  height: var(--pw-logo-h, 64px) !important;
  max-height: var(--pw-logo-h, 64px) !important;
  width: auto !important;
  max-width: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block !important;
  /* Modest hang only */
  transform: translateY(var(--pw-logo-overhang, 8px)) !important;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.38)) !important;
}

/* RIGHT: cart then account, hard against the right edge */
html body .pw-header__actions,
html body .pw-mobile-header__right,
html body.pwmsh-header-footer-control .pw-header__actions {
  justify-self: end !important;
  align-self: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 2px !important;
  column-gap: 2px !important;
  position: relative !important;
  z-index: 3 !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  visibility: visible !important;
  opacity: 1 !important;
}

html body .pw-menu-toggle,
html body .pw-header__actions .pw-icon-btn,
html body .pw-header__actions .pw-cart,
html body .pw-mobile-header__right .pw-icon-btn,
html body.pwmsh-header-footer-control .pw-menu-toggle,
html body.pwmsh-header-footer-control .pw-icon-btn {
  width: var(--pw-header-hit, 48px) !important;
  height: var(--pw-header-hit, 48px) !important;
  min-width: var(--pw-header-hit, 48px) !important;
  min-height: var(--pw-header-hit, 48px) !important;
  margin: 0 !important;
  padding: 0 !important;
  position: relative !important;
  visibility: visible !important;
  opacity: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 var(--pw-header-hit, 48px) !important;
  box-sizing: border-box !important;
}

/* Matched glyph sizes: burger = cart = account */
html body .pw-header-glyph,
html body .pw-header-glyph--menu,
html body .pw-header-glyph--cart,
html body .pw-header-glyph--account,
html body .pw-header-glyph--img,
html body .pw-header__actions .pw-header-glyph,
html body .pw-mobile-header__right .pw-header-glyph,
html body .pw-menu-toggle .pw-header-glyph,
html body .pw-icon-btn svg,
html body.pwmsh-header-footer-control .pw-header-glyph,
html body.pwmsh-header-footer-control .pw-header-glyph--img,
html body.pwmsh-header-footer-control .pw-icon-btn svg,
html body.pwmsh-header-footer-control .pw-menu-toggle .pw-header-glyph {
  width: var(--pw-header-icon, 42px) !important;
  height: var(--pw-header-icon, 42px) !important;
  min-width: var(--pw-header-icon, 42px) !important;
  min-height: var(--pw-header-icon, 42px) !important;
  max-width: var(--pw-header-icon, 42px) !important;
  max-height: var(--pw-header-icon, 42px) !important;
  flex: 0 0 var(--pw-header-icon, 42px) !important;
  display: block !important;
  object-fit: contain !important;
  transform: none !important;
}

/* Spacer clears the modest overhang */
html body .pw-header-spacer {
  height: calc(var(--pw-header-h, 68px) + env(safe-area-inset-top, 0px) + var(--pw-logo-overhang, 8px)) !important;
  min-height: calc(var(--pw-header-h, 68px) + env(safe-area-inset-top, 0px) + var(--pw-logo-overhang, 8px)) !important;
  max-height: none !important;
}

/* Never show cart ticket-count badge in the header */
html body .pw-cart-count,
html body [data-pw-cart-count],
html body .pw-cart .pw-cart-count,
html body .pw-icon-btn .pw-cart-count {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  font-size: 0 !important;
}

@media (min-width: 769px) {
  html body,
  html body.pwmsh-header-footer-control {
    --pw-logo-h: 70px !important;
    --pw-logo-overhang: 10px !important;
    --pw-header-icon: 44px !important;
    --pw-header-edge: 8px !important;
  }
  html body .pw-header__brand,
  html body.pwmsh-header-footer-control .pw-header__brand {
    max-width: min(36vw, 220px) !important;
  }
}

@media (max-width: 360px) {
  html body,
  html body.pwmsh-header-footer-control {
    --pw-logo-h: 58px !important;
    --pw-logo-overhang: 6px !important;
    --pw-header-icon: 40px !important;
    --pw-header-hit: 46px !important;
    --pw-header-edge: 2px !important;
  }
  html body .pw-header__brand {
    max-width: min(44vw, 160px) !important;
  }
}

/* Checkout / cart: same edge-pinned geometry */
html body.woocommerce-checkout .pw-header__inner,
html body.woocommerce-cart .pw-header__inner {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr !important;
  align-items: center !important;
  width: 100% !important;
  padding-left: calc(env(safe-area-inset-left, 0px) + var(--pw-header-edge, 4px)) !important;
  padding-right: calc(env(safe-area-inset-right, 0px) + var(--pw-header-edge, 4px)) !important;
  height: var(--pw-header-h, 68px) !important;
}

html body.woocommerce-checkout .pw-header__brand,
html body.woocommerce-cart .pw-header__brand {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  justify-self: center !important;
  z-index: 1 !important;
  max-width: min(46vw, 190px) !important;
}

/* Cart keeps logo overhang; checkout must NOT — it covers Express Pay. */
html body.woocommerce-cart .pw-header__logo {
  height: var(--pw-logo-h, 64px) !important;
  max-height: var(--pw-logo-h, 64px) !important;
  width: auto !important;
  transform: translateY(var(--pw-logo-overhang, 8px)) !important;
}
html body.woocommerce-checkout {
  --pw-logo-h: 44px !important;
  --pw-logo-overhang: 0px !important;
}
html body.woocommerce-checkout .pw-header__logo {
  height: 44px !important;
  max-height: 44px !important;
  width: auto !important;
  transform: none !important;
}
html body.woocommerce-checkout .pw-header-spacer {
  height: calc(var(--pw-header-h, 68px) + env(safe-area-inset-top, 0px)) !important;
  min-height: calc(var(--pw-header-h, 68px) + env(safe-area-inset-top, 0px)) !important;
}
