/* ============================================================
   文轨车书 · 视觉系统 v3
   轨道绿 · 墨绿底 · 亮绿信号 —— 公众号同款色系
   ============================================================ */
:root {
  /* 浅绿纸面 */
  --paper: #f5f7f3;
  --paper-2: #e2e8de;
  --no: #d5ddd3;
  --surface: #fbfdfa;
  --surface-2: #eef2ea;
  --ink: #1a1e1a;
  --ink-soft: #4d5a4d;
  --ink-faint: #8a958a;
  /* 轨道森绿 / 苔绿信号（低饱和，沉稳不刺眼） */
  --brand: #1a7a3c;
  --brand-dark: #145a2c;
  --brand-soft: rgba(26, 122, 60, 0.10);
  --signal: #52b41c;
  /* 中性深墨（hero / footer）——绿色只做文字/线条点缀 */
  --rail: #1a1d24;
  --rail-2: #232830;
  --rail-line: #2e3540;
  --on-rail: #f0f2f5;
  --on-rail-soft: #9aa0ad;
  /* 绿调网格 */
  --grid: rgba(26, 122, 60, 0.06);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 8px rgba(20, 40, 24, 0.05), 0 12px 32px rgba(20, 40, 24, 0.08);
  --shadow-lg: 0 6px 18px rgba(20, 40, 24, 0.10), 0 24px 60px rgba(20, 40, 24, 0.16);
  --maxw: 1080px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-title: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; transition: color 0.16s ease; }
a:hover { color: var(--brand-dark); }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 253, 250, 0.80);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--paper-2);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: 66px; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; color: var(--ink); letter-spacing: 0.4px; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand .logo { width: 36px; height: 36px; display: block; filter: drop-shadow(0 3px 8px rgba(178, 58, 46, 0.32)); }
.brand .domain { color: var(--ink-faint); font-weight: 500; font-size: 13px; letter-spacing: 0.3px; }

.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
  position: relative; padding: 9px 15px; border-radius: 9px;
  color: var(--ink-soft); font-weight: 600; font-size: 14.5px;
}
.nav-links a::after {
  content: ""; position: absolute; left: 15px; right: 15px; bottom: 5px; height: 2px;
  background: var(--brand); border-radius: 2px; transform: scaleX(0); transform-origin: left;
  transition: transform 0.2s ease;
}
.nav-links a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-links a.active { color: var(--brand); }
.nav-links a.active::after { transform: scaleX(1); }

