/* Shared only by pages that explicitly opt in with data-maia-header. */
[data-maia-header] {
    --mh-text: rgba(255, 255, 255, 0.9);
    --mh-panel: rgba(31, 31, 31, 0.98);
    --mh-line: rgba(255, 255, 255, 0.15);
    --mh-hover: rgba(255, 255, 255, 0.08);
    --mh-glass: linear-gradient(135deg, rgba(137, 250, 138, 0), rgba(137, 250, 138, 0), rgba(137, 250, 138, 0), rgba(137, 250, 138, 0.15)), color-mix(in srgb, #333333 60%, transparent);
    --mh-inset-1: rgba(255, 255, 255, 0.08);
    --mh-inset-2: rgba(255, 255, 255, 0.15);
    --mh-inset-3: rgba(255, 255, 255, 0.10);
    --mh-inset-4: rgba(255, 255, 255, 0.08);
    --mh-shadow: inset 0 0 0 1px var(--mh-inset-1), inset 1.8px 3px 0 -2px var(--mh-inset-2), inset -2px -2px 0 -2px var(--mh-inset-3), inset -3px -8px 1px -6px var(--mh-inset-4), inset -0.3px -1px 4px 0 rgba(0, 0, 0, 0.12), inset -1.5px 2.5px 0 -2px rgba(0, 0, 0, 0.18), inset 0 3px 4px -2px rgba(0, 0, 0, 0.18), 0 6px 16px rgba(0, 0, 0, 0.08);
    position: fixed;
    inset: 0 0 auto;
    height: auto;
    z-index: 3000;
    color: var(--mh-text);
    font-family: 'Libre Franklin', sans-serif;
    line-height: 1.4;
}

[data-theme="light"] [data-maia-header] {
    --mh-text: rgba(15, 23, 42, 0.9);
    --mh-panel: rgba(255, 255, 255, 0.98);
    --mh-line: rgba(15, 23, 42, 0.15);
    --mh-hover: rgba(15, 23, 42, 0.08);
    --mh-glass: linear-gradient(135deg, rgba(137, 250, 138, 0), rgba(137, 250, 138, 0), rgba(137, 250, 138, 0), rgba(137, 250, 138, 0.4)), color-mix(in srgb, #ffffff 14%, transparent);
    --mh-inset-1: rgba(255, 255, 255, 0.22);
    --mh-inset-2: rgba(255, 255, 255, 0.70);
    --mh-inset-3: rgba(255, 255, 255, 0.60);
    --mh-inset-4: rgba(255, 255, 255, 0.40);
}

[data-maia-header], [data-maia-header] * { box-sizing: border-box; }
[data-maia-header] [hidden] { display: none !important; }

[data-maia-header] .maia-header-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    max-width: 1300px;
    height: 74px;
    margin: 0 auto;
    padding: 0 30px;
}

[data-maia-header] .maia-header-brand {
    position: relative;
    z-index: 1;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    color: var(--mh-text);
    font: 22px 'Libre Baskerville', serif;
    text-decoration: none;
    white-space: nowrap;
}

[data-maia-header] .maia-header-brand img { width: 24px; height: 24px; margin-right: 8px; }
[data-maia-header] .maia-logo-light { display: none; }
[data-theme="light"] [data-maia-header] .maia-logo-light { display: block; }
[data-theme="light"] [data-maia-header] .maia-logo-dark { display: none; }

[data-maia-header] .maia-header-nav {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 32px;
    width: max-content;
}

[data-maia-header] .maia-header-bar > .maia-header-nav {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

[data-maia-header] .maia-header-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 22px;
    position: relative;
    z-index: 1;
}

[data-maia-header] .maia-header-link {
    display: inline-flex;
    align-items: center;
    border: 0;
    padding: 0;
    margin: 0;
    background: none;
    color: var(--mh-text);
    font: 500 15px/1.4 'Libre Franklin', sans-serif;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

[data-maia-header] .maia-header-link:hover { opacity: 0.9; text-decoration: none; }
[data-maia-header] :is(a, button):focus-visible {
    outline: 2px solid #3ab448;
    outline-offset: 3px;
}

[data-maia-header] .maia-header-cta {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 20px;
    border: 1px solid var(--mh-inset-1);
    border-radius: 100px;
    background: #89fa8a;
    color: #0f172a;
    font: 500 14px/1.4 'Libre Franklin', sans-serif;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: var(--mh-shadow);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

[data-maia-header] .maia-header-cta:hover { background: #a5ffaa; text-decoration: none; }
[data-maia-header] .maia-header-cta:active { transform: translateY(1px); }
[data-maia-header] .maia-header-cta .arrow { font-size: 16px; line-height: 1.2; }

[data-maia-header] .maia-header-glass {
    position: absolute;
    inset: 8px 18px 8px 12px;
    border-radius: 9999px;
    background: var(--mh-glass);
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    box-shadow: var(--mh-shadow);
    pointer-events: none;
    opacity: 0;
    filter: blur(5px);
    transition: opacity 260ms ease, filter 260ms ease;
}

[data-maia-header][data-scrolled="true"] .maia-header-glass,
[data-maia-header][data-menu-open="true"] .maia-header-glass {
    opacity: 1;
    filter: blur(0);
}

[data-maia-header] .maia-explore { position: relative; padding: 14px 0; margin: -14px 0; }
[data-maia-header] .maia-explore::after {
    content: '';
    position: absolute;
    inset: 100% -16px auto;
    height: 14px;
}
[data-maia-header] .maia-explore-trigger { gap: 6px; }
[data-maia-header] .maia-explore-trigger::after {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    opacity: 0.75;
}
[data-maia-header] .maia-explore-popup {
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    transform: translate(-50%, -4px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 184px;
    padding: 8px;
    border: 1px solid var(--mh-line);
    border-radius: 16px;
    background: var(--mh-panel);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}
[data-maia-header] .maia-explore:is(:hover, :focus-within) .maia-explore-popup {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
}
[data-maia-header] .maia-explore-popup a {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--mh-text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
[data-maia-header] .maia-explore-popup a:is(:hover, :focus-visible) { background: var(--mh-hover); }

[data-maia-header] .maia-menu-toggle {
    display: none;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--mh-line);
    border-radius: 50%;
    background: transparent;
    color: var(--mh-text);
    cursor: pointer;
}
[data-maia-header] .maia-menu-toggle span {
    grid-area: 1 / 1;
    display: block;
    width: 16px;
    height: 1px;
    background: currentColor;
    transition: opacity 180ms ease, transform 180ms ease;
}
[data-maia-header] .maia-menu-toggle span:first-child { transform: translateY(-5px); }
[data-maia-header] .maia-menu-toggle span:last-child { transform: translateY(5px); }
[data-maia-header] .maia-menu-toggle[aria-expanded="true"] span:first-child { transform: rotate(45deg); }
[data-maia-header] .maia-menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
[data-maia-header] .maia-menu-toggle[aria-expanded="true"] span:last-child { transform: rotate(-45deg); }

[data-maia-header] .maia-mobile-menu {
    display: grid;
    width: calc(100% - 32px);
    max-width: 1240px;
    max-height: calc(100vh - 90px);
    max-height: calc(100dvh - 90px - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0 auto;
    padding: 8px 16px;
    border: 1px solid var(--mh-line);
    border-radius: 20px;
    background: var(--mh-panel);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
}
[data-maia-header] .maia-mobile-menu > :is(a, button) {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 12px 4px;
    margin: 0;
    border: 0;
    border-bottom: 1px solid var(--mh-line);
    border-radius: 0;
    background: none;
    color: var(--mh-text);
    font: 500 16px/1.4 'Libre Franklin', sans-serif;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
[data-maia-header] .maia-mobile-menu > :last-child { border-bottom: 0; }
[data-maia-header] .maia-mobile-menu > :is(a, button):hover { background: var(--mh-hover); }

/* Keep the bar's 30px padding in compact mode, inside the glass's 12px/18px insets. */
[data-maia-header][data-header-mode="compact"] .maia-header-bar > .maia-header-nav,
[data-maia-header][data-header-mode="compact"] .maia-header-bar .maia-desktop-login { display: none; }
[data-maia-header][data-header-mode="compact"] .maia-header-bar .maia-header-actions { gap: 10px; }
[data-maia-header][data-header-mode="compact"] .maia-header-bar .maia-menu-toggle { display: grid; }

/* CSS also protects the layout before resize measurements are processed. */
@media (max-width: 1100px) {
    [data-maia-header] .maia-header-bar > .maia-header-nav,
    [data-maia-header] .maia-header-bar .maia-desktop-login { display: none; }
    [data-maia-header] .maia-header-bar .maia-header-actions { gap: 10px; }
    [data-maia-header] .maia-header-bar .maia-menu-toggle { display: grid; }
}

/* Fit the controls on small phones without sacrificing the glass's inner padding. */
@media (max-width: 360px) {
    [data-maia-header] .maia-header-bar { gap: 8px; }
    [data-maia-header][data-header-mode="compact"] .maia-header-bar .maia-header-actions { gap: 8px; }
    [data-maia-header] .maia-header-bar .maia-menu-toggle { flex-basis: 36px; width: 36px; height: 36px; }
    [data-maia-header] .maia-header-bar .maia-header-cta { padding: 8px 12px; }
}

[data-maia-header] .maia-header-measure {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
}
[data-maia-header] .maia-header-measure-content { display: flex; align-items: center; gap: 32px; width: max-content; }
[data-maia-header] .maia-header-measure .maia-explore-popup { display: none; }

@media (prefers-reduced-motion: reduce) {
    [data-maia-header] *, [data-maia-header] *::after { transition: none !important; }
    [data-maia-header] .maia-header-glass { opacity: 1; filter: none; }
}
