/* ===== Mega menu fit-to-screen fix (desktop) ===== */
@media (min-width: 992px) {

    /* Remove every positioned ancestor between the menu and the header,
       so the menu centres on the whole header instead of the link */
    .header .header-main,
    .header .fgs-header-container,
    .header nav.navbar,
    .header .navbar-collapse,
    .header .navbar-nav,
    .header .navbar-nav > .nav-item.dropdown {
        position: static !important;
    }

    .header .navbar .dropdown .dropdown-menu.max {
    position: absolute !important;
    top: 100% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    margin: 0 !important;
}

    /* the template forces each link to 310px wide, which pushes columns out */
    .header .navbar .dropdown .dropdown-menu.max li a,
    .header .navbar .dropdown .dropdown-menu.max .nav-link {
        min-width: 0 !important;
    }
}

/* Small laptops: slightly tighter */
@media (min-width: 992px) and (max-width: 1280px) {
    .header .navbar .dropdown-menu.max .nav-link {
        font-size: 13.5px;
        padding-top: 6px;
        padding-bottom: 6px;
    }
}

/* Tablets and phones: the inline 1040px width would overflow */
@media (max-width: 991px) {
    .header .navbar .dropdown .dropdown-menu.max {
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        position: static !important;
    }
}