/* 林间笔记 · 全站样式 */

:root {
  --bg: #faf9f6;
  --surface: #f1efe9;
  --text: #22251f;
  --muted: #6b6f66;
  --line: #e2dfd6;
  --accent: #2f6b4f;
  --accent-soft: #e3eee7;
  --code-bg: #f1efe9;
  --maxw: 44rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171916;
    --surface: #20231f;
    --text: #e4e6df;
    --muted: #9a9e94;
    --line: #2f332d;
    --accent: #7fbf9c;
    --accent-soft: #23312a;
    --code-bg: #20231f;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  font-size: 17px;
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

/* 顶栏 */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
  font-weight: 600;
  letter-spacing: .02em;
}
.brand:hover { text-decoration: none; }
.brand img { width: 22px; height: 22px; }
.nav { display: flex; gap: 1.25rem; font-size: .95rem; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); }

main { flex: 1; padding: 2.5rem 0 3.5rem; }

/* 首页 */
.intro h1 { font-size: 1.6rem; margin: 0 0 .75rem; line-height: 1.4; }
.intro p { color: var(--muted); margin: 0 0 .5rem; }

.section-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .08em;
  margin: 3rem 0 .5rem;
}

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}
.post-list li:last-child { border-bottom: 0; }
.post-list a.title { font-size: 1.08rem; font-weight: 600; color: var(--text); }
.post-list a.title:hover { color: var(--accent); text-decoration: none; }
.post-list p { margin: .3rem 0 0; color: var(--muted); font-size: .95rem; }

.meta { color: var(--muted); font-size: .88rem; }
.tag {
  display: inline-block;
  font-size: .78rem;
  padding: 0 .5rem;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-left: .4rem;
}

/* 文章 */
.post header { margin-bottom: 2rem; }
.post h1 { font-size: 1.65rem; line-height: 1.45; margin: 0 0 .5rem; }
.post h2 { font-size: 1.2rem; margin: 2.2rem 0 .6rem; }
.post p, .post ul, .post ol { margin: 0 0 1.1rem; }
.post li { margin-bottom: .3rem; }
.post blockquote {
  margin: 1.4rem 0;
  padding: .2rem 1rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .88em;
  background: var(--code-bg);
  padding: .1em .35em;
  border-radius: 3px;
}
pre {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .9rem 1rem;
  overflow-x: auto;
  line-height: 1.6;
  margin: 0 0 1.3rem;
}
pre code { background: none; padding: 0; font-size: .85rem; }
.copy-btn {
  position: absolute;
  top: .4rem;
  right: .4rem;
  font: inherit;
  font-size: .75rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .05rem .5rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
pre:hover .copy-btn, .copy-btn:focus { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }

.post-nav {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: .95rem;
}

/* 404 */
.notfound { text-align: center; padding: 3rem 0; }
.notfound .code { font-size: 3.5rem; font-weight: 600; color: var(--line); margin: 0; line-height: 1; }
.notfound h1 { font-size: 1.3rem; margin: 1rem 0 .5rem; }
.notfound p { color: var(--muted); }

/* 页脚 */
.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
  padding: 1.5rem 0;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}
.site-footer a { color: var(--muted); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  main { padding: 1.75rem 0 2.5rem; }
  .intro h1 { font-size: 1.4rem; }
  .post h1 { font-size: 1.4rem; }
  .post-nav { flex-direction: column; }
}
