/**
 * 知识库文章样式
 *
 * 知识库是静态 HTML（为了可被搜索引擎直接抓取），不走 Vue 构建，
 * 所以这里复制了一份 src/styles/tokens.css 的令牌值。
 * 改动主站设计令牌时，这个文件需要同步更新。
 */

:root {
  --brand-50: #eef4ff;
  --brand-100: #dae6ff;
  --brand-200: #bcd2ff;
  --brand-300: #8eb4ff;
  --brand-500: #3366e6;
  --brand-600: #2350c9;
  --brand-700: #1c3fa1;
  --brand-800: #1a3680;
  --brand-900: #1a3068;

  --ink-900: #0f1729;
  --ink-800: #1c2637;
  --ink-700: #33415c;
  --ink-600: #4a5872;
  --ink-500: #6b7894;
  --ink-400: #94a0b8;
  --ink-300: #c3cbd9;
  --ink-200: #dfe4ec;
  --ink-100: #eef1f6;
  --ink-50: #f6f8fb;
  --white: #ffffff;

  --ok-50: #e9f8ef;
  --ok-500: #14884a;
  --ok-600: #0f6f3c;
  --warn-50: #fff6e6;
  --warn-100: #ffe9c2;
  --warn-500: #b8730a;
  --warn-600: #965c05;

  --font-sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 41, 0.06);
  --shadow-sm: 0 1px 3px rgba(15, 23, 41, 0.08), 0 1px 2px rgba(15, 23, 41, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 41, 0.08), 0 2px 4px rgba(15, 23, 41, 0.04);

  --header-h: 58px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.62;
  color: var(--ink-800);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-break: strict;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  line-height: 1.32;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

p {
  margin: 0;
}

a {
  color: var(--brand-600);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--brand-700);
}

::selection {
  background: var(--brand-100);
  color: var(--brand-900);
}

/* ============ 站点头部：与主站 SiteHeader 保持一致 ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--ink-200);
}

.header-inner {
  max-width: 1340px;
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  flex: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 10.5px;
  color: var(--ink-500);
  letter-spacing: 0.06em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.header-nav a {
  display: block;
  padding: 6px 12px;
  border-radius: var(--r-md);
  color: var(--ink-600);
  font-size: 13px;
  font-weight: 550;
  transition: background 0.15s ease, color 0.15s ease;
}

.header-nav a:hover {
  background: var(--ink-100);
  color: var(--ink-900);
}

.header-nav a.active {
  color: var(--brand-700);
  background: var(--brand-50);
}

.header-actions {
  display: flex;
  align-items: center;
  flex: none;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-600);
  cursor: pointer;
}

.menu-toggle:hover {
  background: var(--ink-100);
}

/* ============ 页面容器 ============ */
.container {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 24px;
}

.article-container {
  max-width: 820px;
}

.page-main {
  padding: 48px 0 64px;
}

/* ============ 文章头部 ============ */
.article-header {
  margin-bottom: 28px;
}

.article-title {
  font-size: 32px;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--ink-500);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-full);
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 12px;
  font-weight: 600;
}

/* ============ 目录 ============ */
.article-toc {
  padding: 18px 22px;
  margin-bottom: 32px;
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

.article-toc-title {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-500);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.article-toc ol {
  margin: 0;
  padding-left: 1.2em;
  font-size: 14px;
  line-height: 2;
  color: var(--ink-600);
}

.article-toc a {
  color: var(--ink-700);
}

.article-toc a:hover {
  color: var(--brand-600);
}

/* ============ 正文 ============ */
.article-body {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-700);
}

.article-body > p {
  margin: 0 0 18px;
}

.article-body h2 {
  font-size: 20px;
  margin: 44px 0 14px;
  padding-left: 11px;
  border-left: 3px solid var(--brand-600);
}

.article-body h3 {
  font-size: 16px;
  margin: 30px 0 10px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 18px;
  padding-left: 1.35em;
  line-height: 1.9;
}

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

.article-body strong {
  color: var(--ink-900);
  font-weight: 650;
}

/* 提示块 */
.callout {
  padding: 14px 18px;
  margin: 0 0 22px;
  border: 1px solid var(--brand-100);
  border-left: 3px solid var(--brand-500);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: var(--brand-50);
  color: var(--brand-800);
  font-size: 14px;
  line-height: 1.75;
}

.callout strong {
  color: var(--brand-900);
}

.callout-warning {
  border-color: var(--warn-100);
  border-left-color: var(--warn-500);
  background: var(--warn-50);
  color: var(--warn-600);
}

