/* 本篇专用样式：只服务这一篇文章，不与其他页面共用。 */
:root {
  color-scheme: light dark;
  --brand: #3D65FD;
  --ink: #14181d;
  --ink-soft: #4d5764;
  --line: #e5e9ee;
  --line-strong: #d3d9e1;
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --measure: 39rem;
  --side: 14.5rem;
  --gap: 3rem;
  --page: 78rem;
  --grid-gap: 1.5rem;
  --radius: 10px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.85;
  line-break: strict;
  text-spacing-trim: trim-start;
  hanging-punctuation: allow-end;
  font-kerning: normal;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
a:hover { border-bottom-color: var(--brand); }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

.skip-link { position: absolute; left: -9999px; top: 0; padding: .6rem 1rem; background: var(--ink); color: #fff; z-index: 60; }
.skip-link:focus { left: .5rem; top: .5rem; }

/* 页头：左边署名、右边站点入口，只占一行，尺寸比正文小一档 */
.site-header { border-bottom: 1px solid var(--line); }
.site-header__inner, .wrap { width: 100%; max-width: var(--page); margin: 0 auto; padding: 0 1.5rem; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.15rem; padding-bottom: 1.15rem; }
.brand-name { font-size: .95rem; font-weight: 600; letter-spacing: .01em; color: var(--ink); border-bottom: 0; }
.brand-name--logo { display: inline-flex; align-items: center; }
.brand-logo { height: 1.75rem; width: auto; display: block; }
.site-header__link { font-size: .9rem; color: var(--ink-soft); border-bottom: 0; }
.site-header__link:hover { color: var(--brand); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 宽屏：左侧目录栏 + 右侧正文栏，把页面宽度用起来，正文行长仍受控 */
.side { display: none; }
@media (min-width: 1080px) {
  /* 12 栏页栅格：目录 3 栏 / 正文 7 栏 / 右侧 2 栏留白（标题与整图会跨过去） */
  .layout { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--grid-gap); justify-content: center; align-items: start; }
  .side { display: block; grid-column: 1 / span 3; position: sticky; top: 2rem; padding: 2.4rem 0 0; }
  .post { grid-column: 4 / span 7; }
  .side__label { margin: 0 0 .9rem; padding-bottom: .6rem; font-size: .78rem; letter-spacing: .08em; color: var(--ink-soft); border-bottom: 1px solid var(--line); }
  .side__list { counter-reset: toc; list-style: none; margin: 0; padding: 0 0 0 .85rem; font-size: .875rem; line-height: 1.65; border-left: 1px solid var(--line); }
  .side__list li { margin-bottom: .7rem; }
  .side__list > li:not(.side__sub) { counter-increment: toc; }
  .side__list > li:not(.side__sub) a::before { content: counter(toc, decimal-leading-zero); margin-right: .5rem; font-size: .74em; color: var(--brand); opacity: .6; font-variant-numeric: tabular-nums; }
  .side__list a { color: var(--ink); font-weight: 500; border-bottom: 0; }
  .side__list a:hover { color: var(--brand); }
}

/* 目录：宽屏用左侧栏，窄屏用原生折叠，手机读长文也有导航 */
.side__sub { margin-left: .55rem; font-size: .86em; }
.side__list .side__sub { color: var(--ink-soft); }
.side__list .side__sub a { color: var(--ink-soft); font-weight: 400; }
.toc-inline { margin: 0 0 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; background: var(--bg-soft); }
.toc-inline summary { font-size: .9rem; color: var(--ink-soft); cursor: pointer; }
.toc-inline__list { margin: .6rem 0 0; padding-left: 1.2rem; font-size: .9rem; line-height: 1.7; }
.toc-inline__list a { color: var(--ink-soft); border-bottom: 0; }
@media (min-width: 1080px) {
  .toc-inline { display: none; }
}

/* 首屏：标题、副标题、元信息，紧跟正文第一段 */
.post { padding: 2.4rem 0 3rem; min-width: 0; }
.post-header h1 { font-size: clamp(2.1rem, 3.2vw, 2.75rem); line-height: 1.24; font-weight: 700; letter-spacing: -.01em; margin: 0 0 1rem; }
/* 刊头：标题上方一道品牌色短线，给页面一个开场重音 */
.post-header h1::before { content: ""; display: block; width: 2.75rem; height: 3px; border-radius: 2px; background: var(--brand); margin-bottom: 1.1rem; }
.post-subtitle { color: var(--ink-soft); font-size: 1.04rem; line-height: 1.75; margin: 0 0 1.4rem; }
.post-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 1.2rem; padding: 0; margin: 0 0 1.8rem; font-size: .875rem; color: var(--ink-soft); }
.meta-label { margin-right: .4rem; }
@media (min-width: 1200px) {
  /* 标题与摘要向右跨栏：首屏不再缩在窄栏里，右侧留白也不白留 */
  .post-header h1, .post-subtitle { margin-right: -10.5rem; }
}

/* 正文排版：18px 正文配 39rem 栏宽，每行约 34 个汉字；段距明显大于行距 */
.post p { margin: 0 0 1.15rem; }
/* 开篇第一段略大，当导语用；重点句块不算导语，不跟着放大 */
.post > p:first-of-type:not(.keyline) { font-size: 1.1em; line-height: 1.78; margin-bottom: 1.7rem; }
/* 段末不孤字、标题不断行：浏览器支持的才生效，不支持不影响阅读 */
.post p, .post li { text-wrap: pretty; }
.post-header h1, .masthead__title, .post h2, .post h3 { text-wrap: balance; }
/* 强调：重点由字重、字号与留白承担，不用颜色刷字，也不加底色块 */
.post strong { font-weight: 700; color: var(--ink); }
/* 重点句：字号拉大 + 一句中性荧光笔底色，靠体量与痕迹强调，不用彩色刷字 */
.post .keyline { margin: 2.8rem 0; font-size: 1.28em; line-height: 1.66; font-weight: 600; }
.post .keyline::before { display: none; }
.post .keyline strong { font-weight: 700; box-shadow: inset 0 -.48em 0 rgba(20, 24, 29, .07); box-shadow: inset 0 -.48em 0 color-mix(in srgb, var(--brand) 16%, transparent); }
.post .keyline strong { font-weight: 700; }
.post h2 { font-size: 1.42rem; line-height: 1.45; letter-spacing: .01em; margin: 3.2rem 0 1.1rem; }
.post h3 { font-size: 1.16rem; line-height: 1.5; margin: 2.4rem 0 .85rem; }
.post h4, .post h5, .post h6 { font-size: 1.02rem; margin: 1.8rem 0 .7rem; }
.post ul, .post ol { padding-left: 1.25rem; margin: 0 0 1.3rem; }
.post li { margin-bottom: .65rem; }
.post li:last-child { margin-bottom: 0; }
.post li::marker { color: var(--brand); }
/* 引用：浅底 + 大引号，与正文拉开一层，不把原话改成宣传语 */
.quote { position: relative; margin: 2rem 0; padding: 1.1rem 1.3rem 1.1rem 3.2rem; border-left: 0; border-radius: 8px; background: var(--bg-soft); color: var(--ink); font-size: .98em; }
.quote::before { content: "“"; position: absolute; left: .95rem; top: .45rem; font-family: Georgia, "Times New Roman", serif; font-size: 3rem; line-height: 1; color: var(--brand); opacity: .5; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 2.2rem 0; }

/* 表格与代码：窄屏不撑破版面 */
.code { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; overflow-x: auto; font-family: var(--font-mono); font-size: .9rem; line-height: 1.7; }
.table-wrap { overflow-x: auto; margin: 0 0 1.4rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: left; }
th { background: var(--bg-soft); }

/* 图：与正文同栏同宽。图只往右出血时，图的右边界与文字对不上，整篇看着参差 */
.post-figure { margin: 1.8rem 0; }
.post-figure img { border-radius: var(--radius); border: 1px solid var(--line); }
figcaption { font-size: .85rem; color: var(--ink-soft); margin-top: .6rem; }
.zoom { display: block; border-bottom: 0; }
/* 手机端宽图会在自己的容器里横滑；不提示一句，读者会以为图被裁了一半。
   提示不进正文、不进 markdown，只在窄屏显示，桌面端完全不出。 */
.post-figure .zoom-hint { display: none; }
.image-gap { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: .9rem 1rem; margin: 1.6rem 0; background: var(--bg-soft); }
.image-gap__label { font-size: .8rem; color: var(--ink-soft); margin: 0 0 .3rem; }
.image-gap__note { margin: 0; }
/* 预览：浮层不铺满视口，四周留边；关闭后阅读位置不变 */
.zoom-exit { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lightbox { display: none; }
.lightbox:target { display: grid; place-items: center; position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 16, .8); padding: clamp(1rem, 4vw, 2.5rem); }
.lightbox img { max-width: min(88vw, 72rem); max-height: 76vh; width: auto; height: auto; object-fit: contain; border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.lightbox__close { position: fixed; top: 1rem; right: 1.2rem; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.4rem; line-height: 1; border-bottom: 0; }
.lightbox__close:hover { background: rgba(255, 255, 255, .3); }

/* 文末引导：与正文同一起点的一条细线 + 一个轻量按钮（描边，悬停才实底） */
.post .brand-foot { display: flex; justify-content: flex-start; margin: 3rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.post .brand-foot__cta { display: inline-flex; align-items: center; padding: .48rem 1rem; border: 1px solid var(--brand); border-radius: 6px; background: transparent; color: var(--brand); font-size: .9rem; font-weight: 500; line-height: 1.5; transition: background-color .18s ease, color .18s ease; }
.post .brand-foot__cta:hover { background: var(--brand); color: #fff; }
.post .brand-foot__cta:active { transform: translateY(1px); }
.post .brand-foot__cta:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

@media (max-width: 640px) {
  .site-header__inner { padding-top: .85rem; padding-bottom: .85rem; }
  .brand-logo { height: 1.45rem; }
}

/* 窄屏、弱动效、打印 */
@media (max-width: 640px) {
  body { font-size: 16.5px; line-height: 1.8; }
  .post { padding-top: 1.8rem; }
  .post h2 { margin-top: 2.6rem; }
  .post .brand-foot { margin-top: 2.6rem; }
  /* 宽图（结构图、信息图）普遍按 1200 宽设计，手机上若压到容器宽，字会缩成 5–6px。
     这里只让「图本身」横滚、保持原尺寸，图注不跟着滚，全文也不会横滚。 */
  .post-figure .zoom { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .post-figure .zoom img { max-width: none; width: auto; }
  .post-figure .zoom-hint { display: block; margin-top: .5rem; font-size: 12px; line-height: 1.6; color: var(--ink-soft); text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media print {
  .site-header, .brand-foot, .skip-link, .lightbox { display: none; }
  body { color: #000; background: #fff; }
  .wrap { max-width: none; }
}

/* 版式变体：长文编辑版——分章序号 */
.theme-editorial .post, .theme-feature .post { counter-reset: section; }
.theme-editorial .post h2, .theme-feature .post h2 { position: relative; counter-increment: section; font-size: 1.5rem; margin: 3.4rem 0 1.1rem; }
/* 章节：大号浅色数字悬挂在正文左侧，形成刊物的节律（窄屏退回行内） */
.theme-editorial .post h2::before, .theme-feature .post h2::before { content: counter(section, decimal-leading-zero); position: absolute; left: -4.1rem; top: -.5rem; font-size: 2.7rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--brand); opacity: .16; pointer-events: none; }
@media (max-width: 1079px) {
  .theme-editorial .post h2, .theme-feature .post h2 { padding-left: 2.7rem; }
  .theme-editorial .post h2::before, .theme-feature .post h2::before { left: 0; top: -.15rem; font-size: 1.7rem; }
}

/* 版式变体：图文杂志版——标题更大、分章用横线 */
.theme-magazine .post-header h1 { font-size: clamp(2.05rem, 2.9vw, 2.45rem); }
.theme-magazine .post h2 { border-top: 2px solid var(--ink); padding-top: .8rem; }

/* 版式变体：技术文档版——朴素栅格，代码与表格优先 */
.theme-docs .post h2 { border-bottom: 1px solid var(--line); padding-bottom: .4rem; }

/* 版式变体：深度特稿版——深色刊头带、白底正文、拉出式重点句 */
.theme-feature .masthead { background: var(--bg); color: var(--ink); border-bottom: 1px solid var(--line-strong); }
.theme-feature .masthead__inner { width: 100%; max-width: var(--page); margin: 0 auto; padding: 0 1.5rem 2.6rem; }
@media (min-width: 1080px) {
  .theme-feature .masthead__inner { padding-left: 20.625rem; }
}
.theme-feature .masthead__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.theme-feature .masthead .brand-name { color: var(--ink); }
.theme-feature .masthead .site-header__link { color: var(--ink-soft); border-bottom: 0; }
.theme-feature .masthead .site-header__link:hover { color: var(--brand); }
.theme-feature .masthead__title { font-size: clamp(2.1rem, 2.9vw, 2.6rem); line-height: 1.26; letter-spacing: -.01em; margin: 2.2rem 0 .9rem; color: var(--ink); }
.theme-feature .masthead .post-subtitle { color: var(--ink-soft); font-size: 1.05rem; line-height: 1.75; margin: 0 0 1.3rem; }
.theme-feature .masthead .post-meta { color: var(--ink-soft); margin: 0 0 .2rem; }
.theme-feature .masthead .meta-label { color: var(--ink-soft); }
.theme-feature .post { padding-top: 2.8rem; }
/* 拉出式重点句：从正文里拉出来，靠字号与上下细线给出停顿（特稿版的识别符号） */
.theme-feature .post .keyline { margin: 2.8rem 0; padding: 1.3rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 1.3em; line-height: 1.62; }
.theme-feature .post .keyline strong { box-shadow: none; }

/* 三套版式里的重点句块：装饰一致，力度跟各自的版式走 */
.theme-editorial .post .keyline::before { width: 1.6rem; }
.theme-magazine .post .keyline { font-size: 1.22em; }
.theme-magazine .post .keyline::before { width: 3rem; }
.theme-docs .post .keyline { font-size: 1.1em; }
.theme-docs .post .keyline::before { display: none; }
