/* ==========================================================================
   分享个人生活 · 个人网站样式
   设计：纸张底色 + 墨绿主色 + 衬线标题，支持深色模式
   ========================================================================== */

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

html { scroll-behavior: smooth; }

:root {
  --bg: #f7f5ef;
  --surface: #fffdf8;
  --surface-2: #efede4;
  --ink: #1d2420;
  --muted: #5e6a62;
  --line: #e2ded2;
  --accent: #2f6b4f;
  --accent-strong: #245640;
  --accent-soft: #e8f0ea;
  --clay: #b26a45;
  --shadow-sm: 0 1px 2px rgba(29, 36, 32, .06);
  --shadow-md: 0 14px 34px rgba(29, 36, 32, .1);
  --radius: 18px;
  --radius-sm: 12px;
  --maxw: 1120px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Noto Serif SC", serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

html[data-theme="dark"] {
  --bg: #131614;
  --surface: #1a1e1b;
  --surface-2: #232823;
  --ink: #e9ede8;
  --muted: #9aa79e;
  --line: #2c332e;
  --accent: #7fb896;
  --accent-strong: #a2cfb3;
  --accent-soft: #22302a;
  --clay: #d39a76;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, .5);
}

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

img, svg { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .18em; }

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

.container {
  width: min(var(--maxw), 100% - 48px);
  margin-inline: auto;
}

@media (max-width: 640px) {
  .container { width: calc(100% - 36px); }
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------- 顶部导航 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}
.brand small {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .22em;
  color: var(--muted);
  text-transform: uppercase;
  line-height: 1.4;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--muted);
  transition: background .18s ease, color .18s ease;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav a.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 600;
}

.header-tools { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, transform .18s ease;
}
.theme-toggle:hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-1px); }
.theme-toggle svg { width: 17px; height: 17px; }

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 860px) {
  .nav {
    position: fixed;
    inset: 69px 0 auto 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 16px 24px 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px 14px; border-radius: 12px; font-size: 16px; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .brand small { display: none; }
}

/* ---------- 首屏 ---------- */

.hero {
  position: relative;
  padding: 92px 0 64px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 420px at 82% -10%, var(--accent-soft), transparent 62%),
    radial-gradient(640px 360px at -6% 110%, color-mix(in srgb, var(--clay) 9%, transparent), transparent 60%);
  overflow: hidden;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--accent-strong);
}
.kicker::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  margin: .32em 0 .34em;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5.4vw, 4.2rem);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -.015em;
}

.hero .lead {
  max-width: 58ch;
  margin: 0;
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 26%, transparent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  margin-top: 48px;
  padding-top: 26px;
  border-top: 1px dashed var(--line);
}
.hero-meta div { display: flex; flex-direction: column; gap: 2px; }
.hero-meta strong {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}
.hero-meta span { font-size: 13px; color: var(--muted); letter-spacing: .04em; }

/* ---------- 通用区块 ---------- */

.section { padding: 68px 0; }
.section + .section { padding-top: 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 2.8vw, 2.05rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
}
.section-head p { margin: 8px 0 0; color: var(--muted); font-size: .95rem; }
.link-more { font-size: 14px; white-space: nowrap; }

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 920px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .section { padding: 52px 0; }
  .hero { padding: 64px 0 48px; }
}

/* ---------- 卡片 ---------- */

.post-card, .work-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.post-card:hover, .work-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
}

.chip {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
}

.post-card h3, .work-card h3 {
  margin: 15px 0 9px;
  font-family: var(--serif);
  font-size: 1.24rem;
  font-weight: 600;
  line-height: 1.42;
}
.post-card h3 a, .work-card h3 a { color: var(--ink); }
.post-card h3 a:hover, .work-card h3 a:hover { color: var(--accent-strong); text-decoration: none; }

.post-card p, .work-card p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.8;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: .82rem;
}

.work-card .work-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: .82rem;
  color: var(--muted);
}

/* ---------- 关于站点小卡 ---------- */

