/* ============================================================
 *  BioLog · 主题样式
 *  浅色为默认主题，支持 [data-theme="dark"] 切换
 * ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  --accent: #1f7a4d;
  --accent-strong: #17603c;
  --accent-soft: #e8f4ee;
  --accent-2: #0f766e;
  --accent-3: #7c5cbf;

  --bg: #ffffff;
  --bg-soft: #f6f8f7;
  --bg-elevated: #ffffff;
  --bg-sunken: #f1f4f2;

  --text: #1b2320;
  --text-strong: #0e1512;
  --text-muted: #66756e;
  --text-faint: #8b9891;

  --border: #e3e8e5;
  --border-strong: #cfd8d3;

  --code-bg: #f6f8fa;
  --code-border: #e3e8e5;
  --code-text: #24292f;

  --tk-kw: #cf222e;
  --tk-st: #0a3069;
  --tk-cm: #6e7781;
  --tk-nu: #0550ae;
  --tk-fn: #8250df;
  --tk-op: #57606a;

  --shadow-sm: 0 1px 2px rgba(16, 32, 24, .05);
  --shadow-md: 0 4px 16px rgba(16, 32, 24, .07);
  --shadow-lg: 0 12px 32px rgba(16, 32, 24, .10);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Georgia, "Songti SC",
    "Noto Serif SC", "Source Han Serif SC", serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Courier New",
    "Noto Sans Mono CJK SC", monospace;

  --header-h: 62px;
  --container: 1160px;
}

[data-theme="dark"] {
  --accent: #4ec98c;
  --accent-strong: #6fd9a4;
  --accent-soft: #16301f;
  --accent-2: #4dc9c0;
  --accent-3: #b39ae8;

  --bg: #10161a;
  --bg-soft: #161d22;
  --bg-elevated: #182026;
  --bg-sunken: #0c1114;

  --text: #dfe7e3;
  --text-strong: #f2f7f4;
  --text-muted: #97a6a0;
  --text-faint: #73827c;

  --border: #263037;
  --border-strong: #35434b;

  --code-bg: #161b22;
  --code-border: #2a333b;
  --code-text: #e6edf3;

  --tk-kw: #ff7b72;
  --tk-st: #a5d6ff;
  --tk-cm: #8b949e;
  --tk-nu: #79c0ff;
  --tk-fn: #d2a8ff;
  --tk-op: #c9d1d9;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .38);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .22s ease, color .22s ease;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4, h5 { line-height: 1.32; color: var(--text-strong); margin: 0; }

::selection { background: var(--accent); color: #fff; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 22px; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 页头 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  height: 100%; display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text-strong); font-weight: 700; }
.brand:hover { color: var(--accent); }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 15.5px; letter-spacing: .01em; }
.brand-sub { font-size: 11px; color: var(--text-faint); font-weight: 500; letter-spacing: .06em; }

.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav a {
  padding: 7px 13px; border-radius: 999px; color: var(--text-muted);
  font-size: 14.5px; font-weight: 500; transition: all .16s ease; white-space: nowrap;
}
.site-nav a:hover { background: var(--bg-soft); color: var(--text-strong); }
.site-nav a.is-active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: 8px; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--bg-elevated);
  border-radius: 10px; color: var(--text-muted); transition: all .16s ease;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--accent); transform: translateY(-1px); }
.icon-btn svg { width: 17px; height: 17px; }

.nav-toggle { display: none; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 17px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; line-height: 1.2;
  transition: all .16s ease; white-space: nowrap; text-decoration: none;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { background: var(--bg-elevated); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-subtle { background: var(--bg-soft); color: var(--text-muted); }
.btn-subtle:hover { color: var(--text-strong); }
.btn-danger { background: transparent; border-color: var(--border); color: #c0392b; }
.btn-danger:hover { background: #c0392b; border-color: #c0392b; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- 首页 Hero ---------- */
.hero { padding: 56px 0 30px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--bg-soft), var(--bg)); }
.hero-inner { display: grid; grid-template-columns: 1.55fr 1fr; gap: 46px; align-items: center; }
.hero-avatar {
  width: 92px; height: 92px; border-radius: 50%; overflow: hidden;
  border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--border), var(--shadow-md);
  background: var(--accent-soft); flex: none;
}
.hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero-top { display: flex; align-items: center; gap: 20px; }
.hero-eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 6px;
}
.hero h1 { font-family: var(--font-serif); font-size: 40px; letter-spacing: -.01em; margin-bottom: 6px; }
.hero-role { font-size: 15.5px; color: var(--text-muted); }
.hero-tagline { margin: 18px 0 22px; font-size: 16.5px; color: var(--text-muted); max-width: 46em; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.hero-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}
.stat { text-align: center; }
.stat-num { font-family: var(--font-serif); font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--text-faint); margin-top: 4px; }

