.acf-mega-menu-nav {
    --mm-bg: #f7faf9;
    --mm-panel: #ffffff;
    --mm-border: #d7e4df;
    --mm-ink: #17352a;
    --mm-muted: #5a7167;
    --mm-accent: #001E41;
    --mm-accent-soft: #e7f6ef;
    position: relative;
}

.acf-mega-menu-nav .acf-mega-menu-item {
    position: static;
}

.acf-mega-menu-hidden-submenu {
    display: none !important;
}

/* Prevent pre-init flashes: hide mega outputs until JS finishes setup. */
.acf-mega-menu-nav:not(.acf-mega-menu-ready) .acf-mega-menu-hidden-submenu,
.acf-mega-menu-nav:not(.acf-mega-menu-ready) .acf-mega-panel {
    display: none !important;
}

.acf-mega-menu-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

@media (min-width: 981px) {
    .acf-mega-menu-nav .acf-mega-menu-item > .acf-mega-menu-link,
    .acf-mega-menu-nav .acf-mega-menu-item > .acf-mega-menu-link:hover,
    .acf-mega-menu-nav .acf-mega-menu-item > .acf-mega-menu-link:focus,
    .acf-mega-menu-nav li a {
        color: #fff;
    }
}

.acf-mega-panel {
    position: absolute;
    left: 0;
    right: auto;
    transform: none;
    width: 80vw;
    top: 100%;
    z-index: 99999;
    display: none;
    padding: 1.25rem;
    border-radius: 0 0 14px 14px;
    border: 1px solid var(--mm-border);
    border-top: none;
    background: #fff;
    box-shadow: 0 14px 28px rgba(15, 40, 31, 0.1);
}

@media (min-width: 981px) {
    .acf-mega-panel {
        /* fixed: always viewport-centered; max-height + overflow-y keeps bottom links reachable */
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        top: 60px; /* JS overrides with the actual nav bottom edge */
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
}

.acf-mega-menu-nav.acf-mega-menu-ready .acf-mega-menu-item:hover > .acf-mega-panel,
.acf-mega-menu-nav.acf-mega-menu-ready .acf-mega-menu-item:focus-within > .acf-mega-panel,
.acf-mega-menu-nav.acf-mega-menu-ready .acf-mega-menu-item.is-open > .acf-mega-panel {
    display: block;
}

.acf-mega-panel-head {
    margin-bottom: 1rem;
}

.acf-mega-panel-head .acf-mega-panel-heading {
    display: block;
    margin: 0;
    color: var(--mm-ink);
    font-size: 1.1rem;
    font-weight: 600;
}

.acf-mega-panel-head p {
    margin: 0.35rem 0 0;
    color: var(--mm-muted);
    font-size: 0.95rem;
}

.acf-mega-panel-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(50px, 14%) 1fr;
}

