/* ============================================================
 * 蔡雨城 · 个人博客  —  展示端主样式
 * 设计语言：编辑部 / 纸质感 —— 克制的衬线排版、细发丝分隔线、
 * 充足留白、极轻阴影。没有渐变光球，没有浮夸装饰。
 * ============================================================ */

/* ---------- 1. 变量：默认素白（ink） ---------- */
:root {
  --accent: #2f2f2c;
  --accent-contrast: #ffffff;

  --bg: #faf9f6;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-subtle: #f4f2ed;

  --text: #1c1b19;
  --text-2: #56534d;
  --text-3: #8c8880;

  --line: #e8e5de;
  --line-strong: #d8d4ca;

  --shadow-sm: 0 1px 2px rgba(28, 27, 25, 0.04);
  --shadow: 0 2px 18px rgba(28, 27, 25, 0.06);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
             "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --font-serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC",
                "STSong", "SimSun", Georgia, serif;

  --wrap: 1080px;
}

/* ---------- 2. 主题色调（低饱和、克制） ---------- */
html[data-theme="sepia"] {
  --accent: #8a6a43; --bg: #faf6ee; --surface-subtle: #f3ecdf;
  --line: #e9dfcd; --line-strong: #dccdb4;
}
html[data-theme="moss"] {
  --accent: #4f6b52; --bg: #f7f9f6; --surface-subtle: #edf2ec;
  --line: #dfe7dd; --line-strong: #cddac9;
}
html[data-theme="indigo"] {
  --accent: #3b5573; --bg: #f7f9fb; --surface-subtle: #eaf0f5;
  --line: #dde5ec; --line-strong: #c9d6e1;
}
html[data-theme="plum"] {
  --accent: #73546b; --bg: #faf7f9; --surface-subtle: #f2ebf0;
  --line: #e8dfe5; --line-strong: #d9c9d5;
}