/* ---------- 工具条 ---------- */
.toolbar { padding: 26px 0 8px; }
.toolbar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1 1 260px; max-width: 380px; }
.search-box svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-faint);
}
.search-box input {
  width: 100%; padding: 10px 14px 10px 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-elevated);
  outline: none; transition: border-color .16s ease, box-shadow .16s ease;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.chip-label { font-size: 12.5px; color: var(--text-faint); letter-spacing: .04em; }
.chip {
  padding: 5px 13px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-muted);
  font-size: 13.5px; transition: all .16s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chip-count { opacity: .65; font-size: 12px; margin-left: 3px; }

/* ---------- 文章卡片 ---------- */
.section { padding: 34px 0 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-title { font-family: var(--font-serif); font-size: 23px; }
.section-desc { font-size: 13.5px; color: var(--text-faint); }

.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 20px; padding-bottom: 10px; }
.post-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); transition: all .2s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.post-cover { aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-sunken); border-bottom: 1px solid var(--border); }
.post-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.post-card:hover .post-cover img { transform: scale(1.04); }
.post-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.post-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-faint); margin-bottom: 9px; flex-wrap: wrap; }
.post-cat {
  padding: 2px 9px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent-strong); font-weight: 600; font-size: 12px;
}
.post-title { font-size: 17.5px; line-height: 1.42; margin-bottom: 8px; }
.post-title a { color: var(--text-strong); }
.post-title a:hover { color: var(--accent); }
.post-excerpt { font-size: 14px; color: var(--text-muted); flex: 1; margin: 0 0 14px; }
.post-foot { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-faint); border-top: 1px dashed var(--border); padding-top: 12px; }
.post-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.tag { font-size: 11.5px; color: var(--text-faint); }
.tag::before { content: "#"; opacity: .6; }

.empty-state {
  text-align: center; padding: 64px 20px; color: var(--text-faint);
  border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg-soft);
}
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--border-strong); }

/* ---------- 归档 ---------- */
.archive-group { margin-bottom: 8px; }
.archive-year {
  font-family: var(--font-serif); font-size: 19px; color: var(--accent);
  margin: 22px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.archive-item {
  display: flex; align-items: baseline; gap: 14px; padding: 8px 10px;
  border-radius: 8px; transition: background .16s ease;
}
.archive-item:hover { background: var(--bg-soft); }
.archive-date { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint); flex: none; }
.archive-title { font-size: 15px; color: var(--text-strong); }
.archive-cat { margin-left: auto; font-size: 12.5px; color: var(--text-faint); flex: none; }

/* ---------- 文章详情 ---------- */
.article-header { padding: 46px 0 26px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.article-header .container { max-width: 860px; }
.article-breadcrumb { font-size: 13px; color: var(--text-faint); margin-bottom: 14px; display: flex; gap: 7px; align-items: center; }
.article-breadcrumb a { color: var(--text-faint); }
.article-breadcrumb a:hover { color: var(--accent); }
.article-title { font-family: var(--font-serif); font-size: 34px; line-height: 1.28; letter-spacing: -.01em; margin-bottom: 14px; }
.article-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-muted); align-items: center; }
.article-meta svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 5px; opacity: .7; }
.article-lead {
  margin-top: 18px; padding: 14px 18px; border-left: 3px solid var(--accent);
  background: var(--bg-elevated); border-radius: 0 10px 10px 0;
  font-size: 15px; color: var(--text-muted);
}
.article-tags { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 216px; gap: 52px; padding: 36px 0 60px; align-items: start; }
.article-body { max-width: 760px; }