.note {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 28px;
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.note h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
}
.note p { margin: 0 0 10px; color: var(--muted); font-size: .95rem; }
.note .tags { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.tag {
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
}
@media (max-width: 760px) {
  .note { grid-template-columns: 1fr; padding: 26px; }
}

/* ---------- 文章列表页 ---------- */

.page-head {
  padding: 64px 0 36px;
  border-bottom: 1px solid var(--line);
}
.page-head h1 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.9rem);
  font-weight: 600;
  letter-spacing: -.01em;
}
.page-head p { margin: 0; color: var(--muted); max-width: 60ch; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 30px 0 26px;
}
.filter-btn {
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
  font-family: var(--sans);
  cursor: pointer;
  transition: all .18s ease;
}
.filter-btn:hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.filter-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.post-list { display: grid; gap: 16px; }

.post-row {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 24px;
  align-items: baseline;
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .18s ease, transform .18s ease;
}
.post-row:hover { border-color: color-mix(in srgb, var(--accent) 34%, var(--line)); transform: translateX(2px); }
.post-row time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.post-row h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.4;
}
.post-row h3 a { color: var(--ink); }
.post-row h3 a:hover { color: var(--accent-strong); text-decoration: none; }
.post-row p { margin: 0; color: var(--muted); font-size: .9rem; }
@media (max-width: 680px) {
  .post-row { grid-template-columns: 1fr; gap: 8px; padding: 20px; }
}

/* ---------- 正文页 ---------- */

.article-hero {
  padding: 60px 0 34px;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(720px 280px at 76% -30%, var(--accent-soft), transparent 60%);
}
.article-hero h1 {
  margin: 12px 0 14px;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--muted);
  font-size: .86rem;
}

.article-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 44px 24px 84px;
}

.prose { font-size: 1.02rem; }
.prose p { margin: 0 0 1.15em; }
.prose h2 {
  margin: 2.1em 0 .65em;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.4;
}
.prose h3 {
  margin: 1.7em 0 .5em;
  font-size: 1.12rem;
  font-weight: 700;
}
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose blockquote {
  margin: 1.4em 0;
  padding: .3em 0 .3em 20px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.prose code {
  padding: .14em .4em;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: .9em;
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}
.prose pre {
  margin: 1.4em 0;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--surface-2);
  overflow-x: auto;
  font-size: .87rem;
  line-height: 1.65;
}
.prose pre code { padding: 0; background: none; font-size: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: .92rem;
}

/* ---------- 关于 / 联系 ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 1.35fr .85fr;
  gap: 40px;
  align-items: start;
}
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
}

.portrait {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  background:
    radial-gradient(240px 220px at 30% 25%, var(--accent-soft), transparent 70%),
    linear-gradient(145deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-family: var(--serif);
  font-size: 5rem;
  font-weight: 600;
  user-select: none;
}

.info-list {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}
.info-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.info-item .ico {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.info-item .ico svg { width: 17px; height: 17px; }
.info-item strong { display: block; font-size: .93rem; margin-bottom: 2px; }
.info-item span, .info-item a { color: var(--muted); font-size: .9rem; }

/* ---------- 404 ---------- */

.error-page {
  min-height: 62vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 80px 24px;
}
.error-page .code {
  font-family: var(--serif);
  font-size: clamp(4.5rem, 14vw, 8rem);
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
  opacity: .9;
}
.error-page h1 { margin: 18px 0 8px; font-family: var(--serif); font-size: 1.6rem; font-weight: 600; }
.error-page p { margin: 0 0 26px; color: var(--muted); }

/* ---------- 页脚 ---------- */

.site-footer {
  margin-top: 20px;
  padding: 44px 0 40px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}
.footer-title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
}
.footer-note { margin: 0; color: var(--muted); font-size: .88rem; max-width: 46ch; }
.beian { text-align: right; }
.beian p { margin: 0 0 4px; color: var(--muted); font-size: .84rem; }
.beian a { color: var(--muted); }
.beian a:hover { color: var(--accent-strong); }
@media (max-width: 640px) {
  .beian { text-align: left; }
}

/* ---------- 进入动画（尊重减少动态偏好） ---------- */

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

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

/* ---------- 打印 ---------- */

@media print {
  .site-header, .site-footer, .hero-actions, .theme-toggle, .article-nav { display: none; }
  body { background: #fff; color: #000; }
}
