/* ==========================================================================
   选址参谋 · 前台资讯（列表 / 详情）
   加载方式：SiteHome::article() 的 $data['extraCss'] = array('css/news.css')
   在 app.css 之后加载，变量全部引用 app.css 的 :root，不复制色值。

   字号体系里的角色：资讯列表与详情。列表标题取 --fs-md、摘要取 --fs-xs 拉开层级；
   详情页左目录 + 760px 正文栏，一行约 50 个汉字，比全站 85 字的行长更适合
   连续阅读 —— 所以它不跟着 --w-page 一起放宽。
   ========================================================================== */

/* 目录跳转走平滑滚动；用户开了「减少动态效果」时尊重系统设置，
   直接跳过去（前庭功能敏感的人对整页滑动会不适） */
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

/* ---------------- 面包屑 ---------------- */
/* 文章页三块（面包屑 / 标题 / 两栏）共用同一个 1094px 的内容宽度：
   240 左栏 + 46 间距 + 760 正文 + 48 内边距。标题、左栏、正文左边线对齐，
   否则标题贴着 viewport 左缘、正文却缩进 80px，整页像没对齐的 PPT。 */
.nd-wrap {
    width: 100%;
    max-width: 1094px;
    margin: 0 auto;
    padding: 0 24px;
}

.nd-crumb {
    padding: 14px 0 0;
    font-size: var(--fs-xs, 13px);
    color: var(--muted);
}
.nd-crumb a { color: var(--muted); }
.nd-crumb a:hover { color: var(--text); }
.nd-sep { margin: 0 6px; color: #3f5170; }
.nd-cur { color: var(--text-2); }

/* ---------------- 标题区 ---------------- */
.nd-head { padding: 18px 0 22px; }
.nd-head h1 {
    max-width: 860px;
    font-size: var(--fs-xl, 26px);
    font-weight: 700;
    line-height: 1.42;
    letter-spacing: -.6px;
    color: var(--text);
}
.nd-sub {
    max-width: 720px;
    margin-top: 12px;
    font-size: var(--fs-base, 15px);
    line-height: 1.85;
    color: var(--muted);
}
.nd-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
    font-size: var(--fs-xs, 13px);
    color: var(--muted);
}
.nd-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.nd-meta svg { width: 13px; height: 13px; }
.nd-meta .mono { font-family: var(--mono); font-size: var(--fs-xs, 13px); font-style: normal; }
.nd-meta-n { color: #4d5c70; }

/* ---------------- 两栏骨架 ---------------- */
/* 240 左 + 760 右（正文上限）：容器本身已经限宽，这里铺满即可，
   两栏之间只靠 46px 留白 + 左栏右侧 1px 细线分隔。 */
.nd-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 46px;
    align-items: start;
    max-width: none;
    margin: 0;
    padding-bottom: 56px;
}
.nd-main { min-width: 0; max-width: 760px; }

/* ---------------- 左栏 ---------------- */
.nd-side {
    position: sticky;
    top: 78px;                 /* 站点头部 62px + 16px 呼吸位 */
    align-self: start;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    padding-right: 4px;
    /* 细分割线只画一条：左栏与正文之间靠留白 + 1px 线分隔，
       比两边都描边更像资讯站，而不是后台面板 */
    border-right: 1px solid var(--line-soft);
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, .28) transparent;
}
.nd-side::-webkit-scrollbar { width: 5px; }
.nd-side::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .24); border-radius: 999px; }

.nd-grp { margin-bottom: 16px; }
.nd-grp:last-child { margin-bottom: 0; }
.nd-grp-t {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    padding-left: 1px;
    font-family: var(--mono);
    font-size: var(--fs-xs, 13px);
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: #4d5c70;
}
.nd-hot {
    font-family: var(--font);
    font-size: var(--fs-xs, 13px);
    letter-spacing: .5px;
    line-height: 15px;
    padding: 0 4px;
    border-radius: 3px;
    color: #f0a92e;
    background: rgba(240, 169, 46, .14);
}

