/* ========== 产品域导航壳：桌面顶栏 + 移动底栏 ========== */

:root {
    --shell-top-h: 56px;
    --shell-sub-h: 44px;
    --shell-bottom-h: 58px;
    --shell-mob-mod-h: 50px;
    --shell-side-w: 220px;
}

body.shell-active {
    padding-top: var(--shell-top-pad, 0);
    padding-bottom: var(--shell-bottom-pad, 0);
}

@media (min-width: 768px) {
    body.shell-active {
        --shell-top-pad: var(--shell-top-total, var(--shell-top-h));
        --shell-bottom-pad: 0;
    }
}

@media (max-width: 767.98px) {
    body.shell-active {
        --shell-top-pad: var(--shell-top-h);
        --shell-bottom-pad: calc(var(--shell-bottom-h) + env(safe-area-inset-bottom, 0px));
    }

    body.shell-has-mob-mod.shell-active {
        --shell-top-pad: calc(var(--shell-top-h) + var(--shell-mob-mod-h));
    }

    body.shell-active .section-header--page h1 {
        font-size: 1.35rem;
        padding-bottom: 6px;
    }

    body.shell-active .section-header--page p {
        font-size: 0.92rem;
        line-height: 1.45;
    }
}

body.shell-chrome-hidden .site-shell-top,
body.shell-chrome-hidden .site-shell-sub,
body.shell-chrome-hidden .site-shell-side,
body.shell-chrome-hidden .site-shell-bottom,
body.shell-chrome-hidden .site-shell-drawer {
    visibility: hidden;
    pointer-events: none;
}

body.shell-active .page-header .header-top {
    display: none !important;
}

