:root {
  --paper: oklch(0.985 0.004 95);
  --bg: oklch(0.97 0.006 95);
  --card: #ffffff;
  --text: oklch(0.27 0.012 80);
  --ink-soft: oklch(0.45 0.012 85);
  --muted: oklch(0.62 0.01 85);
  --line: oklch(0.92 0.006 90);
  --brand: oklch(0.50 0.11 168);
  --brand-soft: oklch(0.96 0.025 168);
  --hot: oklch(0.56 0.15 292);
  --danger: oklch(0.52 0.05 250);
  --shadow: 0 1px 2px rgba(20,30,28,.04), 0 12px 32px rgba(20,30,28,.06);
  --serif: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 16px;
  --maxw: 720px;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); line-height: 1.75; font-size: 16px;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; width: 100%; max-width: 1080px; margin: 0 auto;
  background: color-mix(in oklch, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: .5px; cursor: pointer; }
.brand .logo { width: 30px; height: 30px; color: var(--brand); display: inline-flex; }
.brand .logo svg { width: 100%; height: 100%; }
.topbar .links a { margin-left: 18px; color: var(--ink-soft); font-size: 14px; }

/* 首页 hero */
.hero { text-align: center; padding: 72px 20px 44px; border-bottom: 1px solid var(--line); }
.hero h1 { font-family: var(--serif); font-size: 42px; line-height: 1.2; margin: 0; letter-spacing: 1px; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px 100px; }

/* 文章卡片 */
.post-list { margin-top: 40px; display: grid; gap: 22px; }
.post-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 30px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(20,30,28,.09); }
.post-card h2 { font-family: var(--serif); font-size: 23px; margin: 0 0 10px; line-height: 1.4; }
.post-card .meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.post-card .excerpt { color: var(--ink-soft); margin-top: 12px; font-size: 15px; }

