/* ==========================================================================
   ZanCMS UI · 文档站样式（docs.css）
   仅服务于文档外壳与示例排版，不参与框架本体分发逻辑。
   ========================================================================== */

.doc-body {
  background: var(--zan-bg);
}

/* ---- 左侧目录 ------------------------------------------------------------ */
.doc-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: 268px;
  background: var(--zan-surface);
  border-right: 1px solid var(--zan-border);
}

.doc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
  text-decoration: none;
  color: var(--zan-text);
}

.doc-brand-logo {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(91, 91, 247, 0.28);
}

.doc-brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.doc-brand-name b {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.doc-brand-name span {
  margin-top: 3px;
  font-size: 11px;
  color: var(--zan-text-muted);
}

.doc-brand-ver {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--zan-primary-soft);
  color: var(--zan-primary);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.doc-sidebar-search {
  padding: 0 16px 10px;
}

.doc-sidebar-search .zan-search {
  height: 34px;
}

.doc-sidebar-search .zan-search input {
  font-size: 12.5px;
}

.doc-nav {
  flex: 1;
  padding: 4px 12px 24px;
  overflow: auto;
  scrollbar-width: thin;
}

.doc-nav-group + .doc-nav-group {
  margin-top: 18px;
}

.doc-nav-title {
  padding: 0 10px 7px;
  color: var(--zan-text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.doc-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--zan-text-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: background-color .15s var(--zan-ease), color .15s var(--zan-ease);
}

.doc-nav-link:hover {
  background: var(--zan-surface-2);
  color: var(--zan-text);
}

.doc-nav-link.is-active {
  background: var(--zan-primary-soft);
  color: var(--zan-primary);
  font-weight: 600;
}

.doc-nav-link.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--zan-primary);
}

.doc-nav-link .doc-nav-dot {
  width: 4px;
  height: 4px;
  flex: none;
  border-radius: 50%;
  background: var(--zan-border-strong);
}

.doc-nav-link.is-active .doc-nav-dot {
  background: var(--zan-primary);
}

.doc-side-foot {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--zan-border-soft);
  font-size: 11.5px;
  color: var(--zan-text-muted);
  line-height: 1.7;
}

.doc-side-foot a {
  color: var(--zan-text-secondary);
}

/* ---- 顶栏 ---------------------------------------------------------------- */
.doc-main {
  margin-left: 268px;
  min-width: 0;
}

.doc-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 62px;
  padding: 0 32px;
  background: var(--zan-surface);
  border-bottom: 1px solid var(--zan-border);
}

.doc-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--zan-border);
  border-radius: 8px;
  background: transparent;
  color: var(--zan-text);
  cursor: pointer;
}

.doc-crumb {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--zan-text-muted);
}

.doc-crumb b {
  color: var(--zan-text);
  font-weight: 600;
}

.doc-crumb-sep {
  color: var(--zan-text-faint);
}

.doc-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.doc-top-search {
  position: relative;
  width: 208px;
}

.doc-top-search .zan-search {
  height: 34px;
  background: var(--zan-surface-2);
}

.doc-top-search .zan-search input {
  font-size: 12.5px;
}

.doc-top-search kbd {
  position: absolute;
  right: 34px;
  top: 8px;
  padding: 1px 5px;
  border: 1px solid var(--zan-border);
  border-radius: 4px;
  background: var(--zan-surface);
  color: var(--zan-text-faint);
  font: 10px/1.5 var(--zan-font-mono);
  pointer-events: none;
}

.doc-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--zan-text-secondary);
  font-size: 17px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s var(--zan-ease), color .15s var(--zan-ease);
}

.doc-icon-btn:hover {
  background: var(--zan-surface-2);
  color: var(--zan-text);
}

.doc-theme-sun { display: none; }
html[data-theme="dark"] .doc-theme-sun { display: inline-flex; }
html[data-theme="dark"] .doc-theme-moon { display: none; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .doc-theme-sun { display: inline-flex; }
  html[data-theme="auto"] .doc-theme-moon { display: none; }
}

.doc-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--zan-primary), #22d3ee);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

.doc-top-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--zan-border);
  border-radius: 8px;
  color: var(--zan-text-secondary);
  font-size: 12.5px;
  text-decoration: none;
  transition: border-color .15s, color .15s, background-color .15s;
}

