/*
 * Global navigation layout.
 *
 * The translation script replaces short Chinese labels after the initial
 * render. Every desktop menu item must therefore be sized from its current
 * text instead of retaining the original Chinese width.
 */
@media (min-width: 992px) {
    .header .navbar-top .navbar-nav {
        display: flex !important;
        align-items: center;
        flex-wrap: nowrap;
        width: max-content;
        max-width: none;
    }

    .header .navbar-top .navbar-nav > li {
        float: none;
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: none !important;
    }

    .header .navbar-top .navbar-nav > li > a {
        display: inline-flex;
        align-items: center;
        flex: 0 0 auto;
        width: auto !important;
        min-width: max-content;
        max-width: none !important;
        overflow: visible !important;
        white-space: nowrap !important;
        text-overflow: clip !important;
    }

    .header .navbar-top .navbar-nav > li > a > .menu-item-title {
        display: inline-block;
        width: auto !important;
        min-width: max-content;
        max-width: none !important;
        overflow: visible !important;
        white-space: nowrap !important;
        text-overflow: clip !important;
    }
}

/* Leave more horizontal room for translations on medium desktop screens. */
@media (min-width: 992px) and (max-width: 1280px) {
    .header .navbar-top .navbar-nav {
        margin-right: 8px;
        margin-left: 8px;
    }

    .header .navbar-top .navbar-nav > li > a {
        padding-right: 10px;
        padding-left: 10px;
    }
}

/* Mobile submenu labels need the full drawer width in longer languages. */
@media (max-width: 991px) {
    .header .mobile-menus .sub-menu > li {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
    }

    .header .mobile-menus .sub-menu > li > a {
        display: block !important;
        box-sizing: border-box;
        width: 100% !important;
        max-width: none !important;
        overflow: visible !important;
        white-space: normal !important;
        text-overflow: clip !important;
    }

    .header .mobile-menus .sub-menu .menu-item-title {
        white-space: normal !important;
    }
}