/* 标签 */
.tag { display: inline-block; font-size: 12px; padding: 3px 11px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); margin: 3px 6px 3px 0; }
.tag.filter { cursor: pointer; transition: .15s; }
.tag.filter:hover { background: oklch(0.92 0.04 168); }
.tag.filter.active { background: var(--brand); color: #fff; }
.filters { margin: 34px 0 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filters .lbl { color: var(--muted); font-size: 13px; margin-right: 4px; }

/* 阅读页 */
.reader-grid {
  max-width: 1040px; margin: 0 auto; padding: 48px 20px 120px;
  display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 52px; align-items: start;
}
.reader-main { max-width: 700px; min-width: 0; }
.reader-main h1 { font-family: var(--serif); font-size: 34px; line-height: 1.3; margin: 0 0 12px; }
.reader-main .meta { color: var(--muted); font-size: 13px; margin-bottom: 30px; }

.article-body { font-size: 17px; line-height: 1.95; color: oklch(0.32 0.01 80); }
.article-body img { max-width: 100%; border-radius: 10px; margin: 20px 0; }
.article-body h1, .article-body h2, .article-body h3 { font-family: var(--serif); line-height: 1.4; margin: 1.7em 0 .6em; scroll-margin-top: 88px; }
.article-body h2 { font-size: 25px; }
.article-body h3 { font-size: 20px; }
.article-body p { margin: 1.1em 0; }
.article-body blockquote { margin: 1.5em 0; padding: 12px 18px; border-left: 4px solid var(--brand); background: var(--brand-soft); color: oklch(0.42 0.04 168); border-radius: 0 10px 10px 0; font-style: italic; }
.article-body pre { background: oklch(0.22 0.01 80); color: oklch(0.96 0 0); padding: 16px; border-radius: 10px; overflow: auto; font-size: 14px; }
.article-body code { background: oklch(0.95 0.005 90); padding: 2px 6px; border-radius: 5px; font-size: .9em; }
.article-body a { text-decoration: underline; }

/* 右侧目录 */
.toc { position: sticky; top: 88px; align-self: start; border-left: 1px solid var(--line); padding-left: 18px; max-height: calc(100vh - 120px); overflow: auto; }
.toc-title { font-size: 12px; letter-spacing: 2px; color: var(--muted); margin-bottom: 10px; font-weight: 600; }
#toc-nav a { display: block; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); padding: 5px 0 5px 10px; margin-left: -1px; border-left: 2px solid transparent; transition: .15s; }
#toc-nav a.lvl-h3 { padding-left: 24px; font-size: 13px; }
#toc-nav a:hover { color: var(--brand); text-decoration: none; }
#toc-nav a.active { color: var(--brand); font-weight: 600; border-left-color: var(--brand); }

/* 顶部导航 */
.nav { display: flex; gap: 4px; }
.nav a { font-size: 15px; color: var(--ink-soft); padding: 7px 14px; border-radius: 9px; transition: .15s; }
.nav a:hover { color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.nav a.active { color: var(--brand); font-weight: 600; }

/* 首页时间线 */
.view-title { font-family: var(--serif); font-size: 26px; margin: 6px 0 24px; }
.timeline-month { display: flex; align-items: center; gap: 12px; margin: 32px 0 16px; color: var(--muted); font-size: 13px; }
.timeline-month::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.timeline-month span { letter-spacing: 1px; }

/* 标签页 */
.tag-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
.tag.stat { cursor: pointer; font-size: 13px; }
.tag.stat:hover { background: oklch(0.92 0.04 168); }
.tag.stat b { color: var(--text); font-weight: 700; margin-left: 4px; }
.tag-group { margin-bottom: 26px; }
.tag-group h3 { font-family: var(--serif); font-size: 18px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.tag-group h3 .count { font-size: 12px; color: var(--muted); font-family: var(--sans); font-weight: 400; }
.tag-item { display: flex; justify-content: space-between; gap: 16px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; background: #fff; transition: .15s; }
.tag-item:hover { border-color: var(--brand); }
.tag-item span { color: var(--text); }
.tag-item em { font-style: normal; color: var(--muted); font-size: 13px; }

/* 关于我 */
.about { display: flex; justify-content: center; }
.about-card { text-align: center; padding: 48px 20px; }
.avatar { width: 128px; height: 128px; border-radius: 50%; background: var(--brand-soft); padding: 24px; color: var(--brand); box-shadow: var(--shadow); }
.about-card h1 { font-family: var(--serif); font-size: 30px; margin: 24px 0 10px; }
.about-intro { color: var(--ink-soft); font-size: 17px; margin: 0; }

/* 阅读态：顶栏显示返回 */
.reader-back { display: none; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--ink-soft); padding: 9px 18px; border: 1px solid var(--line); border-radius: 999px; background: #fff; box-shadow: var(--shadow); transition: .15s; }
.reader-back:hover { color: var(--brand); border-color: var(--brand); text-decoration: none; }
body.reading .nav { display: none; }
body.reading #reader-back { display: inline-flex; }

/* 页脚：访问人数 */
.site-foot { margin-top: auto; text-align: center; padding: 44px 20px 40px; color: var(--muted); font-size: 13px; letter-spacing: .5px; }

/* 通用按钮 / 表单 */
.btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 9px 16px; border-radius: 10px; font-size: 14px; transition: .15s; font-family: var(--sans); }
.btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { opacity: .92; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-soft); padding-left: 0; }
.btn.ghost:hover { color: var(--brand); }
.btn.sm { padding: 5px 11px; font-size: 13px; }
input[type=text], textarea, select { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff; color: var(--text); transition: border-color .15s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 5px; }

.hidden { display: none !important; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 14px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(10px); background: oklch(0.24 0.012 80); color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .22s; z-index: 60; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 窄屏：隐藏目录，单列 */
@media (max-width: 980px) {
  .reader-grid { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .hero h1 { font-size: 34px; }
  .nav a { padding: 6px 10px; font-size: 14px; }
  .brand { font-size: 18px; }
}
