.mhb-site-header {
    --mhb-header-bg: color-mix(in srgb, var(--mhb-bg) 72%, transparent);
    --mhb-header-glass: color-mix(in srgb, var(--mhb-bg) 88%, transparent);
    --mhb-header-line: color-mix(in srgb, var(--mhb-border) 72%, transparent);

    background: var(--mhb-header-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid transparent;
    color: var(--mhb-text);
    font-family: var(--mhb-font-display);
    position: sticky;
    top: 0;
    transition: background 0.28s ease, border-color 0.28s ease,
        box-shadow 0.28s ease;
    width: 100%;
    z-index: 50;
}

.mhb-site-header.is-scrolled,
.mhb-site-header.is-menu-open {
    background: var(--mhb-header-glass);
    border-color: var(--mhb-header-line);
    box-shadow: 0 18px 60px -48px var(--mhb-text);
}

.mhb-site-header__inner {
    align-items: center;
    display: flex;
    height: 80px;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 1280px;
    /* padding: 0 40px; */
    transition: height 0.28s ease, padding 0.28s ease;
}

.mhb-site-header.is-scrolled .mhb-site-header__inner {
    height: 68px;
}

.mhb-site-header__brand,
.mhb-site-header__nav,
.mhb-site-header__actions {
    align-items: center;
    display: flex;
}

.mhb-site-header__brand {
    color: var(--mhb-text);
    gap: 12px;
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.mhb-site-header__brand:hover {
    opacity: 0.82;
}

.mhb-site-header__mark {
    align-items: center;
    background: var(--mhb-brand-gradient, linear-gradient(135deg, #ffffff 0%, var(--mhb-blue) 45%, var(--mhb-violet) 100%));
    border-radius: 25px;
    color: #000000;
    display: flex;
    font-family: var(--mhb-font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    height: 36px;
    justify-content: center;
    letter-spacing: 0.05em;
    width: 36px;
}

.mhb-site-header__name {
    font-size: 0.95em;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Image logos: swapped per active color mode. Mirrors the theme logic in
   global.css (default = dark, .light override, prefers-color-scheme fallback). */
.mhb-site-header__logo {
    display: none;
    width: auto;
    -o-object-fit: contain;
       object-fit: contain;
}

.mhb-site-header__logo--dark {
    display: block;
}

[data-mhb-theme="light"] .mhb-site-header__logo--dark {
    display: none;
}

[data-mhb-theme="light"] .mhb-site-header__logo--light {
    display: block;
}

@media (prefers-color-scheme: light) {
    :root:not([data-mhb-theme="dark"]) .mhb-site-header__logo--dark {
        display: none;
    }

    :root:not([data-mhb-theme="dark"]) .mhb-site-header__logo--light {
        display: block;
    }
}

.mhb-site-header__nav {
    gap: 40px;
}

.mhb-site-header__nav a {
    color: var(--mhb-text-muted);
    font-size: 0.875em;
    font-weight: 600;
    letter-spacing: 0.01em;
    position: relative;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
    will-change: transform;
}

.mhb-site-header__nav a::after {
    background: linear-gradient(90deg, var(--mhb-brand, var(--mhb-blue)), var(--mhb-brand-secondary, var(--mhb-violet)));
    border-radius: 999px;
    bottom: -9px;
    content: "";
    height: 2px;
    left: 0;
    opacity: 0;
    position: absolute;
    transform: scaleX(0.45);
    transform-origin: left center;
    transition: opacity 0.22s ease, transform 0.22s ease;
    width: 100%;
}

.mhb-site-header__nav a:hover,
.mhb-site-header__nav a.is-active {
    color: var(--mhb-text);
}

.mhb-site-header__nav a:hover::after,
.mhb-site-header__nav a.is-active::after {
    opacity: 1;
    transform: scaleX(1);
}

.mhb-site-header__actions {
    gap: 16px;
}

.mhb-site-header__cta,
.mhb-site-header__mobile-cta {
    background: linear-gradient(135deg, var(--mhb-green, #22c55e), var(--mhb-teal, #14b8a6));
    border-radius: 999px;
    color: #04130a;
    font-size: 0.875em;
    font-weight: 700;
    letter-spacing: -0.01em;
    overflow: hidden;
    padding: 10px 20px;
    position: relative;
    text-decoration: none;
    transition: box-shadow 0.22s ease, transform 0.22s ease, filter 0.22s ease;
    will-change: transform;
}

.mhb-site-header__cta::before,
.mhb-site-header__mobile-cta::before {
    background: linear-gradient(
        110deg,
        transparent,
        rgba(255, 255, 255, 0.55),
        transparent
    );
    content: "";
    inset: -30% auto -30% -60%;
    position: absolute;
    transform: translateX(0) skewX(-18deg);
    transition: transform 0.55s ease;
    width: 48%;
}

.mhb-site-header__cta:hover,
.mhb-site-header__mobile-cta:hover,
.mhb-site-header__cta:focus-visible,
.mhb-site-header__mobile-cta:focus-visible {
    box-shadow: 0 12px 30px -10px rgba(34, 197, 94, 0.7);
    color: #04130a;
    filter: brightness(1.08) saturate(1.1);
    transform: translateY(-1px);
}

.mhb-site-header__cta:hover::before,
.mhb-site-header__mobile-cta:hover::before {
    transform: translateX(340%) skewX(-18deg);
}

.mhb-site-header__mobile {
    display: none;
    position: relative;
}

.mhb-site-header__mobile summary {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    list-style: none;
    padding: 10px;
}

.mhb-site-header__mobile summary::-webkit-details-marker {
    display: none;
}

.mhb-site-header__mobile summary span {
    background: var(--mhb-text-muted);
    display: block;
    height: 2px;
    transition: background 0.2s ease, transform 0.22s ease;
    width: 20px;
}

.mhb-site-header__mobile[open] summary span:first-child {
    transform: translateY(3.5px) rotate(45deg);
}

.mhb-site-header__mobile[open] summary span:last-child {
    transform: translateY(-3.5px) rotate(-45deg);
}

.mhb-site-header__mobile-panel {
    animation: mhb-mobile-panel-in 0.28s ease both;
    background: var(--mhb-header-glass);
    backdrop-filter: blur(22px);
    border-top: 1px solid var(--mhb-border);
    display: flex;
    flex-direction: column;
    gap: 0;
    left: 0;
    padding: 96px 32px 32px;
    position: fixed;
    right: 0;
    top: 80px;
}

.mhb-site-header__mobile-panel a:not(.mhb-site-header__mobile-cta) {
    animation: mhb-mobile-link-in 0.34s ease both;
    border-bottom: 1px solid var(--mhb-border);
    color: var(--mhb-text);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    padding: 16px 0;
    text-decoration: none;
}

.mhb-site-header__mobile-panel a:nth-child(2) {
    animation-delay: 0.04s;
}

.mhb-site-header__mobile-panel a:nth-child(3) {
    animation-delay: 0.08s;
}

.mhb-site-header__mobile-panel a:nth-child(4) {
    animation-delay: 0.12s;
}

.mhb-site-header__mobile-panel a:nth-child(5) {
    animation-delay: 0.16s;
}

.mhb-site-header__mobile-cta {
    align-items: center;
    animation: mhb-mobile-link-in 0.34s 0.18s ease both;
    display: flex;
    justify-content: center;
    margin-top: 32px;
    padding: 16px;
}

@keyframes mhb-mobile-panel-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mhb-mobile-link-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Header search ──────────────────────────────────────────────────── */
.mhb-site-header__search {
    position: relative;
}

.mhb-site-header__search summary {
    align-items: center;
    border-radius: 999px;
    color: var(--mhb-text-muted);
    cursor: pointer;
    display: flex;
    height: 38px;
    justify-content: center;
    list-style: none;
    transition: background 0.2s ease, color 0.2s ease;
    width: 38px;
}

.mhb-site-header__search summary::-webkit-details-marker {
    display: none;
}

.mhb-site-header__search summary:hover,
.mhb-site-header__search[open] summary {
    background: var(--mhb-surface, rgba(255, 255, 255, 0.06));
    color: var(--mhb-text);
}

.mhb-site-header__search-panel {
    animation: mhb-mobile-panel-in 0.2s ease both;
    background: var(--mhb-header-glass);
    backdrop-filter: blur(22px);
    border: 1px solid var(--mhb-border);
    border-radius: 14px;
    box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.6);
    padding: 10px;
    position: absolute;
    right: 0;
    top: calc(100% + 12px);
    width: 340px;
    z-index: 60;
}

.mhb-site-header__search-panel form {
    align-items: center;
    background: var(--mhb-surface, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--mhb-border);
    border-radius: 10px;
    display: flex;
    gap: 8px;
    padding: 4px 4px 4px 12px;
}

.mhb-site-header__search-panel form > svg {
    color: var(--mhb-text-muted);
    flex-shrink: 0;
}

.mhb-site-header__search-panel input {
    background: transparent;
    border: 0;
    color: var(--mhb-text);
    flex: 1;
    font-family: inherit;
    font-size: 0.92rem;
    outline: 0;
    padding: 9px 0;
}

.mhb-site-header__search-panel input::-moz-placeholder {
    color: var(--mhb-text-dim);
}

.mhb-site-header__search-panel input::placeholder {
    color: var(--mhb-text-dim);
}

.mhb-site-header__search-panel button {
    background: var(--mhb-text);
    border: 0;
    border-radius: 8px;
    color: var(--mhb-bg);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 9px 16px;
}

@media (max-width: 782px) {
    .mhb-site-header__inner {
        padding: 0 24px;
    }

    .mhb-site-header__nav,
    .mhb-site-header__cta {
        display: none;
    }

    .mhb-site-header__mobile {
        display: block;
    }

    .mhb-site-header__search-panel {
        position: fixed;
        right: 16px;
        left: 16px;
        top: 76px;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mhb-site-header,
    .mhb-site-header__inner,
    .mhb-site-header__brand,
    .mhb-site-header__nav a,
    .mhb-site-header__nav a::after,
    .mhb-site-header__cta,
    .mhb-site-header__mobile-cta,
    .mhb-site-header__mobile summary span,
    .mhb-site-header__mobile-panel,
    .mhb-site-header__mobile-panel a {
        animation: none;
        transition: none;
    }
}

/* ---------- v2: pill navigation with sliding indicator, theme button ---------- */

.mhb-site-header__nav {
    background: color-mix(in srgb, var(--mhb-surface-strong) 80%, transparent);
    border: 1px solid var(--mhb-border);
    border-radius: 999px;
    gap: 2px;
    padding: 5px;
    position: relative;
}

.mhb-site-header__nav a {
    border-radius: 999px;
    padding: 8px 15px;
    position: relative;
    z-index: 1;
}

.mhb-site-header__nav a::after {
    display: none;
}

.mhb-site-header__nav a.is-active {
    color: var(--mhb-text);
}

.mhb-site-header__indicator {
    background: var(--mhb-surface-strong);
    border: 1px solid var(--mhb-border-strong);
    border-radius: 999px;
    bottom: 5px;
    left: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 5px;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
    width: 0;
    z-index: 0;
}

.mhb-site-header__nav a.is-active::before {
    background: var(--mhb-brand);
    border-radius: 50%;
    bottom: 3px;
    content: "";
    height: 4px;
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
    width: 4px;
}

.mhb-site-header__theme {
    align-items: center;
    background: none;
    border: 1px solid var(--mhb-border);
    border-radius: 999px;
    color: var(--mhb-text-muted);
    cursor: pointer;
    display: inline-flex;
    height: 38px;
    justify-content: center;
    transition: color 0.2s ease, border-color 0.2s ease, transform 0.3s ease;
    width: 38px;
}

.mhb-site-header__theme:hover {
    border-color: var(--mhb-border-strong);
    color: var(--mhb-text);
    transform: rotate(-12deg);
}

.mhb-site-header__theme .mhb-icon {
    height: 18px;
    width: 18px;
}

.mhb-site-header__theme-moon,
.mhb-site-header__theme[data-mhb-theme-current="light"] .mhb-site-header__theme-sun {
    display: none;
}

.mhb-site-header__theme[data-mhb-theme-current="light"] .mhb-site-header__theme-moon,
.mhb-site-header__theme-sun {
    display: inline-flex;
}

@media (max-width: 1100px) {
    .mhb-site-header__nav a {
        padding: 8px 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mhb-site-header__indicator {
        transition: none;
    }
}

/* Full-screen mobile menu needs a solid background (the glass one let page
   text show through), and room for the bottom dock. */
.mhb-site-header__mobile-panel {
    background: var(--mhb-bg, #050505);
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* Mobile menu: scroll inside the panel, not the page behind it. */
html.mhb-menu-open,
html.mhb-menu-open body {
    overflow: hidden;
}

.mhb-site-header__mobile-panel {
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Keep the dock and floating buttons out of the open menu. */
html.mhb-menu-open .mhb-dock,
html.mhb-menu-open .mhb-to-top,
html.mhb-menu-open .mhb-contact-hub {
    display: none;
}

html.mhb-menu-open body {
    padding-bottom: 0;
}

