/**
 * Site header + mobile drawer navigation.
 * Loaded last so it wins over home-modern.css / site-pages.css.
 */

#siteHeader.hp-header {
    position: sticky;
    top: var(--hp-ticker-h, 2.125rem);
    z-index: 250;
    background: #fff;
    border-bottom: 1px solid var(--hp-border, #e2e8f0);
}

#siteHeader .hp-header-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    position: relative;
}

#siteHeader .hp-logo {
    flex: 0 0 auto;
    min-width: 0;
    max-width: calc(100% - 3.5rem);
}

#siteHeader #mainNav.hp-nav,
#siteHeader #mainNav.hp-nav--enterprise {
    display: flex;
    flex: 1 1 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem 1rem;
    min-width: 0;
}

#siteHeader .hp-nav-primary,
#siteHeader .hp-nav-primary.hp-nav-menu {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.1rem 0.25rem;
    width: auto;
    max-width: none;
}

#siteHeader .hp-nav-utility {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    gap: 0.45rem;
    width: auto;
    padding-left: 0.75rem;
    margin-left: 0.15rem;
    border-left: 1px solid var(--hp-border, #e2e8f0);
}

#siteHeader .hp-nav-cluster {
    position: relative;
    display: block;
    width: auto;
    flex-shrink: 0;
}

#siteHeader .hp-nav-link-top,
#siteHeader .hp-nav-cluster-toggle {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    width: auto;
    flex-shrink: 0;
}

@media (min-width: 901px) {
    .hp-mobile-nav-head {
        display: none !important;
    }

    #siteHeader .hp-mobile-nav-scroll {
        display: flex;
        flex: 1 1 auto;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-end;
        gap: 0.75rem 1rem;
        min-width: 0;
        overflow: visible;
        padding: 0;
    }
}

/* Mobile drawer title — desktop hidden */
.hp-mobile-nav-head {
    display: none;
}

@media (min-width: 901px) and (max-width: 1200px) {
    #siteHeader .hp-nav-link-top,
    #siteHeader .hp-nav-cluster-toggle {
        font-size: 0.8125rem;
        padding: 0.4rem 0.5rem;
    }

    #siteHeader .hp-nav-utility {
        padding-left: 0.5rem;
        gap: 0.35rem;
    }
}

/* ---- Mobile drawer ---- */
.hp-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 480;
    background: rgba(15, 23, 42, 0.5);
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body.hp-nav-open .hp-nav-backdrop {
    display: block;
    animation: hp-nav-backdrop-in 0.22s ease;
}

@keyframes hp-nav-backdrop-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

body.hp-nav-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    body.hp-nav-open #mainNav.open,
    body.hp-nav-open #mainNav.open * {
        touch-action: manipulation;
    }
}

