/* ============================================
   Lightweight Header + Mega Menu — wegrijden.nl
   Two-row: Row 1 = logo + buttons, Row 2 = nav
   ============================================ */

:root {
  --wg-blue: #007ce4;
  --wg-blue-hover: #0069c4;
  --wg-blue-light: #e8f4fd;
  --wg-green: #44eb00;
  --wg-white: #fff;
  --wg-gray-25: #fcfcfd;
  --wg-gray-50: #f8f9fa;
  --wg-gray-100: #f0f1f3;
  --wg-gray-200: #e2e4e8;
  --wg-gray-500: #717584;
  --wg-gray-700: #3d4152;
  --wg-gray-900: #1a1a2e;
  --wg-radius: 10px;
  --wg-radius-sm: 8px;
  --wg-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --wg-shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --wg-shadow-lg: 0 20px 60px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.06);
}

/* ---- Header wrapper ---- */
.wg-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: var(--wg-white);
  font-family: var(--wg-font);
  transition: transform .3s ease, box-shadow .3s ease;
  box-shadow: var(--wg-shadow-sm);
}
.wg-header.is-scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.wg-header.is-hidden {
  transform: translateY(-100%);
}

/* Container: uses Bricks container_v2_flex for width/padding,
   override vertical padding and direction for header use.
   Triple-class selector to beat .container_v2_flex.brxe-container specificity */
.wg-header__container.brxe-container.container_v2_flex {
  flex-direction: row;
  padding-top: 0;
  padding-bottom: 0;
  row-gap: 0;
  align-items: center;
}

/* ---- Row 1: Top bar (logo + actions) ---- */
.wg-header__top {
  border-bottom: 1px solid var(--wg-gray-100);
}
.wg-header__top .wg-header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

/* Logo */
.wg-header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.wg-header__logo svg {
  width: 34px;
  height: 34px;
}
.wg-header__logo-text {
  font-size: 22px;
  font-weight: 800;
  color: var(--wg-gray-900);
  letter-spacing: -.02em;
}

/* Buttons */
.wg-header__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.wg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--wg-font);
  border-radius: var(--wg-radius-sm);
  text-decoration: none;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  transition: all .15s ease;
}

/* ---- Row 2: Nav bar ---- */
.wg-header__bar {
  background: var(--wg-gray-25);
}
.wg-header__bar .wg-header__container {
  display: flex;
  align-items: center;
}

/* Nav list */
.wg-nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2px;
  width: 100%;
}
.wg-nav > li {
  position: relative;
}
.wg-nav > li > a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--wg-gray-700);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
/* First item (Home) aligned with container edge, with room for hover bg */
.wg-nav > li:first-child > a {
  margin-left: -16px;
}
.wg-nav > li > a:hover,
.wg-nav > li > a:focus-visible {
  color: var(--wg-blue);
  background: var(--wg-blue-light);
}
.wg-nav > li[data-active] > a,
.wg-nav > li > a[aria-current="page"] {
  color: var(--wg-blue);
  border-bottom-color: var(--wg-blue);
}

/* Chevron */
.wg-nav__chevron {
  width: 12px;
  height: 12px;
  opacity: .5;
  transition: transform .2s, opacity .2s;
}
.wg-nav > li:hover .wg-nav__chevron {
  transform: rotate(180deg);
  opacity: .8;
}

/* ---- Mega menu panel (full-width) ---- */
.wg-mega {
  position: fixed;
  top: auto;
  left: 0;
  right: 0;
  width: 100vw;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility .25s;
  z-index: 200;
}
.wg-nav > li:hover > .wg-mega,
.wg-nav > li:focus-within > .wg-mega {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.wg-mega__inner {
  max-width: 1230px;
  margin: 0 auto;
  background: var(--wg-white);
  border-top: 1px solid var(--wg-gray-100);
  padding: 32px 2rem 28px;
  display: flex;
  gap: 40px;
}
@media (max-width: 767px) {
  .wg-mega__inner {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}


/* Intro column */
.wg-mega__intro {
  width: 200px;
  flex-shrink: 0;
  padding-top: 4px;
}
.wg-mega__title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--wg-gray-900);
}
.wg-mega__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--wg-gray-500);
}

/* Vehicle grid — max 2 columns, single column if fewer than 3 items */
.wg-mega__grid {
  display: grid;
  grid-template-columns: repeat(2, 270px);
  gap: 6px;
  flex: 1;
}
.wg-mega__grid:not(:has(:nth-child(3))) {
  grid-template-columns: 270px;
}
.wg-mega__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  width: 270px;
  max-width: 270px;
  max-height: 52px;
  font-size: 13px;
  font-weight: 500;
  color: var(--wg-gray-700);
  text-decoration: none;
  border-radius: var(--wg-radius-sm);
  transition: background .15s, color .15s, transform .1s;
}
.wg-mega__item:hover {
  background: var(--wg-blue-light);
  color: var(--wg-blue);
}
.wg-mega__icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  flex-shrink: 0;
  fill: currentColor;
  opacity: .7;
  transition: opacity .15s;
}
.wg-mega__item:hover .wg-mega__icon {
  opacity: 1;
}

