/* Fixed positioning also works when the page wrapper has overflow: hidden. */
body #masthead.sft-fixed-header {
    position: fixed !important;
    top: var(--sft-admin-offset, 0px) !important;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 990;
}
.sft-header-spacer { height: var(--sft-header-height, 0px); }
html { scroll-padding-top: calc(var(--sft-header-height, 0px) + var(--sft-admin-offset, 0px) + 12px); }
body #masthead.sft-scrolled { box-shadow: 0 4px 20px #0002; }
body:not(.ast-theme-transparent-header) #masthead.sft-fixed-header { background: #fff; }
body.ast-theme-transparent-header #masthead.sft-scrolled { background: #00263f; }

/* Keep the catalog visible over the transparent home-page header too. */
#masthead .ast-builder-menu-2 .menu-item > .menu-link {
    color: #d7a569 !important;
}

@media (max-width: 921px) {
    #masthead #ast-mobile-header .ast-builder-grid-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        column-gap: 10px;
    }
    #masthead #ast-mobile-header .site-header-primary-section-right { gap: 6px; }
    #masthead #ast-mobile-header .ast-builder-menu-2 { flex: 0 0 auto; width: auto; padding: 0; margin: 0; }
    #masthead #ast-mobile-header .ast-builder-menu-2 :is(.ast-main-header-bar-alignment, .main-header-bar-navigation, .main-navigation, .main-header-menu) {
        display: flex !important;
        width: auto;
        margin: 0;
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }
    #masthead #ast-mobile-header .ast-builder-menu-2 .menu-item { width: auto; border: 0; }
    #masthead #ast-mobile-header .ast-builder-menu-2 .menu-link {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 0 8px;
        white-space: nowrap;
        word-break: normal;
        writing-mode: horizontal-tb;
        line-height: 1.2;
        font-size: 13px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: .04em;
        background: transparent;
        border: 0;
    }
    #masthead #ast-mobile-header .ast-builder-menu-2 .menu-link[aria-expanded]::after {
        content: '';
        width: 6px;
        height: 6px;
        border-right: 1px solid currentColor;
        border-bottom: 1px solid currentColor;
        transform: rotate(45deg);
        margin-left: 8px;
        margin-top: -4px;
    }
}
@media (max-width: 544px) {
    #masthead #ast-mobile-header .ast-primary-header-bar { padding-left: 12px; padding-right: 12px; }
    #masthead #ast-mobile-header .ast-builder-grid-row { grid-template-columns: minmax(0, 1fr) auto; column-gap: 4px; }
    #masthead #ast-mobile-header .site-header-primary-section-center { display: none; }
    #masthead #ast-mobile-header .site-header-primary-section-left { min-width: 0; }
    #masthead #ast-mobile-header .site-branding { padding: 6px 0; }
    #masthead #ast-mobile-header .custom-logo-link img { width: 120px; max-width: 100%; height: auto; }
    #masthead #ast-mobile-header .site-header-primary-section-right { gap: 10px; }
    #masthead #ast-mobile-header .site-header-primary-section-right > .ast-builder-layout-element { padding-left: 0; padding-right: 0; margin-left: 0; margin-right: 0; }
}
/* Replace hover-only flyouts on narrow/touch screens; desktop keeps its original menu. */
@media (max-width: 1024px), (hover: none) {
    body > .gg-catalog-menu:not(.sft-catalog-panel) { display: none !important; }
}
body .gg-catalog-menu.sft-catalog-panel {
    display: block !important;
    position: fixed !important;
    box-sizing: border-box;
    width: min(360px, calc(100vw - 24px));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #00263f;
    border-top: 2px solid #d7a569;
    box-shadow: 0 16px 40px #0004;
    z-index: 9990;
    opacity: 1;
    visibility: visible;
    transition: none;
}
body .sft-catalog-panel[hidden] { display: none !important; }
body .sft-catalog-panel .gg-cm-item { position: relative; }
body .sft-catalog-panel .gg-cm-link { min-height: 44px; padding: 12px 18px !important; overflow-wrap: anywhere; }
body .sft-catalog-panel .sft-has-children > .gg-cm-link { padding-right: 58px !important; }
body .sft-catalog-panel .gg-cm-arrow { display: none; }
body .sft-catalog-panel .gg-cm-submenu {
    position: static;
    width: auto;
    min-height: 0;
    margin: 0 12px !important;
    padding: 0 0 8px 10px !important;
    opacity: 1;
    visibility: visible;
    border: 0;
    border-left: 1px solid #d7a56966;
    transition: none;
}
body .sft-catalog-panel .gg-cm-submenu[hidden] { display: none !important; }
body .sft-catalog-panel .gg-cm-submenu::before,
body .sft-catalog-panel::before { display: none; }
body .sft-catalog-panel .sft-submenu-toggle {
    position: absolute;
    right: 4px;
    top: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #d7a569;
    font-size: 22px;
    line-height: 1;
}
body .sft-catalog-panel :is(a, button):focus-visible,
#masthead .ast-builder-menu-2 a:focus-visible { outline: 2px solid #d7a569; outline-offset: -3px; }
@media print {
    body #masthead.sft-fixed-header { position: static !important; }
    .sft-header-spacer, body .sft-catalog-panel { display: none !important; }
}
