/**
 * CIVS header — layout & hover inspired by supplementforsoul.com
 * Underline scaleX + faded→solid link colour; quiet spacing.
 */


/* ---------- Sticky header (SFS-like: stays while scrolling) ---------- */
#masthead.site-header,
.site-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 10050 !important;
  width: 100% !important;
  background: transparent;
}

#masthead .ast-primary-header-bar,
#masthead .main-header-bar,
#ast-desktop-header .ast-primary-header-bar,
#ast-mobile-header .ast-primary-header-bar {
  background: rgba(249, 245, 240, 0.92) !important;
  backdrop-filter: blur(12px) saturate(1.05);
  -webkit-backdrop-filter: blur(12px) saturate(1.05);
  border-bottom: 1px solid rgba(61, 43, 31, 0.12) !important;
  box-shadow: none !important;
  transition: box-shadow 0.22s ease, background 0.22s ease, border-color 0.22s ease !important;
}

body.civs-header-scrolled #masthead .ast-primary-header-bar,
body.civs-header-scrolled #masthead .main-header-bar,
body.civs-header-scrolled #ast-desktop-header .ast-primary-header-bar,
body.civs-header-scrolled #ast-mobile-header .ast-primary-header-bar {
  background: rgba(249, 245, 240, 0.97) !important;
  box-shadow: 0 6px 22px rgba(61, 43, 31, 0.08) !important;
  border-bottom-color: rgba(61, 43, 31, 0.14) !important;
}

/* Admin bar offset */
body.admin-bar #masthead.site-header {
  top: 32px !important;
}
@media (max-width: 782px) {
  body.admin-bar #masthead.site-header {
    top: 46px !important;
  }
}

/* ---------- Shell ---------- */
.site-header .ast-primary-header-bar,
.site-header .main-header-bar,
#ast-desktop-header .ast-primary-header-bar {
  background: #f9f5f0 !important;
  border-bottom: 1px solid rgba(61, 43, 31, 0.12) !important;
  box-shadow: none !important;
  min-height: 4.5rem;
}

.site-header .site-primary-header-wrap,
#ast-desktop-header .site-primary-header-wrap {
  padding-top: 0.85rem !important;
  padding-bottom: 0.85rem !important;
}



/* ---------- Logo ---------- */
.site-header .site-branding .custom-logo-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  transition: opacity 0.2s ease;
}

.site-header .site-branding .custom-logo-link:hover {
  opacity: 0.78;
}

.site-header .site-branding .custom-logo {
  width: auto !important;
  max-height: 52px !important;
  height: auto !important;
  transition: transform 0.25s ease;
}

.site-header .site-branding .custom-logo-link:hover .custom-logo {
  transform: scale(1.03);
}

/* ---------- Primary nav (desktop) — SFS-like ---------- */
@media (min-width: 922px) {
  #ast-desktop-header .main-header-menu,
  #ast-hf-menu-2.main-header-menu {
    gap: 0;
    column-gap: 0;
  }

  #ast-desktop-header .main-header-menu > .menu-item {
    margin: 0 !important;
  }

  #ast-desktop-header .main-header-menu > .menu-item > .menu-link {
    position: relative;
    display: inline-block;
    padding: 0.55rem 0 !important;
    margin: 0 1.15rem !important;
    font-family: var(--civs-font-body, "Bricolage Grotesque", "Noto Sans TC", sans-serif) !important;
    font-size: 0.95rem !important;
    font-weight: 400 !important;
    letter-spacing: 0.02em;
    line-height: 1.3 !important;
    color: rgba(61, 43, 31, 0.62) !important;
    background: transparent !important;
    border: 0 !important;
    text-decoration: none !important;
    transition: color 0.2s ease-in-out !important;
  }

  /* SFS underline: scaleX from start */
  #ast-desktop-header .main-header-menu > .menu-item > .menu-link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.15rem;
    height: 2px;
    background: #3d2b1f;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.22s ease-in-out;
    pointer-events: none;
  }

  #ast-desktop-header .main-header-menu > .menu-item > .menu-link:hover,
  #ast-desktop-header .main-header-menu > .menu-item > .menu-link:focus {
    color: #3d2b1f !important;
    background: transparent !important;
  }

  #ast-desktop-header .main-header-menu > .menu-item > .menu-link:hover::after,
  #ast-desktop-header .main-header-menu > .menu-item > .menu-link:focus::after {
    transform: scaleX(1);
  }

  /* Current page: solid + underline */
  #ast-desktop-header .main-header-menu > .menu-item.current-menu-item > .menu-link,
  #ast-desktop-header .main-header-menu > .menu-item.current_page_item > .menu-link {
    color: #3d2b1f !important;
    font-weight: 500 !important;
  }

  #ast-desktop-header .main-header-menu > .menu-item.current-menu-item > .menu-link::after,
  #ast-desktop-header .main-header-menu > .menu-item.current_page_item > .menu-link::after {
    transform: scaleX(1);
  }

  /* Kill Astra default hover bg */
  #ast-desktop-header .main-header-menu .menu-link:hover,
  #ast-desktop-header .main-header-menu .menu-item:hover > .menu-link {
    background: transparent !important;
  }

  /* Submenu polish (if any) */
  #ast-desktop-header .main-header-menu .sub-menu {
    background: #fffafa !important;
    border: 1px solid rgba(61, 43, 31, 0.1) !important;
    box-shadow: 2px 2px 10px rgba(61, 43, 31, 0.06) !important;
    border-radius: 0 !important;
    padding: 0.65rem 0 !important;
  }

  #ast-desktop-header .main-header-menu .sub-menu .menu-link {
    color: rgba(61, 43, 31, 0.72) !important;
    font-size: 0.9rem !important;
    padding: 0.45rem 1.35rem !important;
    transition: color 0.2s ease !important;
  }

  #ast-desktop-header .main-header-menu .sub-menu .menu-link:hover {
    color: #3d2b1f !important;
    background: transparent !important;
  }
}