.toc { position: sticky; top: calc(var(--header-h) + 22px); font-size: 13.5px; }
.toc-title { font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0 0 0 2px; border-left: 2px solid var(--border); }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 5px 10px; color: var(--text-muted); font-size: 13px;
  border-left: 2px solid transparent; margin-left: -2px; line-height: 1.45;
}
.toc a:hover { color: var(--accent); }
.toc a.lv3 { padding-left: 22px; font-size: 12.5px; color: var(--text-faint); }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

.article-footer { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

/* ---------- 学术正文排版 ---------- */
.prose { font-family: var(--font-serif); font-size: 17px; line-height: 1.88; color: var(--text); }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 1.15em; }
.prose .md-h { font-family: var(--font-serif); position: relative; scroll-margin-top: calc(var(--header-h) + 18px); }
.prose .md-h2 { font-size: 24px; margin: 2.1em 0 .7em; padding-left: 14px; }
.prose .md-h2::before {
  content: ""; position: absolute; left: 0; top: .18em; width: 4px; height: 1.05em;
  border-radius: 2px; background: var(--accent);
}
.prose .md-h3 { font-size: 19.5px; margin: 1.7em 0 .55em; color: var(--accent-strong); }
.prose .md-h4 { font-size: 17px; margin: 1.5em 0 .5em; }
.prose .md-anchor { position: absolute; left: -22px; color: var(--border-strong); opacity: 0; font-size: .85em; }
.prose .md-h:hover .md-anchor { opacity: 1; }
.prose .md-h1 { font-size: 27px; margin: 1.6em 0 .6em; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.5em; }
.prose li { margin: .35em 0; }
.prose li > ul, .prose li > ol { margin: .35em 0 .2em; }
.prose strong { color: var(--text-strong); font-weight: 700; }
.prose em { font-style: italic; }
.prose del { color: var(--text-faint); }
.prose mark { background: #fff3b8; color: #5a4a00; padding: 1px 3px; border-radius: 3px; }
[data-theme="dark"] .prose mark { background: #4a3f10; color: #ffe89a; }
.prose .md-hr { border: 0; border-top: 1px solid var(--border); margin: 2.4em 0; }
.prose blockquote {
  margin: 1.5em 0; padding: .4em 1.2em; border-left: 3px solid var(--accent);
  background: var(--bg-soft); border-radius: 0 10px 10px 0;
  color: var(--text-muted); font-style: italic;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose .md-inline-code {
  font-family: var(--font-mono); font-size: .865em; padding: .15em .42em;
  border-radius: 5px; background: var(--code-bg); border: 1px solid var(--code-border);
  color: var(--code-text); white-space: nowrap;
}
.prose .md-img { border-radius: var(--radius-sm); border: 1px solid var(--border); }
.prose .md-figure { margin: 1.9em 0; text-align: center; }
.prose .md-figure .md-img { width: 100%; }
.prose .md-figure figcaption {
  margin-top: 10px; font-size: 13.5px; color: var(--text-faint);
  font-family: var(--font-ui); line-height: 1.6;
}
.prose .md-tasklist { list-style: none; padding-left: .2em; }
.prose .md-tasklist li { display: flex; gap: 9px; align-items: flex-start; }
.prose .md-task {
  flex: none; width: 17px; height: 17px; margin-top: .42em; border-radius: 4px;
  border: 1.5px solid var(--border-strong); display: grid; place-items: center;
  font-size: 12px; color: transparent; font-family: var(--font-ui);
}
.prose .md-task.is-done { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 表格 */
.prose .md-table-wrap { overflow-x: auto; margin: 1.6em 0; border: 1px solid var(--border); border-radius: 10px; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--font-ui); font-size: 14.5px; }
.prose thead th {
  background: var(--bg-soft); text-align: left; font-weight: 700; color: var(--text-strong);
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.prose tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:nth-child(even) { background: var(--bg-soft); }

/* 代码块 */
.prose .md-codeblock {
  margin: 1.6em 0; border: 1px solid var(--code-border); border-radius: 10px;
  overflow: hidden; background: var(--code-bg); font-family: var(--font-ui);
}
.prose .md-codehead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; background: var(--bg-sunken); border-bottom: 1px solid var(--code-border);
}
[data-theme="dark"] .prose .md-codehead { background: #1c2229; }
.prose .md-codelang {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .08em;
  color: var(--text-faint); font-weight: 600;
}
.prose .md-copy {
  border: 1px solid var(--code-border); background: transparent; color: var(--text-faint);
  font-size: 12px; padding: 2px 10px; border-radius: 6px; transition: all .16s ease;
}
.prose .md-copy:hover { color: var(--accent); border-color: var(--accent); }
.prose .md-pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.prose .md-code {
  font-family: var(--font-mono); font-size: 13.2px; line-height: 1.72;
  color: var(--code-text); white-space: pre; tab-size: 2;
}
.tk-kw { color: var(--tk-kw); font-weight: 600; }
.tk-st { color: var(--tk-st); }
.tk-cm { color: var(--tk-cm); font-style: italic; }
.tk-nu { color: var(--tk-nu); }
.tk-fn { color: var(--tk-fn); }
.tk-op { color: var(--tk-op); }

/* 脚注 / 参考文献 */
.prose .md-fnref a {
  font-family: var(--font-ui); font-size: 11.5px; font-weight: 700;
  padding: 0 1px; vertical-align: super; color: var(--accent);
}
.prose .md-references {
  margin-top: 2.8em; padding-top: 1.4em; border-top: 2px solid var(--border);
  font-family: var(--font-ui);
}
.prose .md-refs-title { font-size: 15px; letter-spacing: .04em; margin-bottom: 12px; color: var(--text-strong); }
.prose .md-refs-list { list-style: none; margin: 0; padding: 0; font-size: 13.8px; }
.prose .md-ref-item {
  display: flex; gap: 8px; align-items: baseline; padding: 7px 8px;
  border-radius: 8px; color: var(--text-muted); line-height: 1.68; scroll-margin-top: calc(var(--header-h) + 20px);
}
.prose .md-ref-item:target, .prose .md-ref-item:target { background: var(--accent-soft); }
.prose .md-ref-num { font-family: var(--font-mono); color: var(--accent); font-weight: 600; flex: none; }
.prose .md-ref-body { flex: 1; word-break: break-word; }
.prose .md-ref-back { flex: none; font-size: 12px; color: var(--text-faint); }
.prose .md-ref-back:hover { color: var(--accent); }

/* 正文里的链接 */
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose .md-anchor, .prose .md-fnref a, .prose .md-ref-back { text-decoration: none; }

/* ---------- 关于我 ---------- */
.about-hero { padding: 52px 0 30px; background: linear-gradient(180deg, var(--bg-soft), var(--bg)); border-bottom: 1px solid var(--border); }
.about-hero-inner { display: flex; align-items: center; gap: 30px; flex-wrap: wrap; }
.about-avatar {
  width: 132px; height: 132px; border-radius: 26px; overflow: hidden; flex: none;
  border: 1px solid var(--border); box-shadow: var(--shadow-md); background: var(--accent-soft);
}
.about-avatar img { width: 100%; height: 100%; object-fit: cover; }
.about-name { font-family: var(--font-serif); font-size: 33px; margin-bottom: 6px; }
.about-role { color: var(--accent); font-weight: 600; font-size: 15px; }
.about-sub { color: var(--text-muted); font-size: 14.5px; margin-top: 8px; }
.about-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm);
}
.card-title {
  display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700;
  color: var(--text-strong); margin-bottom: 14px;
}
.card-title svg { width: 17px; height: 17px; color: var(--accent); flex: none; }
.card p { margin: 0 0 10px; color: var(--text-muted); font-size: 14.5px; }
.card p:last-child { margin-bottom: 0; }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); border-radius: 2px; }
.tl-item { position: relative; padding-bottom: 22px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -25px; top: 6px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--bg); border: 2.5px solid var(--accent);
}
.tl-item.is-now::before { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-period { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); font-weight: 600; }
.tl-title { font-size: 15.5px; font-weight: 700; color: var(--text-strong); margin: 3px 0 4px; }
.tl-desc { font-size: 14px; color: var(--text-muted); }