.doc-top-link:hover {
  border-color: var(--zan-primary-line);
  background: var(--zan-primary-soft);
  color: var(--zan-primary);
}

/* ---- 主体网格 ------------------------------------------------------------ */
.doc-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 196px;
  gap: 56px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 38px 44px 88px;
}

.doc-article {
  min-width: 0;
  max-width: 880px;
}

/* ---- 页头 ---------------------------------------------------------------- */
.doc-hero {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--zan-border);
}

.doc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--zan-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.doc-eyebrow::before {
  content: "";
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--zan-primary);
}

.doc-title {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 36px);
  line-height: 1.22;
  letter-spacing: -0.025em;
  color: var(--zan-text);
}

.doc-lead {
  max-width: 720px;
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.75;
  color: var(--zan-text-secondary);
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--zan-border);
  border-radius: 999px;
  background: var(--zan-surface);
  color: var(--zan-text-muted);
  font-size: 11.5px;
}

.doc-chip.is-brand {
  border-color: var(--zan-primary-line);
  background: var(--zan-primary-soft);
  color: var(--zan-primary);
}

/* ---- 正文排版 ------------------------------------------------------------ */
.doc-article h2 {
  margin: 46px 0 12px;
  scroll-margin-top: 84px;
  font-size: 23px;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--zan-text);
}

.doc-article h2 .doc-anchor,
.doc-article h3 .doc-anchor {
  margin-left: 8px;
  color: var(--zan-text-faint);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity .15s;
}

.doc-article h2:hover .doc-anchor,
.doc-article h3:hover .doc-anchor {
  opacity: 1;
}

.doc-article h3 {
  margin: 30px 0 10px;
  scroll-margin-top: 84px;
  font-size: 17px;
  line-height: 1.45;
  color: var(--zan-text);
}

.doc-article p {
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--zan-text-secondary);
}

.doc-article ul,
.doc-article ol {
  margin: 12px 0;
  padding-left: 22px;
  color: var(--zan-text-secondary);
  font-size: 14px;
  line-height: 1.85;
}

.doc-article li + li {
  margin-top: 4px;
}

.doc-article strong {
  color: var(--zan-text);
  font-weight: 600;
}

.doc-article code:not(.doc-pre code) {
  padding: 1px 5px;
  border: 1px solid var(--zan-border-soft);
  border-radius: 4px;
  background: var(--zan-surface-2);
  color: var(--zan-primary);
  font: 12.5px/1.6 var(--zan-font-mono);
}

.doc-article a:not([class*="zan-"]):not(.doc-anchor) {
  color: var(--zan-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--zan-primary-line);
}

/* 提示块 */
.doc-note {
  display: flex;
  gap: 10px;
  margin: 18px 0;
  padding: 13px 16px;
  border: 1px solid var(--zan-border);
  border-left: 3px solid var(--zan-primary);
  border-radius: 8px;
  background: var(--zan-surface);
  font-size: 13px;
  line-height: 1.7;
  color: var(--zan-text-secondary);
}

.doc-note.is-warn {
  border-left-color: var(--zan-warning);
}

.doc-note.is-ok {
  border-left-color: var(--zan-success);
}

.doc-note b {
  color: var(--zan-text);
}

/* ---- 示例卡片 ------------------------------------------------------------ */
.doc-demo {
  margin: 16px 0 26px;
  border: 1px solid var(--zan-border);
  border-radius: 14px;
  background: var(--zan-surface);
  box-shadow: var(--zan-shadow-xs);
  overflow: hidden;
}

.doc-demo-preview {
  padding: 26px 24px;
  background:
    radial-gradient(circle at 100% 0, rgba(91, 91, 247, 0.06), transparent 42%),
    var(--zan-surface);
}

.doc-demo-preview.is-center {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.doc-demo-preview.is-plain {
  padding: 0;
  background: var(--zan-surface);
}

.doc-demo-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 14px;
  border-top: 1px solid var(--zan-border-soft);
  background: var(--zan-surface-2);
  color: var(--zan-text-muted);
  font-size: 11px;
}

.doc-demo-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.doc-demo-label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--zan-success);
}

.doc-demo-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.doc-demo-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--zan-text-muted);
  font: 11.5px/1.6 var(--zan-font-sans);
  cursor: pointer;
}

.doc-demo-btn:hover {
  background: var(--zan-surface-3);
  color: var(--zan-text);
}

