/* =========================================================
   老僧博客 · 全站样式
   配色：纸白 + 墨绿，安静克制的个人博客基调
   ========================================================= */

:root {
  --bg: #f3f4f0;
  --surface: #ffffff;
  --ink: #2f2e2a;
  --ink-soft: #55544d;
  --muted: #8b897f;
  --line: #e5e4dc;
  --accent: #3f6b4e;
  --accent-deep: #2c4f3a;
  --accent-weak: #eef2ea;
  --code-bg: #f7f8f5;
  --radius: 6px;
  --serif: "Kaiti SC", "STKaiti", "KaiTi", "FangSong", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 顶部导航 ---------- */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-name {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 2px;
}
.brand-name:hover { color: var(--accent-deep); }
.brand-slogan {
  font-size: 13px;
  color: var(--muted);
}
.nav { display: flex; gap: 4px; }
.nav a {
  display: block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-soft);
}
.nav a:hover { color: var(--accent-deep); background: var(--accent-weak); }
.nav a.active {
  color: #fff;
  background: var(--accent);
}
.nav a:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 站点横幅 ---------- */
.banner {
  background:
    radial-gradient(1200px 300px at 20% -40px, rgba(63,107,78,.10), transparent 60%),
    var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 34px 0 30px;
}
.banner-inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.banner h1 {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--ink);
}
.banner p.tagline {
  margin-top: 8px;
  font-size: 15px;
  color: var(--ink-soft);
}
.banner .banner-actions { display: flex; gap: 10px; }
.btn {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 14px;
  color: var(--accent-deep);
  background: transparent;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.btn:hover { background: var(--accent); color: #fff; }
.btn.btn-primary { background: var(--accent); color: #fff; }
.btn.btn-primary:hover { background: var(--accent-deep); }

/* ---------- 主体两栏布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
  padding-top: 26px;
  padding-bottom: 40px;
}

.main { min-width: 0; }

/* ---------- 首页文章列表（时间线式） ---------- */
.section-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 26px;
}
.post-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 22px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.post-item:first-child { padding-top: 6px; }
.post-item:last-child { border-bottom: none; padding-bottom: 4px; }
.post-date {
  font-size: 13px;
  color: var(--muted);
  padding-top: 4px;
  text-align: right;
}
.post-date .y { display: block; font-size: 18px; color: var(--ink-soft); font-weight: 600; }
.post-body-main { min-width: 0; }
.post-title {
  font-size: 19px;
  line-height: 1.5;
  font-weight: 600;
}
.post-title a { color: var(--ink); }
.post-title a:hover { color: var(--accent); }
.post-excerpt {
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-tags { margin-top: 10px; font-size: 13px; color: var(--muted); }
.post-tags a, .post-tags span { margin-right: 12px; color: var(--muted); }
.post-tags a:hover { color: var(--accent); }

/* ---------- 侧栏 ---------- */
.sidebar { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.widget {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.widget h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}
.widget-about { text-align: center; }
.avatar {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--serif);
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px auto 10px;
  letter-spacing: 0;
}
.widget-about .name { font-size: 16px; font-weight: 600; }
.widget-about .desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  text-align: left;
}
.widget-about .more {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--accent-deep);
  border-bottom: 1px dashed var(--accent);
}
.widget ul.recent { list-style: none; }
.widget ul.recent li {
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.widget ul.recent li:last-child { border-bottom: none; }
.widget ul.recent a { color: var(--ink-soft); }
.widget ul.recent a:hover { color: var(--accent-deep); }
.widget ul.recent time {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}
.cat-list { list-style: none; }
.cat-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: var(--ink-soft);
  border-bottom: 1px dashed var(--line);
}
.cat-list li:last-child { border-bottom: none; }
.cat-list .count {
  background: var(--accent-weak);
  color: var(--accent-deep);
  border-radius: 999px;
  font-size: 12px;
  padding: 0 8px;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  text-align: center;
}
.stat-grid .num { display: block; font-size: 20px; font-weight: 600; color: var(--accent-deep); }
.stat-grid .label { font-size: 12px; color: var(--muted); }
.widget form.search { display: flex; gap: 6px; }
.widget form.search input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
}
.widget form.search input:focus { border-color: var(--accent); }

