.site-header {
    padding: 36px 0 27px;
}

.as-main-navigation-middle {
    --primary-300: #9A98F0;
    --hover: #D2D2D2;
    --primary-font: 'Garnett', system-ui, sans-serif;
    font-family: var(--primary-font);
    display: flex;
    flex-direction: column;
    /* align-items: center; */
    position: static;

    .menu-primary-menu-container {
        @media(max-width: 991px) {
            width: calc(100% - 70px);
        }
    }



    .as-main-navigation {
        &.is-scrolling {
            .sub-menu-wrapper {
                /* top is now set by JS via getBoundingClientRect — no override needed */
            }
        }

        .mobile-top-line {
            margin-top: 32px;
            padding-bottom: 0;
            margin-bottom: 70px;

            &:after {
                display: none;
            }
        }

        ul#primary-menu {
            position: static;

            @media(max-width: 991px) {
                /* padding-right: 0; */
                position: relative;
                height: 100%;
                overflow-y: scroll;
                scrollbar-width: thin;
                scrollbar-color: #a5a5a5 #444;
                display: flex;
                flex-direction: column;
            }

            /* First-level menu items */
            >li {
                line-height: 1;
                display: inline-block;

                @media (max-width: 575.98px) {
                    display: block;
                    border-bottom: 1px solid #F2F2F2;
                }

                &:not(:first-child) {
                    margin-top: 0;
                }

                a {
                    line-height: inherit;
                    text-decoration: none;
                    color: $color-dark-bg;
                    /* font-weight: 500; */
                    font-size: 15px;

                    &:hover {
                        text-decoration: none;
                        color: $color-primary;
                        cursor: pointer;
                    }

                    @media(max-width: 991px) {
                        font-size: 16px;
                    }
                }

                &:hover {
                    >a {
                        &:after {
                            width: calc(100% + 12px);
                        }
                    }
                }

                >a {
                    display: flex;
                    margin: 0 15px;
                    font-size: 15px;
                    padding: 30px 0;

                    @media(max-width: 991px) {
                        font-size: 18px;
                        line-height: 22.68px;
                        padding: 24px 0;
                        margin: 0 0;
                    }

                    &::after {
                        position: absolute;
                        content: "";
                        left: -6px;
                        bottom: 15px;
                        width: 0;
                        background-color: var(--menu-color-var);
                        height: 3px;
                        border-radius: 1px;
                        transition: width 0.3s;
                    }
                }

                &.menu-item-has-children {

                    &.is-active {
                        >a {
                            &:after {
                                rotate: 180deg;
                            }
                        }
                    }

                    >a {
                        @media(max-width: 991px) {
                            padding: 24px 0;
                            display: flex;
                            align-items: center;
                            justify-content: space-between;
                        }

                        &:after {

                            @media(max-width: 991px) {
                                width: 15px;
                                height: 9px;
                                position: static;
                                left: auto;
                                border-radius: 0;
                                background-color: transparent;
                                transition: all .25s;
                                background-image: url("data:image/svg+xml,%0A%3Csvg width='15' height='9' viewBox='0 0 15 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M14.7017 1.97936L8.22017 8.46089C7.82243 8.85863 7.17757 8.85863 6.77983 8.46089L0.298304 1.97937C-0.0994345 1.58163 -0.0994346 0.936766 0.298304 0.539027C0.696043 0.141288 1.3409 0.141288 1.73864 0.539026L7.5 6.30038L13.2614 0.539024C13.6591 0.141286 14.304 0.141285 14.7017 0.539024C15.0994 0.936763 15.0994 1.58162 14.7017 1.97936Z' fill='%230E0841'/%3E%3C/svg%3E%0A");
                            }
                        }
                    }

                    /* Desktop hover/click is handled by JS (handleDesktopNav).
                       CSS :hover intentionally removed so JS controls open/close
                       with a delay that bridges the gap between nav and card. */

                    .sub-menu-wrapper {
                        overflow: visible;
                        display: none;
                        position: fixed;
                        left: 0;
                        width: 100vw;
                        transform: none;
                        background-color: transparent;
                        padding: 12px 0 0; /* top padding = hover bridge, no visual gap */
                        border: none;
                        box-shadow: none;

                        @media(max-width: 991px) {
                            background-color: #6765E80D;
                            padding: 34px 12px 24px;
                            position: static;
                            left: auto;
                            top: auto;
                            width: 100%;
                            transform: none;
                        }

                        &.is-active {
                            display: block;
                        }

                        /* Link colours for light dropdown — override dark-header white text */
                        a {
                            color: #0E0841;

                            &:hover {
                                color: #6765E8;
                            }
                        }

                        .sub-menu__inner {
                            width: fit-content;
                            margin: 0 auto;
                            padding: 30px;
                            border-radius: 8px;
                            border: 1px solid #E8E8FF;
                            background: #fff;
                            box-shadow: 0 6px 20px rgba(103, 101, 232, 0.12);

                            @media(max-width: 991px) {
                                width: 100%;
                                padding: 0;
                                border-radius: 0;
                                border: none;
                                background: transparent;
                                box-shadow: none;
                            }

                            &.has-featured-2-cols-full {
                                width: 100%;
                                max-width: 1270px;
                            }

                            ul {
                                &.sub-menu {
                                    /* position: relative; */

                                    .menu-item__icon {
                                        width: 20px;
                                        height: 20px;
                                        flex-shrink: 0;
                                        line-height: 0;

                                        img {
                                            width: 20px;
                                            height: 20px;
                                            object-fit: contain;
                                        }
                                    }

                                    &.sub-menu--single,
                                    &.sub-menu--multiple {
                                        display: flex;
                                        gap: 0; /* spacing handled by column padding */

                                        @media(max-width: 991px) {
                                            flex-direction: column;
                                            gap: 0;
                                        }

                                        >li {

                                            position: relative;
                                            flex: 1; /* equal-width columns */
                                            padding: 0 50px; /* 50px on each side = 100px total between columns */

                                            &:first-child { padding-left: 0; }
                                            &:last-child  { padding-right: 0; }

                                            /* Column separator — exactly centred: 25px each side */
                                            &:not(:last-child) {
                                                border-right: 1px solid rgba(14, 8, 65, 0.08);

                                                @media(max-width: 991px) {
                                                    border-right: none;
                                                }
                                            }

                                            @media(max-width: 991px) {
                                                padding: 0;
                                                border-right: none;
                                                border-bottom: none;
                                            }

                                            &.menu-item-has-children,
                                            &.menu-item-has-featured {
                                                >a {
                                                    display: flex;
                                                    align-items: center;
                                                    gap: 8px;
                                                    text-transform: none;
                                                    font-family: 'Garnett', system-ui, sans-serif;
                                                    font-size: 18px;
                                                    font-weight: 600 !important;
                                                    color: #0E0841;
                                                    white-space: nowrap;
                                                    padding: 0;
                                                    margin: 0;
                                                    border-radius: 0;
                                                    cursor: default;

                                                    &:hover {
                                                        background: transparent;

                                                        .menu-item__content-title {
                                                            color: #0E0841;
                                                        }
                                                    }

                                                    .menu-item__icon {
                                                        width: 20px;
                                                        height: 20px;
                                                        flex-shrink: 0;
                                                        line-height: 0;

                                                        img {
                                                            width: 20px;
                                                            height: 20px;
                                                            object-fit: contain;
                                                        }
                                                    }

                                                    &+.sub-menu {
                                                        margin-top: 18px;
                                                        display: grid;
                                                        gap: 20px;

                                                        @media(max-width: 991px) {
                                                            margin-top: 14px;
                                                            gap: 18px;
                                                        }
                                                    }

                                                    &+.mega-menu-featured {
                                                        margin-top: 30px;
                                                    }
                                                }
                                            }

                                            &.menu-item-has-featured {
                                                >a {
                                                    pointer-events: none;

                                                    .menu-item__content-title {
                                                        font-size: 16px;
                                                        line-height: 20px;
                                                        text-transform: uppercase;
                                                        font-weight: 700 !important;
                                                        padding: 0;
                                                    }
                                                }

                                                .mega-menu-featured {
                                                    img {
                                                        margin-bottom: 12px;
                                                    }

                                                    p {
                                                        margin-bottom: 12px;

                                                        &.section-title {
                                                            font-size: 18px;
                                                            font-weight: 500;
                                                        }

                                                        &.section-content {
                                                            color: #D2D2D2;
                                                            font-weight: 300;
                                                            font-size: 16px;
                                                            line-height: 19.2px;
                                                        }
                                                    }

                                                    .section-link {
                                                        color: var(--primary-300);
                                                        font-size: 12px;
                                                        line-height: 14.52px;
                                                        font-weight: 600;
                                                    }
                                                }
                                            }

                                        }
                                    }

                                    &.has-featured-2-cols {
                                        height: 100%;
                                        display: grid;
                                        grid-template-columns: repeat(12, 1fr);
                                        gap: 90px;
                                        margin: 0 auto;
                                        padding-left: calc((100% - 1270px) / 2);

                                        @media(max-width: 991px) {
                                            display: flex;
                                            flex-direction: column;
                                            gap: 24px;
                                        }

                                        >li {

                                            &:first-child {
                                                grid-column: 1 / span 3;

                                                @media(max-width: 991px) {
                                                    grid-column: inherit;
                                                }
                                            }

                                            &:nth-child(2) {
                                                grid-column: 4 / span 3;

                                                @media(max-width: 991px) {
                                                    grid-column: inherit;
                                                }
                                            }

                                            >a {
                                                &+.sub-menu {
                                                    gap: 18px !important;
                                                }
                                            }

                                            &.menu-item-has-featured-2-cols {
                                                height: 100%;
                                                width: 100%;
                                                grid-column: 7 / -1;
                                                position: static;

                                                @media(max-width: 991px) {
                                                    grid-column: inherit;
                                                }

                                                .mega-menu-featured-2-cols {
                                                    display: flex;
                                                    align-items: center;
                                                    height: 100%;
                                                    gap: 32px;
                                                    overflow: hidden;

                                                    @media(max-width: 991px) {
                                                        flex-direction: column;
                                                        overflow: visible;
                                                    }

                                                    .featured-col-left {
                                                        flex-shrink: 0;
                                                        width: min(260px, 100%);

                                                        @media(max-width: 991px) {
                                                            width: 100%;
                                                        }

                                                        .section-title {
                                                            font-size: 34px;
                                                            margin-bottom: 12px;
                                                            color: #0E0841;

                                                            @media(max-width: 991px) {
                                                                font-size: 24px;
                                                                line-height: 30px;
                                                            }
                                                        }

                                                        .section-content {
                                                            font-size: 14px;
                                                            line-height: 20px;
                                                            color: rgba(14, 8, 65, 0.8);
                                                            margin-bottom: 20px;
                                                        }

                                                        .btn {
                                                            color: #fff;
                                                            font-size: 14px;
                                                            line-height: 18px;
                                                            font-weight: 500;
                                                            padding: 8px 18px !important;
                                                            margin-left: 0px;
                                                        }
                                                    }

                                                    img {
                                                        flex: 1 1 0;
                                                        min-width: 0;
                                                        max-width: 58%;
                                                        max-height: 100%;
                                                        width: auto;
                                                        align-self: flex-end;
                                                        object-fit: cover;
                                                        object-position: left bottom;
                                                        position: static !important;

                                                        @media(max-width: 991px) {
                                                            max-width: 100%;
                                                            width: 100%;
                                                            max-height: 200px;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    li {
                                        a:not(.btn):not(.btn-ghost):not(.btn-secondary) {
                                            display: flex;
                                            align-items: flex-start;
                                            gap: 8px;
                                            padding: 6px 10px;
                                            margin: -6px -10px;
                                            border-radius: 8px;
                                            font-family: 'Garnett', system-ui, sans-serif;
                                            font-size: 15px;
                                            font-weight: 400;
                                            color: #0E0841;
                                            white-space: nowrap;
                                            transition: background 0.18s ease;

                                            &:first-child {
                                                margin-top: 0;
                                            }

                                            &:hover {
                                                background: rgba(103, 101, 232, 0.07);

                                                .menu-item__content-title {
                                                    color: #6765E8;
                                                }
                                            }

                                            @media (max-width: 575.98px) {
                                                padding: 10px;
                                                margin: -10px 0;
                                            }
                                        }

                                        .menu-item__content {
                                            display: flex;
                                            flex-direction: column;

                                            .menu-item__icon {
                                                min-width: 20px;
                                                max-width: 20px;
                                                line-height: 0;
                                                margin-top: 1px;

                                                img {
                                                    height: 16px;
                                                    width: auto;
                                                    display: block;
                                                }
                                            }

                                            .menu-item__content-title {
                                                font-family: 'Garnett', system-ui, sans-serif;
                                                font-size: 15px;
                                                font-weight: 400;
                                                line-height: normal;
                                                color: #0E0841;
                                                white-space: nowrap;
                                                transition: color 0.18s ease;
                                            }

                                            .menu-item__content-description {
                                                margin-top: 2px;
                                                font-family: 'Garnett', system-ui, sans-serif;
                                                font-size: 12px;
                                                font-weight: 400;
                                                line-height: normal;
                                                color: rgba(14, 8, 65, 0.80);
                                        }
                                    }

                                }
                            }
                        }

                    }
                }

                &.megamenu-item {
                    .sub-menu-wrapper {
                        .sub-menu__inner {
                            .sub-menu--megamenu {
                                display: flex;
                                gap: 50px;

                                >.menu-item {
                                    flex: 1; /* equal-width columns */

                                    @media(max-width: 991px) {
                                        flex: none;
                                        width: 100%;
                                    }
                                }
                            }
                        }

                        .sub-menu__inner {
                            &.has-featured-2-cols-full {
                                .sub-menu--megamenu {
                                    >.menu-item {
                                        width: 100%;
                                                       
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

/* ── Card width constraint (flat override, nesting unreliable) ───────────── */
/* width: 100% ensures 1fr in the grid resolves against the full card width   */
/* rather than collapsing to fit-content (the nested base rule).               */
.sub-menu__inner.has-featured-2-cols-full {
    width: 100% !important;
    max-width: 1270px;
}

/* ── Fix column spacing ───────────────────────────────────────────────────── */
/* Replace 12-column rigid grid with auto-sized columns so menu columns        */
/* shrink to content width instead of stretching to fixed fractions.           */
.sub-menu.has-featured-2-cols {
    display: grid !important;
    grid-template-columns: auto auto 1fr !important;
    column-gap: 50px !important;
    padding-left: 0 !important;
}

.sub-menu.has-featured-2-cols > li:first-child {
    grid-column: 1 !important;
    border-right: 1px solid rgba(14, 8, 65, 0.08);
    padding-right: 50px !important;
}

.sub-menu.has-featured-2-cols > li:nth-child(2) {
    grid-column: 2 !important;
    padding-right: 50px !important;
    border-right: none !important;
}

.sub-menu.has-featured-2-cols > li.menu-item-has-featured-2-cols {
    grid-column: 3 !important;
    min-width: 480px !important;
}

.sub-menu.has-featured-2-cols > li {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* ── has-featured-2-cols: mobile reset ───────────────────────────────────── */
@media(max-width: 991px) {
    .sub-menu.has-featured-2-cols {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        column-gap: 0 !important;
        gap: 0 !important;
    }

    .sub-menu.has-featured-2-cols > li {
        margin-bottom: 24px !important;
    }

    .sub-menu.has-featured-2-cols > li:last-child {
        margin-bottom: 0 !important;
    }

    .sub-menu.has-featured-2-cols > li:first-child,
    .sub-menu.has-featured-2-cols > li:nth-child(2),
    .sub-menu.has-featured-2-cols > li.menu-item-has-featured-2-cols {
        grid-column: auto !important;
        border-right: none !important;
        padding-right: 0 !important;
        min-width: unset !important;
    }
}

/* ── Featured-2-cols: background-cover approach ───────────────────────────── */
.mega-menu-featured-2-cols {
    position: relative;
    display: flex !important;
    align-items: center;
    height: 100%;
    overflow: hidden;
    /* Let the inline background-image through — just control size/position */
    background-size: cover !important;
    background-position: 0% 50% !important;
    border-radius: 8px;

    @media(max-width: 991px) {
        background-image: none !important;
        height: auto;
        border-radius: 0;
    }
}

/* Gradient: solid white covers only the text area, fades quickly after */
/* .mega-menu-featured-2-cols::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
} */

.mega-menu-featured-2-cols .featured-col-left {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    width: 240px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 24px 8px 0;
}

.mega-menu-featured-2-cols .featured-col-left .section-title {
    font-size: 34px;
    margin-bottom: 12px;
    color: #0E0841;
}

.mega-menu-featured-2-cols .featured-col-left .section-content {
    font-size: 16px;
    line-height: 20px;
    font-weight: 400;
    margin-bottom: 20px;
}

.mega-menu-featured-2-cols .featured-col-left .btn {
    display: inline-flex !important;
    width: auto !important;
    min-width: unset !important;
    align-self: flex-start !important;
    font-size: 14px;
    line-height: 18px;
    font-weight: 500;
    padding: 8px 38px 8px 18px !important;
}

/* Hide the <img> — background-image handles the visual */
.mega-menu-featured-2-cols > img {
    display: none !important;
}

/* ── Featured column: full-bleed background-image card ──────────────────── */
/* Applied when a featured menu item has an image (adds .menu-item-has-featured-bg  */
/* to the <li> and .mega-menu-featured--bg + inline background-image to the card).  */

/* Column becomes a flex column so the card can stretch to full height */
.sub-menu--single  > li.menu-item-has-featured-bg,
.sub-menu--multiple > li.menu-item-has-featured-bg {
    display: flex;
    flex-direction: column;
}

/* Mobile: add breathing room above the featured card */
@media (max-width: 991px) {
    li.menu-item-has-featured-bg {
        margin-top: 16px;
    }
}

/* Hide the column header label — the card is fully self-contained */
.menu-item-has-featured-bg > a {
    display: none !important;
}

/* The card itself */
.mega-menu-featured--bg {
    flex: 1;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background-size: cover;
    background-position: center center;
    padding: 28px 24px;
    margin-top: 0 !important; /* override the a + .mega-menu-featured rule */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 180px;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.mega-menu-featured--bg:hover {
    filter: brightness(1.1);
}

/* Hide the fallback <img> — background-image handles the visual */
.mega-menu-featured--bg img {
    display: none !important;
}

/* Title — Garnett Medium 18px, white */
.mega-menu-featured--bg .section-title {
    font-family: 'Garnett', system-ui, sans-serif !important;
    font-size: 24px !important;
    font-weight: 500 !important;
    line-height: 1.35 !important;
    color: #ffffff !important;
    white-space: normal !important;
    margin-bottom: 16px !important;
}

/* Description */
.mega-menu-featured--bg .section-content {
    font-family: 'Garnett', system-ui, sans-serif !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: rgba(255, 255, 255, 0.80) !important;
    white-space: normal !important;
    margin-bottom: 20px !important;
}

/* btn-secondary link — push to bottom, white color on dark card */
.mega-menu-featured--bg .section-link {
    margin-top: auto !important;  /* push to bottom of card */
    margin-right: 0 !important;   /* reset in case any generic a rule interferes */
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    color: #ffffff !important;
}

/* Prevent the generic li a:hover background from flashing under the button */
.mega-menu-featured--bg .section-link:hover {
    background: transparent !important;
}

/* Stretched link — makes the entire card clickable via the Read More anchor.
   Because .section-link is not positioned, the ::after is placed relative to
   .mega-menu-featured--bg (position: relative), covering the whole card.    */
.mega-menu-featured--bg .section-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* ── Sub-group header within a column (depth 3+) ────────────────────────── */
/* e.g. "Enterprise Scale & Security" nested inside the "Data" column.       */
/* Needs high-specificity overrides to beat the generic li a:not(.btn) rule. */
.sub-menu__inner li.menu-subgroup-header {
    margin-top: 0px;
    padding-top: 24px;
}

.sub-menu__inner li.menu-subgroup-header > a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Garnett', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600 !important;
    color: #0E0841;
    white-space: nowrap;
    cursor: default;
    pointer-events: none;
    /* Reset hover hit-area offsets from the generic li a rule */
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0;
    background: transparent !important;
    transition: none;
}

.sub-menu__inner li.menu-subgroup-header > a:hover {
    background: transparent !important;
}

.sub-menu__inner li.menu-subgroup-header > a:hover .menu-item__content-title {
    color: #0E0841 !important;
}

/* Items inside the sub-group */
.sub-menu__inner li.menu-subgroup-header > a + .sub-menu {
    margin-top: 16px;
    display: grid;
    gap: 16px;
}
