/* ============================================================
   全站样式（唯一一个 CSS 文件，改这里即可）
   - 无任何外部依赖，不加载 CDN 字体，国内访问也快
   - 默认浅色，跟随系统自动切换深色
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --bg: #fbfaf7;
  --bg-soft: #f3f0ea;
  --text: #23201c;
  --muted: #6f6a62;
  --line: #e5e0d6;
  --accent: #2b6b58;
  --code-bg: #f2efe8;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --bg-soft: #201e1b;
    --text: #e9e5dd;
    --muted: #9c968c;
    --line: #302c27;
    --accent: #7fc9ae;
    --code-bg: #201e1b;
  }
}

/* ---------- 基础重置 ---------- */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- 布局容器 ---------- */
.wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

main { flex: 1 0 auto; }

/* ---------- 页头 ---------- */
.site-header { padding-top: 34px; }

.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}

.brand .dot { color: var(--accent); }

.site-nav { display: flex; gap: 22px; }

.site-nav a {
  font-size: 15px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-nav a:hover { color: var(--text); }

/* 当前页高亮：在对应 <a> 上加 aria-current="page" */
.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}

/* ---------- 首页简介 ---------- */
.intro { margin: 64px 0 0; }

.intro h1 {
  margin: 0 0 14px;
  font-size: 30px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.intro p {
  margin: 0;
  max-width: 44ch;
  color: var(--muted);
  font-size: 16.5px;
}

/* ---------- 文章列表 ---------- */
.post-list {
  margin: 52px 0 0;
  padding: 0;
  list-style: none;
}

.post-list li {
  padding: 26px 0;
  border-top: 1px solid var(--line);
}

.post-list li:last-child { border-bottom: 1px solid var(--line); }

.post-list .date {
  display: block;
  margin-bottom: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.post-list .title {
  font-size: 19.5px;
  font-weight: 620;
  line-height: 1.5;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
}

.post-list .title:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

.post-list .excerpt {
  margin: 7px 0 0;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- 文章正文 ---------- */
.article { margin: 60px 0 0; }

.article-header { margin-bottom: 38px; }

.article-header h1 {
  margin: 0 0 16px;
  font-size: 31px;
  line-height: 1.34;
  font-weight: 700;
  letter-spacing: -0.018em;
}

.article-meta {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.article-meta span + span::before {
  content: "·";
  margin: 0 8px;
}

.article-body > * + * { margin-top: 1.15em; }

.article-body h2 {
  margin-top: 2.1em;
  margin-bottom: 0.6em;
  font-size: 21px;
  line-height: 1.5;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.article-body h3 {
  margin-top: 1.8em;
  margin-bottom: 0.5em;
  font-size: 17.5px;
  font-weight: 650;
}

.article-body ul,
.article-body ol { padding-left: 1.35em; }

.article-body li + li { margin-top: 0.4em; }

.article-body blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: normal;
}

.article-body blockquote p { margin: 0; }

.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.87em;
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 4px;
  word-break: break-word;
}

.article-body pre {
  margin: 1.6em 0;
  padding: 16px 18px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
}

.article-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
}

.article-body hr {
  margin: 2.4em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.article-body table {
  width: 100%;
  margin: 1.6em 0;
  border-collapse: collapse;
  font-size: 15px;
}

.article-body th,
.article-body td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.article-body th {
  font-weight: 600;
  color: var(--muted);
  font-size: 13.5px;
  white-space: nowrap;
}

/* ---------- 文章底部导航 ---------- */
.article-footer {
  margin: 60px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 15px;
}

.article-footer a { text-decoration: none; }
.article-footer a:hover { text-decoration: underline; }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 88px;
  padding: 26px 0 40px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- 404 ---------- */
.center-page {
  text-align: center;
  padding: 100px 0 120px;
}

.center-page .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.center-page h1 {
  margin: 12px 0 10px;
  font-size: 26px;
  font-weight: 680;
}

.center-page p {
  margin: 0 auto 26px;
  max-width: 34ch;
  color: var(--muted);
  font-size: 16px;
}

/* ---------- 按钮样式（404、关于页用） ---------- */
.btn {
  display: inline-block;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  background: var(--bg-soft);
  border-color: var(--accent);
}

/* ---------- 小屏适配 ---------- */
@media (max-width: 600px) {
  body { font-size: 16.5px; }
  .wrap { padding: 0 20px; }
  .intro { margin-top: 46px; }
  .intro h1 { font-size: 25px; }
  .article { margin-top: 44px; }
  .article-header h1 { font-size: 25px; }
  .article-body h2 { font-size: 19.5px; }
  .site-footer { margin-top: 64px; }
  .article-body table { font-size: 14px; }
}
