/* 云序使用说明：深色目录 + 浅色正文，长文优先可读性 */

:root {
  --shell: #0b0d11;
  --side: #0f131b;
  --side-line: rgba(255, 255, 255, 0.08);
  --paper: #f7f4ec;
  --paper-2: #fffdf8;
  --ink: #1c1914;
  --muted: #635c50;
  --faint: #8a8172;
  --rule: #ddd5c6;
  --rule-strong: #1c1914;
  --accent: #b83c0a;
  --baijiahao: #6b5bd2;
  --toutiao: #d04a2a;
  --micro: #d4582f;
  --article: #b9821a;
  --video: #c23b2e;
  --sans: "Inter", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--shell);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: rgba(184, 60, 10, 0.18); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 顶栏 ---------- */

.doc-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  background: rgba(11, 13, 17, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f1eee7;
}
.doc-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-right: auto;
}
.doc-brand strong { font-size: 17px; letter-spacing: 0.02em; }
.doc-brand > span:last-child { font-size: 12px; color: #9a948a; }
.doc-mark {
  width: 28px;
  height: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 5px;
  border-radius: 8px;
  background: #171c26;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.doc-mark i { border-radius: 2px; }
.doc-mark i:nth-child(1) { background: #7b6cff; }
.doc-mark i:nth-child(2) { background: #4d8dff; }
.doc-mark i:nth-child(3) { background: #ff6a3d; }
.doc-mark i:nth-child(4) { background: #ffb020; }

.doc-header-right { display: flex; align-items: center; gap: 18px; font-size: 11.5px; }
.doc-version {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: #9a948a;
}
.doc-back {
  text-decoration: none;
  padding: 6px 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  color: #f1eee7;
}
.doc-back:hover { border-color: rgba(255, 255, 255, 0.5); }

/* ---------- 布局 ---------- */

.doc-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  padding-top: 62px;
  min-height: 100vh;
}

.doc-side {
  position: sticky;
  top: 62px;
  height: calc(100vh - 62px);
  overflow-y: auto;
  background: var(--side);
  border-right: 1px solid var(--side-line);
  color: #d8d3c8;
}
.doc-side-inner { padding: 22px 20px 30px; }
.doc-field { display: block; margin-bottom: 14px; }
.doc-field > span {
  display: block;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8b857a;
}
.doc-field select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: #161b24;
  color: #f1eee7;
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
}
.doc-field select:focus { border-color: #ff6a3d; }

.doc-search input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: #121720;
  color: #f1eee7;
  font-size: 12px;
  outline: none;
}
.doc-search input::placeholder { color: #777267; }
.doc-search input:focus { border-color: rgba(255, 106, 61, 0.55); }

.doc-toc {
  margin: 20px 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.doc-toc a {
  display: block;
  padding: 7px 9px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12.5px;
  line-height: 1.5;
  color: #a9a396;
  border-left: 2px solid transparent;
}
.doc-toc a:hover { color: #f1eee7; background: rgba(255, 255, 255, 0.04); }
.doc-toc a.is-active {
  color: #ffb79c;
  border-left-color: #ff6a3d;
  background: rgba(255, 106, 61, 0.08);
}
.doc-side-note {
  margin: 20px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--side-line);
  font-size: 11px;
  line-height: 1.7;
  color: #7f7a6f;
}

.doc-main {
  background: var(--paper);
  padding: 50px 54px 80px;
  min-width: 0;
}
.doc-main > section,
.doc-intro,
.doc-footer {
  width: min(860px, 100%);
  margin-inline: auto;
}

/* ---------- 正文 ---------- */

.doc-intro { padding-bottom: 26px; }
.doc-kicker {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--faint);
}
h1 {
  margin: 0;
  font-size: clamp(2rem, 3.4vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}
.doc-lead {
  margin: 18px 0 0;
  max-width: 44em;
  font-size: 16px;
  line-height: 1.9;
  color: var(--muted);
}
.doc-notice {
  margin-top: 20px;
  padding: 12px 16px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  background: var(--paper-2);
  font-size: 13px;
  color: var(--muted);
}

.doc-main section {
  padding: 34px 0 12px;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 78px;
}
.doc-main h2 {
  margin: 0 0 14px;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.doc-main h3 {
  margin: 26px 0 8px;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.doc-main p { margin: 0 0 12px; color: var(--muted); }
.doc-main b, .doc-main strong { color: var(--ink); }
.doc-list {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.doc-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 7px;
  color: var(--muted);
}
.doc-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.doc-steps {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.doc-steps li {
  position: relative;
  padding: 10px 0 10px 40px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  counter-increment: step;
}
.doc-steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 9px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
}

/* ---------- 表格 ---------- */

.doc-table-wrap { overflow-x: auto; margin: 14px 0 18px; }
.doc-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: var(--paper-2);
}
.doc-table-wrap th {
  text-align: left;
  padding: 9px 11px;
  border-bottom: 1px solid var(--rule-strong);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  font-weight: 500;
  color: var(--faint);
  white-space: nowrap;
}
.doc-table-wrap td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  vertical-align: top;
}
.doc-table-wrap tr:last-child td { border-bottom: 0; }
.doc-table-wrap td b { color: var(--ink); }
.doc-table-wrap tr.is-key td {
  background: #fff0e8;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- 图片 ---------- */

.doc-figure { margin: 18px 0 20px; }
.doc-figure img {
  width: 100%;
  border: 1px solid var(--rule);
  background: #fff;
  cursor: zoom-in;
  box-shadow: 0 18px 38px -30px rgba(28, 25, 20, 0.55);
}
.doc-figure figcaption {
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--faint);
}

/* ---------- 代码块 ---------- */

pre {
  margin: 12px 0 16px;
  padding: 14px 16px;
  overflow-x: auto;
  background: #17140f;
  color: #f1eee7;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
}
code { font-family: var(--mono); }

/* ---------- 差异块 ---------- */

.doc-diff {
  margin: 18px 0;
  padding: 15px 18px 14px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--faint);
}
.doc-diff[hidden] { display: none; }
.doc-diff p:last-child { margin-bottom: 0; }
.diff-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.diff-head strong { font-size: 15px; }

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  vertical-align: 2px;
  white-space: nowrap;
}
.tag-common { background: #e8e2d5; color: #5c554a; }
.tag-baijiahao { background: #ece8ff; color: var(--baijiahao); }
.tag-toutiao { background: #ffe9e2; color: var(--toutiao); }
.tag-micro { background: #ffeadf; color: var(--micro); }
.tag-article { background: #fbf0d5; color: var(--article); }
.tag-video { background: #ffe5e1; color: var(--video); }

.doc-diff[data-products~="baijiahao"] { border-left-color: var(--baijiahao); }
.doc-diff[data-products~="micro"] { border-left-color: var(--micro); }
.doc-diff[data-products~="article"] { border-left-color: var(--article); }
.doc-diff[data-products~="video"] { border-left-color: var(--video); }

/* ---------- 提示 / FAQ ---------- */

.doc-note {
  margin: 16px 0 18px;
  padding: 11px 14px;
  border-left: 2px solid var(--accent);
  background: #f3ede1;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

.doc-faq { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.doc-faq details { border-bottom: 1px solid var(--rule); }
.doc-faq summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.doc-faq summary::-webkit-details-marker { display: none; }
.doc-faq summary::after {
  content: "+";
  font-family: var(--mono);
  color: var(--faint);
  flex: none;
}
.doc-faq details[open] summary::after { content: "−"; color: var(--ink); }
.doc-faq p {
  margin: 0;
  padding: 0 0 13px;
  font-size: 13px;
  color: var(--muted);
}

.doc-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--rule-strong);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--faint);
}
.doc-footer a { text-decoration: none; border-bottom: 1px solid var(--faint); }

/* ---------- 大图 ---------- */

.doc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 8, 8, 0.92);
  display: grid;
  place-items: center;
  padding: 30px;
}
.doc-lightbox[hidden] { display: none; }
.doc-lightbox img { max-width: 94vw; max-height: 88vh; width: auto; }
.doc-lightbox button {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1000px) {
  .doc-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .doc-main { padding: 40px 34px 70px; }
}

@media (max-width: 820px) {
  .doc-header { padding: 0 16px; height: 56px; }
  .doc-version { display: none; }
  .doc-layout { display: block; padding-top: 56px; }
  .doc-side {
    position: static;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--side-line);
  }
  .doc-side-inner { padding: 16px; }
  .doc-toc {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    margin-top: 14px;
    padding-bottom: 4px;
  }
  .doc-toc a {
    white-space: nowrap;
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 5px 8px;
    font-size: 12px;
  }
  .doc-toc a.is-active { border-left-color: transparent; border-bottom-color: #ff6a3d; }
  .doc-side-note { display: none; }
  .doc-main { padding: 30px 18px 60px; }
  .doc-main section { scroll-margin-top: 70px; }
  .doc-main h2 { font-size: 22px; }
  .doc-main h3 { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* 可读性收口：正文行宽、标签对比度 */
.doc-main p,
.doc-list li,
.doc-notice,
.doc-note { max-width: 46em; }
.doc-side-note { color: #b0aa9e; }
.tag-baijiahao { color: #5847b8; }
.tag-toutiao { color: #a83a1c; }
.tag-micro { color: #a8421c; }
.tag-article { color: #8a5e0c; }
.tag-video { color: #9e2f24; }

/* 表格表头与浅色正文的对比度 */
:root { --faint: #6f675a; }
.doc-table-wrap th { color: #6f675a; }

.doc-search { display: block; margin: 2px 0 0; }

.doc-toc a.is-sub {
  padding-left: 22px;
  font-size: 11.5px;
  color: #8f897d;
}
.doc-toc a.is-sub::before { content: "↳ "; opacity: 0.7; }
