/* ============================================================
   HEADER.CSS — INGCO Forge + Blueprint Hybrid Design System
   Sticky Header · Navigation · Mobile Menu · Search
   ============================================================ */

/* ── Announcement bar — scrolls away naturally (NOT sticky) ── */
.announcement-bar {
  position: relative;
  z-index: 1001; /* above sticky header so it slides over it on scroll */
}

/* ── Sticky header group — nav only (bar is outside, above) ── */
.site-header-group {
  position: sticky;
  top: 0;
  z-index: 1000;
  transform: translateZ(0); /* GPU layer — no height change inside = no bounce */
}

/* ── Kill Astra sticky interference — CSS !important wins over Astra's inline styles ──
   Astra JS adds position:fixed inline to #masthead / .site-header on scroll.
   CSS !important overrides inline styles — no JS MutationObserver needed (that caused bounce).
   PHP filters astra_header_stickable/__return_false also prevent Astra from running. */
#masthead,
.site-header,
.ast-header-sticked .site-header,
.ast-sticky-header-active .site-header,
.ast-desktop .ast-header-sticked .site-header,
#masthead.ast-header-sticked,
.ast-header-sticked #site-header,
.ast-sticky-active #masthead,
.ast-sticky-active .site-header {
  position: relative !important;
  top: auto !important;
  width: auto !important;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Site Header (inside .site-header-group sticky wrapper) ─── */
.site-header {
  position: relative;
  top: auto !important; /* JS no longer manages top — group is the sticky element */
  z-index: 999;
  background: rgba(15, 13, 10, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
  transition: padding 0.3s ease, box-shadow 0.3s ease;
}
.site-header.scrolled {
  padding: 0;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

/* ── Header Inner ───────────────────────────────────────────── */
.header-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-top: 16px;
  padding-bottom: 16px;
  transition: padding 0.3s;
}
.site-header.scrolled .header-inner {
  padding-top: 10px;
  padding-bottom: 10px;
}

/* ── Logo ───────────────────────────────────────────────────── */
.site-logo {
  flex-shrink: 0;
}
.site-logo a,
.logo-text {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--c-brand);
  text-decoration: none;
  letter-spacing: 0.05em;
  line-height: 1;
  display: block;
}
.site-logo a:hover {
  color: var(--c-brand-dim);
}
.site-logo img {
  max-height: 48px;
  width: auto;
  transition: max-height 0.3s;
}
.site-header.scrolled .site-logo img {
  max-height: 36px;
}

/* ── Main Nav ───────────────────────────────────────────────── */
.header-nav {
  flex: 1;
  display: flex;
  justify-content: center;
}
@media (max-width: 1024px) {
  .header-nav {
    display: none;
  }
}
.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem;
  align-items: center;
}
.nav-menu a {
  font-family: var(--font-ui);
  font-size: var(--text-body);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--c-text-secondary);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
  padding-block: 4px;
  white-space: nowrap;
}
.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--c-brand);
  transition: width 0.2s;
}
.nav-menu a:hover,
.nav-menu .current-menu-item > a,
.nav-menu .current-menu-ancestor > a {
  color: var(--c-brand);
}
.nav-menu a:hover::after,
.nav-menu .current-menu-item > a::after,
.nav-menu .current-menu-ancestor > a::after {
  width: 100%;
}

/* ── Dropdown sub-menu ──────────────────────────────────────── */
.nav-menu .menu-item-has-children {
  position: relative;
}
.nav-menu .sub-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  min-width: 200px;
  padding: 0.5rem 0;
  list-style: none;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  transition-delay: 100ms;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 10;
}
.nav-menu .menu-item-has-children:hover > .sub-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
  transition-delay: 0s;
}

/* Bridge hover gap between parent nav item and dropdown */
.nav-menu .menu-item-has-children > .sub-menu {
  padding-top: 8px;
  margin-top: -8px; /* compensate so visual position unchanged */
}
.nav-menu .sub-menu a {
  display: block;
  padding: 0.6rem 1.25rem;
  font-size: var(--text-small);
  letter-spacing: 0.03em;
  color: var(--c-text-secondary);
  text-transform: none;
}
.nav-menu .sub-menu a::after { display: none; }
.nav-menu .sub-menu a:hover {
  color: var(--c-brand);
  background: var(--c-surface-2);
}
.nav-menu .sub-menu li {
  border-bottom: 1px solid var(--c-border);
}
.nav-menu .sub-menu li:last-child { border-bottom: none; }

/* ── Header Actions ─────────────────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}
.header-icon-btn {
  background: none;
  border: none;
  color: var(--c-text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  position: relative;
  text-decoration: none;
  min-width: 44px;
  min-height: 44px;
}
.header-icon-btn:hover {
  color: var(--c-brand);
  background: var(--c-surface);
}
.header-icon-btn svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

/* ── Cart Count Badge ───────────────────────────────────────── */
.cart-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--c-brand);
  color: #000;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.65rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}
