/*
 * MWS Public Header V1
 * Shared visual header shell for public sub-pages that must match /legal.
 * Page-specific navigation stays in the owning page; only the visual shell is shared.
 */

.site-header.mws-public-header {
    --mws-public-border: rgba(255, 255, 255, 0.15);
    --mws-public-text: #f8f7ff;
    --mws-public-muted: rgba(248, 247, 255, 0.68);
    --mws-public-primary-rgb: 139, 92, 246;
    --mws-public-topbar-bg: rgba(8, 3, 14, 0.82);
    --mws-public-shadow: 0 26px 80px rgba(0, 0, 0, 0.42);
    --mws-public-moon: #8b5cf6;
    --mws-public-sun: #f6c453;

    position: sticky;
    top: calc(clamp(12px, 1.6vw, 24px) + env(safe-area-inset-top, 0px));
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-inline: auto;
    padding-left: 16px !important;
    padding-right: 14px !important;
    border: 1px solid var(--mws-public-border);
    border-radius: 999px;
    background: var(--mws-public-topbar-bg);
    box-shadow: var(--mws-public-shadow);
    color: var(--mws-public-text);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

html[data-theme="light"] .mws-public-header {
    --mws-public-border: rgba(84, 45, 147, 0.20);
    --mws-public-text: #161022;
    --mws-public-muted: rgba(30, 19, 47, 0.70);
    --mws-public-topbar-bg: rgba(255, 255, 255, 0.92);
    --mws-public-shadow: 0 26px 80px rgba(72, 36, 130, 0.18);
}

.mws-public-header .brand,
.mws-public-header .demo-brand {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: auto;
    min-width: 0;
    height: auto;
    flex: 0 0 auto;
}

.mws-public-header .brand-logo,
.mws-public-header .brand-logo.js-logo-frame {
    display: block;
    width: auto;
    height: 50px;
    flex: 0 0 auto;
    overflow: visible;
    border-radius: 0;
    filter: drop-shadow(0 16px 28px rgba(var(--mws-public-primary-rgb), 0.22));
}

html[data-theme="light"] .mws-public-header .brand-logo,
html[data-theme="light"] .mws-public-header .brand-logo.js-logo-frame {
    filter: drop-shadow(0 14px 24px rgba(72, 36, 130, 0.14));
}

.mws-public-header .brand-logo.js-logo-frame {
    position: relative;
}

.mws-public-header .brand-logo.js-logo-frame > img,
.mws-public-header .demo-brand > img.brand-logo {
    display: block;
    width: auto;
    height: 50px;
    max-width: none;
    object-fit: contain;
}

.mws-public-header .brand-logo.js-logo-frame > .logo-fallback {
    width: 50px;
    height: 50px;
    border-radius: 16px;
}

.mws-public-header .brand-copy {
    display: grid;
    gap: 0;
    min-width: 0;
    line-height: 1.1;
}

.mws-public-header .brand-copy strong {
    color: var(--mws-public-text);
    font-family: "Sora", "Inter", system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.mws-public-header .brand-copy small {
    margin: 0;
    color: var(--mws-public-muted);
    font-size: 0.77rem;
    font-weight: 400;
    white-space: nowrap;
}

.mws-public-header .site-menu,
.mws-public-header.mws-public-header--demos .site-menu,
.mws-public-header.mws-public-header--store .site-menu {
    position: static;
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.mws-public-header .mws-public-header__links {
    display: flex;
    flex-direction: row;
    flex: 0 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
}

.mws-public-header .demo-category-nav,
.mws-public-header .category-tabs-area,
.mws-public-header .category-tabs {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
    width: auto;
    flex: 0 1 auto;
    overflow: visible;
}

.mws-public-header .tab-indicator,
.mws-public-header .demo-category-icon,
.mws-public-header .tab-icon {
    display: none !important;
}

.mws-public-header .demo-category-button,
.mws-public-header .tab,
.mws-public-header .home-tab,
.mws-public-header .mws-public-header__nav-item {
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-height: 42px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    color: var(--mws-public-muted);
    background: transparent;
    box-shadow: none;
    font-size: 0.91rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: 0.22s ease;
}

.mws-public-header .demo-category-button:hover,
.mws-public-header .demo-category-button.is-active,
.mws-public-header .tab:hover,
.mws-public-header .tab.is-active,
.mws-public-header .home-tab:hover,
.mws-public-header .mws-public-header__nav-item:hover,
.mws-public-header .mws-public-header__nav-item.is-active {
    color: var(--mws-public-text);
    border-color: transparent;
    background: rgba(var(--mws-public-primary-rgb), 0.12);
    box-shadow: none;
    transform: none;
}

.mws-public-header .topbar-language-group {
    position: relative;
    flex: 0 0 auto;
    margin: 0;
}

.mws-public-header .topbar-language-trigger,
.mws-public-header .topbar-language-option {
    border: 1px solid var(--mws-public-border);
    color: var(--mws-public-text);
    background: transparent;
    cursor: pointer;
}

.mws-public-header .topbar-language-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-width: 0;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--mws-public-muted);
    font-size: 0.88rem;
    font-weight: 800;
    transition: 0.22s ease;
}

.mws-public-header .topbar-language-trigger:hover,
.mws-public-header .topbar-language-group.is-open .topbar-language-trigger {
    color: var(--mws-public-text);
    background: rgba(var(--mws-public-primary-rgb), 0.12);
}

.mws-public-header .topbar-language-current {
    min-width: 1.9rem;
    text-align: center;
}

.mws-public-header .topbar-language-chevron {
    font-size: 0.68rem;
}

.mws-public-header .topbar-language-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    z-index: 140;
    display: grid;
    gap: 6px;
    width: auto;
    min-width: 74px;
    padding: 8px;
    border: 1px solid var(--mws-public-border);
    border-radius: 22px;
    background: var(--mws-public-topbar-bg);
    box-shadow: var(--mws-public-shadow);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: 0.22s ease;
}

