/* ==========================================================================
   使用手册 / 文档页（浅色主题）
   与首页共用同一套品牌色相，只是主打「浅色可读版」品牌色。
   ========================================================================== */

:root {
    /* 浅色主题语义映射 */
    --primary:          var(--brand-strong);
    --primary-hover:    var(--brand-strong-hover);
    --primary-soft:     var(--brand-strong-soft);
    --primary-glow:     rgba(15, 158, 128, .30);
    --accent:           var(--info);
    --light:            var(--gray-50);
    --dark:             var(--gray-800);
    --gray:             var(--gray-500);
    --light-gray:       var(--gray-200);
    --border:           var(--gray-300);
    --card-bg:          var(--gray-0);
    --body-bg:          var(--gray-100);

    --shadow:           var(--shadow-sm);
    --radius:           var(--radius-md);
    --sidebar-width:    var(--sidebar-w);

    /* 锚点跳转需要让开的顶部距离，由脚本按吸顶导航条的真实高度写入 */
    --anchor-offset:    16px;
}

body {
    background-color: var(--body-bg);
    color: var(--dark);
    padding-bottom: 50px;
}

/* ── Header ── */
/* 头部不再吸附顶部，随页面一起滚走，把顶部空间留给目录导航条 */
header {
    background-color: var(--primary);
    color: var(--gray-0);
    box-shadow: var(--shadow-lg);
    padding: 22px var(--space-5);
    position: relative;
    z-index: 1;
    border-bottom: 3px solid var(--primary-hover);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

header p {
    font-size: .95rem;
    opacity: .9;
}

/* ── 布局 ── */
.container {
    max-width: 1400px;
    margin: var(--space-5) auto;
    padding: 0 var(--space-4);
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 25px;
    align-items: start;
}

/* ── 目录导航 ── */
nav#toc {
    background-color: var(--card-bg);
    padding: var(--space-5);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky;
    /* 头部已不再吸附，侧栏只需让开页面自身的上边距 */
    top: var(--space-4);
    max-height: calc(100vh - var(--space-8));
    overflow-y: auto;
    height: fit-content;
    align-self: start;
}

nav#toc h3 {
    color: var(--primary);
    margin-bottom: var(--space-4);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

nav#toc ul {
    list-style: none;
    padding-left: 0;
}

nav#toc li {
    margin-bottom: var(--space-2);
}

nav#toc a {
    color: var(--primary);
    text-decoration: none;
    padding: var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    border-radius: var(--space-2);
    transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
    font-weight: 500;
    border-left: 3px solid transparent;
}

nav#toc a:hover,
nav#toc a.active {
    background-color: var(--primary-soft);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

nav#toc a i {
    width: 24px;
    text-align: center;
    margin-right: 10px;
}

/* ── 内容区 ── */
.content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

section {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}

/* 浏览器原生锚点跳转（含带 hash 直接进页面）也要让开吸顶导航条 */
section[id] {
    scroll-margin-top: var(--anchor-offset);
}

section:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

section h2 {
    color: var(--primary);
    font-size: 1.6rem;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--light-gray);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

section h3 {
    color: var(--dark);
    font-size: 1.3rem;
    margin-top: 25px;
    margin-bottom: var(--space-4);
    padding: 10px 0;
    border-left: 4px solid var(--primary);
    padding-left: var(--space-4);
}

.intro-text {
    font-size: 1.1rem;
    line-height: 1.8;
    background-color: var(--light);
    padding: var(--space-5);
    border-radius: var(--space-2);
    margin: var(--space-4) 0;
    border-left: 4px solid var(--accent);
}

/* ── 视频容器 ── */
.video-container {
    position: relative;
    margin: var(--space-5) auto;
    max-width: 640px;
    aspect-ratio: 16 / 9;
    max-height: 360px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    background: #000;
}

.video-container .video-js {
    width: 100%;
    height: 100%;
    border-radius: var(--radius);
}

/* 覆盖 Video.js 默认圆角，使播放器贴合容器 */
.video-container .vjs-tech {
    border-radius: var(--radius);
}

/* 缩小默认大播放按钮，让视频未播放时视觉更收敛 */
.video-container .vjs-big-play-button {
    width: 3em;
    height: 3em;
    line-height: 3em;
    border-radius: 50%;
    font-size: 1.6em;
    margin-top: -1.5em;
    margin-left: -1.5em;
}