.nd-list { display: flex; flex-direction: column; gap: 1px; }
.nd-list a {
    display: block;
    padding: 4px 9px 4px 10px;
    border-radius: 5px;
    font-size: var(--fs-sm, 14px);
    line-height: 1.5;
    color: var(--text-2);
    transition: background .15s, color .15s;
}
.nd-list a:hover { background: var(--hover-veil); color: var(--text); }
.nd-list a.on { background: rgba(47, 129, 247, .12); color: #7db6ff; }

/* 目录：两层缩进 + 等宽序号，和产品页的 .px-toc 同一套视觉 */
.nd-toc { margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.nd-toc .nd-list a {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding-left: 10px;
    font-size: var(--fs-xs, 13px);
    border-left: 1px solid transparent;
    border-radius: 0;
}
.nd-toc .nd-list a i {
    flex: 0 0 auto;
    font-family: var(--mono);
    font-size: var(--fs-xs, 13px);
    font-style: normal;
    color: #3f5170;
}
.nd-toc .nd-list a span { min-width: 0; overflow-wrap: anywhere; }
.nd-toc .nd-list li.lv3 a { padding-left: 24px; font-size: var(--fs-xs, 13px); color: var(--muted); }
.nd-toc .nd-list a:hover { background: none; color: var(--text); border-left-color: rgba(47, 129, 247, .6); }
.nd-toc .nd-list a.on { background: none; color: #7db6ff; border-left-color: var(--brand); }
.nd-toc .nd-list a.on i { color: var(--brand); }

/* ---------------- 正文排版 ---------------- */
.nd-prose {
    font-size: var(--fs-base, 15px);
    line-height: var(--lh-loose, 1.9);            /* 1.85~1.95：中文长文的舒适区 */
    color: var(--text-2);
    overflow-wrap: break-word;
}
.nd-prose > *:first-child { margin-top: 0; }

/* 段间距 1.1em ≈ 16.5px；行高与段距分开给，读起来才有呼吸 */
.nd-prose p { margin: 0 0 1.1em; line-height: var(--lh-loose, 1.9); }

.nd-prose h2,
.nd-prose h3,
.nd-prose h4 {
    color: var(--text);
    line-height: 1.55;
    letter-spacing: -.2px;
    font-weight: 600;
    scroll-margin-top: 78px;     /* 锚点跳转后标题不被吸顶导航吃掉 */
}
/* 标题「前留白 > 后留白」：读者先看到标题属于哪一段，再进入内容 */
.nd-prose h2 {
    margin: 40px 0 14px;
    padding-left: 12px;
    border-left: 3px solid var(--brand);
    font-size: var(--fs-lg, 20px);
}
.nd-prose h3 {
    margin: 30px 0 11px;
    padding-left: 11px;
    border-left: 3px solid rgba(47, 129, 247, .5);
    font-size: var(--fs-base, 15px);
}
.nd-prose h4 { margin: 22px 0 9px; font-size: var(--fs-base, 15px); }
.nd-prose strong, .nd-prose b { color: var(--text); font-weight: 600; }
.nd-prose em, .nd-prose i { font-style: italic; }
.nd-prose u { text-decoration: underline; text-underline-offset: 3px; }
.nd-prose a {
    color: #58a6ff;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(88, 166, 255, .4);
}
.nd-prose a:hover { text-decoration-color: #58a6ff; }

.nd-prose ul, .nd-prose ol { margin: 0 0 1.2em; }
.nd-prose ul { padding-left: 0; }
.nd-prose ul > li { position: relative; padding-left: 18px; margin-bottom: 7px; line-height: var(--lh-loose, 1.9); }
.nd-prose ul > li::before {
    content: '';
    position: absolute;
    left: 3px;
    top: .78em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #3d6fa8;
}
.nd-prose ol { padding-left: 22px; list-style: decimal; }
.nd-prose ol > li { margin-bottom: 7px; padding-left: 3px; line-height: var(--lh-loose, 1.9); list-style: decimal; }
.nd-prose ol > li::marker { color: var(--muted); font-family: var(--mono); font-size: var(--fs-xs, 13px); }
.nd-prose li > ul, .nd-prose li > ol { margin: 7px 0 4px; }

.nd-prose blockquote {
    margin: 22px 0;
    padding: 14px 16px 14px 18px;
    border-left: 3px solid var(--brand);
    border-radius: 0 8px 8px 0;
    background: rgba(47, 129, 247, .07);
    color: var(--text-2);
    font-size: var(--fs-base, 15px);
}
.nd-prose blockquote p:last-child { margin-bottom: 0; }
.nd-prose blockquote strong { color: var(--text); }

/* 正文图片：编辑器插入的图不带 width/height，这里统一限宽，
   不加的话 1440px 的原图会把 760px 的正文撑出横向滚动条 */
.nd-prose img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 22px auto;
    border-radius: 10px;
    border: 1px solid var(--line-soft);
}
.nd-prose .imgzoom { display: block; margin: 22px 0; }
.nd-prose .imgzoom img { margin: 0 auto; }
.nd-prose figure { margin: 22px 0; }
.nd-prose figure img { margin: 0 auto; }
.nd-prose figcaption {
    margin-top: 9px;
    font-size: var(--fs-xs, 13px);
    line-height: var(--lh-base, 1.7);
    color: var(--muted);
    text-align: center;
}

.nd-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 22px 0;
    font-size: var(--fs-sm, 14px);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.nd-prose table th, .nd-prose table td {
    border: 1px solid var(--line);
    padding: 9px 12px;
    text-align: left;
    vertical-align: top;
    line-height: var(--lh-base, 1.7);
}
.nd-prose table th { background: #0d141e; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.nd-prose table tr:nth-child(even) td { background: rgba(255, 255, 255, .014); }

.nd-prose code {
    font-family: var(--mono);
    font-size: var(--fs-sm, 14px);
    color: #9fd3b8;
    background: #0b1119;
    border: 1px solid var(--line-soft);
    border-radius: 5px;
    padding: 1px 6px;
    overflow-wrap: break-word;
}
.nd-prose pre {
    margin: 22px 0;
    padding: 14px 16px;
    overflow-x: auto;
    background: #0a0f16;
    border: 1px solid var(--line-soft);
    border-radius: 9px;
    font-family: var(--mono);
    font-size: var(--fs-xs, 13px);
    line-height: 1.75;
    color: var(--text-2);
}
.nd-prose pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
.nd-prose hr { border: none; border-top: 1px solid var(--line); margin: 30px 0; }

.nd-zoomhint { margin-top: 20px; font-size: var(--fs-xs, 13px); color: #5f7089; text-align: center; }

/* ---------------- 上一篇 / 下一篇 ---------------- */
.nd-pn {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 40px;
    padding-top: 22px;
    border-top: 1px solid var(--line-soft);
}
.nd-pn-i {
    display: block;
    padding: 13px 15px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
    transition: border-color .18s, transform .18s;
    min-width: 0;
}
.nd-pn-i:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.nd-pn-i span { display: block; font-size: var(--fs-xs, 13px); color: var(--muted); }
.nd-pn-i b {
    display: block;
    margin-top: 5px;
    font-size: var(--fs-sm, 14px);
    font-weight: 500;
    line-height: 1.6;
    color: var(--text);
}
.nd-pn-i.is-next { text-align: right; }
.nd-pn-empty { display: block; }

/* ---------------- 相关阅读 ---------------- */
.nd-rel { margin-top: 34px; }
.nd-rel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.nd-rel-head h3 { font-size: var(--fs-base, 15px); font-weight: 600; color: var(--text); }
.nd-rel-head a { font-size: var(--fs-xs, 13px); color: var(--muted); }
.nd-rel-head a:hover { color: var(--text); }
.nd-rel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.nd-rel-card {
    display: block;
    min-width: 0;
    padding: 13px 14px;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    transition: border-color .18s, transform .18s;
}
.nd-rel-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.nd-rel-t {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: var(--fs-sm, 14px);
    font-weight: 500;
    line-height: 1.6;
    color: var(--text);
}
.nd-rel-d { display: block; margin-top: 6px; font-family: var(--mono); font-size: var(--fs-xs, 13px); color: var(--muted); }

.nd-cta { margin-top: 38px; text-align: center; }

/* 小屏目录按钮：桌面不出现（桌面有常驻左栏） */
.nd-tocbtn { display: none; }

/* ==========================================================================
   900 以下：两栏折叠成单栏，左栏变成顶部「目录」抽屉
   ========================================================================== */
@media (max-width: 900px) {
    .nd-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .nd-main { max-width: none; }

    .nd-side {
        position: static;
        max-height: none;
        overflow: visible;
        border-right: none;
        border-top: 1px solid var(--line-soft);
        border-bottom: 1px solid var(--line-soft);
        padding: 12px 0;
    }
    /* 有 JS 时默认收起，点「目录」再展开；没 JS 时保持展开，保证内容可达 */
    .nd-js .nd-side { display: none; }
    .nd-js .nd-side.is-open { display: flex; flex-direction: column; }
    /* 手机上点「目录」的人要的就是本文目录，把它排到工具/产品/资讯之前 */
    .nd-toc { order: -1; border-top: none; padding-top: 0; margin-top: 0; margin-bottom: 22px; }

    .nd-tocbtn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        margin-bottom: 16px;
        padding: 10px 14px;
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        background: var(--panel);
        color: var(--text);
        font-size: var(--fs-sm, 14px);
        cursor: pointer;
    }
    .nd-tocbtn b { font-family: var(--mono); font-size: var(--fs-xs, 13px); font-weight: 400; color: var(--muted); }
    /* 移动端「共 N 节」与目录按钮上的「N 节」重复，去掉一个 */
    .nd-meta .nd-meta-n { display: none; }

    /* 抽屉展开后目录条目多一点就会很长，限高滚动，避免把正文顶到看不见 */
    .nd-side.is-open .nd-toc { max-height: 46vh; overflow-y: auto; }

    .nd-head h1 { font-size: var(--fs-xl, 26px); }
    .nd-rel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    /* 与 app.css 的 .wrap 同步收窄，保证文章页和站内其它页的左右边距一致 */
    .nd-wrap { padding: 0 16px; }
    .nd-head { padding: 14px 0 16px; }
    .nd-head h1 { font-size: var(--fs-xl, 26px); line-height: 1.45; }
    .nd-sub { font-size: var(--fs-sm, 14px); }
    .nd-prose { font-size: var(--fs-base, 15px); }
    .nd-prose h2 { font-size: var(--fs-md, 17px); margin-top: 30px; }
    .nd-prose h3 { font-size: var(--fs-base, 15px); margin-top: 24px; }
    .nd-prose table { font-size: var(--fs-sm, 14px); }
    .nd-prose table th, .nd-prose table td { padding: 7px 9px; }
    .nd-pn { grid-template-columns: minmax(0, 1fr); }
    .nd-pn-i.is-next { text-align: left; }
    .nd-rel-grid { grid-template-columns: minmax(0, 1fr); }
}
