/* ==========================================================
   Helios 全站统一设计系统（assets.aigcwei.cn 唯一真源）
   纸面 + 墨色 + 强调色体系 · 手机自适应 · 语义化排版
   四个站点（主站/learn/life/新站）共用本文件。
   改样式后：版本号 +1（style.css?v=N），并同步到各站页面。
   ========================================================== */

/* ===== 1. Design Tokens ===== */
:root {
  /* 纸面与墨色 */
  --paper: #faf8f4;
  --paper-deep: #f1ede4;
  --paper-soft: #f6f3ec;
  --hairline: #e2dccf;
  --hairline-soft: #ece7db;
  --ink: #26292f;
  --ink-secondary: #5b6069;
  --muted: #8b8f97;

  /* 代码（Catppuccin 深色，纸上留白对比） */
  --code-bg: #1e1e2e;
  --code-ink: #cdd6f4;
  --code-border: #313244;

  /* 品牌强调色（默认主站朱砂红） */
  --accent: #b3402f;
  --accent-strong: #8f2f22;
  --accent-soft: #f4e5e0;
  --on-accent: #ffffff;

  /* 语义色 */
  --tip-bg: var(--paper-deep);
  --tip-border: var(--accent);
  --warn-bg: #faf3df;
  --warn-border: #b98313;
  --success: #44745a;
  --success-soft: #e4ede7;

  /* 字体 */
  --font-serif: "Source Han Serif SC", "Noto Serif CJK SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", "Georgia", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  /* 圆角（印刷感：克制） */
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-full: 999px;

  /* 阴影（带暖色） */
  --shadow-sm: 0 1px 2px rgba(70, 60, 40, 0.05);
  --shadow-md: 0 4px 18px rgba(70, 60, 40, 0.10);
}

/* 技术线强调色（learn） */
body.track-kotlin { --accent: #b3402f; --accent-strong: #8f2f22; --accent-soft: #f4e5e0; }
body.track-lvgl   { --accent: #35536b; --accent-strong: #2a4154; --accent-soft: #e3eaef; }
body.track-epub   { --accent: #9a6a1f; --accent-strong: #7a5216; --accent-soft: #f3ead9; }
body.track-sifli  { --accent: #6a4f7a; --accent-strong: #523a5e; --accent-soft: #ece4f0; }
body.track-cpp    { --accent: #3d6b5e; --accent-strong: #2f544a; --accent-soft: #e0e9e5; }

/* 站点个性色（life 旅行站保留金色） */
body.site-life   { --accent: #A67C52; --accent-strong: #8a6540; --accent-soft: #f3e9dd; }

/* ===== 2. Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent-strong); }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
main { flex: 1; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ===== 3. 顶部导航（统一外壳） ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 248, 244, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.site-header .nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 24px;
}
.site-header .brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  text-decoration: none;
  padding: 14px 16px 14px 0;
  margin-right: auto;
  white-space: nowrap;
}
.site-header .brand:hover { text-decoration: none; color: var(--accent); }
.site-header .nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-header .nav-links::-webkit-scrollbar { display: none; }
.site-header .nav-links a {
  color: var(--ink-secondary);
  padding: 14px 14px;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.site-header .nav-links a:hover { color: var(--ink); background: var(--paper-soft); }
.site-header .nav-links a.active {
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ===== 4. 页脚（统一外壳） ===== */
.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--hairline);
  background: var(--paper-deep);
  padding: 28px 0 32px;
}
.site-footer .footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.site-footer .footer-copy { margin-bottom: 8px; }
.site-footer .footer-copy a { color: var(--ink-secondary); text-decoration: none; }
.site-footer .footer-copy a:hover { color: var(--accent-strong); }

/* ===== 5. 文章排版（博客/笔记正文） ===== */
.article { max-width: 780px; margin: 0 auto; padding: 40px 0 20px; }
.article-header { margin-bottom: 28px; }
.article-header h1 {
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1.4;
  color: var(--ink);
  margin-bottom: 10px;
}
.article-meta {
  color: var(--muted);
  font-size: 13.5px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}
.article-meta .tag {
  background: var(--paper-deep);
  color: var(--ink-secondary);
  border-radius: var(--radius-full);
  padding: 2px 12px;
  font-size: 12.5px;
}
.article-body { font-size: 16px; }
.article-body h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  margin: 36px 0 14px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
  color: var(--ink);
}
.article-body h3 { font-size: 19px; margin: 26px 0 10px; color: var(--ink-secondary); }
.article-body h4 { font-size: 16px; margin: 20px 0 8px; color: var(--ink-secondary); }
.article-body p { margin: 12px 0; }
.article-body ul, .article-body ol { margin: 12px 0; padding-left: 26px; }
.article-body li { margin: 5px 0; }
.article-body li::marker { color: var(--accent); }
.article-body strong { color: var(--ink); font-weight: 600; }
.article-body img { border-radius: var(--radius-md); box-shadow: var(--shadow-md); margin: 12px 0; }

/* 代码 */
.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--paper-soft);
  color: var(--accent-strong);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline-soft);
}
.article-body pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 16px 18px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13.5px;
  line-height: 1.65;
  border: 1px solid var(--code-border);
}
.article-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  border: none;
  font-size: 13.5px;
}