/* Center nav optical balance */
@media (min-width: 922px) {
  #ast-desktop-header .ast-builder-grid-row-has-sides.ast-grid-center-col-layout {
    align-items: center;
  }

  #ast-desktop-header .site-header-section-left {
    gap: 0.5rem;
  }
}

/* ---------- Mobile header ---------- */
#ast-mobile-header .ast-primary-header-bar,
.ast-mobile-header-content {
  background: #f9f5f0 !important;
  border-bottom: 1px solid rgba(61, 43, 31, 0.12) !important;
}

#ast-mobile-header .ast-button-wrap .menu-toggle,
#ast-mobile-header .menu-toggle.main-header-menu-toggle {
  color: #3d2b1f !important;
  border-color: transparent !important;
  background: transparent !important;
  padding: 0.4rem !important;
  transition: opacity 0.2s ease;
}

#ast-mobile-header .menu-toggle:hover {
  opacity: 0.7;
}

#ast-mobile-header .ast-mobile-popup-drawer .menu-item > .menu-link,
.ast-mobile-popup-content .menu-item > .menu-link {
  font-family: var(--civs-font-body, "Bricolage Grotesque", "Noto Sans TC", sans-serif) !important;
  color: rgba(61, 43, 31, 0.7) !important;
  font-size: 1.05rem !important;
  font-weight: 400 !important;
  letter-spacing: 0.02em;
  padding-top: 0.85rem !important;
  padding-bottom: 0.85rem !important;
  border-bottom: 1px solid rgba(61, 43, 31, 0.08) !important;
  transition: color 0.2s ease, padding-left 0.2s ease !important;
  background: transparent !important;
}

#ast-mobile-header .ast-mobile-popup-drawer .menu-item > .menu-link:hover,
.ast-mobile-popup-content .menu-item > .menu-link:hover {
  color: #3d2b1f !important;
  padding-left: 1.15rem !important;
}

#ast-mobile-header .ast-mobile-popup-drawer .menu-item.current-menu-item > .menu-link,
.ast-mobile-popup-content .menu-item.current-menu-item > .menu-link {
  color: #3d2b1f !important;
  font-weight: 500 !important;
}

/* Mobile logo size */
#ast-mobile-header .custom-logo {
  max-height: 44px !important;
  width: auto !important;
  height: auto !important;
}

/* ---------- Header cart (rightmost) ---------- */
.site-header .ast-header-woo-cart,
.site-header .ast-site-header-cart,
.site-header .ast-builder-layout-element[data-section="section-header-woo-cart"] {
  display: inline-flex !important;
  align-items: center;
  margin-left: 0.35rem;
}

.site-header .ast-header-woo-cart .count,
.site-header .ast-site-header-cart .count,
.site-header .ast-header-woo-cart .ast-count,
.site-header .ast-site-header-cart .ast-count {
  background: #6b4e3d !important;
  color: #fff !important;
  border: 0 !important;
  min-width: 1.05rem;
  height: 1.05rem;
  line-height: 1.05rem !important;
  font-size: 0.65rem !important;
  font-weight: 600 !important;
}

.site-header .ast-header-account,
.site-header .ast-header-account-wrap,
.site-header .ast-header-account a,
.site-header .ast-header-account .ast-header-account-link,
.site-header .ast-header-woo-cart a,
.site-header .ast-site-header-cart a,
.site-header .ast-header-woo-cart .ast-cart-menu-wrap,
.site-header .ast-site-header-cart .ast-cart-menu-wrap,
.site-header .ast-header-woo-cart .ast-addon-cart-wrap,
.site-header .ast-site-header-cart .ast-addon-cart-wrap,
.site-header .ast-header-woo-cart i.astra-icon,
.site-header .ast-site-header-cart i.astra-icon {
  color: rgba(61, 43, 31, 0.72) !important;
  transition: color 0.2s ease, opacity 0.2s ease !important;
}

.site-header .ast-header-account:hover,
.site-header .ast-header-account a:hover,
.site-header .ast-header-account-wrap:hover .ast-header-account-link,
.site-header .ast-header-woo-cart a:hover,
.site-header .ast-site-header-cart a:hover,
.site-header .ast-header-woo-cart:hover i.astra-icon,
.site-header .ast-site-header-cart:hover i.astra-icon {
  color: #3d2b1f !important;
  opacity: 1;
}

.site-header .ast-header-woo-cart .ahfb-svg-iconset svg,
.site-header .ast-site-header-cart .ahfb-svg-iconset svg,
.site-header .ast-header-account .ahfb-svg-iconset svg,
.site-header .ast-header-account svg,
.site-header .ast-header-woo-cart svg,
.site-header .ast-site-header-cart svg {
  width: 1.35rem !important;
  height: 1.35rem !important;
  fill: currentColor !important;
  stroke: currentColor;
  color: inherit !important;
}

/* Match account icon weight/size to cart */
.site-header .ast-header-account .ast-header-account-type-icon,
.site-header .ast-header-account-wrap {
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
}

/* Hide search in header */
.site-header .ast-header-search,
.site-header .ast-builder-layout-element[data-section="section-header-search"],
.site-header .civs-header-search,
.site-header .civs-search-trigger {
  display: none !important;
}

.civs-search-overlay {
  display: none !important;
}

/* Mobile: Astra disables cart link clicks — re-enable */
#ast-mobile-header .ast-site-header-cart-li a,
#ast-mobile-header .ast-header-woo-cart a,
#ast-mobile-header .ast-site-header-cart a {
  pointer-events: auto !important;
  cursor: pointer !important;
}