/* ── 步骤容器 ── */
.steps-container {
    background-color: var(--light);
    padding: var(--space-5);
    border-radius: var(--radius);
    margin: var(--space-5) 0;
    border-left: 4px solid var(--accent);
}

.steps-container ol {
    padding-left: var(--space-5);
}

.steps-container ol li {
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background-color: var(--gray-0);
    border-radius: var(--space-2);
    box-shadow: var(--shadow);
    border-left: 3px solid var(--primary);
}

.steps-container ol li p {
    margin-top: var(--space-2);
    padding-left: var(--space-4);
}

.steps-container ol li img {
    margin-top: 10px;
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    cursor: zoom-in;
    transition: transform .2s var(--ease);
}

.steps-container ol li img:hover {
    transform: scale(1.02);
}

/* ── FAQ 手风琴 ── */
.faq-item {
    margin-bottom: var(--space-4);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* 触发器是 <button>：天然可聚焦、可键盘触发 */
.faq-item h4 {
    margin: 0;
    font-size: 1rem;
}

.faq-item .faq-toggle {
    width: 100%;
    background-color: var(--light);
    color: var(--dark);
    padding: 18px var(--space-5);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    font-weight: 600;
    font-size: 1rem;
    text-align: left;
    border: none;
    border-bottom: 1px solid var(--border);
    transition: background-color .2s var(--ease), color .2s var(--ease),
                border-color .2s var(--ease);
}

.faq-item .faq-toggle:hover {
    background-color: var(--light-gray);
}

.faq-item .faq-toggle.active {
    background-color: var(--primary);
    color: var(--gray-0);
    border-bottom-color: var(--primary-hover);
}

.faq-item .faq-toggle:after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    flex-shrink: 0;
    transition: transform .3s var(--ease);
}

.faq-item .faq-toggle.active:after {
    transform: rotate(180deg);
}

.faq-item .faq-panel {
    background-color: var(--gray-0);
    padding: 0 var(--space-5);
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s var(--ease), padding .3s var(--ease);
}

.faq-item .faq-panel.open {
    padding: var(--space-5);
    max-height: 1000px;
}

/* ── 返回顶部 ── */
.back-to-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--primary);
    color: var(--gray-0);
    padding: var(--space-4);
    border-radius: 50%;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    width: 50px;
    height: 50px;
    z-index: 1000;

    /* 默认隐藏，由脚本加 .is-visible 控制显隐（不再写内联 style） */
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .2s var(--ease), visibility .2s var(--ease),
                transform .2s var(--ease), background-color .2s var(--ease),
                box-shadow .2s var(--ease);
}

.back-to-top.is-visible {
    opacity: .9;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 16px var(--primary-glow);
    color: var(--gray-0);
    opacity: 1;
}

.back-to-top i {
    font-size: 20px;
}

/* ── Footer ── */
footer {
    background-color: var(--card-bg);
    color: var(--gray);
    font-size: .9rem;
    text-align: center;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: var(--max-w);
    margin: var(--space-10) auto 0;
    padding: 30px;
}

footer .footer-beian {
    margin-top: 12px;
    font-size: .8rem;
}
footer .footer-beian a {
    color: inherit;
    text-decoration: none;
    transition: color .2s var(--ease);
}
footer .footer-beian a:hover {
    color: var(--text);
}

/* ── 全屏图片查看器 ── */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, .9);
    backdrop-filter: blur(5px);
}

/* 脚本通过 .is-open 切换，避免直接改内联 display */
.modal.is-open {
    display: block;
}

.modal-img {
    max-width: 90%;
    max-height: 90%;
}

.modal-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: var(--gray-100);
    font-size: 40px;
    font-weight: bold;
    line-height: 1;
    /* 现在是 <button>，需要清掉浏览器默认外观 */
    background: none;
    border: none;
    padding: 0;
    transition: color .3s var(--ease);
    z-index: 2001;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: var(--gray-400);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, .1);
    color: var(--gray-0);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 2001;
    transition: background-color .2s var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-nav:hover {
    background-color: rgba(255, 255, 255, .25);
}

.modal-nav.prev {
    left: 20px;
}

.modal-nav.next {
    right: 20px;
}

.modal-caption {
    position: absolute;
    bottom: var(--space-2);
    left: var(--space-4);
    color: var(--gray-0);
    font-size: 16px;
    text-align: center;
    width: 100%;
}

