/* ============ 博客前台 ============ */
:root {
  --bg: #f7f6f3;
  --card: #ffffff;
  --text: #1f2328;
  --text-2: #6b7280;
  --border: #e6e3dc;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --code-bg: #f3f4f6;
  --serif: Georgia, "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* ---- 头部 ---- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 52px 0 38px;
  margin-bottom: 36px;
}
.site-title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.5px;
}
.site-title:hover { color: var(--accent); }
.site-sub { color: var(--text-2); margin-top: 8px; font-size: 14px; }

/* ---- 文章卡片列表 ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 26px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07); transform: translateY(-2px); }
.cover { width: 100%; max-height: 340px; object-fit: cover; display: block; }
.card-body { padding: 24px 28px 28px; }
.card h2 a {
  font-family: var(--serif);
  color: var(--text);
  text-decoration: none;
  font-size: 23px;
  line-height: 1.4;
}
.card h2 a:hover { color: var(--accent); }
.meta { color: var(--text-2); font-size: 13px; margin: 10px 0 12px; }
.tag { color: var(--accent); text-decoration: none; margin-right: 10px; font-size: 13px; }
.tag:hover { text-decoration: underline; }
.excerpt { color: #4b5563; font-size: 15px; word-break: break-word; }
.more { color: var(--accent); text-decoration: none; font-size: 14px; display: inline-block; margin-top: 12px; }
.more:hover { color: var(--accent-dark); }

.tag-banner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 24px;
  font-size: 15px;
}
.tag-banner .clear { float: right; color: var(--text-2); text-decoration: none; font-size: 13px; }
.tag-banner .clear:hover { color: #dc2626; }

/* ---- 分页 ---- */
.pager { display: flex; justify-content: space-between; margin: 30px 0 8px; }
.pager a { color: var(--accent); text-decoration: none; font-size: 14px; }
.pager a:hover { text-decoration: underline; }
.pager span { color: #c3c6cb; font-size: 14px; }

/* ---- 文章详情 ---- */
.post {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 44px;
}
.post h1 {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.45;
  margin-bottom: 12px;
  word-break: break-word;
}
.post-body { margin-top: 26px; font-size: 16px; }
.post-body h1, .post-body h2, .post-body h3, .post-body h4 {
  font-family: var(--serif);
  margin: 1.4em 0 0.6em;
  line-height: 1.4;
}
.post-body h2 { font-size: 24px; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.post-body h3 { font-size: 20px; }
.post-body p { margin: 0.8em 0; }
.post-body a { color: var(--accent); }
.post-body ul, .post-body ol { padding-left: 1.6em; margin: 0.6em 0; }
.post-body li { margin: 0.25em 0; }
.post-body img { max-width: 100%; border-radius: 8px; margin: 0.5em 0; }
.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 6px 18px;
  color: var(--text-2);
  margin: 1em 0;
  background: #fafaf8;
  border-radius: 0 8px 8px 0;
}
.post-body pre {
  background: var(--code-bg);
  padding: 14px 18px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
  margin: 1em 0;
}
.post-body code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: "SF Mono", Consolas, "JetBrains Mono", Menlo, monospace;
}
.post-body pre code { padding: 0; background: none; }
.post-body table { border-collapse: collapse; margin: 1em 0; width: 100%; }
.post-body th, .post-body td { border: 1px solid var(--border); padding: 8px 12px; font-size: 14px; }
.post-body th { background: #fafaf8; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 1.6em 0; }

/* ---- 评论 ---- */
.comments { margin-top: 30px; }
.comments h2 { font-family: var(--serif); font-size: 20px; margin-bottom: 16px; }
.comment {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.c-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.c-author { font-weight: 600; font-size: 14px; }
.c-time { color: var(--text-2); font-size: 12px; }
.c-content { font-size: 14.5px; color: #374151; white-space: pre-wrap; word-break: break-word; }
.empty-s { color: var(--text-2); font-size: 14px; padding: 12px 0; }

.comment-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.comment-form input, .comment-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fdfdfc;
  resize: vertical;
}
.comment-form input:focus, .comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.c-msg { font-size: 13px; color: #059669; min-height: 1em; }
.c-msg.err { color: #dc2626; }

/* ---- 按钮 ---- */
.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  align-self: flex-start;
}
.btn:hover { border-color: #c9c5bd; background: #fafaf8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }

.loading, .empty { text-align: center; color: var(--text-2); padding: 70px 0; font-size: 15px; }

/* ---- 页脚 ---- */
.site-footer {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 42px 0 50px;
  border-top: 1px solid var(--border);
  margin-top: 44px;
}

@media (max-width: 640px) {
  .site-header { padding: 34px 0 26px; }
  .site-title { font-size: 26px; }
  .post { padding: 26px 22px; }
  .post h1 { font-size: 24px; }
  .card-body { padding: 20px 20px 22px; }
}
