.so-menu-wrapper {
  position: relative;
  display: inline-block;
  z-index: 1001;
}

.so-menu-btn {
  width: 50px;
  height: 50px;
  background: transparent !important;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  display: block;
  z-index: 1001;
  position: relative;
  padding: 0;
}

.so-menu-btn:hover,
.so-menu-btn:focus,
.so-menu-btn:active { background: transparent !important; box-shadow: none; }

/* Actieve knopstijl wanneer menu open is */
.so-menu-wrapper.so-open .so-menu-btn {
  background: #5597D8 !important;
  border-radius: 0 0 12px 0px;
}

.so-hamburger { 
  width: 43px; 
  height: 34px; 
  position: absolute; 
  top: 50%; 
  left: 50%; 
  transform: translate(-50%, -50%); 
  display: block; 
  background: transparent !important; 
}
.so-hamburger span { position: absolute; left: 0; width: 100%; height: 7px; background: #fff; border-radius: 8px; transition: all 0.3s ease; }
.so-hamburger span:nth-child(1) { top: 0; }
.so-hamburger span:nth-child(2) { top: 13px; }
.so-hamburger span:nth-child(3) { bottom: 0; }

.so-menu-wrapper.so-open .so-hamburger span:nth-child(1) { transform: rotate(45deg); top: 13px; }
.so-menu-wrapper.so-open .so-hamburger span:nth-child(2) { opacity: 0; }
.so-menu-wrapper.so-open .so-hamburger span { background: #fff; }
.so-menu-wrapper.so-open .so-hamburger span:nth-child(3) { transform: rotate(-45deg); bottom: 13px; }

.so-menu-panel {
  position: fixed; /* voor viewport-gebaseerde begrenzing */
  top: 0; /* live gezet via JS */
  left: 0; /* live gezet via JS */
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  padding: 40px 50px 40px 75px;
  min-width: 450px;
  opacity: 0;
  transform: scale(0);
  transform-origin: top left;
  transition: transform 0.2s ease, opacity 0.2s ease;
  pointer-events: none;
  z-index: 1000;
  overflow: auto; /* indien hoger dan max-height */
}

.so-menu-wrapper.so-open .so-menu-panel { opacity: 1; transform: scale(1); pointer-events: auto; }

.so-menu-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.so-menu-links li a { 
  color: #5597D8; 
  text-decoration: none; 
  font-weight: 500; 
  transition: color 0.2s ease; 
  font-size: 40px;
  line-height: 50px;
}
.so-menu-links .sub-menu a { font-size: 33px; line-height: 43px; }
@media (max-width: 768px) {
  .so-menu-links .sub-menu a { font-size: 26px;
    line-height: 32px; }
}
.so-menu-links li a:hover,
.so-menu-links li a:focus,
.so-menu-links li a:active,
.so-menu-links li.current-menu-item > a,
.so-menu-links li.current_page_item > a,
.so-menu-links li.current-menu-ancestor > a { color: #000!important; }

.so-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.so-menu-wrapper ul {
  list-style: none;
}

.so-menu-footer { 
  margin-top: 60px; 
  font-size: 22px;
  line-height: 23px; 
  color: #333; 
}
.so-menu-footer a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }
.so-menu-footer a:hover { color: var(--e-global-color-primary, #5597D8); }

/* Scrollbare content, vaste footer */
.so-menu-panel { display: flex; flex-direction: column; }
.so-menu-content { overflow: visible; position: relative; z-index: 2; }
.so-menu-content #menu-hoofdmenu { position: relative; z-index: 2; background: #fff; }
.so-menu-links .sub-menu { position: relative; z-index: 2; background: #fff; }
.so-menu-footer { position: sticky; bottom: 0; z-index: 0; }

/* Responsive hamburger (≤768px): 35px breed, 6px bars */
@media (max-width: 768px) {
  .so-hamburger { width: 35px; height: 28px; }
  .so-hamburger span { height: 6px; border-radius: 6px; }
  .so-hamburger span:nth-child(2) { top: 11px; }
  .so-menu-wrapper.so-open .so-hamburger span:nth-child(1) { top: 11px; }
  .so-menu-wrapper.so-open .so-hamburger span:nth-child(3) { bottom: 11px; }
  .so-menu-panel { padding: 40px 30px 40px 75px; }
  .so-menu-links li a { font-size: 30px; line-height: 25px; }
  .so-menu-panel { min-width: calc(100vw - 60px); }
  .so-menu-panel { height: calc(100vh - 15px); max-height: calc(100vh - 15px); overflow: auto; display: flex; flex-direction: column; }
  /* Laat submenu over de footer vallen */
  .so-menu-content { overflow: visible; position: relative; z-index: 2; flex: 1 1 auto; }
  .so-menu-links { position: relative; z-index: 2; }
  .so-menu-links > li { position: relative; }
  .so-menu-links .sub-menu { position: relative; z-index: 2; background: #fff; }
  .so-menu-footer { position: sticky; bottom: 0; z-index: 0; }
  /* Geen bounce-animatie op mobiel */
  .so-menu-wrapper.so-open .so-menu-panel { animation: none; }
  .so-menu-panel { transition: none; }
}

/* Submenu standaard ingeklapt, behalve als huidige item/ancestor actief is */
.so-menu-links .sub-menu { display: none; padding-left: 0; margin-top: 8px; }
.so-menu-links li.current-menu-item > .sub-menu,
.so-menu-links li.current-menu-ancestor > .sub-menu { display: block; }

/* Submenu toggle knop */
.so-sub-toggle {
  background: transparent !important;
  border: 0;
  width: 28px;
  height: 28px;
  margin-left: 8px;
  vertical-align: middle;
  position: relative;
  cursor: pointer;
  color: #5597D8!important;
}
/* Chevron icoon */
.so-sub-toggle::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 38%;
  width: 20px;
  height: 20px;
  border-right: 6px solid currentColor;
  border-bottom: 6px solid currentColor;
  transform: translate(-50%, -50%) rotate(-45deg);
  transition: transform 0.2s ease;
}
li.so-sub-open > .so-sub-toggle::before {
  transform: translate(-50%, -50%) rotate(45deg); /* naar beneden */
}

/* Bounce open animation */
@keyframes so-panel-bounce {
  0% { transform: scale(0.90); opacity: 0; }
  60% { transform: scale(1.06); opacity: 1; }
  80% { transform: scale(0.985); }
  100% { transform: scale(1); }
}

/* Geen bounce; gebruik alleen de standaard transform/opacity transition */

@media (prefers-reduced-motion: reduce) {
  .so-menu-wrapper.so-open .so-menu-panel { animation: none; }
}