.callout-warning strong {
  color: var(--warn-600);
}

/* 公式 */
.formula-box {
  padding: 16px 20px;
  margin: 0 0 22px;
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-800);
  text-align: center;
  overflow-x: auto;
}

/* 配图 */
.article-figure {
  margin: 0 0 26px;
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
}

.article-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-sm);
}

.article-figure figcaption {
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-500);
  line-height: 1.6;
  text-align: center;
}

/* 来源说明 */
.article-trust-box {
  padding: 18px 22px;
  margin: 0 0 26px;
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  font-size: 13px;
}

.article-trust-box ul {
  margin: 0;
  padding-left: 1.25em;
  line-height: 1.95;
  color: var(--ink-600);
}

/* 表格：列多时横向滚动，不撑破页面（与主站 .table-wrap 行为一致） */
.article-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 22px;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  font-variant-numeric: tabular-nums;
  -webkit-overflow-scrolling: touch;
}

.article-body table thead,
.article-body table tbody {
  display: table;
  width: 100%;
  min-width: max-content;
}

.article-body th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-500);
  background: var(--ink-50);
  border-bottom: 1px solid var(--ink-200);
  white-space: nowrap;
}

.article-body td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--ink-100);
  color: var(--ink-700);
}

.article-body tbody tr:last-child td {
  border-bottom: none;
}

/* 工具入口 */
.tool-cta-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px 24px;
  margin: 0 0 26px;
  background: var(--white);
  border: 1px solid var(--brand-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

.cta-text strong {
  display: block;
  font-size: 15px;
  color: var(--ink-900);
  margin-bottom: 2px;
}

.cta-text p,
.cta-text span {
  font-size: 13px;
  color: var(--ink-500);
}

.tool-cta-inline a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 20px;
  border-radius: var(--r-md);
  background: var(--brand-600);
  color: var(--white);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  flex: none;
  transition: background 0.15s ease;
}

.tool-cta-inline a:hover {
  background: var(--brand-700);
  color: var(--white);
}

/* 延伸阅读 */
.related-articles {
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--ink-200);
}

.related-articles h3 {
  font-size: 15px;
  margin-bottom: 14px;
}

.related-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.related-list a {
  display: block;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink-800);
  line-height: 1.55;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.related-list a:hover {
  border-color: var(--brand-300);
  color: var(--brand-700);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* ============ 知识库首页 ============ */
.index-head {
  margin-bottom: 32px;
}

.index-head h1 {
  font-size: 34px;
  letter-spacing: -0.03em;
}

.index-head p {
  margin-top: 12px;
  max-width: 680px;
  font-size: 15px;
  color: var(--ink-600);
  line-height: 1.7;
}

.articles-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.article-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.article-card:hover {
  border-color: var(--brand-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.article-card h3 {
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink-900);
}

.article-card:hover h3 {
  color: var(--brand-700);
}

.article-card p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-600);
  flex: 1;
}

.article-card .meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-400);
}

/* ============ 页脚：与主站 SiteFooter 保持一致 ============ */
.site-footer {
  background: var(--white);
  border-top: 1px solid var(--ink-200);
  padding-top: 48px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: flex-start;
}

.footer-brand-name {
  font-weight: 650;
  color: var(--ink-900);
}

.footer-desc {
  max-width: 260px;
  font-size: 12px;
  color: var(--ink-500);
  line-height: 1.65;
}

.footer-head {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-900);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.footer-col a {
  font-size: 13px;
  color: var(--ink-600);
}

.footer-col a:hover {
  color: var(--brand-600);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 16px;
  padding-bottom: 24px;
  border-top: 1px solid var(--ink-100);
  font-size: 12px;
  color: var(--ink-500);
}

/* ============ 响应式 ============ */
@media (max-width: 860px) {
  .header-inner {
    padding: 0 16px;
    gap: 12px;
  }

  .brand-tag {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .header-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px;
    background: var(--white);
    border-bottom: 1px solid var(--ink-200);
    box-shadow: var(--shadow-md);
    display: none;
  }

  .header-nav.open {
    display: flex;
  }

  .header-nav a {
    padding: 10px 12px;
  }

  .container {
    padding: 0 16px;
  }

  .page-main {
    padding: 28px 0 48px;
  }

  .article-title {
    font-size: 25px;
  }

  .index-head h1 {
    font-size: 26px;
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .footer-col:first-child {
    grid-column: 1 / -1;
  }

  .article-body {
    font-size: 14.5px;
  }

  .tool-cta-inline {
    padding: 16px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}
