/* =========================================================
   自定义样式 —— 在 vue.css 之后加载，用于覆盖主题默认外观
   修改配色只需调整下面的变量
   ========================================================= */

:root {
  --theme-color: #2f6fed;
  --wb-text: #1f2733;
  --wb-text-muted: #5b6675;
  --wb-border: #e6e9ef;
  --wb-bg-soft: #f7f9fc;
  --wb-radius: 10px;
}

/* ---------- 全局排版 ---------- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  color: var(--wb-text);
  font-size: 15.5px;
  line-height: 1.78;
  background-color: #fff;
}

.markdown-section {
  max-width: 880px;
  padding: 36px 28px 90px;
}

/* ---------- 标题 ---------- */
.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4 {
  color: var(--wb-text);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.markdown-section h1 {
  font-size: 2rem;
  margin: 0 0 1.2rem;
}

.markdown-section h2 {
  font-size: 1.4rem;
  margin: 2.4rem 0 1rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--wb-border);
}

.markdown-section h3 {
  font-size: 1.12rem;
  margin: 1.9rem 0 0.7rem;
}

/* ---------- 链接 ---------- */
.markdown-section a {
  color: var(--theme-color);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(47, 111, 237, 0.28);
  transition: border-color 0.2s, color 0.2s;
}

.markdown-section a:hover {
  border-bottom-color: var(--theme-color);
}

/* ---------- 引用块 ---------- */
.markdown-section blockquote {
  border-left: 3px solid var(--theme-color);
  background: var(--wb-bg-soft);
  border-radius: 0 8px 8px 0;
  color: var(--wb-text-muted);
  margin: 1.6em 0;
  padding: 0.9em 1.2em;
}

.markdown-section blockquote p {
  margin: 0.3em 0;
}

/* ---------- 代码 ---------- */
.markdown-section code {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono",
    Menlo, monospace;
  font-size: 0.88em;
  color: #2d3b55;
  background: var(--wb-bg-soft);
  border: 1px solid var(--wb-border);
  border-radius: 5px;
  margin: 0 1px;
  padding: 0.12em 0.4em;
}

.markdown-section pre {
  background: #f6f8fa;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
  padding: 1.05em 1.2em;
  margin: 1.4em 0;
  overflow-x: auto;
}

/* 代码块右上角的语言角标与复制按钮位置冲突，隐藏角标 */
.markdown-section pre:after {
  content: none;
}

.markdown-section pre > code,
.markdown-section pre > code[class*="lang-"] {
  display: block;
  background: transparent;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 0;
  color: #33415c;
  font-size: 0.86em;
  line-height: 1.72;
  white-space: pre;
}

/* 复制按钮的样式由插件在运行时注入，需提高选择器优先级才能覆盖 */
.markdown-section pre > .docsify-copy-code-button {
  top: 8px;
  right: 8px;
  border: 1px solid var(--wb-border);
  border-radius: 6px;
  background: #fff;
  color: var(--wb-text-muted);
  font-family: inherit;
  font-size: 12px;
  padding: 4px 10px;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, border-color 0.2s;
}

.markdown-section pre:hover > .docsify-copy-code-button {
  opacity: 1;
}

.markdown-section pre > .docsify-copy-code-button:hover {
  color: var(--theme-color);
  border-color: var(--theme-color);
  opacity: 1;
}

/* ---------- 表格 ---------- */
.markdown-section table {
  display: table;
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--wb-radius);
  overflow: hidden;
  margin: 1.5em 0;
  font-size: 0.94em;
}

.markdown-section thead tr {
  background: var(--wb-bg-soft);
}

.markdown-section th,
.markdown-section td {
  border: 1px solid var(--wb-border);
  padding: 0.62em 0.9em;
  text-align: left;
}

.markdown-section tbody tr:nth-child(2n) {
  background: #fcfdff;
}

/* ---------- 图片 ---------- */
.markdown-section img {
  border-radius: var(--wb-radius);
  max-width: 100%;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  background: #fbfcfe;
  border-right: 1px solid var(--wb-border);
  padding-top: 32px;
}

.sidebar > h1 {
  font-size: 1.18rem;
  font-weight: 600;
  text-align: left;
  padding: 0 28px;
  margin: 0 0 26px;
  letter-spacing: -0.01em;
}

.sidebar > h1 a {
  color: var(--wb-text);
  text-decoration: none;
}

.sidebar ul {
  padding-left: 0;
}

.sidebar ul li a {
  color: var(--wb-text-muted);
  font-size: 0.94rem;
  font-weight: 400;
  padding: 6px 28px;
  line-height: 1.6;
  border-right: 2px solid transparent;
  transition: color 0.15s, background 0.15s;
}

.sidebar ul li a:hover {
  color: var(--theme-color);
  background: rgba(47, 111, 237, 0.05);
  text-decoration: none;
}

.sidebar ul li.active > a {
  color: var(--theme-color);
  font-weight: 600;
  background: rgba(47, 111, 237, 0.07);
}

.sidebar ul ul li a {
  padding-left: 44px;
  font-size: 0.9rem;
}

/* 自动生成的页内标题导航：去掉默认破折号，改用竖线缩进 */
.sidebar .app-sub-sidebar {
  margin: 2px 0 10px 15px;
  padding-left: 10px;
  border-left: 1px solid var(--wb-border);
}

.sidebar .app-sub-sidebar li:before {
  content: none;
}

.sidebar .app-sub-sidebar li a {
  padding: 4px 10px;
  font-size: 0.86rem;
  border-right: 0;
}

.sidebar-nav > ul > li > p {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #98a2b3;
  text-transform: uppercase;
  margin: 20px 0 6px;
  padding: 0 28px;
}