.cart-count:empty,
.cart-count[data-count="0"] {
  display: none;
}

/* ── Hamburger Button ───────────────────────────────────────── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.hamburger-btn:hover {
  background: var(--c-surface);
}
@media (max-width: 1024px) {
  .hamburger-btn {
    display: flex;
  }
}
.hamburger-btn span {
  display: block;
  height: 2px;
  background: var(--c-text-primary);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s, width 0.3s;
  width: 22px;
  transform-origin: center;
}
.hamburger-btn span:nth-child(3) {
  width: 16px;
}
.hamburger-btn.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger-btn.active span:nth-child(3) {
  width: 22px;
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Header Search Bar ──────────────────────────────────────── */
/* Search bar — dark gradient overlay */
.header-search-bar {
  background: linear-gradient(135deg, rgba(10,10,10,0.97) 0%, rgba(25,20,15,0.97) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,100,0,0.2);
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}
.header-search-bar.active {
  max-height: 80px !important;
  padding: 14px 0 !important;
}
.header-search-bar .container {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.search-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: rgba(255,255,255,0.9);
  padding: 10px 16px;
  font-size: 0.95rem;
  width: 100%;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input::placeholder { color: rgba(255,255,255,0.4); }
.search-input:focus {
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(255,100,0,0.18);
}
.search-close-btn {
  background: none;
  border: none;
  color: var(--c-text-muted);
  cursor: pointer;
  padding: 8px;
  flex-shrink: 0;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-close-btn:hover {
  color: var(--c-brand);
}

/* ── Search Dropdown ────────────────────────────────────────── */
.search-dropdown {
  position: fixed;
  left: 0;
  right: 0;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  border-top: 1px solid rgba(255, 153, 0, 0.3);
  z-index: 490;
  max-height: 60vh;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s, opacity 0.2s;
}
.search-dropdown.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}
.search-dropdown-inner {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
  padding-block: 1rem;
}
.search-cat-label {
  font-family: var(--font-ui);
  font-size: var(--text-label);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--c-text-muted);
  padding: 0.5rem 0 0.25rem;
  display: block;
}

/* ── Mobile Menu Overlay ────────────────────────────────────── */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: var(--c-base);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}
.mobile-menu-overlay.open {
  transform: translateX(0);
}
.mobile-menu-inner {
  padding: 2rem;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
.mobile-menu-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.mobile-menu-logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--c-brand);
  text-decoration: none;
}
.mobile-menu-close {
  background: none;
  border: none;
  color: var(--c-text-primary);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  min-width: 44px;
  min-height: 44px;
}
.mobile-menu-close:hover {
  color: var(--c-brand);
}
.mobile-nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}
.mobile-nav-menu > li {
  border-bottom: 1px solid var(--c-border);
}
.mobile-nav-menu > li:first-child {
  border-top: 1px solid var(--c-border);
}
.mobile-nav-menu > li > a {
  display: block;
  padding: 1.25rem 0;
  font-family: var(--font-display);
  font-size: var(--text-h2);
  color: var(--c-text-primary);
  text-decoration: none;
  transition: color 0.2s, padding-left 0.2s;
  letter-spacing: 0.03em;
  line-height: 1;
}
.mobile-nav-menu > li > a:hover {
  color: var(--c-brand);
  padding-left: 0.5rem;
}
.mobile-nav-menu > li.current-menu-item > a {
  color: var(--c-brand);
}

/* Mobile sub-menu */
.mobile-sub-menu {
  list-style: none;
  margin: 0;
  padding: 0 0 1rem 1rem;
  display: none;
}
.mobile-nav-menu > li.open > .mobile-sub-menu {
  display: block;
}
.mobile-sub-menu a {
  display: block;
  padding: 0.5rem 0;
  font-family: var(--font-ui);
  font-size: var(--text-body);
  color: var(--c-text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.mobile-sub-menu a:hover {
  color: var(--c-brand);
}

/* Mobile menu footer actions */
.mobile-menu-actions {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 2rem;
  border-top: 1px solid var(--c-border);
}
.mobile-menu-social {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ── Dark Mode Toggle ───────────────────────────────────────── */
.dark-mode-toggle .icon-moon {
  display: none;
}
[data-theme="dark"] .dark-mode-toggle .icon-sun {
  display: none;
}
[data-theme="dark"] .dark-mode-toggle .icon-moon {
  display: block;
}

/* ── Promo Badge in header ──────────────────────────────────── */
.header-promo-badge {
  background: var(--c-brand);
  color: #000;
  font-family: var(--font-ui);
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  flex-shrink: 0;
}

/* ── Announcement bar — scrolls away with page (no JS hide needed) ── */
/* Defined above in the sticky section — no duplicate block needed */
