/* ============================================================
   京东运营双擎 · 说明文档页样式
   复用 style.css 的设计令牌（京东蓝 / 墨色 / 硬阴影 / 像素字体）
   ============================================================ */

/* ---------- 骨架 ---------- */
.docs-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 208px;
  gap: 32px;
  align-items: start;
  padding: 26px 0 8px;
}

/* ============================================================
   左侧章节树
   ============================================================ */
.docs-side {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  scrollbar-width: thin;
}
.docs-side::-webkit-scrollbar { width: 8px; }
.docs-side::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

.docs-side__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.docs-side__bar .px { color: var(--brand-ink); font-size: 11px; letter-spacing: .1em; }
html[data-theme-allow='1'][data-theme='light'] .docs-side__bar .px { color: #2a53cc; }
.docs-side__close { display: none; }

.docs-side__home {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 700;
  transition: background-color .15s ease, color .15s ease;
}
.docs-side__home svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--brand-ink); }
html[data-theme-allow='1'][data-theme='light'] .docs-side__home svg { color: #2a53cc; }
.docs-side__home em {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: 10px;
  font-style: normal;
  letter-spacing: .04em;
}
.docs-side__home:hover, .docs-side__home.is-active { background: var(--brand-soft); }
.docs-side__home.is-active { color: var(--ink); }

.docs-tree { margin-top: 12px; display: grid; gap: 4px; }
.docs-tree__group { border-radius: 6px; }

.docs-tree__part {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 5px;
  transition: background-color .15s ease;
}
.docs-tree__part:hover { background: var(--brand-soft); }
.docs-tree__pmain {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.45;
}
.docs-tree__pnum {
  margin-left: auto;
  flex: 0 0 auto;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: 10px;
}

.docs-tree__kids { display: none; padding: 2px 0 8px 8px; margin-left: 6px; border-left: 1px solid var(--line); }
.docs-tree__group.is-open .docs-tree__kids { display: block; }

.docs-tree__kid {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 6px;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background-color .15s ease, color .15s ease;
}
.docs-tree__kid:hover { background: var(--brand-soft); }
.docs-tree__kid.is-active { background: var(--brand); }
.docs-tree__kid.is-active .docs-tree__cno,
.docs-tree__kid.is-active .docs-tree__ctitle { color: #11130e; }
.docs-tree__cno {
  color: var(--brand-ink);
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: .02em;
  padding-top: 2px;
}
html[data-theme-allow='1'][data-theme='light'] .docs-tree__cno { color: #2a53cc; }
.docs-tree__ctitle { color: var(--muted); font-size: 12.5px; line-height: 1.5; }

/* ============================================================
   主内容区
   ============================================================ */
.docs-main { min-width: 0; }

.docs-side__open {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 2px solid var(--edge);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.docs-side__open svg { width: 16px; height: 16px; }

/* v1.3.16：总览页的大横幅（.docs-hero）、篇卡片（.docs-parts/.docs-part）、
   快速入口（.docs-quick）已按需求整块删除，样式一并移除。 */

/* ---------- 区块 ---------- */
.docs-sec { margin-top: 46px; }
.docs-sec__head { margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.docs-sec__head h2 {
  margin-top: 8px;
  font-size: clamp(21px, 2.1vw, 28px);
  font-weight: 800;
  letter-spacing: -.025em;
}
.docs-sec__head p { margin-top: 8px; color: var(--muted); font-size: 14.5px; }

/* ---------- 完整目录 ---------- */
.docs-index { display: grid; gap: 22px; }
.docs-index__block h4 {
  padding-bottom: 9px;
  margin-bottom: 10px;
  border-bottom: 1px dashed var(--line);
  font-size: 15px;
  font-weight: 800;
}
.docs-index__block ol { display: grid; gap: 2px; }
.docs-index__block a {
  display: grid;
  grid-template-columns: 58px minmax(0, 190px) minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 9px 11px;
  border-radius: 5px;
  transition: background-color .15s ease;
}
.docs-index__block a:hover { background: var(--brand-soft); }
.docs-index__cno { color: var(--brand-ink); font-family: var(--font-pixel); font-size: 10.5px; }
html[data-theme-allow='1'][data-theme='light'] .docs-index__cno { color: #2a53cc; }
.docs-index__ct { font-size: 14px; font-weight: 700; }
.docs-index__cs { color: var(--muted); font-size: 12.5px; }

/* ---------- 面包屑 / 文章头 ---------- */
.docs-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12.5px;
}
.docs-crumb a { color: var(--muted); }
.docs-crumb a:hover { color: var(--brand-ink); }
html[data-theme-allow='1'][data-theme='light'] .docs-crumb a:hover { color: #2a53cc; }
.docs-crumb span:last-child { color: var(--ink); }

.docs-head { margin-bottom: 24px; }
.docs-head__title { margin-top: 12px; font-size: clamp(25px, 2.9vw, 38px); font-weight: 800; letter-spacing: -.03em; line-height: 1.2; }
.docs-head__desc { margin-top: 10px; color: var(--muted); font-size: 15px; }

/* ---------- 某一篇的章节卡 ---------- */
.docs-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.docs-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.docs-card:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.docs-card__cno { color: var(--brand-ink); font-family: var(--font-pixel); font-size: 11px; letter-spacing: .06em; }
html[data-theme-allow='1'][data-theme='light'] .docs-card__cno { color: #2a53cc; }
.docs-card h3 { margin-top: 9px; font-size: 17px; font-weight: 800; letter-spacing: -.015em; }
.docs-card p { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.docs-card__go { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 13px; font-weight: 700; }
.docs-card__go em { color: var(--brand-ink); font-style: normal; font-family: var(--font-pixel); }
html[data-theme-allow='1'][data-theme='light'] .docs-card__go em { color: #2a53cc; }

/* ---------- 文章 ---------- */
.docs-article {
  padding: 34px 38px 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.docs-article__head { padding-bottom: 22px; margin-bottom: 26px; border-bottom: 2px solid var(--edge); }
.docs-article__head h1 {
  margin-top: 12px;
  font-size: clamp(25px, 2.9vw, 38px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.22;
}
.docs-article__sum { margin-top: 12px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.docs-article__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.docs-article__meta {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: 10.5px;
  letter-spacing: .05em;
}

/* ---------- 翻页 ---------- */
.docs-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.docs-pager__a {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.docs-pager__a.is-next { text-align: right; }
.docs-pager__a.is-empty { border: 1px dashed var(--line); opacity: .35; }
.docs-pager__a:not(.is-empty):hover { border-color: var(--brand); transform: translate(-2px, -2px); box-shadow: var(--shadow-sm); }
.docs-pager__k { color: var(--muted); font-family: var(--font-pixel); font-size: 10.5px; letter-spacing: .05em; }
.docs-pager__a strong { font-size: 13.5px; font-weight: 700; line-height: 1.5; }

/* ---------- 404 ---------- */
.docs-404 { padding: 70px 20px; text-align: center; }
.docs-404 h1 { margin-top: 12px; font-size: 30px; font-weight: 800; }
.docs-404 p { margin: 12px 0 24px; color: var(--muted); }

/* ============================================================
   右侧本页目录
   ============================================================ */
.docs-toc { position: sticky; top: 86px; }
.docs-toc__inner {
  padding: 15px 16px 18px;
  border-left: 2px solid var(--line);
}
.docs-toc__inner .px { color: var(--muted); font-size: 10.5px; letter-spacing: .1em; }
.docs-toc ul { margin-top: 12px; display: grid; gap: 3px; }
.docs-toc a {
  display: block;
  padding: 5px 0 5px 10px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  transition: color .15s ease, border-color .15s ease;
}
.docs-toc a:hover { color: var(--ink); }
.docs-toc li.lvl-3 a { padding-left: 22px; font-size: 12px; }
.docs-toc li.lvl-4 a { padding-left: 32px; font-size: 11.5px; }
.docs-toc li.is-active > a {
  color: var(--ink);
  border-left-color: var(--brand);
  font-weight: 700;
}
.docs-toc__tip { margin-top: 10px; color: var(--muted); font-size: 12.5px; line-height: 1.75; }

/* 移动端遮罩 */
.docs-mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(2px);
}

/* ============================================================
   Markdown 正文排版
   ============================================================ */
.md-body { font-size: 15px; line-height: 1.9; color: var(--ink); }
.md-body > *:first-child { margin-top: 0; }

.md-h1, .md-h2, .md-h3, .md-h4, .md-h5, .md-h6 {
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.35;
  scroll-margin-top: 96px;
}
.md-h1 { margin: 34px 0 16px; font-size: 27px; }
.md-h2 {
  margin: 38px 0 14px;
  padding-left: 14px;
  font-size: 22px;
  border-left: 5px solid var(--brand);
}
.md-h3 { margin: 28px 0 10px; font-size: 18px; }
.md-h4 { margin: 22px 0 8px; font-size: 16px; color: var(--muted); }

.md-p { margin: 13px 0; }
.md-body a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
html[data-theme-allow='1'][data-theme='light'] .md-body a { color: #2a53cc; }
.md-body b { font-weight: 800; }
.md-body i { font-style: italic; opacity: .92; }
.md-body del { opacity: .55; }
.md-body img { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; margin: 14px 0; }

.md-body code {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper-alt);
  color: var(--brand-ink);
  font-family: var(--font-mono);
  font-size: .89em;
  word-break: break-word;
}
html[data-theme-allow='1'][data-theme='light'] .md-body code { color: #2a53cc; }

.md-pre {
  margin: 16px 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0d09;
  overflow: hidden;
}
.md-pre code {
  display: block;
  padding: 16px 18px;
  border: none;
  background: transparent;
  color: #d5dcc9;
  font-size: 13px;
  line-height: 1.95;
  white-space: pre;
  overflow-x: auto;
}
html[data-theme-allow='1'][data-theme='light'] .md-pre code { color: #d5dcc9; }

.md-ul, .md-ol { margin: 13px 0; padding-left: 4px; display: grid; gap: 7px; }
.md-ul > li, .md-ol > li {
  position: relative;
  padding-left: 20px;
  line-height: 1.8;
}
.md-ul > li::before {
  content: '';
  position: absolute;
  top: .72em; left: 2px;
  width: 7px; height: 7px;
  background: var(--brand);
}
.md-ol { counter-reset: mdol; }
.md-ol > li { counter-increment: mdol; padding-left: 28px; }
.md-ol > li::before {
  content: counter(mdol);
  position: absolute;
  top: .12em; left: 0;
  color: var(--brand-ink);
  font-family: var(--font-pixel);
  font-size: 12px;
}
html[data-theme-allow='1'][data-theme='light'] .md-ol > li::before { color: #2a53cc; }

/* 任务列表 */
.md-tasks { gap: 9px; }
.md-tasks > li.md-task {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  padding-left: 2px;
}
.md-tasks > li.md-task::before { display: none; }
.md-check {
  display: grid;
  place-items: center;
  width: 17px; height: 17px;
  margin-top: .34em;
  border: 1.5px solid var(--line);
  border-radius: 3px;
  color: var(--ink-invert);
  font-size: 11px;
  line-height: 1;
}
.md-task.is-done .md-check { background: var(--brand); border-color: var(--brand); }
.md-task.is-done > span:last-child { color: var(--muted); }

.md-quote {
  margin: 16px 0;
  padding: 13px 18px;
  border-left: 4px solid var(--brand);
  border-radius: 0 6px 6px 0;
  background: var(--brand-soft);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.85;
}
.md-quote::before {
  content: 'NOTE';
  display: block;
  margin-bottom: 4px;
  color: var(--brand-ink);
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: .12em;
}
html[data-theme-allow='1'][data-theme='light'] .md-quote::before { color: #2a53cc; }

.md-hr { margin: 28px 0; border: none; border-top: 1px dashed var(--line); }

.md-tablewrap {
  margin: 16px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.md-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.md-table th {
  padding: 11px 14px;
  border-bottom: 2px solid var(--edge);
  background: var(--paper-alt);
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-align: left;
  white-space: nowrap;
}
.md-table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.md-table tr:last-child td { border-bottom: none; }
.md-table tbody tr:hover { background: var(--brand-soft); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1280px) {
  .docs-shell { grid-template-columns: 244px minmax(0, 1fr); gap: 26px; }
  .docs-toc { display: none; }
}

@media (max-width: 980px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .docs-side {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 100;
    width: min(320px, 86vw);
    max-height: none;
    border-radius: 0;
    border: none;
    border-right: 2px solid var(--edge);
    transform: translateX(-102%);
    transition: transform .26s cubic-bezier(.2, .8, .3, 1);
    padding-top: 18px;
  }
  .docs-body.is-side-open .docs-side { transform: none; }
  .docs-body.is-side-open .docs-mask { display: block; }
  .docs-side__close {
    display: grid;
    place-items: center;
    width: 30px; height: 30px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
  }
  .docs-side__close svg { width: 14px; height: 14px; }
  .docs-side__open { display: inline-flex; }
  .docs-cards { grid-template-columns: minmax(0, 1fr); }
  .docs-article { padding: 26px 22px 24px; }
  .docs-index__block a { grid-template-columns: 54px minmax(0, 1fr); }
  .docs-index__cs { display: none; }
}

@media (max-width: 640px) {
  .docs-pager { grid-template-columns: minmax(0, 1fr); }
  .docs-article { padding: 22px 16px 20px; }
  .docs-article__meta { margin-left: 0; width: 100%; }
  .md-h2 { font-size: 19px; }
  .md-body { font-size: 14.5px; }
}

/* ============================================================
   富文本正文（.doc-html）
   编辑器产出的是干净的 <p>/<h2>/<ul>，没有 .md-* class，
   所以这里按「元素」再写一遍排版，效果与 Markdown 渲染保持一致。
   ============================================================ */
.doc-html > *:first-child { margin-top: 0; }
.doc-html h1, .doc-html h2, .doc-html h3,
.doc-html h4, .doc-html h5, .doc-html h6 {
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.35;
  scroll-margin-top: 96px;
}
.doc-html h1 { margin: 34px 0 16px; font-size: 27px; }
.doc-html h2 {
  margin: 38px 0 14px;
  padding-left: 14px;
  font-size: 22px;
  border-left: 5px solid var(--brand);
}
.doc-html h3 { margin: 28px 0 10px; font-size: 18px; }
.doc-html h4 { margin: 22px 0 8px; font-size: 16px; color: var(--muted); }
.doc-html h5, .doc-html h6 { margin: 18px 0 8px; font-size: 15px; color: var(--muted); }

.doc-html p { margin: 13px 0; }
.doc-html a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
.doc-html strong, .doc-html b { font-weight: 800; }
.doc-html em, .doc-html i { font-style: italic; }
.doc-html mark { padding: 1px 5px; border-radius: 3px; background: var(--brand); color: #fff; }

.doc-html ul, .doc-html ol { margin: 13px 0; padding-left: 4px; display: grid; gap: 7px; }
.doc-html ul, .doc-html ol { list-style: none; }
.doc-html li { position: relative; padding-left: 22px; line-height: 1.8; }
.doc-html ul > li::before {
  content: '';
  position: absolute;
  top: .72em; left: 2px;
  width: 7px; height: 7px;
  background: var(--brand);
}
.doc-html ol { counter-reset: dho; }
.doc-html ol > li { counter-increment: dho; padding-left: 28px; }
.doc-html ol > li::before {
  content: counter(dho);
  position: absolute;
  top: .12em; left: 0;
  color: var(--brand-ink);
  font-family: var(--font-pixel);
  font-size: 12px;
}

.doc-html blockquote {
  margin: 16px 0;
  padding: 13px 18px;
  border-left: 4px solid var(--brand);
  border-radius: 0 6px 6px 0;
  background: var(--brand-soft);
  font-size: 14.5px;
  line-height: 1.85;
}
.doc-html code {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper-alt);
  color: var(--brand-ink);
  font-family: var(--font-mono);
  font-size: .89em;
  word-break: break-word;
}
.doc-html pre {
  margin: 16px 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0e16;
  overflow-x: auto;
}
.doc-html pre code {
  padding: 0; border: none; background: transparent;
  color: #cfd6e4; font-size: 13px; line-height: 1.95; white-space: pre;
}
.doc-html hr { margin: 28px 0; border: none; border-top: 1px dashed var(--line); }
.doc-html table {
  width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
  font-size: 14px;
}
.doc-html th, .doc-html td { padding: 11px 14px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc-html th {
  background: var(--paper-alt);
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: 11px;
  letter-spacing: .06em;
}
.doc-html img {
  max-width: 100%;
  height: auto;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: zoom-in;          /* 点了会放大 */
  transition: border-color .16s ease, transform .16s ease;
}
.doc-html img:hover { border-color: var(--brand); transform: translateY(-2px); }
.doc-html video {
  max-width: 100%;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
}
.doc-html figure { margin: 18px 0; }
.doc-html figcaption { margin-top: 8px; color: var(--muted); font-size: 13px; text-align: center; }

.doc-html iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 16px 0;
}

/* ============================================================
   图片放大（lightbox）
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  place-items: center;
  padding: 40px 24px;
  background: rgba(6, 8, 14, .93);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lightbox.is-open { display: grid; }
.lightbox__img {
  max-width: min(96vw, 1600px);
  max-height: 86vh;
  width: auto;
  height: auto;
  border: 2px solid var(--brand);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  cursor: zoom-out;
}
.lightbox__cap {
  margin-top: 14px;
  max-width: 800px;
  color: #cfd6e4;
  font-size: 13.5px;
  line-height: 1.7;
  text-align: center;
}
.lightbox__close {
  position: absolute;
  top: 20px; right: 22px;
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border: 2px solid var(--brand);
  border-radius: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
}
.lightbox__close:hover { background: var(--brand); color: #fff; }
.lightbox__close svg { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .lightbox { padding: 20px 12px; }
  .lightbox__img { max-height: 74vh; }
}