/* ---------- 容器 ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 46px 0 56px; }

/* ---------- 首页 Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 360px at 88% -30%, rgba(26, 122, 60, 0.12), transparent 60%),
    linear-gradient(155deg, #181b21 0%, #1e222a 55%, #1a1d24 100%);
  color: var(--on-rail);
  border-bottom: 3px solid var(--brand);
}
.hero::before {
  /* 细网格底纹 */
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
  pointer-events: none;
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto; padding: 74px 24px 80px;
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 12.5px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--signal); font-weight: 700; margin-bottom: 18px;
}
.hero .eyebrow::before {
  content: ""; width: 26px; height: 2px; background: var(--signal); display: inline-block; border-radius: 2px;
}
.hero h1 {
  font-family: var(--font-title);
  font-size: 44px; line-height: 1.22; font-weight: 700; letter-spacing: 1px;
}
.hero h1 .hl { color: var(--brand); position: relative; white-space: nowrap; }
.hero h1 .hl::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 8px;
  background: rgba(26, 122, 60, 0.22); z-index: -1; border-radius: 3px;
}
.hero p { margin-top: 20px; max-width: 560px; color: var(--on-rail-soft); font-size: 16.5px; }
.hero .stats { margin-top: 32px; display: flex; gap: 38px; flex-wrap: wrap; }
.hero .stats div { display: flex; flex-direction: column; gap: 3px; }
.hero .stats b { font-size: 27px; color: #fff; font-weight: 800; font-family: var(--font-title); letter-spacing: 0.5px; }
.hero .stats span { font-size: 12.5px; color: var(--on-rail-soft); letter-spacing: 0.5px; }
.hero .stats div:not(:last-child) { padding-right: 38px; border-right: 1px solid var(--rail-line); }

/* Hero 装饰：轨道线网图 */
.hero-art { width: 100%; height: auto; opacity: 0.95; }
.hero-art .ln { fill: none; stroke-width: 3.4; stroke-linecap: round; }
.hero-art .stn { stroke: var(--rail); stroke-width: 2.4; }

/* ---------- 标签筛选 ---------- */
.toolbar { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; margin: 4px 0 30px; }
.toolbar .label { font-size: 13.5px; color: var(--ink-faint); font-weight: 700; margin-right: 2px; letter-spacing: 1px; }
.toolbar .label::before { content: "▍"; color: var(--brand); margin-right: 6px; }
.chip {
  cursor: pointer; border: 1px solid var(--paper-2); background: var(--surface);
  color: var(--ink-soft); padding: 7px 15px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; transition: all 0.16s ease; user-select: none;
}
.chip:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.chip.active {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 4px 14px rgba(26, 122, 60, 0.34);
}
.chip .count { opacity: 0.72; font-weight: 700; margin-left: 5px; }

/* ---------- 文章卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 24px; }
.card {
  position: relative; background: var(--surface);
  border: 1px solid var(--paper-2); border-radius: var(--radius);
  padding: 26px 26px 20px; display: flex; flex-direction: column;
  overflow: hidden; transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.card::before {
  content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--signal));
  transform: scaleX(0); transform-origin: left; transition: transform 0.28s ease;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: transparent; }
.card:hover::before { transform: scaleX(1); }
.card .no {
  position: absolute; top: 18px; right: 22px; font-family: var(--font-title);
  font-size: 30px; font-weight: 700; color: var(--no); line-height: 1; z-index: 0;
}
.card > * { position: relative; z-index: 1; }
.card .kicker { font-size: 12.5px; color: var(--brand); font-weight: 700; letter-spacing: 0.6px; }
.card h3 { font-size: 20px; margin: 9px 0 11px; line-height: 1.4; font-family: var(--font-title); font-weight: 700; }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--brand); text-decoration: none; }
.card .excerpt { color: var(--ink-soft); font-size: 14.5px; flex: 1; }
.card .meta {
  margin-top: 18px; padding-top: 15px; border-top: 1px dashed var(--paper-2);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12.5px; color: var(--ink-faint);
}
.card .tags { display: flex; gap: 7px; flex-wrap: wrap; }
.tag { font-size: 12px; color: var(--brand-dark); background: var(--brand-soft); padding: 3px 10px; border-radius: 6px; font-weight: 600; }
.empty { text-align: center; color: var(--ink-faint); padding: 64px 0; }

/* ---------- 文章详情 ---------- */
.post-header { padding: 50px 0 6px; }
.post-header .back { font-size: 14px; color: var(--ink-faint); font-weight: 600; }
.post-header .back:hover { color: var(--brand); text-decoration: none; }
.post-header h1 { font-family: var(--font-title); font-size: 36px; line-height: 1.3; margin: 16px 0 14px; letter-spacing: 0.5px; }
.post-meta { display: flex; gap: 14px; align-items: center; color: var(--ink-faint); font-size: 13.5px; flex-wrap: wrap; }
.post-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-faint); }
.article {
  position: relative; max-width: 760px; margin: 30px auto 0; background: var(--surface);
  border: 1px solid var(--paper-2); border-radius: var(--radius);
  padding: 44px 48px; box-shadow: var(--shadow);
}
.article::before {
  content: ""; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--brand), var(--signal)); border-radius: var(--radius) 0 0 var(--radius);
}

/* Markdown 排版 */
.article h2 { font-family: var(--font-title); font-size: 25px; margin: 38px 0 13px; padding-bottom: 9px; border-bottom: 1px solid var(--paper-2); }
.article h3 { font-size: 19px; margin: 28px 0 10px; color: var(--brand-dark); font-weight: 700; }
.article h4 { font-size: 16px; margin: 22px 0 8px; font-weight: 700; }
.article p { margin: 15px 0; }
.article ul, .article ol { margin: 15px 0; padding-left: 26px; }
.article li { margin: 8px 0; }
.article li::marker { color: var(--brand); }
.article blockquote {
  border-left: 4px solid var(--brand); background: var(--surface-2);
  margin: 20px 0; padding: 14px 20px; border-radius: 0 10px 10px 0; color: var(--ink-soft);
}
.article blockquote p { margin: 5px 0; }
.article code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); padding: 2px 7px; border-radius: 5px; color: var(--brand-dark); }
.article pre { background: var(--rail); color: #e6ecf2; padding: 20px 22px; border-radius: 12px; overflow-x: auto; margin: 20px 0; font-size: 13.5px; line-height: 1.65; box-shadow: var(--shadow); }
.article pre code { background: none; color: inherit; padding: 0; }
.article img { max-width: 100%; border-radius: 12px; margin: 18px 0; box-shadow: var(--shadow); }
.article table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14.5px; border-radius: 10px; overflow: hidden; }
.article th, .article td { border: 1px solid var(--paper-2); padding: 10px 13px; text-align: left; }
.article th { background: var(--surface-2); font-weight: 700; color: var(--ink); }
.article tbody tr:nth-child(even) { background: var(--surface-2); }
.article hr { border: none; border-top: 1px solid var(--paper-2); margin: 30px 0; }