.mws-public-header .topbar-language-group.is-open .topbar-language-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.mws-public-header .topbar-language-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 6px;
    border-radius: 16px;
    transition: 0.22s ease;
}

.mws-public-header .topbar-language-option:hover,
.mws-public-header .topbar-language-option.is-active {
    background: rgba(var(--mws-public-primary-rgb), 0.16);
}

.mws-public-header .topbar-language-option-code {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 26px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

html[data-theme="light"] .mws-public-header .topbar-language-option-code {
    background: rgba(49, 27, 78, 0.055);
}

.mws-public-header .theme-toggle {
    display: inline-flex;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--mws-public-border);
    border-radius: 999px;
    color: var(--mws-public-muted);
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    transition: 0.22s ease;
}

.mws-public-header .theme-toggle:hover,
.mws-public-header .theme-toggle[aria-pressed="true"] {
    color: var(--mws-public-text);
    background: rgba(var(--mws-public-primary-rgb), 0.12);
    transform: none;
}

.mws-public-header .theme-toggle[aria-pressed="true"] {
    background: rgba(var(--mws-public-primary-rgb), 0.16);
}

.mws-public-header .theme-toggle svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
}

.mws-public-header .theme-toggle-icon {
    display: block;
    width: 18px;
    height: 18px;
}

.mws-public-header .theme-toggle-moon {
    color: var(--mws-public-moon);
}

.mws-public-header .theme-toggle-sun {
    display: none;
    color: var(--mws-public-sun);
}

html[data-theme="light"] .mws-public-header .theme-toggle-sun {
    display: block;
}

html[data-theme="light"] .mws-public-header .theme-toggle-moon {
    display: none;
}

.mws-public-header .mws-public-header__native-language {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 980px) {
    .mws-public-header {
        gap: 10px;
    }

    .mws-public-header .brand-copy small {
        display: none;
    }

    .mws-public-header .demo-category-button,
    .mws-public-header .tab,
    .mws-public-header .home-tab,
    .mws-public-header .mws-public-header__nav-item {
        padding-inline: 10px;
        font-size: 0.78rem;
    }
}

@media (max-width: 820px) {
    .site-header.mws-public-header {
        border-radius: 24px;
    }
}

@media (max-width: 760px) {
    .site-header.mws-public-header {
        gap: 6px;
        border-radius: 24px;
        overflow: visible;
    }

    .mws-public-header .brand,
    .mws-public-header .demo-brand {
        flex: 0 0 auto;
        gap: 0;
    }

    .mws-public-header .brand-copy {
        display: none;
    }

    .mws-public-header .brand-logo,
    .mws-public-header .brand-logo.js-logo-frame,
    .mws-public-header .brand-logo.js-logo-frame > img,
    .mws-public-header .demo-brand > img.brand-logo {
        height: 44px;
    }

    .mws-public-header .brand-logo.js-logo-frame > .logo-fallback {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }

    .mws-public-header .site-menu,
    .mws-public-header.mws-public-header--demos .site-menu,
    .mws-public-header.mws-public-header--store .site-menu {
        flex: 1 1 auto;
        gap: 3px;
        min-width: 0;
    }

    .mws-public-header .mws-public-header__links {
        flex: 1 1 auto;
        justify-content: flex-start;
        min-width: 0;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .mws-public-header .mws-public-header__links::-webkit-scrollbar {
        display: none;
    }

    .mws-public-header .category-tabs-area,
    .mws-public-header .category-tabs,
    .mws-public-header .demo-category-nav {
        flex: 0 0 auto;
    }

    .mws-public-header .demo-category-button,
    .mws-public-header .tab,
    .mws-public-header .home-tab,
    .mws-public-header .mws-public-header__nav-item {
        min-height: 40px;
        padding-inline: 9px;
        font-size: 0.72rem;
    }

    .mws-public-header .topbar-language-trigger {
        width: 42px;
        min-width: 42px;
        min-height: 40px;
        padding: 0;
        gap: 0;
    }

    .mws-public-header .topbar-language-chevron {
        display: none;
    }

    .mws-public-header .topbar-language-current {
        min-width: 0;
        font-size: 0.68rem;
    }

    .mws-public-header .theme-toggle {
        flex-basis: 40px;
        width: 40px;
        min-width: 40px;
        min-height: 40px;
        height: 40px;
    }
}

@media (max-width: 420px) {
    .mws-public-header .brand-logo,
    .mws-public-header .brand-logo.js-logo-frame,
    .mws-public-header .brand-logo.js-logo-frame > img,
    .mws-public-header .demo-brand > img.brand-logo {
        height: 40px;
    }

    .mws-public-header .brand-logo.js-logo-frame > .logo-fallback {
        width: 40px;
        height: 40px;
    }

    .mws-public-header .demo-category-button,
    .mws-public-header .tab,
    .mws-public-header .home-tab,
    .mws-public-header .mws-public-header__nav-item {
        min-height: 38px;
        padding-inline: 8px;
        font-size: 0.68rem;
    }

    .mws-public-header .topbar-language-trigger,
    .mws-public-header .theme-toggle {
        width: 38px;
        min-width: 38px;
        min-height: 38px;
        height: 38px;
    }
}
