/* ═══════════════════════════════════════════════
   riskanalysis.cn · Docsify 自定义主题
   计划工程师出品 · 针对中文阅读优化
   ═══════════════════════════════════════════════ */

/* ── 基础排版 ── */
:root {
  --content-max-width: 800px;
  --sidebar-width: 260px;
  --base-font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  --base-font-size: 16px;
  --base-line-height: 1.9;
  --heading-color: #1a1a2e;
  --text-color: #2c2e3a;
  --link-color: #1a5276;
  --sidebar-background: #f8f9fb;
  --sidebar-nav-link-color: #3a3d4a;
  --sidebar-nav-link-color--active: #1a5276;
  --sidebar-nav-link-font-weight--active: 600;
  --blockquote-background: #f5f7fa;
  --blockquote-border-color: #1a5276;
  --table-border-color: #e0e4ea;
  --table-header-background: #f4f6f9;
}

/* ── 全局 ── */
body {
  font-family: var(--base-font-family);
  font-size: var(--base-font-size);
  line-height: var(--base-line-height);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── 正文内容区域 ── */
.markdown-section {
  max-width: var(--content-max-width);
  padding: 20px 32px 60px;
}

.markdown-section p {
  margin: 0 0 14px;
  word-break: break-word;
}

/* ── 标题层次 ── */
.markdown-section h1 {
  font-size: 1.7em;
  font-weight: 700;
  margin: 32px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e8ecf1;
  color: #111;
  letter-spacing: 0.5px;
}

.markdown-section h2 {
  font-size: 1.35em;
  font-weight: 700;
  margin: 28px 0 12px;
  padding-left: 12px;
  border-left: 3px solid #1a5276;
  color: #1a1a2e;
}

.markdown-section h3 {
  font-size: 1.12em;
  font-weight: 600;
  margin: 22px 0 10px;
  color: #333;
}

.markdown-section h4 {
  font-size: 1.02em;
  font-weight: 600;
  margin: 16px 0 8px;
  color: #555;
}

/* ── 段落间距 ── */
.markdown-section p + p { margin-top: 0; }
.markdown-section h2 + p,
.markdown-section h3 + p,
.markdown-section h4 + p { margin-top: 6px; }

/* ── 链接 ── */
.markdown-section a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.markdown-section a:hover {
  border-bottom-color: var(--link-color);
}

/* ── 列表 ── */
.markdown-section ul,
.markdown-section ol {
  padding-left: 24px;
  margin: 10px 0 14px;
}
.markdown-section li { margin: 5px 0; }
.markdown-section li > p { margin: 0; }

/* ── 表格 ── */
.markdown-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 18px;
  font-size: 0.94em;
  border-radius: 6px;
  overflow: hidden;
}
.markdown-section th {
  background: var(--table-header-background);
  font-weight: 600;
  color: #1a5276;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid #d0d7e0;
  white-space: nowrap;
}
.markdown-section td {
  padding: 9px 14px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
.markdown-section tr:hover td { background: #fafbfc; }

/* ── 引用块 ── */
.markdown-section blockquote {
  background: var(--blockquote-background);
  border-left: 3px solid var(--blockquote-border-color);
  margin: 16px 0;
  padding: 14px 20px;
  color: #4a5568;
  border-radius: 0 6px 6px 0;
  font-size: 0.96em;
}
.markdown-section blockquote p { margin: 0 0 6px; }
.markdown-section blockquote p:last-child { margin: 0; }

/* ── 强调/提示框 ── */
.markdown-section .tip {
  background: #eaf7ee;
  border-left: 4px solid #27ae60;
  padding: 14px 18px;
  margin: 16px 0;
  border-radius: 0 6px 6px 0;
  font-size: 0.95em;
}
.markdown-section .warn {
  background: #fef9e7;
  border-left: 4px solid #f39c12;
  padding: 14px 18px;
  margin: 16px 0;
  border-radius: 0 6px 6px 0;
}

/* ── 图片 ── */
.markdown-section img {
  max-width: 100%;
  border-radius: 6px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
  margin: 8px 0;
}
.markdown-section p:has(img) { text-align: center; }

/* ── 行内代码 ── */
.markdown-section code {
  background: #f5f2f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "Cascadia Code", "Source Code Pro", "Fira Code", "Consolas", monospace;
  font-size: 0.9em;
  color: #c0392b;
}
.markdown-section pre {
  background: #282c34;
  border-radius: 6px;
  padding: 16px 20px;
  overflow-x: auto;
}
.markdown-section pre code {
  background: none;
  color: #abb2bf;
  padding: 0;
  font-size: 0.88em;
}

/* ── 侧边栏标题加大 ── */
.sidebar > h1 {
  font-size: 22px !important;
  font-weight: 700 !important;
  padding: 16px !important;
}
.sidebar > h1 a { font-size: inherit; }

/* ── 侧边栏优化 ── */
.sidebar {
  background: var(--sidebar-background);
  border-right: 1px solid #e8ecf1;
}
.sidebar-nav li { margin: 0; }
.sidebar-nav a {
  color: var(--sidebar-nav-link-color);
  font-size: 14px;
  padding: 5px 16px;
  display: block;
  transition: background 0.15s;
}
.sidebar-nav a:hover { background: #edf0f5; }
.sidebar-nav .active > a {
  color: var(--sidebar-nav-link-color--active);
  font-weight: var(--sidebar-nav-link-font-weight--active);
  background: #e8eef7;
  border-right: 3px solid #1a5276;
}

/* ── 侧边栏二维码区域 ── */
.sidebar-qrcode {
  margin: 16px;
  padding: 14px;
  text-align: center;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.sidebar-qrcode img {
  width: 120px;
  height: auto;
  border-radius: 6px;
}
.sidebar-qrcode .qr-text {
  font-size: 12px;
  color: #888;
  margin-top: 6px;
  line-height: 1.5;
}
.sidebar-qrcode .qr-brand {
  font-size: 13px;
  font-weight: 600;
  color: #1a5276;
  margin-top: 4px;
}

/* ── 页脚：二维码 + 信息 + 广告位 ── */
.page-footer {
  margin-top: 48px;
  border-top: 2px solid #e8ecf1;
  padding-top: 0;
}
.footer-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 28px 20px 20px;
  flex-wrap: wrap;
}
.footer-qr {
  text-align: center;
  flex-shrink: 0;
}
.footer-qr img {
  width: 200px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
.footer-qr p {
  font-size: 12px;
  color: #888;
  margin: 6px 0 0;
}
.footer-info {
  text-align: left;
  line-height: 1.8;
}
.footer-info h4 {
  font-size: 15px;
  color: #1a1a2e;
  margin: 0 0 6px;
}
.footer-info p {
  font-size: 13px;
  color: #666;
  margin: 2px 0;
}
.footer-info a {
  color: #2980b9;
  text-decoration: none;
}
.footer-ad {
  text-align: center;
  padding: 14px 20px;
  background: #fafafa;
  border-top: 1px dashed #ddd;
  color: #aaa;
  font-size: 13px;
  margin: 0;
}
.footer-ad p { margin: 0; }

/* 响应式页脚 */
@media (max-width: 480px) {
  .footer-main {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  .footer-info { text-align: center; }
}

/* ── 响应式 ── */
@media (max-width: 768px) {
  .markdown-section { padding: 16px 20px 40px; }
  .markdown-section h1 { font-size: 1.5em; }
  .markdown-section h2 { font-size: 1.2em; }
  .markdown-section table { font-size: 0.85em; }
  .markdown-section th,
  .markdown-section td { padding: 6px 8px; }
}
