/* =========================================================
   BURO210 Mega Menu
   Scoped to .buro210-mega to avoid conflicts with Breakdance
   ========================================================= */

header {
    z-index: 10000 !important;
}

:root,
.buro210-mega {
    --green: #245C4DFF;
    --yellow: #FFD54D;
    --menu-bg: rgba(255,255,255,0.8);
    --drop-bg: #e9e9e9;
    --white: #ffffff;
    --black: #111;
    --muted: rgba(0,0,0,0.65);
    --line: rgba(255,255,255,0.5);

    /* Mobile drawer */
    --drawer-bg: rgba(255,255,255,0.92);
    --drawer-blur: 12px;
}

.buro210-mega.mega{
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* Top menu */
.buro210-mega ul.main-menu{
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 30px;
    position: static !important;
    align-items: center;
}

.buro210-mega .mega__item{ position: static; }

.buro210-mega .mega__link{
    color: var(--green);
    font-weight: 600;
    text-decoration: none;
    font-size: 16px;
}

.buro210-mega .mega__link:hover,
.buro210-mega .mega__link:focus-visible{
    outline: none;
}

/* =========================================================
   Active states (current + ancestor)
   ========================================================= */
.buro210-mega .mega__link.is-current,
.buro210-mega .mega__link.is-ancestor{
    color: var(--yellow);
}

/* =========================================================
   Top link chevron (Font Awesome)
   ========================================================= */
.buro210-mega .mega__link{
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.buro210-mega .mega__chevron{
    font-size: 12px;
    line-height: 1;
    opacity: 0.85;
    transition: transform 180ms ease;
    font-family: "Font Awesome 6 Pro";
}

.buro210-mega .mega__item:hover > .mega__link .mega__chevron,
.buro210-mega .mega__item:focus-within > .mega__link .mega__chevron{
    transform: rotate(180deg);
}

/* Screen-reader helper */
.buro210-mega .mega__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;
}

/* =========================================================
   Hide L3/L4 columns if not needed for the active selection
   JS toggles: .mega__drop--active-has-l3 / --active-has-l4
   ========================================================= */
.buro210-mega .mega__drop:not(.mega__drop--active-has-l3) [data-mega-col="l3"],
.buro210-mega .mega__drop:not(.mega__drop--active-has-l3) [data-mega-col="l4"]{
    display: none;
}

.buro210-mega .mega__drop.mega__drop--active-has-l3:not(.mega__drop--active-has-l4) [data-mega-col="l4"]{
    display: none;
}

/* Make dropdown same width as the main bar */
.buro210-mega .mega__drop{
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    border-radius: 10px;
    padding-top: 45px;
    overflow: hidden;
    z-index: 50;
}

.buro210-mega .mega__drop .mega__drop-inner {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,.12);
    overflow: hidden;
    box-sizing: border-box;
}

.buro210-mega .mega__inner{
    position: relative;
}

/* Open on hover + keyboard focus (desktop) */
.buro210-mega .mega__item:hover > .mega__drop,
.buro210-mega .mega__item:focus-within > .mega__drop{
    display: block;
}

/* 4 columns: info | l2 | l3 | l4 */
.buro210-mega .mega__cols{
    display: grid;
    grid-template-columns: 1.2fr 0.85fr 0.9fr 1fr;
}

.buro210-mega .mega__cols ul {
    list-style: none;
}

