/* ==========================================================================
   文档中心（/docs）布局与 Markdown 排版
   --------------------------------------------------------------------------
   改版阶段 2 · 仅作用于文档中心页面，不影响站点其他页面。
   依赖：public/static/css/tokens.css（设计令牌）
   结构：左导航（分类 + 文档列表） / 中正文 / 右页内目录（TOC）
   ========================================================================== */

/* ---------- 布局骨架 ---------- */
.docs-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 216px;
  gap: 24px;
  max-width: 1320px;
  margin: 0 auto;
  /* 顶部留出固定导航高度（56px）+ 间距 */
  padding: 80px 24px 64px;
  align-items: start;
}

.docs-sidebar,
.docs-toc {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid #e6e9f0;
  border-radius: 10px;
  padding: 16px 12px;
}

/* 细滚动条 */
.docs-sidebar::-webkit-scrollbar,
.docs-toc::-webkit-scrollbar {
  width: 6px;
}

.docs-sidebar::-webkit-scrollbar-thumb,
.docs-toc::-webkit-scrollbar-thumb {
  background: #d8dde6;
  border-radius: 3px;
}

/* ---------- 左侧导航 ---------- */
.docs-sidebar__title {
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
  letter-spacing: .06em;
  padding: 4px 12px 10px;
  margin: 0;
  text-transform: uppercase;
}

.docs-cate {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 6px 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #eef1f6;
}

.docs-cate__item {
  font-size: 13px;
  line-height: 1;
  padding: 7px 10px;
  border-radius: 6px;
  color: #4b5563;
  background: #f4f6fa;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.docs-cate__item:hover {
  color: #1C468A;
  background: #eceffa;
}

.docs-cate__item.is-active {
  color: #fff;
  background: #2356A8;
  border-color: #2356A8;
}

.docs-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-nav__section {
  margin: 3px 0;
  list-style: none;
}

.docs-nav__group {
  display: flex;
  width: 100%;
  min-height: 38px;
  padding: 8px 11px 8px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  color: #66758a;
  background: transparent;
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease;
}

.docs-nav__group:hover,
.docs-nav__section.is-open > .docs-nav__group {
  color: #1c468a;
  background: #f2f6fb;
}

.docs-nav__group span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.docs-nav__chevron {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  margin-right: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .16s ease;
}

.docs-nav__section.is-open > .docs-nav__group .docs-nav__chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.docs-nav__children {
  margin: 2px 0 5px;
  padding: 0 0 0 5px;
  list-style: none;
}

.docs-nav__link {
  display: block;
  position: relative;
  padding: 8px 12px 8px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #3f4a5a;
  border-radius: 6px;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.docs-nav__link:hover {
  background: #f5f7fb;
  color: #1C468A;
}

.docs-nav__link.is-active {
  background: #EEF4FC;
  color: #2356A8;
  border-left-color: #2356A8;
  font-weight: 600;
}

.docs-nav__dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: #22a06b;
  vertical-align: middle;
}

.docs-nav__empty {
  padding: 10px 14px;
  font-size: 13px;
  color: #9aa3b2;
}

/* ---------- 文档搜索 ---------- */
.docs-search {
  position: relative;
  padding: 0 6px 12px;
}

.docs-search__input {
  width: 100%;
  height: 34px;
  padding: 0 10px 0 30px;
  font-size: 13px;
  color: #1f2530;
  border: 1px solid #e2e6ee;
  border-radius: 6px;
  background: #f7f8fb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 9px center;
  outline: none;
  box-sizing: border-box;
}

.docs-search__input:focus {
  border-color: #2356A8;
  background-color: #fff;
}

.docs-search__hint {
  position: absolute;
  right: 14px;
  top: 9px;
  font-size: 11px;
  color: #b6bcc8;
  pointer-events: none;
}

