/* ==========================================================================
   林间随笔 — 样式表
   1. 变量与重置  2. 布局骨架  3. 头部导航  4. 首页  5. 文章列表
   6. 文章详情    7. 关于页    8. 页脚    9. 响应式   10. 动效
   ========================================================================== */

/* ---------- 1. 变量与重置 ---------- */
:root {
  --bg: #faf8f4;
  --bg-elevated: #ffffff;
  --bg-subtle: #f2eee7;
  --text: #22201c;
  --text-soft: #5f5a53;
  --text-faint: #918a80;
  --line: #e5dfd5;
  --line-strong: #d3cabc;
  --accent: #a4502b;
  --accent-soft: #f0e3da;
  --shadow-sm: 0 1px 2px rgba(34, 32, 28, .05);
  --shadow-md: 0 4px 16px -6px rgba(34, 32, 28, .12);
  --radius: 10px;
  --radius-lg: 16px;
  --maxw: 720px;
  --maxw-wide: 1080px;

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

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171512;
    --bg-elevated: #1f1c18;
    --bg-subtle: #221f1b;
    --text: #ece7df;
    --text-soft: #a8a197;
    --text-faint: #7b746a;
    --line: #2e2a25;
    --line-strong: #3d3832;
    --accent: #d98a5c;
    --accent-soft: #33241b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 4px 18px -6px rgba(0, 0, 0, .5);
  }
}

:root[data-theme="dark"] {
  --bg: #171512;
  --bg-elevated: #1f1c18;
  --bg-subtle: #221f1b;
  --text: #ece7df;
  --text-soft: #a8a197;
  --text-faint: #7b746a;
  --line: #2e2a25;
  --line-strong: #3d3832;
  --accent: #d98a5c;
  --accent-soft: #33241b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 18px -6px rgba(0, 0, 0, .5);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--accent-soft); color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- 2. 布局骨架 ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}
.wrap--wide { max-width: var(--maxw-wide); }

main { padding-bottom: 96px; min-height: 60vh; }

/* ---------- 3. 头部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.site-header.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 66px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .01em;
  margin-right: auto;
  white-space: nowrap;
}
.brand__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex: none;
  transform: translateY(-2px);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav__link {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--text-soft);
  transition: color .18s ease, background-color .18s ease;
}
.nav__link:hover { color: var(--text); background: var(--bg-subtle); }
.nav__link.is-active { color: var(--text); font-weight: 600; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  transition: background-color .18s ease, color .18s ease;
}
.icon-btn:hover { background: var(--bg-subtle); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

/* 阅读进度条 */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 60;
  transition: width .08s linear;
}

/* ---------- 4. 首页 ---------- */
.hero {
  padding: 72px 0 56px;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 20px;
}
.hero__eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--line-strong);
}
.hero__title {
  font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.28;
  letter-spacing: -.015em;
  margin: 0 0 18px;
  font-weight: 700;
  text-wrap: balance;
}
.hero__desc {
  font-size: 17px;
  color: var(--text-soft);
  max-width: 54ch;
  margin: 0 0 32px;
  text-wrap: pretty;
}
.hero__desc em {
  font-style: normal;
  color: var(--text);
  border-bottom: 1.5px solid var(--accent-soft);
  padding-bottom: 1px;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-item__num {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
}
.meta-item__label {
  font-size: 12.5px;
  color: var(--text-faint);
  letter-spacing: .04em;
}

/* ---------- 5. 文章列表 ---------- */
.list-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 0 4px;
}
.section-label {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after {
  content: "";
  width: 28px; height: 1px;
  background: var(--line-strong);
}

.search {
  position: relative;
  margin-left: auto;
  width: 210px;
  max-width: 100%;
}
.search__input {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.search__input::placeholder { color: var(--text-faint); }
.search__input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search__icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 18px 0 4px;
}
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  border-radius: 999px;
  padding: 4px 13px;
  font-size: 13px;
  transition: all .18s ease;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.is-active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.post-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.post-item {
  border-bottom: 1px solid var(--line);
}
.post-item:last-child { border-bottom: 0; }

.post-card {
  display: block;
  padding: 30px 12px 30px 16px;
  margin: 0 -16px;
  border-radius: var(--radius);
  position: relative;
  transition: background-color .2s ease, transform .2s ease;
}
.post-card::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 3px; height: 0;
  background: var(--accent);
  border-radius: 2px;
  transform: translateY(-50%);
  transition: height .25s cubic-bezier(.4,0,.2,1);
}
.post-card:hover { background: var(--bg-subtle); }
.post-card:hover::before { height: 42px; }

.post-card__top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 12.5px;
  color: var(--text-faint);
  letter-spacing: .02em;
}
.post-card__date { font-variant-numeric: tabular-nums; }
.post-card__sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

.post-card__title {
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 1.45;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -.008em;
  transition: color .18s ease;
  text-wrap: balance;
}
.post-card:hover .post-card__title { color: var(--accent); }