.acf-mega-tier-2 {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.acf-mega-tab {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    border: none;
    background-color: #ffffff !important;
    color: var(--mm-ink);
    border-radius: 10px;
    text-align: left;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.acf-mega-tab:hover,
.acf-mega-tab.is-active {
    background:none !important;
    border-color: var(--mm-accent);
    color: #0f3c2b;
    border-color: var(--e-global-color-accent);
    border: 1px solid var(--mm-border) !important;
}

.acf-mega-group-thumb-wrap {
    position: relative;
    display: block;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

/* Gradient overlay in normal (non-hover, non-active) state */
.acf-mega-group-thumb-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background-color: transparent;
    background-image: linear-gradient(180deg, var(--e-global-color-340bb902) 0%, var(--e-global-color-primary) 100%);
    pointer-events: none;
    transition: opacity 0.2s ease;
    opacity: 0.38;
}

/* Remove gradient overlay on hover or when the tab is active */
.acf-mega-tab:hover .acf-mega-group-thumb-wrap::after,
.acf-mega-tab.is-active .acf-mega-group-thumb-wrap::after {
    background-image: none;
    opacity: 0;
}

.acf-mega-group-thumb {
    display: block;
    width: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.acf-mega-group-title {
    font-weight: 600;
    color: #0f3c2b;
}

.acf-mega-tier-3-groups {
    min-height: 260px;
    border: 1px solid var(--mm-border);
    border-radius: 12px;
    background: var(--mm-panel);
    padding: 1rem;
}

.acf-mega-pane {
    display: none;
}

.acf-mega-pane.is-active {
    display: block;
    animation: mm-fade 0.22s ease;
}

.acf-mega-group-layout {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(240px, 60%) 1fr;
    align-items: start; /* required for sticky child to work inside a grid */
}

.acf-mega-tier-3 {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-height: 72vh;
    overflow-y: auto;
    padding-right: 0.25rem; /* prevents scrollbar from overlapping last button */
}

.acf-mega-link-tab {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    border: 1px solid var(--mm-border);
    border-radius: 10px;
    padding: 0.3rem;
    text-align: left;
    cursor: pointer;
    color: var(--mm-ink);
    background-color: #fff !important;
    color:#001E41 !important;
    border: 1px solid var(--mm-border) !important;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.acf-mega-link-tab:hover,
.acf-mega-link-tab.is-active {
    border-color: var(--mm-accent);
    background-color: #efefef !important;
    color: #001E41 !important;
}

.acf-mega-link-thumb {
    width: 100px;
   /* height: 44px; */
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 auto;
}

.acf-mega-link-title {
    display: -webkit-box;
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    line-height: 1.35;
    white-space: normal;
    overflow: hidden;
    overflow-wrap: anywhere;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.acf-mega-tier-3-detail {
    border: 1px solid var(--mm-border);
    border-radius: 12px;
    background: #fff;
    padding: 0.9rem;
    position: sticky;
    top: 0;
}

.acf-mega-link-detail {
    display: none;
}

.acf-mega-link-detail.is-active {
    display: block;
    animation: mm-fade 0.22s ease;
}

.acf-mega-link-image {
    display: block;
    width: 100%;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 0.7rem;
}

.acf-mega-link-heading {
    margin: 0;
    color: var(--mm-ink);
    font-size: 1rem;
}

.acf-mega-link-description {
    margin: 0.65rem 0;
    color: var(--mm-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.acf-mega-detail-button {
    /* Block + text-align: center gives every card the same full-width button */
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin-top: 0.75rem;
    padding: 10px 20px !important;
    border-radius: 999px;
    background: #7D999C00 !important;
    color: var(--e-global-color-text) !important;
    border: 1px solid var(--e-global-color-accent) !important;
    text-decoration: none;
    text-align: center;
    font-weight: 500;
}

.acf-mega-empty-state {
    margin: 0;
    color: var(--mm-muted);
    font-size: 0.9rem;
}

/* ── Tier 2 scroll wrapper: shown when there are > 5 group buttons ─────────── */
.acf-mega-tier-2-scroll-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.acf-mega-tier-2.is-scrollable {
    overflow-y: auto;
    /* Tall enough to show at least 4 thumbnail-height tab buttons before clipping */
    max-height: 70vh;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.acf-mega-tier-2.is-scrollable::-webkit-scrollbar {
    display: none;
}

.acf-mega-tier-2-scroll-btn {
    flex-shrink: 0;
    width: 100%;
    height: 26px;
    padding: 0;
    border: 1px solid var(--mm-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--mm-ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.acf-mega-tier-2-scroll-btn:hover:not(:disabled) {
    background: #d0e4fb;
    border-color: var(--mm-accent);
    color: #001E41;
}

.acf-mega-tier-2-scroll-btn:disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

@keyframes mm-fade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .acf-mega-menu-hidden-submenu {
        display: none !important;
    }

    /* Let theme/mobile-menu controls (sub-arrow or open-state classes)
       decide when the native submenu should be visible. */
    .acf-mega-menu-nav.acf-mega-menu-ready .menu-item-has-children.open > .acf-mega-menu-hidden-submenu,
    .acf-mega-menu-nav.acf-mega-menu-ready .menu-item-has-children.is-open > .acf-mega-menu-hidden-submenu,
    .acf-mega-menu-nav.acf-mega-menu-ready .menu-item-has-children.submenu-open > .acf-mega-menu-hidden-submenu,
    .acf-mega-menu-nav.acf-mega-menu-ready .menu-item-has-children.elementor-active > .acf-mega-menu-hidden-submenu,
    .acf-mega-menu-nav.acf-mega-menu-ready .menu-item-has-children > a[aria-expanded="true"] ~ .acf-mega-menu-hidden-submenu,
    .acf-mega-menu-nav.acf-mega-menu-ready .menu-item-has-children > .sub-arrow[aria-expanded="true"] ~ .acf-mega-menu-hidden-submenu,
    .acf-mega-menu-nav.acf-mega-menu-ready .menu-item-has-children > .sub-arrow.active ~ .acf-mega-menu-hidden-submenu {
        display: block !important;
    }

    .acf-mega-panel {
        display: none !important;
    }
}
.swiper-pagination {z-index:1!important;}
.elementor-widget-image-carousel .swiper {position:sticky !important;}