/* Compact mega (simple link lists) */
.wg-mega--compact .wg-mega__inner {
  padding: 28px 32px 24px;
}
.wg-mega__links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.wg-mega__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  max-width: 270px;
  max-height: 52px;
  font-size: 14px;
  font-weight: 500;
  color: var(--wg-gray-700);
  text-decoration: none;
  border-radius: var(--wg-radius-sm);
  transition: background .15s, color .15s;
}
.wg-mega__link:hover {
  background: var(--wg-blue-light);
  color: var(--wg-blue);
}
.wg-mega__link-arrow {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .4;
  transition: opacity .15s, transform .15s;
}
.wg-mega__link:hover .wg-mega__link-arrow {
  opacity: .8;
  transform: translateX(3px);
}

/* ---- Keep mega open while moving to it ---- */
.wg-nav > li.wg-nav__has-mega > a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 4px;
}

/* ---- Hamburger (mobile) ---- */
.wg-header__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--wg-radius-sm);
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.wg-header__burger:hover {
  background: var(--wg-gray-50);
}
.wg-header__burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--wg-gray-900);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
  transform-origin: center;
}
.wg-header__burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.wg-header__burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.wg-header__burger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Mobile menu overlay ---- */
.wg-mobile {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--wg-white);
  z-index: 10000; /* above header (9999) */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s;
}
.wg-mobile.is-open {
  opacity: 1;
  visibility: visible;
}

/* Mobile close button */
.wg-mobile__close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wg-gray-100);
  border: none;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  color: var(--wg-gray-700);
  transition: background .15s, color .15s;
}
.wg-mobile__close::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E") center/contain no-repeat;
}
.wg-mobile__close:hover {
  background: var(--wg-gray-200);
  color: var(--wg-gray-900);
}

/* Mobile nav items — uniform style for links and toggles */
.wg-mobile__nav {
  list-style: none;
  margin: 0;
  padding: 64px 24px 24px;
}
.wg-mobile__nav > li > a,
.wg-mobile__nav > li > .wg-mobile__toggle {
  display: flex;
  align-items: center;
  padding: 14px 0;
  font-size: 17px;
  font-weight: 600 !important;
  font-family: var(--wg-font);
  color: var(--wg-gray-900);
  text-decoration: none;
  border-bottom: 1px solid var(--wg-gray-100);
}
.wg-mobile__nav > li > a:hover {
  color: var(--wg-blue);
}

/* Mobile accordion toggle */
.wg-mobile__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--wg-gray-900);
  text-decoration: none;
  background: none;
  border: none;
  border-bottom: 1px solid var(--wg-gray-100);
  cursor: pointer;
  text-align: left;
  font-family: var(--wg-font);
}
.wg-mobile__toggle svg {
  width: 16px;
  height: 16px;
  transition: transform .2s;
  color: var(--wg-gray-500);
}
.wg-mobile__toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* Mobile sub-items */
.wg-mobile__sub {
  display: none;
  padding: 4px 0 8px 8px;
}
.wg-mobile__sub.is-open {
  display: block;
}
.wg-mobile__sub a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--wg-gray-700);
  text-decoration: none;
  border-radius: var(--wg-radius-sm);
}
.wg-mobile__sub a:hover {
  background: var(--wg-blue-light);
  color: var(--wg-blue);
}
.wg-mobile__sub svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  opacity: .6;
  flex-shrink: 0;
}

/* Mobile buttons */
.wg-mobile__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 24px 32px;
}
.wg-mobile__actions .wg-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
}

/* ---- Prevent nav overflow on narrow desktops ---- */
.wg-header__bar .wg-header__container {
  overflow: hidden;
}
.wg-nav > li > a {
  flex-shrink: 1;
  min-width: 0;
}
@media (max-width: 1200px) {
  .wg-nav > li > a {
    padding: 12px 10px;
    font-size: 13px;
  }
  .wg-nav > li:first-child > a {
    margin-left: -10px;
  }
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .wg-header__bar {
    display: none;
  }
  .wg-header__actions {
    display: none;
  }
  .wg-header__burger {
    display: flex;
  }
}

/* ---- Admin bar ---- */
.admin-bar .wg-header {
  top: 32px;
}
.admin-bar .wg-mobile {
  top: 32px;
}
@media (max-width: 782px) {
  .admin-bar .wg-header { top: 46px; }
  .admin-bar .wg-mobile { top: 46px; }
}

/* ---- Page backdrop: overlay + blur when mega menu is open ---- */
.wg-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, .3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9998; /* just below header (9999) */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility .25s;
}
/* Show when any mega menu is hovered — uses general sibling ~ :has() */
.wg-header:has(.wg-nav__has-mega:hover) ~ .wg-backdrop,
.wg-header:has(.wg-nav__has-mega:focus-within) ~ .wg-backdrop {
  opacity: 1;
  visibility: visible;
}

/* ---- Scroll animation ---- */
.wg-header {
  will-change: transform;
}