.docs-search__result {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-search__group {
  padding: 8px 12px 2px;
  font-size: 12px;
  font-weight: 700;
  color: #9aa3b2;
}

.docs-search__result a {
  display: block;
  padding: 7px 12px;
  font-size: 13.5px;
  color: #3f4a5a;
  border-radius: 6px;
  text-decoration: none;
}

.docs-search__result a:hover {
  background: #f5f7fb;
  color: #1C468A;
}

.docs-search__empty {
  padding: 10px 12px;
  font-size: 13px;
  color: #9aa3b2;
}

.docs-search mark {
  background: #fff3c4;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* ---------- 正文 ---------- */
.docs-main {
  min-width: 0;
  background: #fff;
  border: 1px solid #e6e9f0;
  border-radius: 10px;
  padding: 32px 40px 48px;
}

.docs-crumb {
  font-size: 13px;
  color: #9aa3b2;
  margin-bottom: 16px;
}

.docs-crumb a {
  color: #6b7280;
  text-decoration: none;
}

.docs-crumb a:hover {
  color: #2356A8;
}

.docs-crumb span {
  margin: 0 6px;
  color: #c7ccd6;
}

.docs-title {
  font-size: 28px;
  line-height: 1.35;
  font-weight: 700;
  color: #14161a;
  margin: 0 0 10px;
}

.docs-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #8a93a2;
  padding-bottom: 16px;
  border-bottom: 1px solid #eef1f6;
  margin-bottom: 28px;
}

.docs-meta__btn {
  margin-left: auto;
  font-size: 13px;
  color: #6b7280;
  border: 1px solid #dfe3ea;
  background: #fff;
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  line-height: 1.6;
}

.docs-meta__btn:hover {
  color: #2356A8;
  border-color: #2356A8;
}

/* ---------- Markdown 排版 ---------- */
.md-body {
  font-size: 15px;
  line-height: 1.8;
  color: #333a45;
  word-wrap: break-word;
}

.md-body>*:first-child {
  margin-top: 0;
}

.md-body h2 {
  font-size: 21px;
  font-weight: 700;
  color: #14161a;
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef1f6;
  scroll-margin-top: 80px;
}

.md-body h3 {
  font-size: 17px;
  font-weight: 600;
  color: #1f2530;
  margin: 28px 0 12px;
  scroll-margin-top: 80px;
}

.md-body h4,
.md-body h5,
.md-body h6 {
  font-size: 15px;
  font-weight: 600;
  color: #3f4a5a;
  margin: 22px 0 10px;
  scroll-margin-top: 80px;
}

.md-body p {
  margin: 12px 0;
}

.md-body a {
  color: #0b57d0;
  text-decoration: none;
}

.md-body a:hover {
  text-decoration: underline;
}

.md-body strong {
  font-weight: 600;
  color: #14161a;
}

.md-body ul,
.md-body ol {
  margin: 12px 0;
  padding-left: 24px;
}

.md-body li {
  margin: 6px 0;
}

.md-body blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 4px solid #2356A8;
  background: #f7f8fc;
  border-radius: 0 6px 6px 0;
  color: #4b5563;
}

.md-body blockquote p {
  margin: 0;
}

.md-body hr {
  height: 1px;
  border: 0;
  background: #e9ecf2;
  margin: 28px 0;
}

/* 行内代码 */
.md-body code {
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .88em;
  padding: 2px 6px;
  background: #f2f4f8;
  border: 1px solid #e6e9f0;
  border-radius: 4px;
  color: #c7254e;
}

/* 代码块 */
.md-body pre {
  position: relative;
  margin: 16px 0;
  padding: 16px 18px;
  background: #1e2230;
  border-radius: 8px;
  overflow-x: auto;
}

.md-body pre code {
  display: block;
  padding: 0;
  background: transparent;
  border: 0;
  color: #e6e9f0;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre;
}

.md-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  color: #aab2c0;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 5px;
  padding: 3px 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s;
}

.md-body pre:hover .md-copy {
  opacity: 1;
}

.md-copy:hover {
  color: #fff;
  background: rgba(255, 255, 255, .18);
}

/* 表格 */
.md-table-wrap {
  overflow-x: auto;
  margin: 16px 0;
}

.md-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.md-body th,
.md-body td {
  border: 1px solid #e6e9f0;
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}

.md-body thead th {
  background: #f6f8fc;
  font-weight: 600;
  color: #1f2530;
  white-space: nowrap;
}

.md-body tbody tr:nth-child(even) {
  background: #fafbfd;
}

/* 图片 */
.md-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 12px 0;
}

/* ---------- 上一篇 / 下一篇 ---------- */
.docs-pager {
  display: flex;
  gap: 12px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid #eef1f6;
}

.docs-pager__item {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e6e9f0;
  border-radius: 8px;
  text-decoration: none;
  color: #3f4a5a;
  font-size: 14px;
  background: #fff;
}

.docs-pager__item:hover {
  border-color: #2356A8;
  color: #2356A8;
}

.docs-pager__item.is-next {
  text-align: right;
}

.docs-pager__label {
  display: block;
  font-size: 12px;
  color: #9aa3b2;
  margin-bottom: 4px;
}

/* ---------- 右侧页内目录 ---------- */
.docs-toc__title {
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
  letter-spacing: .06em;
  padding: 4px 12px 10px;
  margin: 0;
}

