/* ============================================================
   CF-Blog 前台样式
   设计基调：纸张与印泥 —— 米白纸色背景 + 衬线标题 + 印章红点缀，
   呼应"博客"这一中文互联网书写传统的视觉记忆。
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700;900&family=Noto+Sans+SC:wght@400;500;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f2ede3;
  --text: #201e1a;
  --text-muted: #6b6558;
  --accent: #b3432b;
  --accent-ink: #ffffff;
  --accent-2: #3f6659;
  --border: #e4dfd3;
  --shadow: 0 1px 2px rgba(32, 30, 26, 0.04), 0 8px 24px rgba(32, 30, 26, 0.06);
  --radius: 6px;
  --font-display: "Noto Serif SC", "Songti SC", serif;
  --font-body: "Noto Sans SC", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #16150f;
  --surface: #201f19;
  --surface-2: #2a281f;
  --text: #ede7da;
  --text-muted: #a39a87;
  --accent: #e2603f;
  --accent-ink: #16150f;
  --accent-2: #6fa394;
  --border: #322f27;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.7;
  transition: background 0.25s ease, color 0.25s ease;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------- 顶部导航 ---------------- */
.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  z-index: 50;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.seal {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.site-nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.site-nav a { color: var(--text-muted); font-size: 15px; }
.site-nav a:hover { color: var(--accent); text-decoration: none; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(12deg); }
.search-box {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  background: var(--surface);
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: 14px;
  width: 140px;
}

/* ---------------- 主体布局 ---------------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  padding: 40px 0 80px;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------------- 文章卡片 ---------------- */
.post-card {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}
.post-card:first-child { padding-top: 0; }
.post-eyebrow {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.post-eyebrow .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--border); }
.post-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 10px;
  line-height: 1.35;
}
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); text-decoration: none; }
.post-excerpt { color: var(--text-muted); margin: 0 0 12px; }
.post-meta-row { display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); align-items: center; flex-wrap: wrap; }
.tag-pill {
  display: inline-block;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.tag-pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.empty-state { color: var(--text-muted); padding: 60px 0; text-align: center; }

/* ---------------- 侧栏 ---------------- */
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}
.sidebar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-title::before { content: ""; width: 3px; height: 14px; background: var(--accent); border-radius: 2px; }
.meta-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.meta-list a { display: flex; justify-content: space-between; color: var(--text); font-size: 14px; }
.meta-list a:hover { color: var(--accent); text-decoration: none; }
.meta-list .count { color: var(--text-muted); font-size: 12px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

.pagination { display: flex; justify-content: center; gap: 10px; padding: 20px 0 60px; }
.pagination button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-body);
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------------- 文章详情 ---------------- */
.post-detail { padding: 40px 0 20px; }
.post-detail-header { margin-bottom: 28px; }
.post-detail-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  line-height: 1.3;
  margin: 10px 0 16px;
}
.article-body { font-size: 17px; }
.article-body h2, .article-body h3 { font-family: var(--font-display); }
.article-body p { margin: 0 0 20px; }
.article-body img { border-radius: var(--radius); margin: 16px 0; }
.article-body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
}
.article-body code { font-family: var(--font-mono); background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }
.article-body pre code { background: none; padding: 0; }
.article-body blockquote {
  margin: 20px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
}
.article-body a { text-decoration: underline; }
.article-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 30px; }

/* ---------------- 评论区 ---------------- */
.comments-section { margin-top: 48px; border-top: 1px solid var(--border); padding-top: 32px; }
.comments-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.comment-form { display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 28px; }
.comment-form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .comment-form-row { grid-template-columns: 1fr; } }
.comment-form input, .comment-form textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}
.comment-form textarea { min-height: 100px; resize: vertical; }
.comment-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-item .children { margin-left: 28px; margin-top: 12px; border-left: 2px solid var(--border); padding-left: 16px; }
.comment-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.comment-author { font-weight: 700; font-size: 14px; }
.comment-time { font-size: 12px; color: var(--text-muted); }
.comment-text { font-size: 14.5px; }
.comment-reply-btn { font-size: 12px; color: var(--accent-2); cursor: pointer; background: none; border: none; padding: 0; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.88; text-decoration: none; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------- 页脚 ---------------- */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ---------------- 独立页面 ---------------- */
.page-detail { padding: 40px 0 80px; max-width: 760px; margin: 0 auto; }

/* 加载/空态 */
.loading-hint { color: var(--text-muted); text-align: center; padding: 60px 0; }