/* ---------- 文章正文页 ---------- */
.post-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 26px 20px 50px;
}
.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 44px 28px;
}
.post-head { margin-bottom: 22px; }
.post-head h1 {
  font-size: 26px;
  line-height: 1.5;
  font-weight: 600;
}
.post-meta {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}
.post-meta a { color: var(--accent-deep); }
.post-meta .sep { margin: 0 6px; color: var(--line); }
.post-body {
  font-size: 16px;
  line-height: 2;
  color: #3a3934;
  word-break: break-word;
}
.post-body p { margin: 0 0 1.1em; }
.post-body h2 {
  font-size: 20px;
  margin: 1.8em 0 .8em;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
  line-height: 1.4;
}
.post-body h3 { font-size: 17px; margin: 1.6em 0 .7em; }
.post-body strong { color: var(--ink); }
.post-body blockquote {
  margin: 1.4em 0;
  padding: 10px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-weak);
  color: var(--ink-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 1.2em 0;
  font-size: 13px;
  line-height: 1.7;
}
.post-body code {
  font-family: Consolas, "Courier New", monospace;
  font-size: .92em;
  background: var(--accent-weak);
  color: var(--accent-deep);
  padding: 2px 6px;
  border-radius: 4px;
}
.post-body pre code { background: none; color: inherit; padding: 0; }
.post-body ul, .post-body ol { margin: 0 0 1.2em 1.6em; }
.post-body img { max-width: 100%; border-radius: var(--radius); }
.post-copyright {
  margin-top: 30px;
  padding: 12px 16px;
  background: var(--code-bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--muted);
}

/* 上一篇/下一篇 */
.post-pager {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
}
.post-pager .pager-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 18px;
  flex: 1;
  min-width: 0;
}
.post-pager .dir { font-size: 12px; color: var(--muted); display: block; }
.post-pager .t {
  font-size: 14px;
  color: var(--ink-soft);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-pager a:hover .t { color: var(--accent-deep); }
.post-pager .empty .t { color: var(--line); }

/* ---------- 评论区（静态展示） ---------- */
.comments {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-top: 18px;
}
.comments h2 { font-size: 17px; font-weight: 600; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.comment-item { padding: 16px 0; border-bottom: 1px dashed var(--line); }
.comment-item:last-child { border-bottom: none; }
.comment-item .c-head { display: flex; align-items: baseline; gap: 10px; }
.comment-item .c-name { font-weight: 600; font-size: 14px; color: var(--accent-deep); }
.comment-item .c-time { font-size: 12px; color: var(--muted); }
.comment-item .c-body { font-size: 14px; margin-top: 6px; color: var(--ink-soft); }
.comments form { margin-top: 12px; }
.comments .form-row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.comments input[type="text"], .comments textarea {
  font-family: var(--sans);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  color: var(--ink);
  background: var(--surface);
}
.comments input[type="text"] { width: 180px; }
.comments textarea { width: 100%; min-height: 90px; resize: vertical; }
.comments input:focus, .comments textarea:focus { border-color: var(--accent); }
.comments .btn { border-radius: var(--radius); }

/* ---------- 归档 / 关于页 ---------- */
.page-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 26px 20px 50px;
}
.page {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 44px;
}
.page h1 { font-size: 24px; margin-bottom: 8px; }
.page .lead { color: var(--muted); font-size: 14px; margin-bottom: 26px; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.archive-year { margin: 8px 0 4px; }
.archive-year h2 {
  font-size: 18px;
  color: var(--accent-deep);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
}
.archive-year h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.archive-year ul { list-style: none; margin-top: 6px; }
.archive-year ul li {
  display: flex;
  gap: 18px;
  align-items: baseline;
  padding: 9px 2px;
  border-bottom: 1px dashed var(--line);
  font-size: 15px;
}
.archive-year ul li time { color: var(--muted); font-size: 13px; min-width: 84px; }
.archive-year ul li a { color: var(--ink); flex: 1; }
.archive-year ul li a:hover { color: var(--accent-deep); }

.about-body { font-size: 15px; line-height: 2; color: #3a3934; }
.about-body h2 {
  font-size: 18px;
  margin: 1.6em 0 .6em;
  color: var(--accent-deep);
}
.about-body p { margin-bottom: 1em; }
.about-body .avatar { width: 84px; height: 84px; font-size: 36px; }
.about-center { text-align: center; }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 22px 0 26px;
  font-size: 13px;
  color: var(--muted);
}
.footer p { line-height: 1.9; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent-deep); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .post-date { text-align: left; }
  .post-item { grid-template-columns: 1fr; gap: 6px; }
  .post-date .y { display: inline; font-size: 13px; margin-right: 6px; }
  .post { padding: 24px 20px; }
  .page { padding: 24px 20px; }
  .header-inner { padding-top: 12px; padding-bottom: 12px; }
  .brand-slogan { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
