/* ============================================================
   CDI V20 NAV STABILITY FIX
   Fixes desktop dropdown clipping after scrolling and keeps menus
   readable inside the viewport.
   ============================================================ */
@media (min-width: 981px){
  body:not(.admin-body) .topnav{
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9900 !important;
    overflow: visible !important;
    contain: none !important;
  }
  body:not(.admin-body) .topnav .row,
  body:not(.admin-body) .nav-links,
  body:not(.admin-body) .cdi-megawrap{
    overflow: visible !important;
    contain: none !important;
  }
  body:not(.admin-body) .cdi-mega{
    position: fixed !important;
    left: 50% !important;
    top: 76px;
    width: min(920px, calc(100vw - 40px)) !important;
    max-width: calc(100vw - 40px) !important;
    max-height: calc(100svh - 94px);
    overflow: auto !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    z-index: 10020 !important;
    transform: translateX(-50%) translateY(-8px) !important;
    margin: 0 !important;
  }
  body:not(.admin-body) .cdi-mega.open{
    transform: translateX(-50%) translateY(0) !important;
  }
  body:not(.admin-body) .cdi-overlay{
    z-index: 10000 !important;
    background: transparent !important;
  }
  body:not(.admin-body) .cdi-menu{
    min-height: 0 !important;
  }
  body:not(.admin-body) .cdi-navpane,
  body:not(.admin-body) .cdi-featurepane{
    min-height: 0 !important;
  }
  body:not(.admin-body) .cdi-level{
    max-height: calc(100svh - 122px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body:not(.admin-body) .cdi-featurepane{
    overflow-y: auto;
    max-height: calc(100svh - 94px);
  }
}

@media (max-width: 980px){
  body:not(.admin-body) .cdi-mega,
  body:not(.admin-body) .cdi-overlay{
    display: none !important;
  }
}