.skill-row { margin-bottom: 14px; }
.skill-head { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; color: var(--text-muted); }
.skill-bar { height: 7px; border-radius: 4px; background: var(--bg-sunken); overflow: hidden; }
.skill-bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.plain-list { margin: 0; padding-left: 1.15em; color: var(--text-muted); font-size: 14.5px; }
.plain-list li { margin: .38em 0; }
.plain-list strong { color: var(--text-strong); }

.contact-list { display: flex; flex-direction: column; gap: 10px; }
.contact-item { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--text-muted); }
.contact-item svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.contact-item a { word-break: break-all; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field-label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field-hint { font-size: 12.5px; color: var(--text-faint); margin-top: 5px; }
.input, .textarea, .select {
  width: 100%; padding: 10px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-elevated);
  outline: none; transition: border-color .16s ease, box-shadow .16s ease;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.7; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- 编辑器 ---------- */
.editor-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.editor-tab {
  padding: 10px 16px; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-weight: 600; font-size: 14.5px; white-space: nowrap; transition: all .16s ease;
}
.editor-tab:hover { color: var(--text-strong); }
.editor-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.editor-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 22px; align-items: start; }
.editor-side .card { position: sticky; top: calc(var(--header-h) + 20px); }

.md-toolbar {
  display: flex; flex-wrap: wrap; gap: 3px; padding: 7px 8px;
  background: var(--bg-soft); border: 1px solid var(--border); border-bottom: 0;
  border-radius: 10px 10px 0 0;
}
.md-toolbar button {
  min-width: 32px; height: 30px; padding: 0 8px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-muted); font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; transition: all .14s ease;
}
.md-toolbar button:hover { background: var(--bg-elevated); color: var(--accent); box-shadow: var(--shadow-sm); }
.md-toolbar .sep { width: 1px; background: var(--border); margin: 5px 5px; }

