/*
 * Beshay Realty — conditional navigation (v1.2).
 * Keep unavailable menu links in the markup so AJAX can show them again
 * immediately after a REX listing category changes, including cached pages.
 */
body.beshay-nav-hide-commercial-sale li.beshay-nav-commercial-sale,
body.beshay-nav-hide-commercial-lease li.beshay-nav-commercial-lease,
body.beshay-nav-hide-commercial-sale nav li:has(> a[href*="beshay_type=sale"]),
body.beshay-nav-hide-commercial-lease nav li:has(> a[href*="beshay_type=lease"]),
body.beshay-nav-hide-commercial header li:has(> a[href$="/commercial/"]),
body.beshay-nav-hide-commercial header li:has(> a[href$="/commercial"]),
body.beshay-nav-hide-commercial nav li:has(> a[href$="/commercial/"]),
body.beshay-nav-hide-commercial nav li:has(> a[href$="/commercial"]),
body.beshay-nav-hide-commercial footer li:has(> a[href$="/commercial/"]),
body.beshay-nav-hide-commercial footer li:has(> a[href$="/commercial"]),
body.beshay-nav-hide-commercial .ekit-template-content-header li:has(> a[href$="/commercial/"]),
body.beshay-nav-hide-commercial .ekit-template-content-footer li:has(> a[href$="/commercial/"]),
body.beshay-nav-hide-commercial .elementor-location-header li:has(> a[href$="/commercial/"]),
body.beshay-nav-hide-commercial .elementor-location-footer li:has(> a[href$="/commercial/"]),
body.beshay-nav-hide-for-lease ul.sub-menu > li:has(> a[href$="/leasing/"]),
body.beshay-nav-hide-for-lease ul.sub-menu > li:has(> a[href$="/leasing"]),
body.beshay-nav-hide-for-lease ul.elementskit-dropdown > li:has(> a[href$="/leasing/"]),
body.beshay-nav-hide-for-lease ul.elementskit-dropdown > li:has(> a[href$="/leasing"]) {
    display: none !important;
}

/* Generic protection if the theme produces a menu div rather than an li. */
body.beshay-nav-hide-commercial-sale a[data-beshay-nav="commercial_sale"],
body.beshay-nav-hide-commercial-lease a[data-beshay-nav="commercial_lease"],
body.beshay-nav-hide-commercial a[data-beshay-nav="commercial"],
body.beshay-nav-hide-for-lease a[data-beshay-nav="for_lease"] {
    display: none !important;
}

/*
 * Only used when Commercial is manually built in Elementor and no native
 * WordPress submenu exists. Native submenu appearance remains untouched.
 * Colours intentionally follow Beshay's slate and ivory palette.
 */
.beshay-commercial-parent {
    position: relative;
}
.beshay-commercial-parent > ul.beshay-commercial-submenu {
    position: absolute;
    z-index: 100000;
    top: 100%;
    left: 0;
    min-width: 176px;
    list-style: none;
    display: none;
    margin: 0;
    padding: 6px 0;
    background: #0D1721;
    border: 1px solid rgba(167, 199, 183, .35);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .16);
}
.beshay-commercial-parent:hover > ul.beshay-commercial-submenu,
.beshay-commercial-parent:focus-within > ul.beshay-commercial-submenu,
.beshay-commercial-parent.beshay-submenu-open > ul.beshay-commercial-submenu {
    display: block;
}
.beshay-commercial-parent > ul.beshay-commercial-submenu > li {
    display: block;
    margin: 0;
    padding: 0;
}
.beshay-commercial-parent > ul.beshay-commercial-submenu > li > a {
    display: block;
    padding: 12px 20px;
    color: #F5F1E8;
    text-decoration: none;
    font-size: inherit;
    white-space: nowrap;
}
.beshay-commercial-parent > ul.beshay-commercial-submenu > li > a:hover,
.beshay-commercial-parent > ul.beshay-commercial-submenu > li > a:focus-visible {
    color: #A7C7B7;
    background: rgba(255, 255, 255, .06);
}

@media (max-width: 1024px) {
    .beshay-commercial-parent > ul.beshay-commercial-submenu {
        position: static;
        width: 100%;
        min-width: 0;
        border-left: 2px solid #A7C7B7;
        border-top: 0;
        border-right: 0;
        border-bottom: 0;
        box-shadow: none;
    }
}

/* Footer links need the same first-render protection as the main menu. */
body.beshay-nav-hide-for-lease :is(footer, .ekit-template-content-footer, .elementor-location-footer) li:has(> a[href$="/leasing/"]),
body.beshay-nav-hide-for-lease :is(footer, .ekit-template-content-footer, .elementor-location-footer) li:has(> a[href$="/leasing"]),
body.beshay-nav-hide-inspections-sale :is(header, footer, nav, [role="navigation"], .ekit-template-content-header, .ekit-template-content-footer, .elementor-location-header, .elementor-location-footer) li:has(> a[href*="/buy/?"][href*="home_open=upcoming"]),
body.beshay-nav-hide-inspections-lease :is(header, footer, nav, [role="navigation"], .ekit-template-content-header, .ekit-template-content-footer, .elementor-location-header, .elementor-location-footer) li:has(> a[href*="/leasing/?"][href*="home_open=upcoming"]),
body.beshay-nav-hide-inspections-lease :is(header, footer, nav, [role="navigation"], .ekit-template-content-header, .ekit-template-content-footer, .elementor-location-header, .elementor-location-footer) li:has(> a[href*="/for-lease/?"][href*="home_open=upcoming"]),
body.beshay-nav-hide-inspections-sale a[data-beshay-nav="inspections_sale"],
body.beshay-nav-hide-inspections-lease a[data-beshay-nav="inspections_lease"] {
    display: none !important;
}