/* ── 响应式 ── */
@media (max-width: 992px) {
    /* 单列排布：目录卡片在上，正文在下 */
    .container {
        display: block;
        padding-left: 0;
        padding-right: 0;
    }

    /* 目录导航保持和 PC 一样的竖排卡片，放在正文最上方，随页面一起滚走。
       滚过它之后由 .toc-bar 接管吸顶。 */
    nav#toc {
        position: static;
        top: auto;
        max-height: none;
        height: auto;
        margin: 0 var(--space-4) var(--space-5);
        overflow: visible;
    }
}

/* ── 吸顶横条（脚本从 #toc 克隆生成，滚过竖排目录后浮出） ── */
.toc-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    padding: var(--space-3) var(--space-4);
    background-color: var(--card-bg);
    border-radius: 0;
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;

    /* 默认收在视口上方 */
    transform: translateY(-100%);
    transition: transform .28s var(--ease);
}

.toc-bar::-webkit-scrollbar {
    display: none;
}

/* 滚过竖排目录后浮出 */
.toc-bar.is-visible {
    transform: translateY(0);
}

/* 下滑收起；放在 .is-visible 之后，保证同时存在时以收起为准 */
.toc-bar.is-hidden {
    transform: translateY(-100%);
}

/* 以下规则必须自成一套：克隆出来的横条没有 #toc，
   上面 nav#toc 开头的选择器一条都匹配不到它 */
.toc-bar h3 {
    display: none;
}

.toc-bar ul {
    list-style: none;
    padding-left: 0;
    display: flex;
    gap: var(--space-2);
    white-space: nowrap;
}

.toc-bar li {
    margin-bottom: 0;
}

.toc-bar a {
    display: flex;
    align-items: center;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    border-left: none;
    border-radius: 20px;
    padding: var(--space-2) var(--space-4);
    background-color: var(--light);
    transition: background-color .2s var(--ease), color .2s var(--ease);
}

.toc-bar a i {
    width: 24px;
    text-align: center;
    margin-right: var(--space-2);
}

.toc-bar a:hover,
.toc-bar a.active {
    background-color: var(--primary-soft);
    color: var(--primary);
}

/* 横条只在移动端存在 */
@media (min-width: 993px) {
    .toc-bar {
        display: none;
    }
}

@media (max-width: 768px) {
    header {
        padding: var(--space-4);
        padding-top: max(var(--space-4), env(safe-area-inset-top));
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
    }

    header h1 {
        font-size: 1.5rem;
    }

    /* 左右留白交给 section 自己的 padding，容器不能有内边距，
       否则吸顶的目录条两侧会漏出滚动的内容 */
    .container {
        padding: 0;
        margin-top: var(--space-4);
    }

    section {
        padding: var(--space-5) var(--space-4);
    }

    section h2 {
        font-size: 1.4rem;
    }

    .steps-container ol li {
        padding: var(--space-3);
    }

    .faq-item .faq-toggle {
        padding: var(--space-4);
        font-size: 1rem;
    }

    .faq-item .faq-panel.open {
        padding: var(--space-4);
    }
}

@media (max-width: 576px) {
    header h1 {
        font-size: 1.3rem;
    }

    section h2 {
        font-size: 1.3rem;
    }

    .back-to-top {
        width: 45px;
        height: 45px;
        padding: var(--space-3);
        bottom: 20px;
        right: 20px;
    }

    .intro-text {
        padding: var(--space-4);
    }
}

/* ── 自定义滚动条 ── */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* ── 语义图标 ──
   替代原先散落在 HTML 里的 style="color: var(--success)" 等内联写法。
   颜色一律取自 tokens，页面只使用语义名。 */
.icon-ok,
.icon-warn,
.icon-danger,
.icon-brand,
.icon-inline {
    margin-right: var(--space-2);
}

.icon-ok {
    color: var(--success);
}

.icon-warn {
    color: var(--warning);
}

.icon-danger {
    color: var(--danger);
}

.icon-brand {
    color: var(--primary);
}

.icon-inline {
    color: inherit;
}

/* ── 步骤截图 ── */
.step-img {
    width: 100%;
    cursor: zoom-in;
}

/* ── 图标列表（原内联 padding / list-style） ── */
.icon-list {
    padding-left: var(--space-5);
    margin: var(--space-4) 0;
}

.icon-list li {
    margin-bottom: var(--space-3);
    list-style: none;
}

.icon-list li:last-child {
    margin-bottom: 0;
}

/* ── 自定义滚动条 ── */