.md-editor {
  width: 100%; min-height: 520px; padding: 16px 18px; resize: vertical;
  border: 1px solid var(--border); border-radius: 0 0 10px 10px;
  background: var(--bg-elevated); font-family: var(--font-mono); font-size: 13.8px;
  line-height: 1.78; outline: none; tab-size: 2;
}
.md-editor:focus { border-color: var(--accent); }

.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.preview-pane {
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elevated);
  padding: 6px 22px 22px; max-height: 700px; overflow-y: auto;
}
.preview-pane .prose { font-size: 15.5px; }
.preview-pane .md-h2::before { top: .22em; height: 1em; }

.editor-status {
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-faint);
  padding: 8px 2px;
}
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 16px;
  text-align: center; color: var(--text-faint); font-size: 13.5px; background: var(--bg-soft);
  transition: all .16s ease; cursor: pointer;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }

.cover-preview { margin-top: 10px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }

/* 文章管理列表 */
.manage-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-elevated); }
.manage-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.manage-row:last-child { border-bottom: 0; }
.manage-row:hover { background: var(--bg-soft); }
.manage-thumb {
  width: 54px; height: 40px; border-radius: 7px; overflow: hidden; flex: none;
  background: var(--bg-sunken); border: 1px solid var(--border);
}
.manage-thumb img { width: 100%; height: 100%; object-fit: cover; }
.manage-info { flex: 1; min-width: 0; }
.manage-title { font-size: 14.8px; font-weight: 600; color: var(--text-strong); margin-bottom: 3px; }
.manage-sub { font-size: 12.5px; color: var(--text-faint); display: flex; gap: 10px; flex-wrap: wrap; }
.manage-actions { display: flex; gap: 6px; flex: none; }
.badge {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px; font-weight: 600;
  background: var(--bg-sunken); color: var(--text-muted);
}
.badge-live { background: var(--accent-soft); color: var(--accent-strong); }
.badge-draft { background: #fdf1d8; color: #9a6a06; }
[data-theme="dark"] .badge-draft { background: #3a2f11; color: #e0b558; }

.cat-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.cat-row:last-child { border-bottom: 0; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cat-name { font-weight: 600; font-size: 14.5px; }
.cat-desc { font-size: 12.8px; color: var(--text-faint); }
.cat-count { margin-left: auto; font-size: 12.5px; color: var(--text-faint); }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border); background: var(--bg-soft);
  padding: 34px 0 30px; margin-top: 50px; font-size: 13.5px; color: var(--text-faint);
}
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }
.storage-note { font-size: 12px; color: var(--text-faint); opacity: .85; }
/* 备案号：首页底部居中，链接到工信部备案系统（合规要求） */
.footer-legal { margin-top: 12px; font-size: 12px; text-align: center; }
.footer-legal a { color: var(--text-faint); }
.footer-legal a:hover { color: var(--accent); }

