/* Keep Blocksy's native trigger styling and show it only for narrow desktops. */
#header .morlion-menu2-trigger {
    display: none;
}

@media (min-width: 1000px) and (max-width: 1299.98px) {
    #header [data-device="desktop"] [data-row="middle"] [data-id="menu-secondary"] {
        display: none;
    }

    #header .morlion-menu2-trigger {
        display: inline-flex;
    }

    /* Match the native tablet trigger on the transparent home header. */
    body.home:not([data-header*="shrink"]) #header .morlion-menu2-trigger {
        --theme-link-initial-color: var(--theme-palette-color-8, #fff);
        --theme-link-hover-color: var(--theme-palette-color-8, #fff);
        --theme-icon-color: var(--theme-palette-color-8, #fff);
        --theme-icon-hover-color: var(--theme-palette-color-8, #fff);
    }

    /* Align the right-hand controls on the same baseline as the native trigger. */
    #header [data-device="desktop"] [data-row="middle"] [data-column="end"] [data-items="primary"] > .ct-header-search,
    #header [data-device="desktop"] [data-row="middle"] [data-column="end"] [data-items="primary"] > .ct-header-text {
        margin-bottom: 0 !important;
        margin-right: 10px;
    }

    /* Open the actual theme mobile panel, including all Header Builder items. */
    #offcanvas .ct-panel-content[data-device="desktop"] {
        display: none;
    }

    #offcanvas .ct-panel-content[data-device="mobile"] {
        display: flex;
    }

    /* Extend the site's existing mobile logo treatment to this breakpoint. */
    #offcanvas .ct-panel-content[data-device="mobile"] .ct-header-text[data-id="T4bIv3"] {
        width: max-content !important;
        grid-column: 1 !important;
        grid-row: 1 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    #offcanvas .ct-panel-content[data-device="mobile"] .offcanvas-html-logo img {
        display: block !important;
        width: auto !important;
        height: 48px !important;
        max-height: 48px !important;
    }

    #offcanvas .ct-panel-content[data-device="mobile"] .ct-panel-content-inner {
        display: grid;
        grid-template-columns: 1fr auto 15%;
        align-items: start;
        align-content: start;
        padding-top: 0;
    }

    #offcanvas .ct-panel-content[data-device="mobile"] .ct-panel-content-inner > * {
        grid-column: 1 / -1;
    }

    #offcanvas .ct-panel-content[data-device="mobile"] .ct-panel-content-inner > :has(.trp-shortcode-switcher__wrapper) {
        grid-column: 2;
        grid-row: 1;
        margin: 0;
    }

    #offcanvas .ct-panel-content[data-device="mobile"] .langcu {
        margin-right: 80px;
    }

    #offcanvas .ct-panel-content[data-device="mobile"] [data-id="mobile-menu"] {
        margin: 10px 0 0;
    }

    #offcanvas .ct-panel-content[data-device="mobile"] [data-id="QpLLGg"] {
        --theme-text-color: var(--theme-palette-color-5);
        --theme-link-initial-color: var(--theme-palette-color-2);
        --theme-font-size: 14px;
        width: 100%;
        margin-bottom: 15px;
    }

    #offcanvas .ct-panel-content[data-device="mobile"] .ct-header-divider {
        --divider-style: 1px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 15px;
    }

    /* Blocksy's sticky script reserves the header height from each row's
       --height variable. In this band the secondary menu is swapped for the
       compact trigger above, and the reserved height comes out at 100px while
       the header actually draws 80px - a 20px discrepancy that exists only
       between 1000px and 1299.98px. Pin the container so the reserved and
       rendered heights agree and nothing is corrected after load. */
    #header [data-device="desktop"] .ct-sticky-container {
        height: 80px !important;
    }

}

/* Header phone and email tooltips. */
#header .ct-contact-info li {
    position: relative;
}

#header .ct-contact-info li::before,
#header .ct-contact-info li > .contact-info {
    position: absolute;
    left: 50%;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -5px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

#header .ct-contact-info li::before {
    content: '';
    top: calc(100% + 6px);
    border: 7px solid transparent;
    border-bottom-color: #fff;
    pointer-events: none;
}

#header .ct-contact-info li > .contact-info {
    top: calc(100% + 20px);
    display: block;
    width: auto;
    height: auto;
    min-width: max-content;
    max-width: min(320px, 80vw);
    padding: 10px 14px;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(10, 58, 35, 0.2);
    color: #00803f;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
    white-space: nowrap;
    pointer-events: none;
    user-select: text;
    -webkit-user-select: text;
}

#header .ct-contact-info li > .contact-info a {
    color: inherit;
    user-select: text;
    -webkit-user-select: text;
}

#header .ct-contact-info li:hover::before,
#header .ct-contact-info li:hover > .contact-info,
#header .ct-contact-info li:focus-within::before,
#header .ct-contact-info li:focus-within > .contact-info,
#header .ct-contact-info li.is-contact-open::before,
#header .ct-contact-info li.is-contact-open > .contact-info {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

#header .ct-contact-info li:hover > .contact-info,
#header .ct-contact-info li:focus-within > .contact-info,
#header .ct-contact-info li.is-contact-open > .contact-info {
    pointer-events: auto;
}


/* German, French, Spanish, Portuguese and Russian menu labels are longer than English. Just above the
   hamburger breakpoint, shrink them slightly so the last item stays clear of the search icon. */
@media (min-width: 1300px) and (max-width: 1439.98px) {
    html:is([lang^="de"], [lang^="fr"], [lang^="es"], [lang^="pt"], [lang^="ru"]) [data-header*="type-1"] .ct-header [data-id="menu-secondary"] > ul > li > a {
        --theme-font-size: 13px;
    }
}

/* Blocksy gives off-canvas menu items 12px vertical padding only on phones (<690px) and 5px everywhere else,
   which leaves the tablet and 1000-1299px hamburger menus cramped. Use the phone spacing up to 1299.98px. */
@media (min-width: 690px) and (max-width: 1299.98px) {
    #offcanvas [data-id="mobile-menu"] {
        --items-vertical-spacing: 12px;
    }
}