.docs-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-toc__list a {
  display: block;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #6b7280;
  border-left: 2px solid transparent;
  text-decoration: none;
}

.docs-toc__list a:hover {
  color: #1C468A;
}

.docs-toc__list a.is-active {
  color: #2356A8;
  border-left-color: #2356A8;
  font-weight: 600;
}

.docs-toc__list .lv3 a {
  padding-left: 26px;
  font-size: 12.5px;
}

/* ---------- 移动端适配 ---------- */
.docs-fab {
  display: none;
  position: fixed;
  left: 16px;
  bottom: 24px;
  z-index: 1200;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 22px;
  background: #2356A8;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(35, 86, 168, .2);
  cursor: pointer;
}

@media screen and (max-width: 1200px) {
  .docs-layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media screen and (max-width: 991px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 72px 16px 40px;
  }

  .docs-main {
    padding: 20px 18px 32px;
  }

  .docs-title {
    font-size: 22px;
  }

  .docs-fab {
    display: block;
  }

  /* 侧边栏在移动端变为抽屉 */
  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1300;
    width: 280px;
    max-width: 84vw;
    max-height: none;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    padding-top: 64px;
  }

  .docs-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, .25);
  }

  .docs-mask {
    position: fixed;
    inset: 0;
    z-index: 1250;
    background: rgba(15, 17, 21, .45);
    display: none;
  }

  .docs-mask.is-open {
    display: block;
  }

  .md-body {
    font-size: 15px;
  }

  .md-body h2 {
    font-size: 19px;
  }
}

/* Accessible reading controls for tablet and mobile. */
.docs-layout {
  max-width: 1480px;
  grid-template-columns: 258px minmax(0, 1fr) 210px;
  padding-top: 24px;
}

.docs-main {
  min-width: 0;
}

.docs-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.docs-drawer-close,
.docs-mobile-tools,
.docs-mobile-toc {
  display: none;
}

.docs-layout a:focus-visible,
.docs-layout button:focus-visible,
.docs-layout input:focus-visible {
  outline: 3px solid #2356a8;
  outline-offset: 2px;
}

.docs-title {
  color: #17324d;
}

.md-body {
  font-size: 16px;
  line-height: 1.8;
}

.md-body h2,
.md-body h3 {
  scroll-margin-top: 95px;
}

.md-body pre {
  overflow-x: auto;
  max-width: 100%;
}

.md-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

@media screen and (max-width: 1200px) {
  .docs-layout {
    grid-template-columns: 235px minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }

  .docs-mobile-tools {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
  }

  .docs-mobile-tools #docsFab {
    display: none;
  }

  .docs-mobile-tools button {
    min-height: 42px;
    border: 1px solid #dbe5f0;
    border-radius: 8px;
    padding: 0 14px;
    background: #f7f9fc;
    color: #2356a8;
    font-weight: 700;
  }

  .docs-mobile-toc:not([hidden]) {
    display: block;
    padding: 16px;
    margin-bottom: 18px;
    border: 1px solid #dbe5f0;
    border-radius: 10px;
    background: #f7f9fc;
  }
}

@media screen and (max-width: 991px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 16px 40px;
  }

  .docs-main {
    padding: 22px 18px 32px;
  }

  .docs-mobile-tools #docsFab {
    display: inline-flex;
    align-items: center;
  }

  .docs-sidebar {
    z-index: 1300;
    padding-top: 20px;
  }

  .docs-drawer-close {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #17324d;
    font-size: 28px;
  }

  .docs-fab {
    display: none;
  }

  .docs-drawer-open {
    overflow: hidden;
  }

  .md-body {
    font-size: 16px;
  }

  .docs-title {
    font-size: 26px;
    line-height: 1.35;
  }
}

@media screen and (max-width: 580px) {
  .docs-main {
    padding: 19px 15px 28px;
  }

  .docs-layout {
    padding-left: 10px;
    padding-right: 10px;
  }

  .docs-mobile-tools {
    position: sticky;
    top: 72px;
    z-index: 20;
    padding: 8px 0;
    background: #fff;
  }

  .docs-mobile-tools button {
    flex: 1;
    justify-content: center;
  }

  .md-body pre code {
    font-size: 13px;
  }
}

.docs-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.docs-entry-grid a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 104px;
  padding: 17px;
  border: 1px solid #dbe6f1;
  border-radius: 12px;
  background: #f7f9fc;
  color: #17324d;
  text-decoration: none;
}