@media (max-width: 900px) {
    #siteHeader.hp-header,
    .hp-home-page .hp-header,
    .hp-saas-premium .hp-header {
        overflow: visible !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: #fff !important;
        transform: none !important;
        filter: none !important;
    }

    #siteHeader .hp-header-inner {
        overflow: visible;
        flex-wrap: nowrap;
        position: relative;
        z-index: 502;
    }

    body.hp-nav-open #siteHeader.hp-header {
        z-index: 502;
        box-shadow: 0 1px 0 var(--hp-border, #e2e8f0);
    }

    #siteHeader .hp-nav-toggle {
        display: flex;
        flex-shrink: 0;
        margin-left: auto;
        min-width: 44px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        position: relative;
        z-index: 503;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    #siteHeader #mainNav.hp-nav,
    #siteHeader #mainNav.hp-nav--enterprise,
    #mainNav.hp-nav {
        display: none !important;
    }

    #siteHeader #mainNav.hp-nav.open,
    #siteHeader #mainNav.hp-nav--enterprise.open,
    #mainNav.hp-nav.open,
    #mainNav.hp-nav--enterprise.open {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        position: fixed !important;
        top: var(--hp-mobile-nav-top, 5.75rem) !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: calc(100vh - var(--hp-mobile-nav-top, 5.75rem)) !important;
        min-height: calc(100dvh - var(--hp-mobile-nav-top, 5.75rem)) !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        z-index: 490 !important;
        overflow: hidden !important;
        background: #fff !important;
        border: none !important;
        border-top: 1px solid var(--hp-border, #e2e8f0) !important;
        border-radius: 0 !important;
        box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18) !important;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        animation: hp-mobile-nav-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    }

    @keyframes hp-mobile-nav-in {
        from {
            opacity: 0;
            transform: translateY(-8px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    #mainNav.open .hp-mobile-nav-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
        padding: 0.85rem 1rem;
        border-bottom: 1px solid var(--hp-border, #e2e8f0);
        background: #f8fafc;
    }

    #mainNav.open .hp-mobile-nav-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        margin: -0.35rem -0.35rem -0.35rem 0;
        padding: 0;
        border: none;
        border-radius: 10px;
        background: transparent;
        color: var(--hp-navy, #002443);
        font-size: 1.125rem;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        transition: background 0.15s ease, transform 0.15s ease;
    }

    #mainNav.open .hp-mobile-nav-close:active {
        transform: scale(0.94);
        background: rgba(49, 112, 222, 0.08);
    }

    #mainNav.open .hp-mobile-nav-close:focus-visible {
        outline: 2px solid var(--hp-blue, #3170de);
        outline-offset: 2px;
    }

    #mainNav.open .hp-mobile-nav-title {
        font-size: 0.8125rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--hp-navy, #002443);
    }

    #mainNav.open .hp-mobile-nav-scroll {
        flex: 1 1 auto;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 0.75rem var(--hp-edge-x, 1rem) calc(1.25rem + env(safe-area-inset-bottom, 0px));
    }

    #mainNav.open .hp-nav-primary,
    #mainNav.open .hp-nav-utility,
    #siteHeader #mainNav.open .hp-nav-primary,
    #siteHeader #mainNav.open .hp-nav-utility {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        border-left: none !important;
        padding-left: 0 !important;
        margin-left: 0 !important;
        flex-shrink: 0;
    }

    #mainNav.open .hp-nav-utility {
        margin-top: 0.65rem;
        padding-top: 0.65rem;
        border-top: 1px solid var(--hp-border, #e2e8f0);
    }

    .hp-mobile-login-tab {
        display: none;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--hp-border, #e2e8f0);
    }

    #mainNav.open .hp-mobile-login-tab {
        display: block;
    }

    #mainNav.open .hp-nav-login-cluster-desktop {
        display: none !important;
    }

    .hp-mobile-login-tab-title {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin: 0 0 0.65rem;
        font-size: 0.8125rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--hp-navy, #002443);
    }

    .hp-mobile-login-tab-list {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }

    .hp-mobile-login-tab-link {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
        min-height: 48px;
        padding: 0.65rem 0.75rem;
        border-radius: 10px;
        border: 1px solid var(--hp-border, #e2e8f0);
        background: #f8fafc;
        color: var(--hp-navy, #002443);
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    }

    .hp-mobile-login-tab-link:active {
        transform: scale(0.99);
        background: rgba(49, 112, 222, 0.08);
        border-color: rgba(49, 112, 222, 0.35);
    }

    .hp-mobile-login-tab-link.is-active {
        background: rgba(49, 112, 222, 0.1);
        border-color: rgba(49, 112, 222, 0.45);
    }

    .hp-mobile-login-tab-link-title {
        font-size: 1rem;
        font-weight: 700;
        line-height: 1.25;
    }

    .hp-mobile-login-tab-link-desc {
        font-size: 0.8125rem;
        color: var(--hp-muted, #64748b);
        line-height: 1.35;
    }

    #mainNav.open .hp-nav-link-top,
    #mainNav.open .hp-nav-cluster-toggle,
    #mainNav.open .hp-nav-cluster,
    #mainNav.open .hp-nav-utility .hp-btn,
    #mainNav.open .hp-nav-utility a {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        white-space: normal !important;
        word-break: break-word;
        text-align: left !important;
        justify-content: space-between !important;
        align-items: center !important;
        min-height: 48px !important;
        padding: 0.65rem 0.75rem !important;
        border-radius: 10px !important;
        font-size: 1rem !important;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    #mainNav.open .hp-nav-link-top.is-active,
    #mainNav.open .hp-nav-cluster-toggle.is-active {
        background: rgba(49, 112, 222, 0.08);
        color: var(--hp-navy, #002443);
    }

    /* Beat home-modern.css + site-pages.css display:none on sub-panels */
    #mainNav.open .hp-nav-cluster-panel,
    #mainNav.open .hp-nav--enterprise .hp-nav-cluster-panel {
        display: block !important;
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none !important;
        border: none !important;
        max-height: 0;
        overflow: hidden;
        padding: 0 0 0 0.65rem;
        margin: 0;
        min-width: 0;
        transition: max-height 0.3s ease, padding 0.2s ease;
    }

    #mainNav.open .hp-nav-cluster.is-open .hp-nav-cluster-panel {
        max-height: 36rem;
        padding: 0.25rem 0 0.5rem 0.65rem;
    }

    #mainNav.open .hp-nav-sublink {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        min-height: 44px;
        padding: 0.5rem 0.65rem;
        border-radius: 8px;
        white-space: normal;
        word-break: break-word;
    }

    #mainNav.open .hp-nav-sublink-title {
        font-weight: 600;
        color: var(--hp-navy, #002443);
    }

    #mainNav.open .hp-nav-sublink-desc {
        font-size: 0.8125rem;
        color: var(--hp-muted, #64748b);
        margin-top: 0.15rem;
    }

    #mainNav.open .hp-nav-cluster {
        width: 100% !important;
    }

    #mainNav.open .hp-nav-cluster-toggle i {
        transition: transform 0.2s ease;
    }

    #mainNav.open .hp-nav-cluster.is-open .hp-nav-cluster-toggle i {
        transform: rotate(180deg);
    }

    #mainNav.open .hp-nav-utility .hp-btn-nav-signup {
        justify-content: center !important;
        margin-top: 0.35rem;
        background: linear-gradient(135deg, var(--hp-navy, #002443) 0%, #3170de 100%) !important;
        color: #fff !important;
        font-weight: 700;
        border: none !important;
        box-shadow: 0 8px 20px rgba(49, 112, 222, 0.28);
    }

    #mainNav.open .hp-nav-utility .hp-btn-nav-login {
        justify-content: center !important;
        border: 1px solid var(--hp-border, #e2e8f0);
        background: #fff;
        font-weight: 600;
    }

    #mainNav.open .hp-nav-link-top:active,
    #mainNav.open .hp-nav-cluster-toggle:active,
    #mainNav.open .hp-nav-sublink:active {
        background: rgba(49, 112, 222, 0.06);
    }

    #siteHeader .hp-nav-toggle:focus-visible {
        outline: 2px solid var(--hp-blue, #3170de);
        outline-offset: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #mainNav.hp-nav.open,
    body.hp-nav-open .hp-nav-backdrop {
        animation: none !important;
    }

    #mainNav.open .hp-nav-cluster-panel {
        transition: none !important;
    }
}

