/*
|--------------------------------------------------------------------------
| PRCF GLOBAL DIGITAL INSTITUTION
| HEADER NAVIGATION FINAL
|--------------------------------------------------------------------------
*/

.site-header,
.main-header,
.main-header-inner,
.primary-navigation {
    overflow: visible;
}

.main-header {
    position: relative;
    z-index: 900;
}

.main-header-inner {
    position: relative;
}

.primary-navigation {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: clamp(.45rem, .8vw, .9rem);
    min-width: 0;
}


/* ============================================================
   PARENT ITEMS
============================================================ */

.nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.nav-parent-row {
    display: inline-flex;
    align-items: center;
    gap: .08rem;
    white-space: nowrap;
}

.nav-parent-link {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.nav-dropdown-toggle {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 1.5rem;
    min-width: 1.5rem;
    height: 2rem;

    padding: 0;
    margin: 0;

    cursor: pointer;
    font-size: .7rem;
}


/* ============================================================
   DESKTOP MEGA DROPDOWN
============================================================ */

.nav-submenu {
    position: absolute;

    top: calc(100% + .5rem);
    left: 50%;

    z-index: 1500;

    display: grid;
    grid-template-columns:
        repeat(
            2,
            minmax(
                180px,
                1fr
            )
        );

    gap: .35rem;

    width: max-content;
    min-width: 390px;
    max-width:
        min(
            620px,
            calc(100vw - 2rem)
        );

    padding: .8rem;

    border:
        1px solid
        var(--border);

    border-radius: 12px;

    background:
        var(--surface);

    box-shadow:
        0 18px 48px
        rgba(
            0,
            0,
            0,
            .28
        );

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform:
        translate(
            -50%,
            .35rem
        );

    transition:
        opacity .14s ease,
        transform .14s ease,
        visibility .14s ease;
}


/*
 * Hover bridge:
 * Pointer can move from parent into menu
 * without the dropdown disappearing.
 */

.nav-submenu::before {
    content: "";

    position: absolute;

    left: 0;
    right: 0;

    top: -.7rem;

    height: .75rem;
}


.nav-submenu > a {
    display: flex;

    align-items: center;

    min-height: 44px;

    padding:
        .7rem
        .8rem;

    border-radius: 8px;

    color:
        var(--text);

    text-decoration: none;

    white-space: normal;

    line-height: 1.45;
}


.nav-submenu > a:hover,
.nav-submenu > a:focus-visible {
    background:
        rgba(
            255,
            255,
            255,
            .055
        );

    outline: none;
}


.nav-dropdown:hover > .nav-submenu,
.nav-dropdown:focus-within > .nav-submenu,
.nav-dropdown.is-open > .nav-submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform:
        translate(
            -50%,
            0
        );
}


/* ============================================================
   EDGE SAFETY
============================================================ */

#who-we-are-navigation > .nav-submenu {
    left: 0;

    transform:
        translate(
            0,
            .35rem
        );
}


#who-we-are-navigation:hover > .nav-submenu,
#who-we-are-navigation:focus-within > .nav-submenu,
#who-we-are-navigation.is-open > .nav-submenu {
    transform:
        translate(
            0,
            0
        );
}


#international-navigation > .nav-submenu {
    left: auto;
    right: 0;

    transform:
        translate(
            0,
            .35rem
        );
}


#international-navigation:hover > .nav-submenu,
#international-navigation:focus-within > .nav-submenu,
#international-navigation.is-open > .nav-submenu {
    transform:
        translate(
            0,
            0
        );
}


/* ============================================================
   BURMESE DESKTOP PROTECTION
============================================================ */

html[lang="my"] .primary-navigation {
    gap:
        clamp(
            .3rem,
            .55vw,
            .65rem
        );
}


html[lang="my"]
.primary-navigation > a,

html[lang="my"]
.nav-parent-link {
    font-size: .84em;

    line-height: 1.35;
}


html[lang="my"]
.nav-submenu > a {
    font-size: .92rem;

    line-height: 1.65;
}


/* ============================================================
   MEDIUM DESKTOP
============================================================ */

@media (
    max-width: 1180px
)
and
(
    min-width: 901px
) {

    .primary-navigation {
        gap: .35rem;
    }


    .primary-navigation > a,
    .nav-parent-link {
        font-size: .86rem;
    }


    html[lang="my"]
    .primary-navigation > a,

    html[lang="my"]
    .nav-parent-link {
        font-size: .78rem;
    }


    .nav-submenu {
        min-width: 350px;
    }

}


/* ============================================================
   MOBILE
============================================================ */

@media (
    max-width: 900px
) {

    .primary-navigation {
        width: 100%;

        flex-direction: column;

        align-items: stretch;

        gap: 0;
    }


    .nav-dropdown,
    .nav-parent-row {
        width: 100%;
    }


    .nav-parent-row {
        justify-content: space-between;
    }


    .nav-parent-link {
        flex:
            1
            1
            auto;

        white-space: normal;
    }


    .nav-dropdown-toggle {
        width: 44px;

        min-width: 44px;

        height: 44px;
    }


    .nav-submenu,

    #who-we-are-navigation
    > .nav-submenu,

    #international-navigation
    > .nav-submenu {

        position: static;

        display: none;

        grid-template-columns: 1fr;

        width: 100%;

        min-width: 0;

        max-width: none;

        padding:
            .35rem
            0
            .7rem
            1rem;

        border: 0;

        border-radius: 0;

        background: transparent;

        box-shadow: none;

        opacity: 1;

        visibility: visible;

        pointer-events: auto;

        transform: none;
    }


    .nav-submenu::before {
        display: none;
    }


    .nav-dropdown.is-open
    > .nav-submenu {

        display: grid;

        transform: none;
    }


    .nav-submenu > a {
        min-height: 40px;

        padding:
            .55rem
            .7rem;

        white-space: normal;
    }

}