/* ---------- 关于页 ---------- */
.about-hero { padding: 56px 0 12px; }
.about-card {
  position: relative; max-width: 820px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--paper-2); border-radius: var(--radius);
  padding: 44px 48px; box-shadow: var(--shadow);
}
.about-card::before {
  content: ""; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--brand), var(--signal)); border-radius: var(--radius) 0 0 var(--radius);
}
.about-card h2 { font-family: var(--font-title); font-size: 23px; margin: 30px 0 11px; }
.about-card h2:first-of-type { margin-top: 0; }
.about-card h2::before { content: "▪"; color: var(--brand); margin-right: 9px; }
.about-card ul { padding-left: 24px; margin: 11px 0; }
.about-card li { margin: 9px 0; }
.about-card li::marker { color: var(--brand); }
.profile { display: flex; gap: 22px; align-items: center; margin-bottom: 6px; }
.avatar {
  width: 86px; height: 86px; border-radius: 20px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 8px 22px rgba(26, 122, 60, 0.34);
}
.avatar svg { width: 46px; height: 46px; }
.profile .name { font-family: var(--font-title); font-size: 25px; font-weight: 700; }
.profile .role { color: var(--ink-soft); font-size: 15px; margin-top: 3px; }
.contact { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.contact a { border: 1px solid var(--paper-2); border-radius: 10px; padding: 10px 16px; font-weight: 600; font-size: 14px; color: var(--ink); background: var(--surface); }
.contact a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; transform: translateY(-1px); }

/* ---------- 页脚 ---------- */
.footer { margin-top: 56px; border-top: 1px solid var(--rail-line); background: var(--rail); color: var(--on-rail-soft); }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 30px 24px;
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13.5px;
}
.footer-inner a { color: var(--on-rail-soft); }
.footer-inner a:hover { color: var(--signal); }
.footer .mark { color: var(--on-rail); font-weight: 700; font-family: var(--font-title); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; gap: 30px; }
  .hero-art { max-width: 320px; margin: 0 auto; }
  .hero h1 { font-size: 34px; }
}
@media (max-width: 600px) {
  .hero h1 { font-size: 28px; }
  .article, .about-card { padding: 30px 24px; }
  .post-header h1 { font-size: 26px; }
  .nav-links a { padding: 9px 11px; }
  .hero .stats { gap: 22px; }
  .hero .stats div:not(:last-child) { padding-right: 22px; }
}

/* ---------- 主题切换按钮（浅 / 深 / 跟随系统 三态） ---------- */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  border: 1px solid var(--paper-2); background: var(--surface);
  color: var(--ink-soft); cursor: pointer; display: grid; place-items: center;
  transition: all 0.18s ease; margin-left: 6px; position: relative;
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.theme-toggle svg { width: 19px; height: 19px; grid-area: 1 / 1; }
.theme-toggle .ic-sun,
.theme-toggle .ic-moon,
.theme-toggle .ic-auto { display: none; }
.theme-toggle[data-mode="light"] .ic-sun { display: block; }
.theme-toggle[data-mode="dark"] .ic-moon { display: block; }
.theme-toggle[data-mode="system"] .ic-auto { display: block; }

/* ---------- 深色主题变量（中性墨灰底 + 绿色点缀） ---------- */
[data-theme="dark"] {
  --paper: #111318;
  --surface: #1a1d22;
  --surface-2: #232a33;
  --ink: #dde0e4;
  --ink-soft: #9aa2ad;
  --ink-faint: #6a7280;
  --paper-2: #252c36;
  --brand: #3cbd44;
  --brand-dark: #55d45f;
  --brand-soft: rgba(60, 189, 68, 0.15);
  --signal: #8fdc55;
  --rail: #0b0d12;
  --rail-2: #12161e;
  --rail-line: #1e2630;
  --on-rail: #eef0f3;
  --on-rail-soft: #88929c;
  --no: #181c24;
  --grid: rgba(60, 189, 68, 0.06);
}
[data-theme="dark"] body { background-color: var(--paper); }
[data-theme="dark"] .nav { background: rgba(17, 19, 24, 0.82); border-bottom-color: var(--rail-line); }
[data-theme="dark"] .article pre { background: #0b0d12; }
[data-theme="dark"] .hero .stats b { color: #fff; }

/* ---------- 主题切换过渡动画 ---------- */
html.theme-transition,
html.theme-transition *,
html.theme-transition body {
  transition: background-color .42s ease, border-color .42s ease, color .42s ease,
    fill .42s ease, box-shadow .42s ease !important;
}
