/*!
 * kb-toc.css — 知识库详情页左侧目录 + 落地页浮动目录（2026-11-24）
 *
 * 范围：
 *   body.kb-page  —— /knowledge/<slug>.html 常规文章（市场专版 categoryCode=market 不加此类）
 *   body.lp-page  —— 价格指南落地页 /{slug}
 *
 * 目录类名刻意避开正文里历史内嵌的 nav.kb-toc（id 115/120/100 用过）：
 * 新导航统一用 .kb-nav / .kb-navbar / .lp-toc / .lp-tocbar。
 *
 * 偏移量 --kb-hdr（固定 header 实测高度）与 --kb-bar（移动横滑条高度）由 kb-toc.js 运行时写入，
 * 这里只给回退值：桌面 116px，移动端 header 不再 fixed 用 0。
 */

/* ================= 常规知识详情：桌面左侧目录 ================= */

/* body 原本 overflow-x:hidden 会形成滚动容器，position:sticky 失效；clip 不创建滚动容器 */
body.kb-page{overflow-x:clip;}

@media only screen and (min-width:993px){
    body.kb-page .n_main > .container{
        display:grid;
        grid-template-columns:23fr 77fr;
        column-gap:40px;
        align-items:stretch;
    }
    /* 覆盖旧 float 宽度；min-width:0 防止长 URL/表格把左栏撑开 */
    body.kb-page #main.n_left,
    body.kb-page #sidebar.n_right{
        float:none;
        width:auto;
        min-width:0;
        padding:0;
    }
    body.kb-page #main{grid-column:1;grid-row:1;}
    body.kb-page #sidebar{grid-column:2;grid-row:1;}
    /* 左栏整体吸附：#main 已被 stretch 到文章高度，sticky 才有活动空间 */
    body.kb-page #main > .theiaStickySidebar{
        position:sticky;
        top:calc(var(--kb-hdr, 116px) + 16px);
        max-height:calc(100vh - var(--kb-hdr, 116px) - 32px);
        overflow-y:auto;
        overscroll-behavior:contain;
    }
}

/* ================= 目录本体（文章左栏 + 落地页浮层共用） ================= */

