/* ============ 主题变量 ============ */
:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --text: #242320;
  --text-soft: #6b6862;
  --text-faint: #9a968e;
  --border: #e9e6e0;
  --accent: #4a6fa5;
  --accent-soft: #eaf0f8;
  --code-bg: #f2f0ec;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.03);
  --radius: 10px;
  --maxw: 720px;
}

[data-theme="dark"] {
  --bg: #17181a;
  --surface: #1f2124;
  --text: #e8e6e1;
  --text-soft: #a6a29a;
  --text-faint: #77736c;
  --border: #2e3034;
  --accent: #8fb3e8;
  --accent-soft: #253247;
  --code-bg: #26282c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.15);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: inherit; text-decoration: none; }

.site-wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============ 头部 ============ */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 600;
}

.brand-text { font-size: 17px; font-weight: 600; letter-spacing: 0.02em; }

.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav a { color: var(--text-soft); font-size: 14px; transition: color 0.15s; }
.site-nav a:hover, .site-nav a.active { color: var(--accent); }

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ============ 主体 ============ */
.app { flex: 1; padding: 48px 0 64px; }

.hero { margin-bottom: 52px; }
.hero h1 { font-size: 30px; line-height: 1.35; margin: 0 0 12px; letter-spacing: -0.01em; }
.hero p { color: var(--text-soft); margin: 0; font-size: 15px; }

.section-label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 20px;
}

/* ============ 文章列表 ============ */
.post-list { display: flex; flex-direction: column; gap: 8px; }

.post-item {
  display: block;
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.post-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
  font-size: 13px;
  margin-bottom: 8px;
}
.post-meta .dot::before { content: "·"; margin-right: 12px; }

.post-item h2 { font-size: 19px; margin: 0 0 8px; line-height: 1.45; letter-spacing: -0.01em; }
.post-item p { color: var(--text-soft); font-size: 14px; margin: 0; }

.tags { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.tag {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ============ 文章详情 ============ */
.post-back {
  display: inline-block;
  color: var(--text-soft);
  font-size: 14px;
  margin-bottom: 32px;
}
.post-back:hover { color: var(--accent); }

.post-header { margin-bottom: 40px; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.post-header h1 { font-size: 30px; line-height: 1.35; margin: 0 0 16px; letter-spacing: -0.01em; }
.post-header .post-meta { margin-bottom: 0; }

.post-body { font-size: 16px; line-height: 1.9; }
.post-body h2 { font-size: 21px; margin: 40px 0 16px; letter-spacing: -0.01em; }
.post-body p { margin: 0 0 20px; }
.post-body ul { padding-left: 22px; margin: 0 0 20px; }
.post-body li { margin-bottom: 6px; }
.post-body blockquote {
  margin: 24px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  color: var(--text-soft);
}
.post-body code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.post-body pre {
  background: var(--code-bg);
  padding: 18px 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0 0 20px;
}
.post-body pre code { background: none; padding: 0; }
.post-body strong { font-weight: 600; }
.post-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ============ 关于页 ============ */
.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
}
.about-card h1 { font-size: 26px; margin: 0 0 20px; }
.about-card p { color: var(--text-soft); margin: 0 0 16px; }
.about-card a { color: var(--accent); }

/* ============ 空状态 ============ */
.empty { text-align: center; padding: 60px 20px; color: var(--text-faint); }

/* ============ 页脚 ============ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 32px;
  color: var(--text-faint);
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ============ 响应式 ============ */
@media (max-width: 540px) {
  .site-wrap { padding: 0 18px; }
  .site-header { padding: 24px 0 20px; }
  .site-nav { gap: 16px; }
  .app { padding: 36px 0 48px; }
  .hero h1 { font-size: 25px; }
  .post-item { padding: 20px; }
  .post-header h1 { font-size: 25px; }
  .about-card { padding: 26px; }
}