/* Left info */
.buro210-mega .mega__col--info{
    background: var(--white);
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.buro210-mega .mega__info-panel{ display:none; }
.buro210-mega .mega__info-panel.is-active{ display:block; }
.buro210-mega .mega__info-panel[hidden]{ display:none !important; }

.buro210-mega .mega__info-title{
    margin: 0 0 20px 0;
    font-size: clamp(20px, 5vw, 26px);
    line-height: normal;
    letter-spacing: -0.02em;
    color: var(--purple);
}

.buro210-mega .mega__info-text{
    margin: 0;
    max-width: 50ch;
    line-height: 1.55;
    color: var(--muted);
    font-size: 16px;
}

/* Column padding */
.buro210-mega .mega__col--l2,
.buro210-mega .mega__col--l3list,
.buro210-mega .mega__col--l4{
    padding: 44px 34px;
    display: grid;
    gap: 0x;
    align-content: start;
    position: relative;
}

/* vertical dividers */
.buro210-mega .mega__col--l3list::before,
.buro210-mega .mega__col--l4::before{
    content:"";
    position:absolute;
    left: 0;
    top: 40px;
    bottom: 40px;
    width: 2px;
    background: var(--line);
}

/* the pink tick */
.buro210-mega .mega__col--l4::after{
    content:"";
    position:absolute;
    left: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 36px;
    background: var(--pink);
    border-radius: 4px;
    opacity: 0;
}

.buro210-mega .mega__drop:hover .mega__col--l4::after,
.buro210-mega .mega__item:focus-within .mega__col--l4::after{
    opacity: 1;
}

/* shared link styles */
.buro210-mega .mega__l2, .buro210-mega .mega__l3, .buro210-mega .mega__l4{
    color: var(--black);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-radius: 12px;
    font-weight: 500;
    position: relative;
}

/* arrow icon in dropdown for items with children */
.buro210-mega .mega__arrow{
    font-size: 14px;
    line-height: 1;
    opacity: 0.9;
}

.buro210-mega .mega__item-text{
    display: inline-block;
}

.buro210-mega .mega__item:not(:has(.mega__link[aria-expanded="true"])) 
.mega__l2.is-active,
.buro210-mega .mega__item:not(:has(.mega__link[aria-expanded="true"])) 
.mega__l3.is-active {
    color: var(--bde-brand-primary-color);
    font-weight: 700;
}

/* current / ancestor in dropdown */
.buro210-mega .mega__l2.is-current,
.buro210-mega .mega__l2.is-ancestor,
.buro210-mega .mega__l3.is-current,
.buro210-mega .mega__l3.is-ancestor,
.buro210-mega .mega__l4.is-current,
.buro210-mega .mega__l4.is-ancestor{
    color: var(--bde-brand-primary-color);
    font-weight: 700;
}

.buro210-mega li.has-children a:hover::after,
.buro210-mega li.has-children a.is-current::after,
.buro210-mega li.has-children a.is-ancestor::after {
    content:'';
    width:2px;
    height:100%;
    position: absolute;
    top: 0;
    right:-36px;
    z-index: 2;
    background-color: var(--pink);
}

/* Panels */
.buro210-mega .mega__panel{
    display:none;
    align-content: start;
}
.buro210-mega .mega__panel.is-active{ display:grid; }
.buro210-mega .mega__panel[hidden]{ display:none !important; }

.buro210-mega .mega__panel4{
    display:none;
    gap: 14px;
    align-content: start;
}
.buro210-mega .mega__panel4.is-active{ display:grid; }
.buro210-mega .mega__panel4[hidden]{ display:none !important; }

.buro210-mega .mega__empty{
    color: var(--muted);
    padding: 12px 10px;
}

/* =========================================================
   Mega dropdown matcht exact #bottom-header (desktop)
   ========================================================= */
@media (min-width: 768px){
    .buro210-mega .mega__drop{
        position: fixed;
        left: var(--buro210-drop-left, 0px);
        width: var(--buro210-drop-width, 100vw);
        right: auto;
        transform: none;
    }
}

/* =========================================================
   Global overlay in <body>
   ========================================================= */

:root{
    --buro210-header-z: 9999;
    --buro210-overlay-z: calc(var(--buro210-header-z) - 1);
}

#buro210-mega-overlay.buro210-mega-overlay{
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: var(--buro210-overlay-z);
    pointer-events: auto;
}

body.buro210-mega-open #buro210-mega-overlay.buro210-mega-overlay{
    display: block;
}

/* Scroll lock alleen bij mobile drawer open */
body.buro210-mobile-nav-open{
    overflow: hidden;
}

/* =========================================================
   Hamburger / mobile drawer (<=1240px)
   ========================================================= */

.buro210-mega .mega__toggle{
    display: none;
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 10px 0;
    align-items: center;
    gap: 10px;
    color: var(--black);
    font-weight: 700;
}

.buro210-mega .mega__toggle:focus-visible{
    outline: 2px solid rgba(0,0,0,.25);
    outline-offset: 4px;
    border-radius: 10px;
}

.buro210-mega .mega__toggle-icon{
    display: inline-grid;
    gap: 5px;
}

