/* header.css – enkel, ACF‑styrt header (ported from Button) */

.bx-custom-header #top-header,
.bx-custom-header #main-header,
.bx-custom-header .et-fixed-header {
  display: none !important;
}

.bx-header {
  position: relative;
  z-index: 10020;
  width: 100%;
  background: var(--color-accent-2); /* default FDE8D3; overridden inline when set */
  border: 0;
  margin-bottom: 24px; /* default spacing under header */
}
.bx-header.bx-inline { /* full-bleed when injected inside content */
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}
.bx-header .bx-header-inner { width: 100%; margin: 0 auto; padding: 22px 0; }
.bx-header .bx-header-flex { display: flex; align-items: center; justify-content: space-between; gap: 16px; text-align: left; }
.bx-header.bx-inline .bx-header-inner { justify-content: space-between !important; }
.bx-header .bx-nav { margin-left: auto; }
.bx-header .bx-logo { flex: 0 0 auto; }
.bx-header .bx-nav { flex: 1 1 auto; display: flex; justify-content: flex-end; }
.bx-header .bx-nav ul { display: flex; justify-content: flex-end; margin-left: auto; }
.bx-header .bx-logo { display: flex; align-items: center; gap: 10px; }
.bx-header .bx-logo img { max-height: 46px; width: auto; display: block; }
.bx-header .bx-logo-text { font-weight: 500; font-size: 16px; color: #111; }
.bx-header .bx-site-name { font-weight: 600; font-size: 18px; }
.bx-header nav ul { margin: 0; padding: 0; list-style: none; display: flex; gap: 18px; }
.bx-header nav a { color: #111; text-decoration: underline; }
.bx-header nav a:hover { text-decoration: underline; }

/* Dropdowns */
.bx-header nav ul li { position: relative; }
.bx-header nav ul li.menu-item-has-children > a::after {
  content: "\25BE"; /* small down triangle */
  margin-left: 6px; font-size: 0.8em;
}
.bx-header nav ul li ul.sub-menu {
  position: absolute;
  left: 0; top: 100%;
  min-width: 220px;
  background: #fff;
  border: 1px solid #eee;
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
  display: none;
  padding: 6px 0;
  z-index: 10000;
}
.bx-header nav ul li ul.sub-menu li { width: 100%; }
.bx-header nav ul li ul.sub-menu a {
  display: block;
  padding: 8px 12px;
  white-space: nowrap;
}
.bx-header nav ul li:hover > ul.sub-menu,
.bx-header nav ul li:focus-within > ul.sub-menu { display: block; }

/* Nested submenu (3rd level) */
.bx-header nav ul li ul.sub-menu li.menu-item-has-children > ul.sub-menu {
  top: 0; left: 100%;
}

@media (max-width: 980px) {
  .bx-header .bx-header-inner { padding-left: 0; padding-right: 0; padding-top: 20px !important; padding-bottom: 20px !important; }
  .bx-header { margin-bottom: 0; }
}

@media (max-width: 768px) {
  .bx-header .bx-header-inner { flex-wrap: wrap; padding-left: 0; padding-right: 0; }
  .bx-header nav a { font-size: 16px; }
}

/* No spacing on home/front page by default */
.home .bx-header { margin-bottom: 0 !important; }

/* Utility to force remove gap when desired */
.bx-no-header-gap .bx-header { margin-bottom: 0 !important; }

/* Mobile menu */
.bx-menu-toggle { display: none; border: 0; background: transparent; padding: 8px; cursor: pointer; }
.bx-menu-icon { position: relative; width: 24px; height: 18px; display: inline-block; }
.bx-menu-icon span { position: absolute; left: 0; right: 0; height: 2px; background: #111; transition: transform .25s ease, opacity .25s ease, top .25s ease; }
.bx-menu-icon span:nth-child(1) { top: 0; }
.bx-menu-icon span:nth-child(2) { top: 8px; }
.bx-menu-icon span:nth-child(3) { top: 16px; }
.bx-header.is-open .bx-menu-icon span:nth-child(1) { top: 8px; transform: rotate(45deg); }
.bx-header.is-open .bx-menu-icon span:nth-child(2) { opacity: 0; }
.bx-header.is-open .bx-menu-icon span:nth-child(3) { top: 8px; transform: rotate(-45deg); }

@media (max-width: 980px) {
  .bx-menu-toggle { display: inline-block; }
  /* Full-width dropdown from top (below header) */
  .bx-header .bx-nav { position: fixed; left: 0; right: 0; top: 0; max-height: calc(100vh - 64px); background: var(--color-bg-light); color: var(--color-dark); box-shadow: none; opacity: 0; transform: translateY(-8px); transition: transform .28s ease, opacity .28s ease; padding: 24px var(--container-pad-desktop) 32px; overflow-y: auto; z-index: 10010; pointer-events: none; }
  .bx-header .bx-nav a { font-size: 18px; color: var(--color-dark); }
  .bx-header .bx-nav ul { flex-direction: column; gap: 14px; align-items: stretch; width: 100%; }
  .bx-header .bx-nav ul li { width: 100%; display: flex; align-items: center; gap: 8px; }
  .bx-header .bx-nav ul li > a { flex: 1 1 auto; }
  .bx-header .bx-nav ul li ul.sub-menu { position: static; display: none; border: 0; box-shadow: none; padding: 8px 0 0 12px; }
  .bx-header .bx-nav ul li:hover > ul.sub-menu,
  .bx-header .bx-nav ul li:focus-within > ul.sub-menu { display: none; }
  .bx-header.is-open .bx-nav { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .bx-nav-overlay { position: fixed; left: 0; right: 0; top: 0; bottom: 0; background: rgba(0,0,0,.4); z-index: 10000; opacity: 0; transition: opacity .28s ease; pointer-events: none; }
  /* Enable overlay when menu is open; support both header-scoped and body-scoped overlay */
  .bx-header.is-open .bx-nav-overlay,
  .bx-menu-open .bx-nav-overlay { display: block; opacity: 1; pointer-events: auto; }
  .bx-header.is-open { box-shadow: none; }

  /* Submenu toggle button */
  .submenu-toggle { appearance: none; -webkit-appearance: none; border: 0; background: transparent; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
  .submenu-toggle span { display: inline-block; width: 10px; height: 10px; border-right: 2px solid #111; border-bottom: 2px solid #111; transform: rotate(-45deg); transition: transform .2s ease; }
  li.is-open > .submenu-toggle span { transform: rotate(45deg); }
}

/* Sticky-on-scroll-up behavior (JS toggles .is-sticky + .is-sticky-visible) */
.bx-header.is-sticky {
  position: fixed;
  left: 0; right: 0;
  top: 0; /* JS updates offset via style.top when needed */
  transform: translateY(-100%);
  transition: transform .25s ease;
  will-change: transform;
}
.bx-header.is-sticky.no-anim { transition: none; }
.bx-header.is-sticky.is-sticky-visible {
  transform: translateY(0);
  box-shadow: none;
}

/* When menu is open, neutralize sticky transform so fixed children
   (overlay/menu) are viewport-fixed and not confined by transform context */
.bx-header.is-sticky.is-open {
  transform: none;
}

/* Spacer used to preserve layout when header becomes fixed */
.bx-header-spacer { height: 0; }