.docs-entry-grid a:hover {
  border-color: #2356a8;
  background: #eef4fc;
  text-decoration: none;
}

.docs-entry-grid strong {
  color: #17324d;
  font-size: 16px;
}

.docs-entry-grid span {
  color: #596779;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 580px) {
  .docs-entry-grid {
    grid-template-columns: 1fr;
  }

  .docs-entry-grid a {
    min-height: 0;
  }
}

.docs-entry-grid .docs-entry-placeholder {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 104px;
  padding: 17px;
  border: 1px dashed #bccddd;
  border-radius: 12px;
  background: #fafbfd;
}

.docs-entry-placeholder strong {
  color: #596779;
  font-size: 16px;
}

.docs-entry-placeholder span {
  color: #77879b;
  font-size: 13px;
  line-height: 1.5;
}

/* 文档首页：先呈现用户目标，再进入完整参考目录。 */
.docs-welcome {
  background: linear-gradient(130deg, #edf5ff, #fff 54%, #eaf8f4)
}

.docs-welcome__inner {
  display: grid;
  grid-template-columns: 1fr 330px;
  align-items: center;
  gap: 60px;
  width: min(1200px, calc(100% - 48px));
  min-height: 390px;
  margin: 0 auto;
  padding: 55px 0
}

.docs-welcome p {
  margin: 0 0 13px;
  color: #1c468a;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .14em
}

.docs-welcome h1 {
  margin: 0 0 20px;
  color: #17324d;
  font-size: clamp(38px, 4.6vw, 63px);
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: -.045em
}

.docs-welcome h1 em {
  color: #167a6b;
  font-style: normal
}

.docs-welcome__inner>div>span {
  display: block;
  max-width: 680px;
  color: #596779;
  font-size: 17px;
  line-height: 1.8
}

.docs-welcome__status {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 220px;
  padding: 35px;
  border-radius: 24px;
  background: #17324d;
  box-shadow: 0 24px 48px rgba(23, 50, 77, .22);
  transform: rotate(2deg)
}

.docs-welcome__status i {
  width: 12px;
  height: 12px;
  margin-bottom: 35px;
  border-radius: 50%;
  background: #52cba9;
  box-shadow: 0 0 0 8px rgba(82, 203, 169, .12)
}

.docs-welcome__status b {
  color: #fff;
  font: 800 30px var(--font-mono)
}

.docs-welcome__status span {
  margin-top: 8px;
  color: #8bd5c7;
  font: 11px var(--font-mono);
  letter-spacing: .08em
}

.docs-layout.is-landing {
  padding-top: 35px
}

.docs-layout.is-landing .docs-title {
  font-size: 30px
}

.docs-landing-lead {
  padding: 18px;
  border-left: 4px solid #f3b32b;
  background: #fff9e9;
  color: #596779 !important
}

.docs-entry-grid a i {
  color: #c3443e;
  font-style: normal;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .1em
}

.docs-entry-grid a:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(23, 50, 77, .08)
}

@media(max-width:900px) {
  .docs-welcome__inner {
    grid-template-columns: 1fr
  }

  .docs-welcome__status {
    display: none
  }
}

@media(max-width:580px) {
  .docs-welcome__inner {
    width: min(100% - 32px, 1200px);
    min-height: 340px;
    padding: 42px 0
  }

  .docs-welcome h1 {
    font-size: 39px
  }

  .docs-welcome__inner>div>span {
    font-size: 15px
  }
}

.docs-capability-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0
}

.docs-capability-grid a {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 5px 8px;
  min-height: 155px;
  padding: 20px;
  border: 1px solid #dbe6f1;
  border-radius: 14px;
  background: #fff;
  color: #17324d;
  text-decoration: none;
  transition: transform .2s, border-color .2s, box-shadow .2s
}

.docs-capability-grid a:hover {
  transform: translateY(-2px);
  border-color: #2356a8;
  box-shadow: 0 12px 24px rgba(23, 50, 77, .08);
  text-decoration: none
}

.docs-capability-grid i {
  grid-row: 1/4;
  color: #c3443e;
  font-style: normal;
  font-size: 11px;
  font-weight: 850
}

.docs-capability-grid strong {
  font-size: 16px;
  line-height: 1.45
}

.docs-capability-grid span {
  color: #596779;
  font-size: 13px;
  line-height: 1.6
}

.docs-capability-grid b {
  align-self: end;
  color: #2356a8;
  font-size: 12px
}

@media(max-width:580px) {
  .docs-capability-grid {
    grid-template-columns: 1fr
  }

  .docs-capability-grid a {
    min-height: 0
  }
}
