/* 最新动态（/news/）：只在新闻页加载（NEWS:HEAD 注入 <link>，带内容指纹）。
   页面骨架沿用 site.css 的 chead / doc / gcards / mcard / gcta，这里只补差异；.nb 是文章正文的容器和隔离层。 */

/* ---------- 文章正文 .nb-guard > .nb ----------
   上传的 <style> 都被加上 .nb 前缀（api/news_html.py），html / body / :root 映射成 .nb 本身，所以作者能盖掉 .nb 上的任何声明。
   隔离因此放在作者选择器够不到的外层：position + isolation 收住层叠与定位，contain: paint 让 fixed 也以它为包含块并裁切，
   overflow 兜底，max-width 防止撑宽页面。 */
.nb-guard {
  position: relative;
  isolation: isolate;
  contain: paint;
  overflow: hidden;
  max-width: 100%;
}
.nb {
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink-2);
  overflow-wrap: break-word;
}
/* 公众号式固定宽度的块（如 section 写死 677px）收进容器，否则右边被 .nb-guard 裁掉。只限宽，表格和 pre 仍在自己内部滚动 */
.nb section, .nb div, .nb article, .nb aside, .nb figure, .nb blockquote, .nb details, .nb p, .nb ul, .nb ol, .nb img, .nb video, .nb audio, .nb iframe { box-sizing: border-box; max-width: 100%; }
/* 公众号风格的基础排版：选择器权重都压在一层，作者的行内样式和 <style> 都能覆盖 */
.nb p { margin: 0 0 1.15em; }
.nb h1, .nb h2, .nb h3, .nb h4, .nb h5, .nb h6 { margin: 1.6em 0 0.6em; font-family: var(--font-display); font-weight: 700; line-height: 1.2; color: var(--ink); }
.nb h1 { font-size: 32px; }
.nb h2 { font-size: 27px; }
.nb h3 { font-size: 21px; }
.nb h4 { font-size: 18px; }
.nb h5, .nb h6 { font-size: 16px; }
.nb > :first-child { margin-top: 0; }
.nb > :last-child { margin-bottom: 0; }
.nb a { color: var(--amber-deep); text-decoration: underline; text-underline-offset: 3px; }
.nb img, .nb video { display: block; max-width: 100%; height: auto; margin-inline: auto; border-radius: var(--r-md); }
.nb audio { display: block; width: 100%; }
.nb figure { margin: 1.5em 0; }
.nb figcaption { margin-top: 8px; font-size: 14px; line-height: 1.5; text-align: center; color: var(--muted); }
.nb ul, .nb ol { margin: 0 0 1.15em; padding-left: 1.5em; }
.nb ul { list-style: disc; }
.nb ol { list-style: decimal; }
.nb li { margin-bottom: 0.4em; }
.nb blockquote { margin: 1.5em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--amber); color: var(--muted); }
.nb hr { margin: 2em 0; border: 0; border-top: 1px solid var(--line); }
/* 宽表格和代码块在自己内部滚动（.nb 整体是 overflow: hidden，不处理就被裁掉） */
.nb table { display: block; max-width: 100%; overflow-x: auto; margin: 1.5em 0; border-collapse: collapse; font-size: 15px; }
.nb th, .nb td { padding: 8px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.nb th { background: var(--soft); font-weight: 600; }
.nb pre { margin: 1.5em 0; padding: 14px 16px; overflow-x: auto; border-radius: var(--r-md); background: var(--soft); font-size: 14px; line-height: 1.55; }
.nb code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.88em; }
.nb details { margin: 1em 0; }
.nb summary { cursor: pointer; font-weight: 600; }
.nb-embed { margin: 1.5em 0; }

/* ---------- 文章页 ---------- */
.nart__title { max-width: 30ch; margin-top: 24px; }
.nart__wrap { padding-block: 36px 64px; }
.nart__col { max-width: 760px; margin-inline: auto; }
.nart__cover { margin-bottom: 28px; }
.nart__cover img { width: 100%; border-radius: var(--r-lg); }
.nart__h { margin-bottom: 16px; font-family: var(--font-display); font-size: 25px; font-weight: 700; line-height: 1.2; }
.nart__faq, .nart__products { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.nart__q { border-bottom: 1px solid var(--line); }
.nart__q summary { padding: 14px 0; font-weight: 600; cursor: pointer; }
.nart__q p { padding-bottom: 16px; font-size: 16px; line-height: 1.65; color: var(--muted); }
.nart__plist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.nart__ctas { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- 列表页 ---------- */
.nlist__note { margin-bottom: 20px; padding: 12px 16px; border-radius: var(--r-md); background: var(--soft); font-size: 15px; color: var(--ink-2); }
.nlist__topics { margin: 0 0 24px; }
.nlist__topics .chip[aria-current] { background: var(--ink); color: #fff; }
.nlist__empty { padding: 48px 0; font-size: 17px; color: var(--muted); }
.ncard { overflow: hidden; }
/* overflow: hidden 必须有：aspect-ratio 盒子默认 min-height:auto，方形封面会把它撑高，整行卡片跟着变高 */
.ncard__media { margin: -24px -24px 4px; aspect-ratio: 16 / 9; background: var(--soft); overflow: hidden; }
/* 无封面的占位块铺满媒体位（卡片圆角由 .ncard 的 overflow 裁出） */
.ncard__media--empty .card__placeholder { border-radius: 0; font-size: 18px; }
.ncard__media img { width: 100%; height: 100%; object-fit: cover; }
.ncard__topics { display: flex; flex-wrap: wrap; gap: 6px; }
/* 标题链接的 ::after 铺满整张卡片，标签要浮在它上面才点得到 */
.ncard__topics .chip { position: relative; z-index: 1; height: 30px; padding: 0 10px; border-color: var(--line-2); font-size: 12.5px; }
.npager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; margin-top: 36px; }
.npager__at { font-family: var(--font-figure); font-size: 14px; color: var(--muted); }

/* ---------- 404 ---------- */
.nmiss { min-height: 40vh; }
.nmiss__text { max-width: 60ch; margin: 14px 0 24px; font-size: 17px; color: var(--muted); }

@media (max-width: 640px) {
  .nb { font-size: 16px; }
  .nb h1 { font-size: 27px; }
  .nb h2 { font-size: 23px; }
  .nb h3 { font-size: 19px; }
  .nart__wrap { padding-block: 24px 44px; }
  .nart__plist { grid-template-columns: minmax(0, 1fr); }
}
