.wpb-navigation { --nav-bg-clr: var(--clr-light); --nav-text-clr: var(--clr-text); position: fixed; top: 0; right: 0; left: 0; bottom: auto; z-index: 1040; transition: background-color var(--ts-duration) var(--ts-function);
  .container { display: flex; align-items: center; justify-content: space-between; }

  .wpb-navigation__top { display: none; padding-top: 1.6rem; 
    .wpb-navigation__top-left, .wpb-navigation__top-right { display: flex; align-items: center; gap: 2.4rem; 
      a { color: var(--nav-text-clr); text-decoration: none; font-size: 1.4rem; font-weight: 600; transition: color var(--ts-duration) var(--ts-function); 
        &:hover { color: var(--clr-primary); }
      }
    }
  }
  .wpb-navigation__main { padding: 2rem 0; }

  .logo { display: inline-flex; z-index: 1040;
    img { width: 16rem; height: auto; transition: filter var(--ts-duration) var(--ts-function); }
  }

  &.is-scrolled { background-color: #fff; --nav-text-clr: var(--clr-text) !important;
    .btn.btn--nav-toggle { --bg-clr: var(--clr-light); --border: 1px solid var(--clr-light); }
  } 
}

.wpb-pagewrapper:has(> .wpb-main-content > .wpb-hero.text-light:first-child) > .wpb-navigation:not(.is-scrolled, :has(.wpb-navigation__collapse.active)) {
  .logo img { filter: brightness(0) invert(1); }

  .wpb-navigation__collapse {
    .menu-item {
      .menu-link:hover { color: rgb(255, 255, 255, .4); }
      &.menu-item--current > .menu-link { color: #FFF; }
    }
  }

  .btn.btn--contact { --clr: var(--clr-text); --bg-clr: #fff; --border: 1px solid #fff; --hover-clr: var(--clr); --hover-bg-clr: var(--clr-light); --hover-border: 1px solid var(--clr-light);  
    &:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
  }
}


.btn--nav-toggle { min-height: 4.7rem; z-index: 1040;
  svg { fill: var(--clr); 
    rect { transition: y var(--ts-duration) var(--ts-function) var(--ts-function), transform var(--ts-duration) var(--ts-function), opacity var(--ts-duration) var(--ts-function), fill var(--ts-duration) var(--ts-function); transform-origin: center; }
  }
  &:hover svg rect { fill: var(--hover-clr); }
  &:focus svg rect { fill: var(--focus-clr); }
  &:active svg rect { fill: var(--active-clr); }
  
  &[aria-expanded="true"] {
    svg .top { transform: translateY(5px) translateX(-4px) rotate(45deg); }
    svg .middle { opacity: 0; }
    svg .bottom { transform: translateY(-5px) translateX(-4px) rotate(-45deg); }
  }
}

.wpb-navigation__collapse {
   ul { list-style: none; }
   .menu-item {
    .menu-link { color: var(--nav-text-clr); width: 100%; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; column-gap: .6rem; line-height: 1; transition: color var(--ts-duration) var(--ts-function); 
      &:hover { color: var(--clr-primary); }
    }

    &.menu-item--current > .menu-link { color: var(--clr-primary); }
    &.menu-item-has-children { position: relative; }  
  }
}

@media (max-width: 1199.98px) {
  .wpb-navigation {
    .btn.btn--contact { border-radius: 99rem; --p: 0; aspect-ratio: 1/1; min-height: 4.7rem; z-index: 1040;
      .btn__text { display: none; }
    }
  }
}

/*** Navigation mobile ***/
@media (max-width: 991.98px) {
  /* .wpb-navigation {
    .btn.btn--contact { border-radius: 99rem; --p: 0; aspect-ratio: 1/1; min-height: 4.7rem; z-index: 1040;
      .btn__text { display: none; }
    }
  } */
  .wpb-navigation__collapse { padding-top: var(--header-height); opacity: 0; width: 100%; display: none; flex-direction: column; position: fixed; top: 0; right: 0; bottom: 0; left: auto; background-color: var(--nav-bg-clr); z-index: 1030; overflow: hidden; transition: opacity var(--ts-35) ease; 
    /* No transform here: it would become the containing block for the position: fixed sub-menu panels */
    .wpb-collapse__body { width: 100%; max-width: var(--container-width--md); margin-inline: auto; max-height: calc(100dvh - var(--header-height)); margin-top: 2rem; padding: 0 1.8rem; flex-grow: 1; overflow-y: auto; overscroll-behavior: contain; transition: margin-top var(--ts-35) ease; overflow-x: hidden; overflow-y: auto; }
    
    &.active { pointer-events: all; opacity: 1;
      .wpb-collapse__body { margin-top: 0; }
    }
    
    .menu-item {
      .menu-link { font-size: 2rem; padding: 1.5rem 0; }
      &.menu-item-has-children > .menu-link > .btn { position: absolute; right: 0; top: 50%; transform: translateY(-50%); min-height: 4.7rem; }
    }
  }
  
  .wpb-sub-menu { pointer-events: none; opacity: 0; display: flex; flex-direction: column; height: 100%; overflow: hidden; list-style: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; padding-top: var(--header-height); background-color: var(--nav-bg-clr); z-index: 1; transition: opacity var(--ts-35) ease; 
    /* Header overlays the nav bar so the back button lands exactly on the nav-toggle spot */
    .wpb-sub-menu__header { position: absolute; top: 0; right: 0; left: 0; height: var(--header-height); width: 100%; max-width: var(--container-width--md); margin-inline: auto; padding: 0 1.8rem; display: flex; align-items: center; justify-content: flex-start; 
      .btn { min-height: 4.7rem; } /* matches .btn--nav-toggle so both centre identically */
      > span:not(.btn) { display: none; } /* submenu title */
      > .btn.js-nav-toggle { display: none; } /* redundant close: contact button stays visible like in the main menu */
    }
    .wpb-sub-menu__body { transform: translateY(2rem); width: 100%; max-width: var(--container-width--md); margin-inline: auto; max-height: calc(100dvh - var(--header-height)); padding: 2rem 1.8rem; flex-grow: 1; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; transition: transform var(--ts-35) ease; }
    &.active { opacity: 1; pointer-events: all;
      .wpb-sub-menu__body { transform: translateY(0); }
    }
  }

  /* While a submenu is open the back button replaces the close button */
  .wpb-navigation:has(.wpb-sub-menu.active) .btn.btn--nav-toggle { opacity: 0; pointer-events: none; }
}

@media (max-width: 767.98px) {
  .wpb-navigation__collapse {
    .wpb-collapse__body, .wpb-sub-menu__header, .wpb-sub-menu__body { max-width: var(--container-width--sm); }
  }
}

@media (max-width: 575.98px) {
  .wpb-navigation__collapse {
    .wpb-collapse__body, .wpb-sub-menu__header, .wpb-sub-menu__body { max-width: 100%; }
  }
}

/*** Navigation desktop ***/
@media (min-width: 992px) {
  .wpb-pagewrapper:has(.wpb-hero--subpage.text-dark) .wpb-navigation { --nav-text-clr: var(--clr-text); }
  .wpb-pagewrapper:has(.wpb-hero--subpage.text-light) .wpb-navigation { --nav-text-clr: #fff; }

  .wpb-navigation {
    .logo { border-right: 1px solid rgba(var(--clr-dark-rgb), .2); padding-right: 3.2rem; }

    .wpb-navigation__top { display: block; }

    .wpb-navigation__main { padding-top: 1.6rem; }

    .btn.btn--nav-toggle, .wpb-sub-menu__header { display: none; }
  }

  .wpb-navigation__collapse { --sub-menu-gap: 1.6rem; width: 100%; display: flex!important;
    .wpb-collapse__body { display: flex; justify-content: space-between; width: 100%; padding-inline: 1.8rem; }
    .menu-item {
      .menu-link { font-size: 1.6rem; position: relative; padding: 1rem 1.6rem; }
      &.menu-item-has-children {
        > .menu-link { display: flex; justify-content: space-between;
          > .btn { --bg-clr: transparent; --border: none; --clr: var(--nav-text-clr); width: auto; height: auto; min-height: 0; }
        }
        /* Hover bridge: keeps the panel open while the cursor crosses the gap below the link */
        &:hover > .menu-link::after { content: ''; position: absolute; top: 100%; right: 0; left: 0; height: calc(var(--sub-menu-gap) + 2rem); }
        &:hover > .wpb-sub-menu { pointer-events: all; opacity: 1; }
      }
    }

    .wpb-menu { display: flex; align-items: center;
      > .menu-item > .menu-link { padding: 1.6rem 1.2rem; 
        > .btn { transform: rotate(90deg); --border: none; pointer-events: none; }
      } /* Hoogste niveau links */

      .wpb-sub-menu {--nav-text-clr: var(--clr-text); position: absolute; top: calc(100% + var(--sub-menu-gap)); right: auto; bottom: auto; left: 50%; transform: translateX(-50%); box-shadow: 0 .5rem .5rem rgba(21, 47, 51, .1); width: 100%; padding: 0; min-width: 20rem; height: auto!important; background-color: var(--nav-bg-clr); opacity: 0; overflow: visible; pointer-events: none; transition: opacity var(--ts-25) ease; 
        .wpb-sub-menu { top: 0; left: 100%; transform: none; } 
        .wpb-sub-menu__header { display: none; }
      }
    }
  }
}

@media (min-width: 1200px) {
  .wpb-navigation {
    .logo { padding-right: 4.8rem;
      img { width: 19rem; }
    }

    .btn.btn--contact {
      i.fa-comment { display: none; }  
      .btn__text { white-space: nowrap; }
    }
  }

  .wpb-navigation__collapse {
    .wpb-collapse__body { padding-inline: 3.6rem; }
  }
}

/*** Mega menu ***/
.wpb-sub-menu.wpb-sub-menu--mega {
  .container { display: block; }

  .wpb-mega-menu__header{display: none;}

  .wpb-mega-menu__body { display: grid; grid-template-columns: 1fr; column-gap: clamp(3.2rem, 3.2vw, 5.4rem); row-gap: clamp(3.2rem, 4vw, 6.4rem); }
}

@media (max-width: 991.98px) {
  .wpb-sub-menu.wpb-sub-menu--mega {
    .wpb-sub-menu__body .container { padding-inline: 0; }
    .wpb-card--solution .btn.btn--link-white { --clr: var(--clr-text);
      &:hover {--hover-clr: var(--clr-primary);}
    }
  }
}

@media (min-width: 480px) {
  .wpb-sub-menu.wpb-sub-menu--mega .wpb-mega-menu__body { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 992px) {
  .wpb-navigation__collapse .wpb-menu > .menu-item.menu-item-has-children:has(> .wpb-sub-menu--mega) { position: static; }
  .wpb-navigation__collapse .wpb-menu .wpb-sub-menu.wpb-sub-menu--mega { --nav-text-clr: #fff; --clr-contrast: #fff; --clr-contrast-text: rgb(255, 255, 255); color: #fff; top: calc(100% + var(--sub-menu-gap)); right: 0; left: 0; transform: none; width: auto; min-width: 0; max-height: calc(100dvh - var(--header-height)); overflow-y: auto; background-color: var(--clr-primary); background-image: linear-gradient(240deg, rgba(var(--clr-primary-rgb), 0) -16.8%, rgba(var(--clr-primary-rgb), 0.5) 18.22%, var(--clr-primary-120) 89.57%); border-radius: var(--br-lg); box-shadow: 0 1rem 2rem rgba(174, 24, 38, .1), 0 1rem 2rem rgba(174, 24, 38, .1);
    .wpb-sub-menu__body { padding: clamp(3.2rem, 4vw, 6.4rem); }
    .wpb-mega-menu__header { display: flex; flex-direction: column; gap: clamp(2rem, 3vw, 4rem); justify-content: space-between; margin-bottom: clamp(2.4rem, 4vw, 4rem);
      .wpb-text { display: flex; flex-direction: column; width: 100%; max-width: 66rem; color: #fff; 
        .wpb-label span {color: #fff; }
        .h2 { --mt: 0.2em; display: block; font-weight: 700; }
      }
    }
    .wpb-mega-menu__body { grid-template-columns: repeat(3, 1fr); }
  }
}