.doc-demo-code {
  display: none;
  border-top: 1px solid var(--zan-border);
  background: #0f172a;
  color: #c9d4e6;
  font: 12px/1.75 var(--zan-font-mono);
  overflow: auto;
  max-height: 440px;
}

.doc-demo.is-open .doc-demo-code {
  display: block;
}

.doc-demo-code pre {
  margin: 0;
  padding: 16px 18px;
  white-space: pre;
}

/* 独立代码块 */
.doc-pre {
  position: relative;
  margin: 14px 0 24px;
  border: 1px solid var(--zan-border);
  border-radius: 12px;
  background: #0f172a;
  color: #c9d4e6;
  overflow: hidden;
}

.doc-pre-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: #8fa1bd;
  font: 11px/1.4 var(--zan-font-sans);
}

.doc-pre-head .doc-demo-actions {
  margin-left: auto;
}

.doc-pre-head .doc-demo-btn {
  color: #9fb0c9;
}

.doc-pre-head .doc-demo-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.doc-pre pre {
  margin: 0;
  padding: 15px 18px;
  overflow: auto;
  font: 12.5px/1.75 var(--zan-font-mono);
}

.doc-pre code,
.doc-demo-code code {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: inherit;
}

/* 代码着色 */
.tok-tag { color: #7dd3fc; }
.tok-attr { color: #c4b5fd; }
.tok-str { color: #fcd34d; }
.tok-com { color: #64748b; font-style: italic; }
.tok-kw { color: #f472b6; }

/* ---- API 表 ------------------------------------------------------------- */
.doc-article .zan-table {
  margin: 12px 0 26px;
  font-size: 13px;
}

.doc-article .zan-table th {
  height: 40px;
}

.doc-article .zan-table td {
  height: 40px;
}

.doc-article .zan-table code {
  white-space: nowrap;
}

/* ---- 页脚翻页 ------------------------------------------------------------ */
.doc-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--zan-border);
}

.doc-pager a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--zan-border);
  border-radius: 10px;
  background: var(--zan-surface);
  border-bottom-width: 1px;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}

.doc-pager a:hover {
  border-color: var(--zan-primary-line);
  box-shadow: var(--zan-shadow-sm);
}

.doc-pager a.is-next {
  text-align: right;
}

.doc-pager span {
  font-size: 11px;
  color: var(--zan-text-muted);
}

.doc-pager b {
  font-size: 13px;
  color: var(--zan-text);
}

.doc-pager a:hover b { color: var(--zan-primary); }

/* ---- 右侧本页目录 -------------------------------------------------------- */
.doc-toc {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding-left: 16px;
  border-left: 1px solid var(--zan-border-soft);
}

.doc-toc-title {
  margin: 2px 0 10px;
  color: var(--zan-text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.doc-toc a {
  display: block;
  padding: 5px 8px;
  border-radius: 5px;
  color: var(--zan-text-muted);
  font-size: 12.5px;
  line-height: 1.5;
  text-decoration: none;
}

.doc-toc a[data-level="3"] {
  padding-left: 18px;
  font-size: 12px;
}

.doc-toc a:hover {
  color: var(--zan-text);
  background: var(--zan-surface-2);
}

.doc-toc a.is-active {
  color: var(--zan-primary);
  font-weight: 600;
  background: var(--zan-primary-soft);
}

/* ---- 首页介绍页装饰 ------------------------------------------------------ */
.doc-hero-home {
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
  padding: 40px 40px 34px;
  border: 1px solid var(--zan-border);
  border-radius: 20px;
  background:
    radial-gradient(700px 320px at 88% -12%, rgba(91, 91, 247, 0.16), transparent 70%),
    radial-gradient(500px 260px at 8% 108%, rgba(14, 165, 233, 0.1), transparent 70%),
    var(--zan-surface);
  box-shadow: var(--zan-shadow-sm);
}

.doc-hero-home::after {
  content: "Z";
  position: absolute;
  right: 34px;
  top: 8px;
  font-size: 150px;
  font-weight: 800;
  line-height: 1;
  color: var(--zan-primary);
  opacity: .07;
  pointer-events: none;
}

.doc-hero-home .doc-title {
  max-width: 560px;
  font-size: clamp(30px, 3.6vw, 42px);
}

.doc-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.doc-stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0 6px;
}

.doc-stat {
  padding: 14px 16px;
  border: 1px solid var(--zan-border);
  border-radius: 12px;
  background: var(--zan-surface);
}

.doc-stat b {
  display: block;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.doc-stat span {
  color: var(--zan-text-muted);
  font-size: 11.5px;
}

/* 首页特性卡 */
.doc-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 10px;
}

.doc-feature {
  padding: 18px;
  border: 1px solid var(--zan-border);
  border-radius: 12px;
  background: var(--zan-surface);
  transition: transform .18s var(--zan-ease), box-shadow .18s var(--zan-ease);
}

.doc-feature:hover {
  transform: translateY(-2px);
  box-shadow: var(--zan-shadow-md);
}

.doc-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  border-radius: 9px;
  background: var(--zan-primary-soft);
  color: var(--zan-primary);
  font-size: 17px;
}

.doc-feature h3 {
  margin: 0 0 5px;
  font-size: 14.5px;
}

.doc-feature p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--zan-text-muted);
}