/* ---------- Toast ---------- */
.toast-host {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--text-strong); color: var(--bg); padding: 10px 18px;
  border-radius: 999px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toast-in .24s ease; max-width: 84vw; text-align: center;
}
.toast.is-warn { background: #9a6a06; color: #fff; }
.toast.is-error { background: #b3261e; color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 运行状态条 ---------- */
.status-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 18px; margin-bottom: 20px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elevated); box-shadow: var(--shadow-sm);
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--text-faint); }
.status-dot.is-cloud { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.status-dot.is-local { background: #d9a406; box-shadow: 0 0 0 3px #fdf1d8; }
.status-dot.is-temp { background: #c0392b; box-shadow: 0 0 0 3px #fbe3e1; }
.status-text { font-size: 13.8px; color: var(--text-muted); }
.status-text strong { color: var(--text-strong); }
.status-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 加载态 ---------- */
.skeleton { border-radius: var(--radius); background: var(--bg-soft); height: 210px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; gap: 28px; }
  .hero-stats { max-width: 460px; }
  .article-layout { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-side .card { position: static; }
  .editor-split { grid-template-columns: 1fr; }
  .preview-pane { max-height: none; }
}

@media (max-width: 760px) {
  :root { --header-h: 58px; }
  .site-nav {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px; padding: 12px 14px 18px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md); display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 11px 14px; font-size: 15.5px; }
  .nav-toggle { display: grid; margin-left: auto; }
  .nav-actions { margin-left: 0; }
  .hero { padding: 34px 0 22px; }
  .hero h1 { font-size: 30px; }
  .hero-top { gap: 14px; }
  .hero-avatar { width: 68px; height: 68px; }
  .hero-tagline { font-size: 15.5px; }
  .article-title { font-size: 25px; }
  .article-header { padding: 28px 0 20px; }
  .prose { font-size: 16.5px; line-height: 1.85; }
  .prose .md-h2 { font-size: 21px; }
  .prose .md-h3 { font-size: 18px; }
  .prose .md-anchor { display: none; }
  .post-grid { grid-template-columns: 1fr; }
  .about-name { font-size: 27px; }
  .about-avatar { width: 96px; height: 96px; border-radius: 20px; }
  .field-row { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .archive-item { flex-wrap: wrap; gap: 8px; }
  .archive-cat { margin-left: 0; }
  .manage-row { flex-wrap: wrap; }
}

@media print {
  .site-header, .site-footer, .toc, .article-footer, .toolbar { display: none !important; }
  .article-layout { display: block; }
  body { background: #fff; }
}