/* 无链接的分组标题（纯文本节点）降级为小号灰色标签 */
.sidebar-nav > ul > li:not(:has(> a)) {
  margin-top: 16px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #98a2b3;
}

/* ---------- 侧边栏折叠按钮 ---------- */
.sidebar-toggle span {
  background-color: #b8c1ce;
  width: 18px;
  height: 2px;
  margin-bottom: 3px;
  border-radius: 1px;
}

.sidebar-toggle:hover span {
  background-color: var(--theme-color);
}

@media screen and (min-width: 769px) {
  .sidebar-toggle {
    border-top: 1px solid var(--wb-border);
    padding: 14px 28px;
    text-align: left;
  }
}

/* ---------- 顶部导航 ---------- */
.app-nav {
  margin: 26px 56px 0 0;
}

.app-nav a {
  color: var(--wb-text-muted);
  font-size: 0.94rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  padding-bottom: 4px;
  transition: color 0.2s;
}

.app-nav a:hover,
.app-nav a.active {
  color: var(--theme-color);
}

/* ---------- 搜索 ---------- */
.sidebar > .search {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fbfcfe;
  margin: 0 0 6px;
  padding: 14px 20px 12px;
  border-bottom: 0;
}

.sidebar .search input {
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--wb-border);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  color: var(--wb-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sidebar .search input:focus {
  border-color: var(--theme-color);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
  outline: none;
}

.sidebar .search .results-panel {
  font-size: 0.9rem;
}

/* ---------- 封面 ---------- */
/* Docsify 会给封面注入内联渐变背景，需用 !important 覆盖 */
section.cover {
  background:
    radial-gradient(1100px 560px at 18% 0%, rgba(47, 111, 237, 0.1), transparent 62%),
    radial-gradient(900px 480px at 88% 100%, rgba(16, 185, 129, 0.09), transparent 62%),
    #fbfcfe !important;
  color: var(--wb-text);
}

section.cover .cover-main > h1 {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

section.cover .cover-main > blockquote > p {
  font-size: 1.06rem;
  color: var(--wb-text-muted);
}

section.cover .cover-main > p:last-child a {
  border-radius: 8px;
  font-size: 0.96rem;
  letter-spacing: 0;
  padding: 0.7em 1.9em;
  font-weight: 500;
}

section.cover .cover-main > p:last-child a:last-child {
  background-color: var(--theme-color);
  border-color: var(--theme-color);
  color: #fff;
}

section.cover .cover-main > p:last-child a:hover {
  opacity: 0.88;
}

/* ---------- 首页功能卡片 ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin: 28px 0 8px;
}

.feature-card {
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
  background: #fff;
  padding: 18px 20px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.feature-card:hover {
  border-color: #c9d8ff;
  box-shadow: 0 8px 22px rgba(47, 111, 237, 0.08);
  transform: translateY(-2px);
}

.feature-card h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--wb-text);
}

.feature-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--wb-text-muted);
}

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--wb-border);
  font-size: 0.84rem;
  color: #98a2b3;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.site-footer .dot {
  color: #c9d1dc;
}

/* ---------- 滚动条 ---------- */
.sidebar::-webkit-scrollbar,
.markdown-section pre::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.sidebar::-webkit-scrollbar-thumb,
.markdown-section pre::-webkit-scrollbar-thumb {
  background: #d7dee8;
  border-radius: 4px;
}

/* ---------- 页内目录（由 [TOC] 生成） ---------- */
.markdown-section .toc-list {
  list-style: none;
  margin: 1.2em 0 2em;
  padding: 14px 20px;
  background: var(--wb-bg-soft);
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
  font-size: 0.92em;
  line-height: 1.55;
  max-height: 62vh;
  overflow-y: auto;
}

.markdown-section .toc-list ul {
  list-style: none;
  margin: 0;
  padding-left: 18px;
}

.markdown-section .toc-list li {
  margin: 2px 0;
}

.markdown-section .toc-list a {
  display: inline-block;
  color: var(--wb-text-muted);
  font-weight: 400;
  border-bottom: 0;
  padding: 1px 0;
  transition: color 0.15s;
}

.markdown-section .toc-list a:hover {
  color: var(--theme-color);
  border-bottom: 0;
}

.markdown-section .toc-list > li > a {
  color: var(--wb-text);
  font-weight: 500;
}

/* 长目录默认折叠 */
.markdown-section .toc-details {
  margin: 1.2em 0 2em;
}

.markdown-section .toc-details > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 0.92em;
  color: var(--wb-text-muted);
  background: var(--wb-bg-soft);
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
  padding: 10px 16px;
  transition: color 0.15s, border-color 0.15s;
}

.markdown-section .toc-details > summary::-webkit-details-marker {
  display: none;
}

.markdown-section .toc-details > summary:hover {
  color: var(--theme-color);
  border-color: #c9d8ff;
}

.markdown-section .toc-details > summary:before {
  content: "▸";
  display: inline-block;
  width: 1em;
  margin-right: 4px;
}

.markdown-section .toc-details[open] > summary:before {
  content: "▾";
}

.markdown-section .toc-details[open] > summary {
  border-radius: var(--wb-radius) var(--wb-radius) 0 0;
}

.markdown-section .toc-details[open] > .toc-list {
  margin-top: 0;
  border-radius: 0 0 var(--wb-radius) var(--wb-radius);
  border-top: 0;
}

/* ---------- 移动端 ---------- */
@media screen and (max-width: 768px) {
  .markdown-section {
    padding: 20px 18px 70px;
    max-width: 100%;
  }

  section.cover .cover-main > h1 {
    font-size: 2rem;
  }
}