/* ---- 图标库 -------------------------------------------------------------- */
.doc-icon-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}

.doc-icon-toolbar .zan-search {
  width: 240px;
}

.doc-icon-count {
  font-size: 12px;
  color: var(--zan-text-muted);
}

.doc-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
  gap: 8px;
  margin: 14px 0 24px;
}

.doc-icon-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 6px 10px;
  border: 1px solid var(--zan-border);
  border-radius: 9px;
  background: var(--zan-surface);
  color: var(--zan-text-secondary);
  cursor: pointer;
  transition: border-color .15s, color .15s, background-color .15s, transform .15s;
}

.doc-icon-cell:hover {
  border-color: var(--zan-primary-line);
  background: var(--zan-primary-soft);
  color: var(--zan-primary);
  transform: translateY(-1px);
}

.doc-icon-cell .zan-icon {
  font-size: 24px;
}

.doc-icon-cell span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--zan-text-muted);
}

.doc-icon-cell:hover span { color: var(--zan-primary); }

/* ---- 色彩令牌展示 -------------------------------------------------------- */
.doc-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin: 14px 0 24px;
}

.doc-color {
  overflow: hidden;
  border: 1px solid var(--zan-border);
  border-radius: 9px;
  background: var(--zan-surface);
}

.doc-color-swatch {
  height: 56px;
}

.doc-color-meta {
  padding: 7px 9px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--zan-text-muted);
}

.doc-color-meta b {
  display: block;
  color: var(--zan-text);
  font-size: 11px;
  font-weight: 600;
}

/* ---- 响应式 -------------------------------------------------------------- */
.doc-backdrop {
  display: none;
}

@media (max-width: 1240px) {
  .doc-content {
    grid-template-columns: minmax(0, 1fr);
    max-width: 940px;
  }
  .doc-toc { display: none; }
}

@media (max-width: 980px) {
  .doc-sidebar {
    transform: translateX(-100%);
    transition: transform .24s var(--zan-ease);
    box-shadow: var(--zan-shadow-xl);
  }
  .doc-sidebar.is-open { transform: none; }
  .doc-main { margin-left: 0; }
  .doc-menu-btn { display: inline-flex; }
  .doc-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: block;
    background: var(--zan-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s;
  }
  .doc-backdrop.is-open { opacity: 1; visibility: visible; }
  .doc-content { padding: 28px 24px 72px; }
  .doc-topbar { padding: 0 18px; gap: 10px; }
  .doc-top-search { display: none; }
  .doc-crumb { font-size: 12px; }
  .doc-stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-feature-grid { grid-template-columns: 1fr; }
  .doc-hero-home { padding: 28px 22px; }
  .doc-hero-home .doc-title { font-size: 28px; }
}

@media (max-width: 640px) {
  .doc-top-link.is-home { display: none; }
  .doc-topbar { height: 56px; }
  .doc-title { font-size: 26px; }
  .doc-lead { font-size: 14px; }
  .doc-demo-preview { padding: 18px 14px; }
  .doc-article h2 { font-size: 20px; margin-top: 36px; }
  .doc-pager { grid-template-columns: 1fr; }
}

/* 打印 */
@media print {
  .doc-sidebar, .doc-topbar, .doc-toc, .doc-demo-bar, .doc-pager { display: none !important; }
  .doc-main { margin: 0; }
  .doc-content { display: block; padding: 0; }
}