html.hp-page-root {
    scroll-padding-top: calc(var(--hp-ticker-h, 2.125rem) + var(--hp-header-h, 4.5rem) + 0.35rem);
}

.hp-home-page .hp-section[id],
.hp-home-page main [id],
.hp-inner-page .hp-section[id],
.hp-inner-page main [id] {
    scroll-margin-top: calc(var(--hp-ticker-h, 2.125rem) + var(--hp-header-h, 4.5rem) + 0.5rem);
}

@media (max-width: 900px) {
    .hp-inner-page #siteHeader.hp-header,
    .hp-inner-page .hp-header {
        overflow: visible !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .hp-inner-page .hp-inner-main {
        padding-top: 0;
    }
}

/* Desktop (901px+) — undo mobile menu side-effects; do not change rules above 900px */
@media (min-width: 901px) {
    body.hp-nav-open {
        overflow: visible !important;
    }

    body.hp-nav-open .hp-nav-backdrop {
        display: none !important;
    }

    #siteHeader .hp-nav-toggle {
        display: none !important;
    }

    .hp-mobile-login-tab,
    #mainNav .hp-mobile-nav-head {
        display: none !important;
    }

    #siteHeader #mainNav.hp-nav,
    #siteHeader #mainNav.hp-nav--enterprise,
    #siteHeader #mainNav.hp-nav.open,
    #siteHeader #mainNav.hp-nav--enterprise.open,
    #mainNav.hp-nav,
    #mainNav.hp-nav.open {
        display: flex !important;
        position: static !important;
        inset: auto !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        flex-direction: row !important;
        align-items: center !important;
        animation: none !important;
        transform: none !important;
    }

    #siteHeader .hp-mobile-nav-scroll {
        display: flex !important;
        flex: 1 1 auto !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    #siteHeader .hp-nav-primary,
    #siteHeader .hp-nav-utility,
    #siteHeader #mainNav .hp-nav-primary,
    #siteHeader #mainNav .hp-nav-utility {
        flex-direction: row !important;
        width: auto !important;
        border-top: none !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    #siteHeader .hp-nav-login-cluster-desktop {
        display: block !important;
    }

    #siteHeader .hp-nav-link-top,
    #siteHeader .hp-nav-cluster-toggle,
    #siteHeader .hp-nav-utility .hp-btn {
        width: auto !important;
        min-height: 0 !important;
        justify-content: center !important;
    }
}
