/* article.css — standalone stylesheet for build-time wiki article pages.
   Self-contained: defines its own design tokens (mirroring the site theme)
   so article pages need no dependency on the SPA's hashed style.css. */

:root {
  --bg: #f5f5f7;
  --section-alt: #ffffff;
  --surface: #ffffff;
  --border: #e8e8ed;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --accent-light: #e8f0fe;
  --code-bg: #f2f2f7;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #000000;
  --section-alt: #1c1c1e;
  --surface: #1c1c1e;
  --border: #38383a;
  --text: #f5f5f7;
  --text-secondary: #98989d;
  --accent: #0a84ff;
  --accent-light: #1c3a5e;
  --code-bg: #161618;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.article-shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Top bar */
.article-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.top-rss {
  font-size: 13px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 999px;
}
.top-rss:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* Floating theme toggle */
.theme-toggle {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover { border-color: var(--accent); }

/* Article header */
.article-header { margin-bottom: 28px; }
.article-icon { font-size: 40px; line-height: 1; margin-bottom: 12px; }
.article-title {
  font-size: 34px;
  line-height: 1.25;
  margin: 0 0 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--text-secondary);
  font-size: 14px;
}
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
}
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.article-tags span {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}

/* Table of contents */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  margin: 0 0 32px;
}
.toc-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 4px 0; }
.toc li.lvl-3 { padding-left: 16px; }
.toc a { color: var(--text-secondary); font-size: 14px; }
.toc a:hover { color: var(--accent); text-decoration: none; }

/* Article body */
.article-content { font-size: 16.5px; }
.article-content h2 {
  font-size: 24px;
  margin: 38px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.article-content h3 { font-size: 19px; margin: 28px 0 10px; scroll-margin-top: 80px; }
.article-content p { margin: 14px 0; }
.article-content ul, .article-content ol { margin: 14px 0; padding-left: 24px; }
.article-content li { margin: 6px 0; }
.article-content blockquote {
  margin: 18px 0;
  padding: 12px 18px;
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  border-radius: 0 10px 10px 0;
  color: var(--text);
}
.article-content blockquote p { margin: 6px 0; }
.article-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 6px;
}
.article-content pre.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  overflow: auto;
  margin: 18px 0;
  position: relative;
}
.article-content pre.code-block code {
  background: none;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.6;
}
.article-content pre.code-block[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.article-content img { max-width: 100%; border-radius: 12px; margin: 18px 0; }
.article-content hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

.table-wrap { overflow-x: auto; margin: 18px 0; }
.article-content table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.article-content th { background: var(--surface); font-weight: 600; }

/* Footer */
.article-footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.back-home { display: inline-block; font-weight: 600; }
.article-beian { margin-top: 12px; font-size: 12px; }
.article-beian a { color: var(--text-secondary); text-decoration: none; }
.article-beian a:hover { color: var(--accent); }

@media (max-width: 600px) {
  .article-title { font-size: 27px; }
  .article-shell { padding: 18px 16px 64px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
