/**
 * HiGuppy shared header — homepage design, every public page.
 * inc/higuppy-header.php declares this layer before route styles. Important
 * declarations in this first layer own only the navigation component; Shop,
 * product, article and information-page content retain their existing owners.
 */
@layer hg-header {
  /* Only the document scrolls. overflow:hidden on body breaks sticky on PDP. */
  html:has(body.higuppy-site-shell) { overflow-x: clip !important; overflow-y: auto !important; scroll-padding-top: 88px !important; }
  body.higuppy-site-shell:not(.hg-nav-open):not(.hg-search-open):not(.higuppy-sidebar-cart-open) { overflow-x: clip !important; overflow-y: visible !important; }
  body.higuppy-site-shell :is(main section[id],main h2[id],main h3[id],#shop-products,#hg-product-information,#hg-reviews,[role="tabpanel"]) { scroll-margin-top: 8px !important; }

  body.higuppy-site-shell nav#hgSiteNav.hg-nav {
    --hg-header-inset: var(--hg-layout-inset);
    --hg-header-surface: linear-gradient(90deg, #f0f7f2 0%, #f8f8f0 65%, #fbf5e8 100%);
    --hg-header-ink: #29483e;
    --hg-header-green: #285644;
    --hg-header-height: 72px;
    box-sizing: border-box !important;
    position: sticky !important;
    inset: var(--wp-admin--admin-bar--height, 0px) auto auto !important;
    z-index: 10040 !important;
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr) auto !important;
    align-items: center !important;
    justify-content: normal !important;
    flex-wrap: nowrap !important;
    gap: 22px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: var(--hg-header-height) !important;
    min-height: var(--hg-header-height) !important;
    max-height: var(--hg-header-height) !important;
    margin: 0 !important;
    padding: 13px var(--hg-header-inset) !important;
    border: 0 !important;
    border-bottom: 1px solid #d8e2d8 !important;
    border-radius: 0 !important;
    background: var(--hg-header-surface) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    color: var(--hg-header-ink) !important;
    font-family: var(--hg-shared-body, Arial, sans-serif) !important;
    font-size: 16px !important;
    line-height: 1.65 !important;
    transform: none !important;
    overflow: visible !important;
  }
  body.higuppy-site-shell #hgSiteNav *,
  body.higuppy-site-shell #hgSiteNav *::before,
  body.higuppy-site-shell #hgSiteNav *::after { box-sizing: border-box !important; }
  body.higuppy-site-shell #hgSiteNav::before,
  body.higuppy-site-shell #hgSiteNav::after,
  body.higuppy-site-shell #hgSiteNav .hg-logo::before,
  body.higuppy-site-shell #hgSiteNav .hg-menu a::after,
  body.higuppy-site-shell #hgSiteNav .hg-menu-toggle::before,
  body.higuppy-site-shell #hgSiteNav .hg-menu-toggle::after {
    content: none !important; display: none !important;
  }
  body.higuppy-site-shell #hgSiteNav .hg-logo {
    display: inline-flex !important;
    position: static !important;
    align-items: center !important;
    align-self: center !important;
    justify-content: flex-start !important;
    flex: 0 0 auto !important;
    gap:var(--hg-brand-gap) !important;
    width: max-content !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    margin: 0 !important; padding: 0 !important;
    border: 0 !important; border-radius: 0 !important;
    background: transparent !important; box-shadow: none !important;
    overflow: visible !important; transform: none !important;
    text-decoration: none !important;
  }
  body.higuppy-site-shell #hgSiteNav .hg-logo-img {
    display: block !important; position: static !important;
    flex: 0 0 42px !important;
    width:var(--hg-brand-mark) !important; min-width:var(--hg-brand-mark) !important; max-width:var(--hg-brand-mark) !important;
    height:var(--hg-brand-mark) !important; max-height:var(--hg-brand-mark) !important;
    margin: 0 !important; padding: 0 !important;
    border: 0 !important; border-radius: 0 !important;
    object-fit: contain !important; transform: none !important;
   flex-basis:var(--hg-brand-mark) !important; }
  body.higuppy-site-shell #hgSiteNav .hg-logo::after {
    content: "HiGuppy" !important;
    display: block !important; position: static !important;
    flex: 0 0 auto !important; width: auto !important; height: auto !important;
    margin: 0 !important; padding: 0 !important;
    background: none !important; border: 0 !important;
    color: var(--hg-header-green) !important;
    -webkit-text-fill-color: var(--hg-header-green) !important;
    font-family: var(--hg-shared-heading, "Baloo 2", sans-serif) !important;
    font-size:var(--hg-brand-size) !important; font-weight: 750 !important; line-height: 1 !important;
    letter-spacing: -1px !important; white-space: nowrap !important;
    transform: none !important;
  }
  body.higuppy-site-shell #hgSiteNav .hg-logo.is-fallback::after { display: none !important; }
  body.higuppy-site-shell #hgSiteNav .hg-actions {
    display: flex !important; flex: 0 0 auto !important;
    align-items: center !important; align-self: center !important;
    justify-content: flex-end !important; flex-wrap: nowrap !important;
    gap: 6px !important; width: auto !important; min-width: 0 !important;
    height: 44px !important; margin: 0 0 0 auto !important; padding: 0 !important;
    border: 0 !important; background: transparent !important;
    overflow: visible !important; box-shadow: none !important;
  }
  body.higuppy-site-shell #hgSiteNav :is(.hg-action-btn, .hg-menu-toggle) {
    position: relative !important; display: inline-flex !important;
    flex: 0 0 44px !important; align-items: center !important; justify-content: center !important;
    width: 44px !important; min-width: 44px !important; max-width: 44px !important;
    height: 44px !important; min-height: 44px !important; max-height: 44px !important;
    margin: 0 !important; padding: 0 !important;
    border: 1px solid #cddbcf !important; border-radius: 12px !important;
    background: rgba(255,253,248,.7) !important;
    color: var(--hg-header-green) !important; -webkit-text-fill-color: currentColor !important;
    box-shadow: none !important; transform: none !important;
    text-decoration: none !important; cursor: pointer !important; font-size: 22px !important;
  }
  body.higuppy-site-shell #hgSiteNav :is(.hg-action-btn, .hg-menu-toggle):is(:hover, :focus-visible) {
    background: #e3efe7 !important; border-color: #a9c1b0 !important; color: #285644 !important;
  }
  body.higuppy-site-shell #hgSiteNav :is(.hg-action-btn, .hg-menu-toggle) svg {
    display: block !important; width: 21px !important; height: 21px !important;
    color: currentColor !important; margin: 0 !important;
  }
  body.higuppy-site-shell #hgSiteNav .na2-menu-icon {
    fill: none !important; stroke: currentColor !important; stroke-width: 2 !important; stroke-linecap: round !important;
  }
  body.higuppy-site-shell #hgSiteNav .na2-menu-close,
  body.higuppy-site-shell #hgSiteNav [aria-expanded="true"] .na2-menu-bars { display: none !important; }
  body.higuppy-site-shell #hgSiteNav [aria-expanded="true"] .na2-menu-close { display: block !important; }
  body.higuppy-site-shell #hgSiteNav :is(.hg-menu-spotlight, .hg-menu-note) { display: none !important; }
  body.higuppy-site-shell #hgSiteNav .hg-menu {
    position: static !important; display: flex !important; flex: 1 1 auto !important;
    align-items: center !important; align-self: center !important; justify-content: center !important;
    flex-direction: row !important; width: auto !important; min-width: 0 !important;
    height: 44px !important; min-height: 0 !important; max-height: none !important;
    margin: 0 !important; padding: 0 !important;
    border: 0 !important; border-radius: 0 !important;
    background: transparent !important; box-shadow: none !important;
    transform: none !important; overflow: visible !important;
  }
  body.higuppy-site-shell #hgSiteNav .hg-menu-links {
    display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important;
    align-items: center !important; justify-content: center !important;
    gap: 4px !important; width: auto !important; min-width: 0 !important;
    margin: 0 !important; padding: 0 !important;
  }
  body.higuppy-site-shell #hgSiteNav .hg-menu-links > a {
    position: relative !important; display: inline-flex !important; flex: 0 0 auto !important;
    align-items: center !important; justify-content: center !important;
    width: auto !important; min-width: 44px !important;
    height: 44px !important; min-height: 44px !important;
    margin: 0 !important; padding: 10px 12px !important;
    border: 0 !important; border-radius: 12px !important;
    background: transparent !important; color: var(--hg-header-ink) !important;
    -webkit-text-fill-color: currentColor !important;
    font-family: var(--hg-shared-body, Arial, sans-serif) !important;
    font-size: var(--hg-type-ui) !important; font-weight: 650 !important; line-height: 1.2 !important;
    letter-spacing: normal !important; text-transform: none !important; text-decoration: none !important;
    white-space: nowrap !important; box-shadow: none !important; transform: none !important;
  }
  body.higuppy-site-shell #hgSiteNav .hg-menu-links > a:is(:hover, :focus-visible) {
    background: #e3eee6 !important; color: #285644 !important; -webkit-text-fill-color: currentColor !important;
  }
  body.higuppy-site-shell #hgSiteNav .hg-menu-links > a.is-active {
    background: #285644 !important; color: #fff !important; -webkit-text-fill-color: #fff !important;
  }
  body.higuppy-site-shell #hgSiteNav .hg-menu-links > a.is-active:is(:hover, :focus-visible) {
    background: #1c4232 !important; color: #fff !important; -webkit-text-fill-color: #fff !important;
  }
  body.higuppy-site-shell #hgSiteNav :is(a, button):focus-visible {
    outline: 3px solid #9d651d !important; outline-offset: 3px !important;
  }
  body.higuppy-site-shell #hgSiteNav .hg-menu-toggle { display: none !important; }
  body.higuppy-site-shell #hgSiteNav .hg-action-cart > span {
    position: absolute !important; top: -5px !important; right: -5px !important;
    z-index: 2 !important; display: grid !important; place-items: center !important;
    min-width: 22px !important; height: 22px !important; padding: 0 5px !important;
    border-radius: 999px !important; background: #b7472c !important;
    color: #fff !important; -webkit-text-fill-color: #fff !important;
    font: 700 12px/1 var(--hg-shared-body, Arial, sans-serif) !important;
    pointer-events: none !important;
  }
  body.higuppy-site-shell #hgSiteNav .hg-action-cart > span:is([hidden], :empty, .is-empty) { display: none !important; }
  body.higuppy-site-shell .hg-nav-spacer { display: none !important; }
  @media (max-width: 1100px) {
    body.higuppy-site-shell nav#hgSiteNav.hg-nav {
      --hg-header-height: 64px;
      display: flex !important; grid-template-columns: none !important;
      justify-content: flex-start !important; gap: 6px !important; padding-block: 9px !important;
    }
    body.higuppy-site-shell #hgSiteNav .hg-logo-img {
      flex-basis:var(--hg-brand-mark) !important; width:var(--hg-brand-mark) !important; min-width:var(--hg-brand-mark) !important; max-width:var(--hg-brand-mark) !important;
      height:var(--hg-brand-mark) !important; max-height:var(--hg-brand-mark) !important;
    }
    body.higuppy-site-shell #hgSiteNav .hg-logo::after { font-size:var(--hg-brand-size) !important; }
    body.higuppy-site-shell #hgSiteNav .hg-menu-toggle { display: inline-flex !important; }
    body.higuppy-site-shell #hgSiteNav .hg-menu {
      display: none !important; position: absolute !important;
      inset: calc(100% + 4px) var(--hg-header-inset) auto !important;
      flex: none !important; flex-direction: column !important;
      align-items: stretch !important; justify-content: flex-start !important;
      width: auto !important; height: auto !important; min-height: 0 !important;
      max-height: calc(100dvh - 88px - var(--wp-admin--admin-bar--height, 0px)) !important;
      margin: 0 !important; padding: 10px !important;
      border: 1px solid #d9e4da !important; border-radius: 16px !important;
      background: #fffdf8 !important; box-shadow: 0 18px 42px rgba(23,54,47,.14) !important;
      overflow: hidden auto !important; overscroll-behavior: contain !important;
    }
    body.higuppy-site-shell #hgSiteNav.is-open .hg-menu { display: flex !important; }
    body.higuppy-site-shell #hgSiteNav .hg-menu-links {
      width: 100% !important; flex-direction: column !important; align-items: stretch !important; gap: 4px !important;
    }
    body.higuppy-site-shell #hgSiteNav .hg-menu-links > a {
      width: 100% !important; height: 48px !important; min-height: 48px !important;
      padding: 10px 14px !important; justify-content: center !important;
    }
    body.higuppy-site-shell.hg-nav-open nav#hgSiteNav.hg-nav.is-open {
      position: fixed !important; left: 0 !important; right: 0 !important;
    }
    body.higuppy-site-shell #hgSiteNav.is-open + .hg-nav-spacer {
      display: block !important; height: 64px !important; min-height: 64px !important;
      width: 100% !important; margin: 0 !important; padding: 0 !important;
    }
    body.higuppy-site-shell.hg-nav-open { overflow: hidden !important; }
    body.higuppy-site-shell.hg-nav-open::before {
      content: "" !important; position: fixed !important; inset: 0 !important;
      background: rgba(23,54,47,.22) !important; z-index: 10000 !important; pointer-events: none !important;
    }

  }
  @media (max-width: 900px) {
    body.higuppy-site-shell nav#hgSiteNav.hg-nav { --hg-header-inset: var(--hg-layout-inset); }
  }
  @media (max-width: 600px) {
    body.higuppy-site-shell nav#hgSiteNav.hg-nav { --hg-header-inset: var(--hg-layout-inset); }
    body.higuppy-site-shell #hgSiteNav .hg-actions { gap: 4px !important; }
  }
  @media (max-width: 389px) {
    body.higuppy-site-shell nav#hgSiteNav.hg-nav { gap: 4px !important; }
    body.higuppy-site-shell #hgSiteNav .hg-logo { gap:var(--hg-brand-gap) !important; }
    body.higuppy-site-shell #hgSiteNav .hg-logo::after { font-size:var(--hg-brand-size) !important; }
  }
  @media (max-width: 359px) {
    body.higuppy-site-shell #hgSiteNav .hg-logo-img { display: none !important; }
  }
  @media (prefers-reduced-motion: reduce) {
    body.higuppy-site-shell #hgSiteNav *, body.higuppy-site-shell #hgSiteNav *::after {
      transition: none !important; animation: none !important;
    }
  }
}

