/**
 * Compact Header Styles — standalone WordPress Pages.
 *
 * Paired with assets/js/compact-header.js, loaded on any is_page() that is
 * not is_front_page(). Collapses the full sticky header behind a thin
 * toggle bar so content-absorb pages (About, Visit Us, Earthies, Reuse
 * Library, etc.) start with a clean, uncluttered layout.
 *
 * These rules are a standalone copy of the corresponding block in
 * custom-checkout-experience.css (section "CART/CHECKOUT HEADER FOCUS MODE"
 * near line 7730). Keep both in sync if the toggle markup changes.
 */

/* ========================================
   TOGGLE BAR — fixed thin strip below the 25px top bar
   ======================================== */
body.cce-header-focus-mode .cce-header-toggle-bar {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  top: var(--cce-header-compact-bar-top, 25px) !important;
  height: var(--cce-header-compact-bar-height, 25px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
  padding: 0 12px !important;
  margin: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid #c8d4ce !important;
  background: #edf3f0 !important;
  color: #3e534d !important;
  font-family: brandon-grotesque, sans-serif !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  line-height: 1 !important;
  cursor: pointer !important;
  z-index: 10000 !important; /* Below top bar (10001), above header (1000) */
  transition: background 0.2s ease, color 0.2s ease !important;
}

body.cce-header-focus-mode .cce-header-toggle-bar .cce-header-toggle-logo {
  height: 16px !important;
  width: auto !important;
  max-width: 140px !important;
  display: block !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
}

body.cce-header-focus-mode .cce-header-toggle-bar .cce-header-toggle-brand {
  white-space: nowrap !important;
}

body.cce-header-focus-mode .cce-header-toggle-bar .cce-header-toggle-center {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
}

body.cce-header-focus-mode .cce-header-toggle-bar:hover,
body.cce-header-focus-mode .cce-header-toggle-bar:focus-visible {
  background: #e4ede8 !important;
  color: #2d403a !important;
  outline: none !important;
}

body.cce-header-focus-mode .cce-header-toggle-bar .cce-header-toggle-label {
  white-space: nowrap !important;
}

body.cce-header-focus-mode .cce-header-toggle-bar .cce-header-toggle-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 12px !important;
  transform: translateY(-0.5px);
}

/* Magnifying glass icon: sits left of the "Show Search + Menu" label so
   visitors scanning the bar recognize "search lives here" before reading the
   label. Hidden when the header is expanded — the real search bar takes
   over the signaling job. */
body.cce-header-focus-mode .cce-header-toggle-bar .cce-header-toggle-search-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: currentColor !important;
  flex-shrink: 0 !important;
  line-height: 0 !important;
}

body.cce-header-focus-mode .cce-header-toggle-bar .cce-header-toggle-search-icon svg {
  width: 13px !important;
  height: 13px !important;
  display: block !important;
}

body.cce-header-focus-mode.cce-header-expanded .cce-header-toggle-bar .cce-header-toggle-search-icon {
  display: none !important;
}

/* When the header is EXPANDED, hide the toggle bar entirely so the sticky
   header matches its original non-compact height. The small collapse
   chevron (.cce-header-collapse-btn) replaces the toggle-bar affordance. */
body.cce-header-focus-mode.cce-header-expanded .cce-header-toggle-bar {
  display: none !important;
}

/* ========================================
   COLLAPSE CHEVRON — small in-header button to re-collapse when expanded
   ======================================== */
.cce-header-collapse-btn {
  position: fixed !important;
  top: calc(var(--cce-header-compact-bar-top, 25px) + 6px) !important;
  right: 10px !important;
  z-index: 10002 !important; /* above header (1000) and toggle bar (10000) */
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 1px solid #c8d4ce !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.92) !important;
  color: #3e534d !important;
  font-size: 14px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease !important;
}

/* Visible only when a compact-header page is in the expanded state. */
body.cce-header-focus-mode.cce-header-expanded .cce-header-collapse-btn {
  display: inline-flex !important;
}