.post-card__excerpt {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-soft);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.tag {
  font-size: 11.5px;
  letter-spacing: .03em;
  color: var(--text-faint);
  background: var(--bg-subtle);
  border-radius: 4px;
  padding: 2px 7px;
}
.post-card:hover .tag { background: var(--bg-elevated); }

.empty {
  padding: 72px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 15px;
}
.empty__mark {
  font-family: var(--font-serif);
  font-size: 34px;
  color: var(--line-strong);
  display: block;
  margin-bottom: 12px;
}

/* ---------- 6. 文章详情 ---------- */
.article { padding-top: 52px; }

.article__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-faint);
  margin-bottom: 34px;
  transition: color .18s ease, gap .18s ease;
}
.article__back:hover { color: var(--accent); gap: 10px; }
.article__back svg { width: 14px; height: 14px; }

.article__header { margin-bottom: 40px; }

.article__title {
  font-family: var(--font-serif);
  font-size: clamp(26px, 4.4vw, 36px);
  line-height: 1.34;
  font-weight: 700;
  letter-spacing: -.015em;
  margin: 0 0 20px;
  text-wrap: balance;
}
.article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-faint);
}
.article__meta .tag { background: var(--accent-soft); color: var(--accent); }
.article__rule {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0 0 48px;
}

/* 正文排版 */
.prose {
  font-size: 17px;
  line-height: 1.92;
  color: var(--text);
}
.prose > * + * { margin-top: 1.35em; }
.prose p { margin: 0; text-wrap: pretty; }

.prose h2 {
  font-family: var(--font-serif);
  font-size: 23px;
  line-height: 1.45;
  font-weight: 700;
  margin-top: 2.4em;
  margin-bottom: .7em;
  letter-spacing: -.008em;
  position: relative;
  padding-left: 18px;
}
.prose h2::before {
  content: "";
  position: absolute;
  left: 0; top: .42em;
  width: 4px; height: .82em;
  background: var(--accent);
  border-radius: 2px;
}

.prose ul, .prose ol {
  margin: 0;
  padding-left: 1.4em;
}
.prose li { margin-bottom: .55em; }
.prose li::marker { color: var(--text-faint); }

.prose blockquote {
  margin: 1.8em 0;
  padding: 4px 0 4px 22px;
  border-left: 2.5px solid var(--accent);
  color: var(--text-soft);
  font-family: var(--font-serif);
  font-size: 17.5px;
  line-height: 1.8;
}
.prose blockquote p { margin: 0; }

.prose code {
  font-family: var(--font-mono);
  font-size: .855em;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .12em .38em;
}
.prose pre {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.75;
  margin: 1.8em 0;
}
.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}
.prose strong { font-weight: 700; }
.prose em { font-style: italic; }
.prose a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color .18s ease;
}
.prose a:hover { border-bottom-color: var(--accent); }
.prose hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 2.5em 0;
}

/* 上下篇 */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.pager__item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}
.pager__item:hover {
  border-color: var(--line-strong);
  background: var(--bg-subtle);
  transform: translateY(-1px);
}
.pager__item--next { text-align: right; }
.pager__label {
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: .05em;
}
.pager__title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pager__item.is-empty {
  border: 1px dashed var(--line);
  color: var(--text-faint);
  pointer-events: none;
  justify-content: center;
}
.pager__item.is-empty .pager__title {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13.5px;
}

/* ---------- 7. 关于页 ---------- */
.about { padding-top: 64px; }

.about__intro {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 40px;
}
.avatar {
  width: 76px; height: 76px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--bg);
  background: linear-gradient(145deg, var(--accent), #6d3a22);
  box-shadow: var(--shadow-md);
  user-select: none;
}
.about__name {
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -.01em;
}
.about__role {
  font-size: 14.5px;
  color: var(--text-soft);
  margin: 0;
}

/* ---------- 8. 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 34px 0 44px;
}
.footer__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-faint);
}
.footer__links {
  display: flex;
  gap: 18px;
  margin-left: auto;
}
.footer__links a { transition: color .18s ease; }
.footer__links a:hover { color: var(--accent); }

/* ---------- 9. 响应式 ---------- */
@media (max-width: 720px) {
  .wrap { padding: 0 20px; }
  .hero { padding: 44px 0 36px; }
  .hero__desc { font-size: 16px; }
  .list-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .search { margin-left: 0; width: 100%; }
  .post-card { padding: 26px 12px 26px 14px; margin: 0 -12px; }
  .post-card__title { font-size: 19px; }
  .article { padding-top: 32px; }
  .prose { font-size: 16.5px; line-height: 1.88; }
  .pager { grid-template-columns: 1fr; margin-top: 52px; }
  .about { padding-top: 40px; }
  .about__intro { flex-direction: column; align-items: flex-start; gap: 16px; }
  .nav__links .nav__link { padding: 6px 8px; font-size: 14px; }
  .footer__links { margin-left: 0; }
}

@media (max-width: 420px) {
  .brand { font-size: 17px; }
  .nav__links .nav__link:first-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 10. 动效 ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal {
  opacity: 0;
  transform: translateY(10px);
}
.reveal.is-in {
  animation: fadeUp .5s cubic-bezier(.22,.61,.36,1) forwards;
}