/* Existing duplicate-theme-chrome guards (unchanged). */
/* The block theme template part is a second header on HiGuppy product pages. */
body.single-product > .wp-site-blocks > header.wp-block-template-part {
	display: none !important;
}

/* The product block template otherwise leaves its content in one half of a
 * two-column shell after the duplicate header is removed. */
body.single-product > .wp-site-blocks > .wp-block-group.woocommerce.product {
	display: block !important;
}

/* Global HiGuppy shell: suppress the XStore FSE template chrome so every
 * page has one header and one footer. The child theme renders the canonical
 * hg-nav and hg-site-footer instead. */
body.higuppy-site-shell header.wp-block-template-part,
body.higuppy-site-shell footer.wp-block-template-part {
	display: none !important;
}

/* The FSE template parts are not always direct children of .wp-site-blocks.
 * Keep the canonical HiGuppy shell and remove the extra theme chrome on
 * product, shop, and other pages that opt into higuppy-site-shell. */
body.higuppy-site-shell header.wp-block-template-part,
body.higuppy-site-shell footer.wp-block-template-part,
body.single-product header.wp-block-template-part,
body.single-product footer.wp-block-template-part {
	display: none !important;
	visibility: hidden !important;
	height: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
}

/* Site-wide XStore/FSE cleanup. Some archive and content templates do not
 * receive higuppy-site-shell, but they do render the canonical HiGuppy nav
 * and footer. In that case remove the remaining legacy chrome as well. */
:is(body:has(nav.hg-nav), body:has(footer.hg-site-footer)) :is(
	header.wp-block-template-part,
	footer.wp-block-template-part,
	#header.site-header,
	.header-wrapper,
	.mobile-header-wrapper,
	.main-header,
	footer.footer,
	#footer,
	.et-footers-wrapper
) {
	display: none !important;
	visibility: hidden !important;
	height: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
}

:is(body:has(nav.hg-nav), body:has(footer.hg-site-footer)) footer.site-footer:not(:has(.hg-site-footer)) {
	display: none !important;
	visibility: hidden !important;
	height: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
}