.cce-header-collapse-btn:hover,
.cce-header-collapse-btn:focus-visible {
  background: #edf3f0 !important;
  color: #1a3328 !important;
  outline: none !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
}

.cce-header-collapse-btn .cce-header-collapse-icon {
  display: block !important;
  line-height: 1 !important;
  transform: translateY(-1px) !important;
}

/* ========================================
   FULL HEADER — collapse / expand animation
   ======================================== */
body.cce-header-focus-mode .site-header {
  transition: max-height 0.25s ease, opacity 0.2s ease, transform 0.25s ease, padding 0.25s ease, box-shadow 0.2s ease, border-color 0.2s ease, top 0.2s ease !important;
}

body.cce-header-focus-mode.cce-header-collapsed .site-header {
  max-height: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-bottom-color: transparent !important;
  box-shadow: none !important;
  opacity: 0 !important;
  transform: translateY(-8px) !important;
  pointer-events: none !important;
}

body.cce-header-focus-mode.cce-header-expanded .site-header {
  max-height: 220px !important;
  opacity: 1 !important;
  /* CRITICAL: use 'none' not 'translateY(0)' — any transform value (even 0)
     creates a new containing block, breaking position:fixed on mega menu dropdowns */
  transform: none !important;
  pointer-events: auto !important;
  /* Toggle bar is hidden when expanded, so the header sits directly below
     the top bar — matching the site's original non-compact header height. */
  top: var(--cce-header-compact-bar-top, 25px) !important;
  overflow: visible !important;
}

/* ========================================
   MEGA MENU — let the dropdown escape when expanded
   ======================================== */
body.cce-header-focus-mode .eg-dropdown {
  margin-top: 0 !important;
}

body.cce-header-focus-mode.cce-header-expanded .site-header .nav-primary,
body.cce-header-focus-mode.cce-header-expanded .site-header .genesis-nav-menu {
  overflow: visible !important;
}

body.cce-header-focus-mode .eg-dropdown.open {
  z-index: 100000 !important;
}

/* ========================================
   COLLAPSED STATE — shrink .site-inner padding-top to match compact chrome
   ========================================
   Without this, .site-inner keeps the 132px padding-top it reserves for the
   expanded header, leaving a ~82px "white strip" above the hero on first
   paint before the JS-driven --sticky-header-height override takes effect.

   When collapsed, the only chrome above the content is:
     top-bar (25px) + toggle-bar (25px) = 50px

   No extra buffer — the hero sits flush against the toggle bar bottom, no
   visible gap. Server-rendered class (cce-header-ssr) guarantees this rule
   hits on first paint for fresh visitors, not after the JS bootstraps.
*/
body.cce-compact-header-page.cce-header-collapsed .site-inner {
  padding-top: 50px !important;
}

/* Admin bar pushes body down via its own margin — padding-top math unchanged. */
body.admin-bar.cce-compact-header-page.cce-header-collapsed .site-inner {
  padding-top: 50px !important;
}

/* Smooth the transition when toggling collapsed ↔ expanded so the content
   slides down in lockstep with the header animating open (0.25s in the
   .site-header rule above). Without this, the header animates but the
   content below snaps instantly — looks jumpy on hero-first pages like
   the homepage where the 92px shift is highly visible. */
body.cce-compact-header-page .site-inner {
  transition: padding-top 0.25s ease !important;
}


/* ========================================
   MOBILE
   ======================================== */
@media (max-width: 768px) {
  body.cce-header-focus-mode .cce-header-toggle-bar {
    font-size: 10px !important;
    letter-spacing: 0.05em !important;
    gap: 6px !important;
  }

  body.cce-header-focus-mode .cce-header-toggle-bar .cce-header-toggle-center {
    gap: 6px !important;
  }

  body.cce-header-focus-mode .cce-header-toggle-bar .cce-header-toggle-logo {
    height: 14px !important;
    max-width: 110px !important;
  }
}