/* 左栏目录卡片：白底 + 细边 + 轻投影，与右侧正文拉开层次 */
body.kb-page .kb-nav-box{
    margin:0 0 18px;
    padding:0;
    background:#fff;
    border:1px solid #e5edf5;
    border-radius:14px;
    box-shadow:0 10px 28px rgba(1,33,92,.07);
    overflow:hidden;
}
.kb-nav-title{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:8px;
    font-family:'Oswald','Inter',sans-serif;
    font-size:12.5px;
    font-weight:800;
    letter-spacing:1.6px;
    text-transform:uppercase;
    color:#0b75be;
    margin:0;
    padding:14px 16px 11px;
    background:linear-gradient(180deg,#f5faff 0%,#fff 100%);
    border-bottom:1px solid #eef3f9;
}
/* 标题前的蓝色竖条，和正文 H2 的标记呼应 */
.kb-nav-title::before{
    content:"";
    flex:0 0 4px;
    width:4px;
    height:14px;
    border-radius:2px;
    background:linear-gradient(180deg,#0b75be,#4aa3e0);
}
/* 章节数量小徽章（由 JSP 传入，五语通用） */
.kb-nav-count{
    margin-inline-start:auto;
    font-family:'Inter',sans-serif;
    font-size:11px;
    font-weight:700;
    letter-spacing:0;
    line-height:1;
    color:#0b75be;
    background:#eaf4fe;
    border:1px solid #d7e8f7;
    border-radius:999px;
    padding:4px 8px;
}
/* 阿拉伯语连写：去掉标题字距，否则字母被拆开 */
[dir="rtl"] .kb-nav-title{letter-spacing:0;}
.kb-nav-list{list-style:none;margin:0;padding:8px;}
.kb-nav-list li{margin:0;}
.kb-nav-list a{
    position:relative;
    display:flex;
    align-items:center;
    padding:9px 12px;
    border-inline-start:3px solid transparent;
    border-radius:8px;
    color:#2f4356;
    font-size:14px;
    font-weight:700;
    line-height:1.38;
    text-decoration:none;
    transition:color .15s,background .15s,border-color .15s;
}
.kb-nav-list a:hover{color:#0b75be;background:#f3f8fe;text-decoration:none;}
.kb-nav-list a.is-active{
    color:#0b75be;
    background:#e9f4fe;
    border-inline-start-color:#0b75be;
    box-shadow:0 2px 10px rgba(11,117,190,.08);
}
/* 当前项尾部小圆点，RTL 下由 margin-inline-start:auto 自动换到另一侧 */
.kb-nav-list a.is-active::after{
    content:"";
    flex:0 0 6px;
    width:6px;
    height:6px;
    margin-inline-start:auto;
    border-radius:50%;
    background:#0b75be;
}

/* ================= 后台正文里历史内嵌的目录（115/120/100） ================= */
/* 新导航渲染成功时隐藏旧目录，避免同页双目录；旧锚点仍在正文中，深链不受影响 */
.kb-toc-on .blog_p .kb-toc,
.kb-toc-on #richContentDiv .kb-toc{display:none;}

/* ================= 移动端：文章顶部横向滑动条 ================= */

@media only screen and (max-width:992px){
    .kb-nav{display:none;}
    .kb-navbar{
        display:block;
        position:sticky;
        top:var(--kb-hdr, 0px);
        z-index:20;
        margin:0 0 16px;
        background:#fff;
        border-bottom:1px solid #e8eef4;
    }
    .kb-navbar-track{
        display:flex;
        gap:8px;
        overflow-x:auto;
        padding:8px 0;
        -webkit-overflow-scrolling:touch;
        scrollbar-width:none;
    }
    .kb-navbar-track::-webkit-scrollbar{display:none;}
    .kb-navbar-track a{
        flex:0 0 auto;
        max-width:64vw;
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
        padding:6px 12px;
        background:#f4f8fc;
        border:1px solid #e2ebf4;
        border-radius:999px;
        color:#4a5a6a;
        font-size:13px;
        font-weight:700;
        line-height:1.3;
        text-decoration:none;
    }
    .kb-navbar-track a.is-active{
        color:#fff;
        background:#0b75be;
        border-color:#0b75be;
    }
}

@media only screen and (min-width:993px){
    .kb-navbar{display:none;}
}

/* ================= 落地页目录 ================= */

/* <1600px：顶部横滑条（含全部移动端） */
.lp-tocbar{
    display:block;
    position:sticky;
    top:var(--kb-hdr, 116px);
    z-index:30;
    background:#fff;
    border-bottom:1px solid #e8eef4;
}
.lp-tocbar-track{
    display:flex;
    gap:8px;
    max-width:1140px;
    margin:0 auto;
    padding:10px 20px;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
    box-sizing:border-box;
}
.lp-tocbar-track::-webkit-scrollbar{display:none;}
.lp-tocbar-track a{
    flex:0 0 auto;
    max-width:64vw;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    padding:6px 12px;
    background:#f4f8fc;
    border:1px solid #e2ebf4;
    border-radius:999px;
    color:#4a5a6a;
    font-size:13px;
    font-weight:700;
    line-height:1.3;
    text-decoration:none;
}
.lp-tocbar-track a.is-active{
    color:#fff;
    background:#0b75be;
    border-color:#0b75be;
}

/* <1600px 不显示浮层 */
.lp-toc{display:none;}

/* ≥1600px：左侧浮层。1140px 正文居中 → 左缘 50%-570px；目录 176px 宽 + 16px 间距：
   左缘 = 50% - 762px；窄于 1600 时 max(16px) 兜底（此时本就不显示）。RTL 由 inset-inline-start 镜像。 */
@media only screen and (min-width:1600px){
    .lp-tocbar{display:none;}
    .lp-toc{
        display:block;
        position:fixed;
        inset-block-start:calc(var(--kb-hdr, 116px) + 24px);
        inset-inline-start:max(16px, calc(50% - 762px));
        width:176px;
        max-height:calc(100vh - var(--kb-hdr, 116px) - 48px);
        overflow-y:auto;
        overscroll-behavior:contain;
        z-index:30;
        padding:12px 8px;
        background:#fff;
        border:1px solid #e8eef4;
        border-radius:10px;
        box-shadow:0 8px 28px rgba(1,33,92,.08);
        box-sizing:border-box;
    }
    /* 浮层窄（176px）：标题与条目缩一档，避免多次换行 */
    .lp-toc .kb-nav-title{
        padding:2px 4px 8px;
        font-size:11px;
        letter-spacing:1.2px;
        background:none;
        border-bottom-color:#edf2f8;
    }
    .lp-toc .kb-nav-list{padding:0;}
    .lp-toc .kb-nav-list a{font-size:12.5px;line-height:1.4;padding:7px 4px;border-radius:7px;}
    .lp-toc .kb-nav-list a.is-active::after{display:none;}
    /* 滚动到页脚时淡出，不压在询盘/页脚上 */
    .lp-toc.is-hidden{opacity:0;visibility:hidden;pointer-events:none;transition:opacity .2s;}
}

/* ================= 锚点滚动偏移 ================= */
/* 点击目录后标题不被固定 header / 移动横条遮住；--kb-bar 由 JS 实测（桌面为 0） */
body.kb-page .blog_p h2,
body.lp-page #richContentDiv h2{
    scroll-margin-top:calc(var(--kb-hdr, 116px) + var(--kb-bar, 0px) + 12px);
}

@media only screen and (max-width:992px){
    body.kb-page .blog_p h2,
    body.lp-page #richContentDiv h2{
        scroll-margin-top:calc(var(--kb-hdr, 0px) + var(--kb-bar, 46px) + 10px);
    }
}
