/* ===== CZC Reading Site — 阅读站设计系统 ===== */
:root {
  --bg: #faf9f7;
  --bg-soft: #f2f1ee;
  --card: #ffffff;
  --text: #1c1c1e;
  --text-2: #6b7280;
  --border: #e5e3de;
  --accent: #4f46e5;
  --accent-2: #0d9488;
  --grad: linear-gradient(135deg, #4f46e5 0%, #0d9488 100%);
  --shadow: 0 1px 3px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.04);
  --radius: 14px;
}
[data-theme="dark"] {
  --bg: #141517;
  --bg-soft: #1a1b1f;
  --card: #1d1e23;
  --text: #e5e7eb;
  --text-2: #9ca3af;
  --border: #2c2d33;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background .25s, color .25s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 顶部导航 ===== */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: 700; font-size: 17px; color: var(--text);
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand:hover { text-decoration: none; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, border-color .2s;
}
.icon-btn:hover { transform: rotate(20deg); border-color: var(--accent); }

/* ===== 布局 ===== */
.container { max-width: 860px; margin: 0 auto; padding: 24px 20px 60px; }

/* ===== 首页 Hero ===== */
.hero { text-align: center; padding: 48px 12px 28px; }
.hero h1 {
  font-size: clamp(30px, 5vw, 44px);
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  font-weight: 700; letter-spacing: 1px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub { color: var(--text-2); margin: 10px 0 26px; font-size: 15px; }
#search {
  width: min(520px, 90%); padding: 13px 20px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--text);
  font-size: 15px; outline: none;
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

/* ===== 分类导航 ===== */
.cat-nav {
  display: flex; gap: 10px; flex-wrap: wrap;
  justify-content: center; margin: 22px 0 8px;
}
.chip {
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text-2); font-size: 14px; cursor: pointer;
  transition: all .2s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--grad); color: #fff; border-color: transparent; }

/* ===== 分类区块 ===== */
.cat-section { margin: 34px 0; }
.cat-title {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  font-size: 21px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.cat-count {
  font-size: 13px; font-weight: 400; color: var(--text-2);
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 2px 10px; border-radius: 999px;
}
.card-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }

/* ===== 文章卡片 ===== */
.post-card {
  display: block; padding: 18px 22px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s, border-color .2s;
  color: var(--text);
}
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,.07), 0 16px 36px rgba(0,0,0,.08);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  text-decoration: none;
}
.card-top { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12px; }
.card-date { color: var(--text-2); }
.card-cat { color: var(--accent); }
.post-card h3 {
  font-size: 17px; font-weight: 600; line-height: 1.5; margin-bottom: 6px;
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
}
.post-card p { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.no-results { text-align: center; color: var(--text-2); padding: 40px 0; }

/* ===== 文章页 ===== */
.post { margin: 30px auto; }
.post-head { text-align: center; margin-bottom: 34px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.post-cat {
  display: inline-block; font-size: 12px; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  padding: 3px 12px; border-radius: 999px; margin-bottom: 14px;
}
.post-head h1 {
  font-size: clamp(24px, 4vw, 34px); line-height: 1.4;
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  font-weight: 700;
}
.post-meta { margin-top: 14px; color: var(--text-2); font-size: 13.5px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.src-link { color: var(--text-2); border-bottom: 1px dashed var(--text-2); }
.src-link:hover { color: var(--accent); border-color: var(--accent); }

.post-body { font-size: 16.5px; line-height: 1.85; color: var(--text); }
.post-body > * { margin-bottom: 18px; }
.post-body h1, .post-body h2, .post-body h3, .post-body h4 {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  margin-top: 34px; margin-bottom: 14px; line-height: 1.45;
}
.post-body h2 { font-size: 23px; padding-left: 12px; border-left: 3px solid var(--accent); }
.post-body h3 { font-size: 19px; }
.post-body p { margin-bottom: 16px; }
.post-body ul, .post-body ol { padding-left: 24px; margin-bottom: 16px; }
.post-body li { margin-bottom: 6px; }
.post-body blockquote {
  border-left: 3px solid var(--accent-2);
  background: var(--bg-soft);
  padding: 12px 18px; border-radius: 0 10px 10px 0;
  color: var(--text-2); margin-bottom: 18px;
}
.post-body blockquote p { margin-bottom: 0; }
.post-body code {
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 6px; font-size: .88em;
  font-family: "SF Mono", "JetBrains Mono", Consolas, monospace;
}
.post-body pre {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; overflow-x: auto; margin-bottom: 18px;
}
.post-body pre code { background: none; border: none; padding: 0; }
.post-body table {
  width: 100%; border-collapse: collapse; margin-bottom: 18px; font-size: 14.5px;
  display: block; overflow-x: auto;
}
.post-body th, .post-body td {
  border: 1px solid var(--border); padding: 9px 12px; text-align: left;
}
.post-body th { background: var(--bg-soft); font-weight: 600; }
.post-body img { max-width: 100%; border-radius: 10px; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 26px 0; }
.post-body strong { font-weight: 700; }

/* ===== 上一篇/下一篇 ===== */
.prev-next {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--border);
}
.pn {
  flex: 1; padding: 14px 18px; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 14px; color: var(--text); transition: border-color .2s;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.pn:hover { border-color: var(--accent); text-decoration: none; }
.pn.next { text-align: right; }

/* ===== 页脚 ===== */
.site-footer {
  text-align: center; color: var(--text-2); font-size: 13px;
  padding: 30px 16px 40px; border-top: 1px solid var(--border);
}

/* ===== 响应式 ===== */
@media (min-width: 720px) {
  .card-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .container { padding: 16px 14px 50px; }
  .hero { padding-top: 34px; }
  .post-body { font-size: 16px; }
  .post-meta { gap: 10px; }
}

/* 阅读进度条 */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; z-index: 100;
  background: var(--grad); width: 0; transition: width .1s linear;
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .post-card:hover { transform: none; }
}