/* 只限制主内容容器宽度，勿单独限制每个 .app-panel（OCR/Markdown 等多卡片布局会错位） */
body.shell-active.shell-content-narrow main.app-panel,
body.shell-active.shell-content-narrow main > .app-panel,
body.shell-active.shell-content-narrow main > .section,
body.shell-active.shell-content-narrow main > .section > .features {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

body.shell-active.shell-content-wide main {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* 顶栏 */
.site-shell-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--shell-top-h);
    box-sizing: border-box;
    background: var(--color-card);
    border-top: 4px solid var(--color-theme, #fffa00);
    border-bottom: 1px solid var(--line-ins);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
    display: block;
}

header.site-shell-top::before {
    content: none;
    display: none;
}

.site-shell-top__inner {
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 左右等宽，中间导航相对视口居中（决策等项少时也不会偏左） */
.site-shell-brand {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--color-ink);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
}

.site-shell-brand__mark {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: block;
}

.site-shell-brand__word {
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-shell-brand:hover .site-shell-brand__word {
    text-decoration: underline;
}

.site-shell-l1 {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px 18px;
    overflow-x: auto;
    scrollbar-width: none;
    min-width: 0;
    max-width: min(100%, 720px);
}

.site-shell-l1::-webkit-scrollbar {
    display: none;
}

.site-shell-l1 a {
    flex-shrink: 0;
    font-size: 0.88rem;
    font-weight: 650;
    color: rgba(0, 0, 0, 0.55);
    text-decoration: none;
    padding: 6px 2px;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.site-shell-l1 a:hover {
    color: var(--color-ink);
}

.site-shell-l1 a.is-active {
    color: var(--color-ink);
    border-bottom-color: var(--color-theme);
}

.site-shell-l1 a.is-muted {
    font-weight: 550;
    color: rgba(0, 0, 0, 0.45);
}

.site-shell-aside {
    flex: 1 1 0;
    min-width: 0;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 650;
    color: rgba(0, 0, 0, 0.55);
    text-decoration: none;
    white-space: nowrap;
}

.site-shell-aside:hover {
    color: var(--color-ink, #0a0a0a);
    text-decoration: underline;
}

.site-shell-menu-btn {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 0.35em;
    padding: 6px 10px;
    min-height: 40px;
    border: 1px solid var(--line-ins, rgba(0, 0, 0, 0.1));
    border-radius: 0;
    background: var(--color-surface-dim, rgba(0, 0, 0, 0.04));
    color: var(--color-ink, #0a0a0a);
    font-size: 0.72rem;
    font-weight: 650;
    font-family: inherit;
    cursor: pointer;
}

.site-shell-menu-btn .site-shell-tab__icon {
    width: 1.125em;
    height: 1.125em;
    min-width: 1.125em;
    min-height: 1.125em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.site-shell-menu-btn .site-shell-tab__icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.site-shell-menu-btn__text {
    line-height: 1.25;
}

@media (max-width: 767.98px) {
    .site-shell-top__inner {
        padding: 0 10px;
        gap: 8px;
    }

    .site-shell-l1--global {
        display: none;
    }

    .site-shell-aside {
        display: none;
    }

    .site-shell-menu-btn {
        display: inline-flex;
    }

    .site-shell-brand {
        flex: 1 1 auto;
    }

    .site-shell-brand__word {
        font-size: 0.88rem;
    }
}

.site-shell-l1--global {
    flex: 1 1 auto;
    max-width: none;
    justify-content: center;
    padding: 0 4px;
    gap: 6px 14px;
}

@media (min-width: 768px) {
    body.shell-has-sidebar.shell-active {
        padding-left: var(--shell-side-w);
    }

    body.shell-has-sidebar.shell-has-sub.shell-active {
        --shell-top-total: var(--shell-top-h);
    }

    body.shell-has-sidebar .site-shell-sub {
        display: none !important;
    }
}

.site-shell-side {
    display: none;
}

@media (min-width: 768px) {
    .site-shell-side {
        display: block;
        position: fixed;
        top: var(--shell-top-h);
        left: 0;
        z-index: 98;
        width: var(--shell-side-w);
        bottom: 0;
        overflow-y: auto;
        padding: 12px 10px 24px;
        background: var(--color-card, #fff);
        border-right: 1px solid var(--line-ins, rgba(0, 0, 0, 0.08));
    }
}

.site-shell-side__heading {
    margin: 0 8px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.42);
}

.site-shell-side__heading:first-child {
    margin-top: 4px;
}

/* 侧栏分组：首组无上划线，其余组顶部分界线 + 留白 */
.site-shell-side__heading:not(:first-child) {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line-ins, rgba(0, 0, 0, 0.08));
}

.site-shell-side__link {
    display: block;
    padding: 8px 10px;
    margin: 2px 0;
    font-size: 0.84rem;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.62);
    text-decoration: none;
    border-radius: 0;
    border-left: 3px solid transparent;
}

.site-shell-side__link:hover {
    color: var(--color-ink, #0a0a0a);
    background: var(--color-surface-dim, rgba(0, 0, 0, 0.04));
}

.site-shell-side__link.is-active {
    color: var(--color-ink, #0a0a0a);
    background: var(--color-theme-wash, #fffde7);
    border-left-color: var(--color-theme, #fffa00);
}

.site-shell-side__link.is-muted {
    font-weight: 550;
    color: rgba(0, 0, 0, 0.45);
}

/* 移动：与桌面侧栏同源的横向模块导航 */
.site-shell-mob-mod {
    display: none;
}

@media (max-width: 767.98px) {
    .site-shell-mob-mod {
        display: block;
        position: fixed;
        top: var(--shell-top-h);
        left: 0;
        right: 0;
        z-index: 99;
        height: var(--shell-mob-mod-h);
        background: var(--color-card, #fff);
        border-bottom: 1px solid var(--line-ins, rgba(0, 0, 0, 0.08));
    }

    .site-shell-mob-mod__scroll {
        display: flex;
        align-items: center;
        height: 100%;
        overflow-x: auto;
        padding: 5px 10px;
        gap: 10px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .site-shell-mob-mod__scroll::-webkit-scrollbar {
        display: none;
    }

    .site-shell-mob-mod__group {
        flex-shrink: 0;
        display: flex;
        align-items: stretch;
        max-height: 40px;
        background: var(--color-surface-dim, rgba(0, 0, 0, 0.045));
        border: 1px solid var(--line-ins, rgba(0, 0, 0, 0.1));
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    }

    .site-shell-mob-mod__label {
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        padding: 0 9px;
        font-size: 0.58rem;
        font-weight: 750;
        letter-spacing: 0.02em;
        line-height: 1.15;
        max-width: 4.2rem;
        text-align: center;
        color: rgba(0, 0, 0, 0.48);
        background: rgba(0, 0, 0, 0.06);
        border-right: 1px solid var(--line-ins, rgba(0, 0, 0, 0.1));
    }

    .site-shell-mob-mod__links {
        display: flex;
        align-items: stretch;
        gap: 0;
    }

    .site-shell-mob-mod__link {
        flex-shrink: 0;
        padding: 0 10px;
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        font-size: 0.76rem;
        font-weight: 600;
        color: rgba(0, 0, 0, 0.58);
        text-decoration: none;
        border-radius: 0;
        border: none;
        border-right: 1px solid rgba(0, 0, 0, 0.06);
    }

    .site-shell-mob-mod__links .site-shell-mob-mod__link:last-child {
        border-right: none;
    }

    .site-shell-mob-mod__link.is-active {
        color: var(--color-ink, #0a0a0a);
        background: var(--color-theme-wash, #fffde7);
        box-shadow: inset 0 -2px 0 var(--color-theme, #fffa00);
    }

    .site-shell-mob-mod__link.is-muted {
        color: rgba(0, 0, 0, 0.42);
    }
}

/* 枢纽首页仍用与 home.css 一致的居中栏宽，避免宽屏下区块贴 viewport 左缘 */
body.shell-active.shell-content-hub {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

body.shell-hub.shell-active {
    padding-top: var(--shell-top-pad, 0);
}

@media (min-width: 768px) {
    body.shell-hub.shell-active {
        --shell-top-pad: var(--shell-top-h);
    }
}

/* 顶栏已有顶黄线，首页 hero 不再重复 */
body.shell-hub.shell-active header.hub-hero::before {
    display: none;
}

@media (min-width: 768px) {
    body.shell-hub.shell-active header.hub-hero {
        padding-top: 10px;
    }
}

/* 二级顶栏 */
.site-shell-sub {
    position: fixed;
    top: var(--shell-top-h);
    left: 0;
    right: 0;
    z-index: 99;
    height: var(--shell-sub-h);
    background: #fff;
    border-bottom: 1px solid var(--line-ins);
    display: none;
}

body.shell-has-sub .site-shell-sub {
    display: none;
}

@media (min-width: 768px) {
    body.shell-has-sub .site-shell-sub {
        display: block;
    }

    body.shell-has-sub.shell-active {
        --shell-top-total: calc(var(--shell-top-h) + var(--shell-sub-h));
    }
}

.site-shell-sub__inner {
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.site-shell-sub__inner::-webkit-scrollbar {
    display: none;
}

.site-shell-sub a {
    flex-shrink: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.5);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 0;
    background: transparent;
}

.site-shell-sub a:hover {
    color: var(--color-ink);
    background: var(--color-surface-dim);
}

.site-shell-sub a.is-active {
    color: var(--color-ink);
    background: var(--color-theme-wash);
    box-shadow: inset 0 -2px 0 var(--color-theme);
}

/* 移动底栏 */
.site-shell-bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    background: var(--color-card);
    border-top: 1px solid var(--line-ins);
    padding-bottom: env(safe-area-inset-bottom, 0);
    min-height: var(--shell-bottom-h);
}

@media (min-width: 768px) {
    .site-shell-bottom {
        display: none;
    }
}

.site-shell-tab {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px 10px;
    min-height: var(--shell-bottom-h);
    text-decoration: none;
    color: rgba(0, 0, 0, 0.5);
    font-size: 0.65rem;
    font-weight: 650;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

.site-shell-tab .site-shell-tab__icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.site-shell-tab.is-active {
    color: var(--color-ink);
    box-shadow: inset 0 3px 0 var(--color-theme);
}

.site-shell-tab .site-shell-tab__icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* 抽屉 */
.site-shell-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 109;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.site-shell-drawer-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.site-shell-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 110;
    background: var(--color-card);
    border-top: 1px solid var(--line-ins);
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
    transform: translateY(100%);
    transition: transform 0.25s ease;
    max-height: 70vh;
    overflow-y: auto;
}

.site-shell-drawer.is-open {
    transform: translateY(0);
}

.site-shell-drawer h3 {
    font-size: 0.95rem;
    margin: 0 0 12px;
    color: var(--color-ink);
}

.site-shell-drawer a {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-ins);
    color: var(--color-ink);
    text-decoration: none;
    font-weight: 600;
}

.site-shell-drawer a:last-child {
    border-bottom: none;
}

.site-shell-drawer-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: var(--color-surface-dim);
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.1rem;
}

.site-shell-drawer--menu {
    max-height: 85vh;
}

.site-shell-menu__group {
    margin-bottom: 16px;
}

.site-shell-menu__group h4 {
    margin: 0 0 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.45);
}

.site-shell-menu__group a {
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-ins, rgba(0, 0, 0, 0.08));
    color: var(--color-ink, #0a0a0a);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
}

.site-shell-menu__group a:last-child {
    border-bottom: none;
}

body.shell-chrome-hidden .site-shell-mob-mod {
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 767.98px) {
    body.shell-active .back-to-top {
        bottom: calc(
            var(--shell-bottom-h) + env(safe-area-inset-bottom, 0px) + 12px
        );
        right: 16px;
        z-index: 90;
    }
}