.buro210-mega .mega__toggle-icon span{
    display: block;
    width: 25px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

@media (max-width: 1240px){

    .buro210-mega .mega__toggle{
        display: inline-flex;
    }

    /* main menu becomes drawer */
    .buro210-mega ul.main-menu{
        display: none;
        position: fixed;
        left: var(--buro210-drop-left, 0px);
        width: var(--buro210-drop-width, 100vw);
        top: var(--buro210-drawer-top, 0px);
        max-height: calc(100vh - var(--buro210-drawer-top, 0px) - 16px);
        overflow: auto;
        margin: 0;
        padding: 14px 16px;
        gap: 0;
        flex-direction: column;
        background: var(--drawer-bg);
        backdrop-filter: blur(var(--drawer-blur));
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0,0,0,.12);

        /* FIX: boven overlay, ook wanneer naar body geportald */
        z-index: calc(var(--buro210-header-z) + 2);
    }

     /* ========== MOBILE HOTFIXES ========== */
    .mega__top.main-menu {
        position: fixed;

        /* top exact onder #bottom-header (komt uit JS) */
        top: calc(var(--buro210-drawer-top) + 10px);

        /* CHANGED:
           - bottom verwijderd (dat forceert full-height)
           - max-height beperkt de hoogte zodat hij pas scrollt als het nodig is
           - height: fit-content houdt hem compact als het past
        */
        height: fit-content;
        max-height: calc(100vh - (var(--buro210-drawer-top) + 10px) - 30px);

        /* rechts uitlijnen op #bottom-header */
        right: 58px;
        left: auto;

        /* breedte die nooit buiten beeld valt */
        width: min(420px, calc(100vw - 50px));
        min-width: 0;

        z-index: 9999;
        margin: 0;
        padding: 30px;
        box-shadow: 5px 20px 75px 0 #00000025;
        background: rgba(255, 255, 255, .8);
        backdrop-filter: blur(10px);
        border-radius: 10px;
        color: #000;
        font-size: 16px;
        list-style: none;

        /* scrollt alleen als content hoger is dan max-height */
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    /* ========== END of MOBILE HOTFIXES ========== */

    .buro210-mega.is-nav-open ul.main-menu{
        display: flex;
    }

    .buro210-mega .mega__link{
        width: 100%;
        justify-content: space-between;
        padding: 12px 10px;
        border-radius: 12px;
    }

    .buro210-mega .mega__item:hover > .mega__drop,
    .buro210-mega .mega__item:focus-within > .mega__drop{
        display: none;
    }

    .buro210-mega .mega__item.is-open > .mega__drop{
        display: block;
        position: static;
        padding: 10px 0 0 0;
        border-radius: 0;
    }

    .buro210-mega .mega__drop .mega__drop-inner{
        border-radius: 12px;
        padding-top: 0;
    }

    .mega__top.main-menu .mega__cols .mega__col--info { display: none; }
    .mega__top.main-menu .mega__sr-only { display: none !important; }

    .mega__top.main-menu li.mega__item a {
        display: block;
        width: 100%;
        padding: 10px 20px;
    }

    .mega__top.main-menu ul {
        list-style: none;
        padding:0;
        margin: 0;
    }

    .mega__top.main-menu ul li.mega__mob-item--l1 + li.mega__mob-item--l1{
        margin-top: 15px;
    }
    .mega__top.main-menu ul li.mega__mob-item--l2 + li.mega__mob-item--l2{
        margin-top: 8px;
    }

    .mega__top.main-menu ul li a {
        display: block;
        width: fit-content;
        box-sizing: border-box;
        text-decoration: none;
        font-weight: 500;
    }

    .mega__top.main-menu .mega__link { font-weight: 700; text-decoration: none; }

    .mega__top.main-menu ul li a.is-current.is-active, .mega__top.main-menu ul li a.is-current, .mega__top.main-menu a.is-ancestor { color: #ff2f8e; }

    /* ========== END of MOBILE HOTFIXES ========== */

    .mega__mobile-tree,
    .mega__mobile-tree ul{
        list-style: none;
        margin: 0;
        padding-left: 14px;
    }

    .mega__mob-row{
        display: flex;
        align-items: center;
        justify-content: start;
        gap: 10px;
    }

    .mega__mob-toggle{
        appearance: none;
        border: 0;
        background: transparent;
        cursor: pointer;
        padding: 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: relative;
        width: 10px;
        height: 10px;
    }

    .mega__mob-toggle-icon{
        width: 10px;
        height: 10px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        display: inline-block;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -70%) rotate(45deg);
    }

    .mega__mob-item.is-open > .mega__mob-row .mega__mob-toggle-icon{
        transform: translate(-50%, -50%) rotate(225deg);
        border-color: var(--pink)!important;
    }

    .mega__mob-item ul.mega__mob-sub {
        padding: 5px 0 0 15px;
        border-left: 2px solid rgba(255,255,255, 0.6);
    }

}

@media (max-width: 1119px) {
    .mega__top.main-menu {
        /* rechts uitlijnen op #bottom-header */
        right: 25px;
    }
}

@media (max-width: 767px){
    .buro210-mega .mega__cols{
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .buro210-mega .mega__col--l2::before,
    .buro210-mega .mega__col--l3list::before,
    .buro210-mega .mega__col--l4::before,
    .buro210-mega .mega__col--l4::after{
        display:none;
    }

    .buro210-mega .mega__col--info{ padding: 28px 22px; }
    .buro210-mega .mega__info-title{
        font-size: clamp(20px, 5vw, 26px);
        line-height: normal;
    }
    .buro210-mega .mega__col--l2,
    .buro210-mega .mega__col--l3list,
    .buro210-mega .mega__col--l4{ padding: 22px; }
}

/* Vanaf 480px en kleiner: zelfde breedte als #bottom-header en netjes blijven op kleine schermen */
@media (max-width: 480px) {
    .buro210-mega ul.mega__top.main-menu {
        /* iets compacter zodat het beter past op kleine schermen */
        padding: 20px;
        border-radius: 12px;

        /* top iets strakker */
        top: calc(var(--buro210-drawer-top) + 8px);

        /* CHANGED: bottom verwijderd, max-height doet het werk al */
        height: fit-content;
        max-height: calc(100vh - (var(--buro210-drawer-top) + 8px) - 16px);
    }
}