/* 引用 */
.article-body blockquote {
  margin: 16px 0;
  padding: 10px 18px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--ink-secondary);
}
.article-body blockquote p { margin: 4px 0; }

/* 表格 */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 20px;
  font-size: 14.5px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.article-body thead th {
  background: var(--paper-deep);
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--hairline);
}
.article-body tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--hairline-soft);
  vertical-align: top;
}
.article-body tbody tr:last-child td { border-bottom: none; }

/* 分割线 */
.article-body hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 32px 0;
}

/* 提示框（learn 组件复用） */
.article-body .tip, .article-body .warning {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--tip-border);
  background: var(--tip-bg);
}
.article-body .tip .tip-title, .article-body .warning .tip-title { font-weight: 600; margin-bottom: 4px; }
.article-body .warning { background: var(--warn-bg); border-color: var(--warn-border); }

/* ===== 6. 首页卡片（博客流/笔记库/门户通用） ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin: 24px 0;
}
.card {
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
  display: block;
  text-decoration: none;
  color: var(--ink);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.card .card-date { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.card .card-title { font-family: var(--font-serif); font-size: 17px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.card:hover .card-title { color: var(--accent); }
.card .card-desc { color: var(--ink-secondary); font-size: 13.5px; line-height: 1.7; }
.card .card-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.card .card-tags .tag {
  background: var(--paper-soft);
  color: var(--ink-secondary);
  border-radius: var(--radius-full);
  padding: 1px 10px;
  font-size: 12px;
}

/* 分类页标题 */
.page-title {
  font-family: var(--font-serif);
  font-size: 26px;
  margin: 32px 0 6px;
  color: var(--ink);
}
.page-subtitle { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

/* ===== 7. 移动端自适应（硬性要求） ===== */
@media (max-width: 768px) {
  body { font-size: 15px; }
  .container, .site-header .nav-inner, .site-footer .footer-inner { padding: 0 16px; }
  .article { padding: 24px 0 16px; }
  .article-header h1 { font-size: 22px; }
  .article-body h2 { font-size: 20px; }
  .article-body h3 { font-size: 17px; }
  .article-body table { display: block; overflow-x: auto; white-space: nowrap; }
  .site-header .nav-links { flex-wrap: nowrap; }
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .article-header h1 { font-size: 20px; }
  .article-body pre { font-size: 12px; padding: 12px 14px; }
  .article-body pre code { font-size: 12px; }
  .site-header .brand { font-size: 15px; padding: 12px 10px 12px 0; }
  .site-header .nav-links a { padding: 12px 11px; font-size: 13.5px; }
}

/* ===== 8. 打印 ===== */
@media print {
  .site-header, .site-footer { display: none; }
  body { background: #fff; }
  .article { max-width: none; padding: 0; }
}