/* ---------- 3. 深色模式 ---------- */
html[data-mode="dark"] {
  --bg: #141414;
  --bg-elevated: #1b1b1a;
  --surface: #1b1b1a;
  --surface-subtle: #232321;
  --text: #ece9e3;
  --text-2: #a9a59d;
  --text-3: #726e67;
  --line: #2c2c29;
  --line-strong: #3b3b37;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --accent-contrast: #ffffff;
}
html[data-mode="dark"][data-theme="ink"]    { --accent: #e0ddd6; --accent-contrast: #141414; }
html[data-mode="dark"][data-theme="sepia"]  { --accent: #d9b98c; --accent-contrast: #141414; }
html[data-mode="dark"][data-theme="moss"]   { --accent: #9dbb9e; --accent-contrast: #141414; }
html[data-mode="dark"][data-theme="indigo"] { --accent: #9cb6d2; --accent-contrast: #141414; }
html[data-mode="dark"][data-theme="plum"]   { --accent: #c6a6bf; --accent-contrast: #141414; }

/* ---------- 4. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
  min-height: 100dvh;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
::selection { background: var(--surface-subtle); color: var(--text); }
.container { width: min(var(--wrap), calc(100% - 48px)); margin: 0 auto; }

/* ---------- 5. 顶部导航（细线、无浮夸背景） ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 24px; }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-name { font-family: var(--font-serif); font-size: 21px; font-weight: 700; letter-spacing: 0.08em; }
.brand-sep { width: 1px; height: 15px; background: var(--line-strong); }
.brand-tag { font-size: 11px; letter-spacing: 0.22em; color: var(--text-3); text-transform: uppercase; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 7px 13px; border-radius: 7px; font-size: 14px; color: var(--text-2);
  border: none; background: transparent; transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); font-weight: 600; }
.nav-link.active::after {
  content: ""; display: block; height: 1px; background: var(--accent);
  margin: 4px auto 0; width: 16px;
}

/* ---------- 6. Hero（安静、留白、衬线大标题） ---------- */
.hero { padding: 104px 24px 76px; text-align: center; border-bottom: 1px solid var(--line); }
.hero-eyebrow {
  display: inline-block; font-size: 11px; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 28px;
}
.hero h1 {
  margin: 0 0 22px; font-family: var(--font-serif);
  font-size: clamp(44px, 7vw, 72px); line-height: 1.12;
  font-weight: 700; letter-spacing: 0.12em; color: var(--text);
  text-indent: 0.12em;
}
.hero-rule { width: 42px; height: 1px; background: var(--accent); margin: 0 auto 26px; opacity: 0.7; }
.hero p {
  margin: 0 auto; max-width: 540px; font-family: var(--font-serif);
  font-size: clamp(15px, 2vw, 18px); line-height: 1.9; color: var(--text-2); letter-spacing: 0.03em;
}

/* ---------- 7. 分类与搜索 ---------- */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; margin: 6px 0 34px; padding-top: 34px; flex-wrap: wrap;
}
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  padding: 8px 15px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); font-size: 14px;
  transition: all 0.2s var(--ease);
}
.chip:hover { color: var(--text); background: var(--surface-subtle); }
.chip.active { color: var(--accent); font-weight: 600; border-color: var(--line); background: var(--surface); }
.search-box {
  display: flex; align-items: center; gap: 9px; padding: 0 13px; height: 40px;
  border-radius: 8px; background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.2s var(--ease); min-width: 230px;
}
.search-box:focus-within { border-color: var(--accent); }
.search-box svg { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.search-box input { border: none; outline: none; background: transparent; color: var(--text); width: 100%; font-size: 14px; }
.search-box input::placeholder { color: var(--text-3); }

/* ---------- 8. 文章列表（左图右文，杂志式） ---------- */
.post-grid { display: flex; flex-direction: column; padding-bottom: 90px; }
.post-card {
  display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 30px;
  padding: 30px 0; border-bottom: 1px solid var(--line);
  cursor: pointer; opacity: 0; transform: translateY(14px);
  animation: rise 0.55s var(--ease) forwards;
  transition: opacity 0.25s var(--ease);
}
.post-card:hover { opacity: 0.78; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }
.card-cover { aspect-ratio: 3 / 2; overflow: hidden; background: var(--surface-subtle); border-radius: var(--radius-sm); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.post-card:hover .card-cover img { transform: scale(1.04); }
.card-body { display: flex; flex-direction: column; padding: 4px 0; }
.card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-cat { font-size: 11px; letter-spacing: 0.14em; color: var(--accent); font-weight: 600; }
.original-tag {
  font-size: 10px; letter-spacing: 0.08em; color: var(--text-3);
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 6px;
}
.card-title {
  margin: 0 0 10px; font-family: var(--font-serif);
  font-size: clamp(21px, 2.6vw, 27px); line-height: 1.4; letter-spacing: 0.02em; font-weight: 700;
}
.card-excerpt {
  margin: 0 0 18px; color: var(--text-2); font-family: var(--font-serif);
  font-size: 15px; line-height: 1.85; flex: 1; letter-spacing: 0.02em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { display: flex; align-items: center; gap: 20px; color: var(--text-3); font-size: 12px; }
.card-meta span { display: inline-flex; align-items: center; gap: 6px; }
.card-meta svg { width: 14px; height: 14px; }

/* ---------- 9. 空状态 / 加载 ---------- */
.empty-state { text-align: center; padding: 120px 20px; color: var(--text-3); }
.empty-state .mark { font-family: var(--font-serif); font-size: 40px; color: var(--line-strong); margin-bottom: 12px; }
.empty-state h3 { font-family: var(--font-serif); color: var(--text); margin: 0 0 10px; font-size: 20px; font-weight: 600; }
.empty-state p { font-size: 14px; }
.skeleton { height: 150px; border-bottom: 1px solid var(--line);
  background: linear-gradient(100deg, transparent 30%, var(--surface-subtle) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 10. 页脚 + 版权 ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 46px 24px 40px; text-align: center; }
.footer-brand { font-family: var(--font-serif); font-size: 16px; font-weight: 700; letter-spacing: 0.1em; margin-bottom: 10px; }
.footer-text { color: var(--text-2); font-family: var(--font-serif); font-size: 14px; margin-bottom: 18px; }
.copyright-block {
  max-width: 620px; margin: 0 auto; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text-3); line-height: 1.9;
}
.copyright-block .cc-line { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.copyright-block .cc-mark { border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 5px; font-size: 10px; letter-spacing: 0.1em; }
.footer-icp { margin-top: 8px; font-size: 11px; }

/* ---------- 11. 文章详情页 ---------- */
.article-wrap { padding: 64px 0 100px; }
.article-head { max-width: 760px; margin: 0 auto 48px; text-align: center; }
.article-head .back-link {
  display: inline-flex; align-items: center; gap: 7px; color: var(--text-3);
  font-size: 13px; margin-bottom: 36px; transition: color 0.2s;
}
.article-head .back-link:hover { color: var(--accent); }
.article-cat { font-size: 11px; letter-spacing: 0.18em; color: var(--accent); font-weight: 600; text-transform: uppercase; }
.article-title {
  margin: 16px 0 20px; font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, 46px); line-height: 1.32; letter-spacing: 0.03em; font-weight: 700;
}
.article-info { display: flex; justify-content: center; gap: 22px; color: var(--text-3); font-size: 12px; }
.article-info span { display: inline-flex; align-items: center; gap: 6px; }
.article-info svg { width: 14px; height: 14px; }
.article-cover { max-width: 860px; margin: 0 auto 52px; border-radius: var(--radius); overflow: hidden; }
.article-cover img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }

/* 正文排版 */
.article-body {
  max-width: 720px; margin: 0 auto; font-family: var(--font-serif);
  font-size: 18px; line-height: 2.15; color: var(--text); letter-spacing: 0.02em;
}
.article-body h1, .article-body h2, .article-body h3,
.article-body h4, .article-body h5, .article-body h6 {
  font-family: var(--font-serif); letter-spacing: 0.04em; line-height: 1.5;
  margin: 2em 0 0.8em; font-weight: 700;
}
.article-body h2 { font-size: 25px; }
.article-body h3 { font-size: 21px; }
.article-body p { margin: 0 0 1.4em; }
.article-body blockquote {
  margin: 2em 0; padding: 4px 0 4px 24px;
  border-left: 2px solid var(--accent); color: var(--text-2); font-style: italic;
}
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.article-body code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.86em; padding: 2px 6px; border-radius: 5px;
  background: var(--surface-subtle); color: var(--text);
}
.article-body pre {
  background: var(--surface-subtle); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 18px 20px; overflow-x: auto; margin: 1.6em 0;
}
.article-body pre code { background: none; padding: 0; font-size: 13px; }
.article-body img { border-radius: var(--radius-sm); margin: 2em auto; }
.article-body hr { border: none; border-top: 1px solid var(--line); margin: 2.6em 0; }
.article-body ul, .article-body ol { padding-left: 1.5em; margin: 0 0 1.4em; }
.article-body li { margin: 0.5em 0; }

/* 原创声明（文章末尾） */
.article-copyright {
  max-width: 720px; margin: 64px auto 0; padding: 22px 24px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-subtle);
}
.article-copyright .ac-head { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.article-copyright .cc-mark { font-size: 10px; letter-spacing: 0.08em; border: 1px solid var(--line-strong); border-radius: 3px; padding: 1px 5px; color: var(--text-2); }
.article-copyright p { margin: 0; font-size: 12.5px; line-height: 1.85; color: var(--text-2); }

.article-tags { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 40px; }
.tag { padding: 6px 13px; border-radius: 100px; background: var(--surface-subtle); color: var(--text-2); font-size: 12px; }
.not-found { text-align: center; padding: 140px 20px; }
.not-found h1 { font-family: var(--font-serif); font-size: 84px; margin: 0; color: var(--line-strong); }
.not-found p { color: var(--text-2); margin: 10px 0 28px; }
.primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 8px; border: none;
  background: var(--accent); color: var(--accent-contrast);
  font-weight: 600; font-size: 14px; transition: opacity 0.2s var(--ease);
}
.primary-btn:hover { opacity: 0.86; }

/* ---------- 12. 主题面板（极简） ---------- */
.theme-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2);
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
  transition: color 0.2s var(--ease), transform 0.3s var(--ease);
}
.theme-fab:hover { color: var(--accent); transform: rotate(20deg); }
.theme-fab svg { width: 18px; height: 18px; }
.theme-panel {
  position: fixed; right: 24px; bottom: 80px; z-index: 60; width: 250px; padding: 20px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: all 0.28s var(--ease);
}
.theme-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.theme-panel h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; }
.theme-panel .hint { margin: 0 0 16px; font-size: 11px; color: var(--text-3); }
.theme-swatches { display: flex; gap: 14px; margin-bottom: 18px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; border: none; background: none; color: var(--text-2); font-size: 11px; padding: 0; }
.swatch .color { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-strong); transition: transform 0.2s var(--ease); }
.swatch:hover .color { transform: scale(1.1); }
.swatch.active .color { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); }
.mode-row { display: flex; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.mode-btn {
  flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2); font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.2s var(--ease);
}
.mode-btn.active { color: var(--accent); border-color: var(--accent); }
.mode-btn svg { width: 14px; height: 14px; }

/* ---------- 13. 响应式 ---------- */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .hero { padding: 76px 20px 56px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-box { width: 100%; }
}
@media (max-width: 620px) {
  .container { width: min(100% - 36px, var(--wrap)); }
  .post-card { grid-template-columns: 1fr; gap: 16px; padding: 26px 0; }
  .card-cover { aspect-ratio: 16 / 9; }
  .article-body { font-size: 17px; line-height: 2.05; }
  .theme-panel { right: 16px; }
  .theme-fab { right: 16px; bottom: 16px; }
}
