/* ===== 基础变量与主题 ===== */
:root {
  --bg: #f7f4ef;
  --bg-soft: #efe9e0;
  --bg-card: #fffdf9;
  --text: #2b2622;
  --text-soft: #6b6258;
  --text-mute: #9a9088;
  --accent: #b8442e;
  --accent-soft: #d9785f;
  --accent-bg: rgba(184, 68, 46, 0.08);
  --border: #e3dccf;
  --shadow: 0 1px 2px rgba(43, 38, 34, 0.04), 0 8px 24px rgba(43, 38, 34, 0.06);
  --shadow-hover: 0 4px 12px rgba(43, 38, 34, 0.08), 0 18px 40px rgba(43, 38, 34, 0.1);
  --radius: 14px;
  --radius-sm: 9px;
  --max-width: 1120px;
  --serif: "Noto Serif SC", "Playfair Display", Georgia, serif;
  --sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --header-h: 68px;
}

[data-theme="dark"] {
  --bg: #1a1714;
  --bg-soft: #221d18;
  --bg-card: #25201a;
  --text: #ece6dd;
  --text-soft: #b3a99c;
  --text-mute: #7d7468;
  --accent: #e08a6f;
  --accent-soft: #e8a48c;
  --accent-bg: rgba(224, 138, 111, 0.12);
  --border: #34302a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.45);
}

/* ===== 重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* ===== 顶部导航 ===== */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(247, 244, 239, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: background 0.4s ease, border-color 0.4s ease;
}
[data-theme="dark"] .site-header { background: rgba(26, 23, 20, 0.82); }
.site-header.scrolled { border-bottom-color: var(--border); }
.nav-inner { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; font-size: 1.25rem; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 1.05rem;
  box-shadow: 0 4px 12px rgba(184, 68, 46, 0.35);
}
.logo-mark.small { width: 30px; height: 30px; font-size: 0.95rem; }
.nav-menu { display: flex; gap: 6px; }
.nav-menu a {
  padding: 8px 14px; border-radius: 8px; font-size: 0.95rem; color: var(--text-soft);
  transition: color 0.2s, background 0.2s;
}
.nav-menu a:hover { color: var(--text); background: var(--accent-bg); }
.nav-menu a.active { color: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; color: var(--text-soft);
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--accent-bg); color: var(--accent); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.menu-toggle { display: none; }

/* ===== 搜索浮层 ===== */
.search-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(26, 23, 20, 0.55);
  backdrop-filter: blur(6px);
  display: none; flex-direction: column; align-items: center;
  padding-top: 12vh;
}
.search-overlay.open { display: flex; }
.search-box { width: min(620px, 90vw); display: flex; align-items: center; gap: 10px; background: var(--bg-card); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow-hover); }
.search-box input { flex: 1; border: none; outline: none; background: none; color: var(--text); font-size: 1.05rem; font-family: var(--sans); }
.search-box input::placeholder { color: var(--text-mute); }
.search-close { color: var(--text-mute); }
.search-results { width: min(620px, 90vw); margin-top: 12px; background: var(--bg-card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; max-height: 50vh; overflow-y: auto; }
.search-results .result-item { display: block; padding: 14px 18px; border-bottom: 1px solid var(--border); transition: background 0.15s; }
.search-results .result-item:last-child { border-bottom: none; }
.search-results .result-item:hover { background: var(--accent-bg); }
.search-results .result-title { font-weight: 500; color: var(--text); }
.search-results .result-meta { font-size: 0.82rem; color: var(--text-mute); margin-top: 2px; }
.search-results .empty { padding: 28px; text-align: center; color: var(--text-mute); }

/* ===== 通用区块 ===== */
main { min-height: 60vh; padding-top: var(--header-h); }
.section { padding: 64px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 32px; gap: 16px; flex-wrap: wrap; }
.section-title { font-family: var(--serif); font-size: 1.7rem; font-weight: 700; }
.section-title .accent { color: var(--accent); }
.section-sub { color: var(--text-mute); font-size: 0.92rem; }

/* ===== Hero ===== */
.hero { position: relative; padding: 80px 0 56px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; top: -120px; right: -80px;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-bg), transparent 70%);
  filter: blur(8px); z-index: -1;
}
.hero-inner { max-width: 760px; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--accent); background: var(--accent-bg); padding: 6px 14px; border-radius: 999px; margin-bottom: 22px; }
.hero-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.hero h1 { font-family: var(--serif); font-size: clamp(2.4rem, 6vw, 3.8rem); font-weight: 900; line-height: 1.15; letter-spacing: -0.01em; }
.hero h1 .em { color: var(--accent); font-style: italic; font-family: "Playfair Display", var(--serif); }
.hero p.lead { margin-top: 22px; font-size: 1.12rem; color: var(--text-soft); max-width: 560px; }
.hero-actions { margin-top: 32px; display: flex; gap: 14px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 10px; font-size: 0.95rem; font-weight: 500; transition: transform 0.15s, box-shadow 0.2s, background 0.2s; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(184, 68, 46, 0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(184, 68, 46, 0.4); }
.btn-ghost { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
.hero-stats { margin-top: 48px; display: flex; gap: 40px; flex-wrap: wrap; }
.hero-stat .num { font-family: var(--serif); font-size: 1.8rem; font-weight: 700; color: var(--text); }
.hero-stat .label { font-size: 0.85rem; color: var(--text-mute); }

/* ===== 文章卡片网格 ===== */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 26px; }
.article-card {
  background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s;
  display: flex; flex-direction: column;
}
.article-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); border-color: var(--accent-soft); }
.card-cover { height: 180px; position: relative; overflow: hidden; }
.card-cover .cover-inner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 3rem; color: rgba(255,255,255,0.92); font-weight: 700; }
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.card-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tag { font-size: 0.76rem; color: var(--accent); background: var(--accent-bg); padding: 3px 10px; border-radius: 999px; }
.card-title { font-family: var(--serif); font-size: 1.22rem; font-weight: 700; line-height: 1.4; margin-bottom: 10px; transition: color 0.2s; }
.article-card:hover .card-title { color: var(--accent); }
.card-excerpt { color: var(--text-soft); font-size: 0.92rem; line-height: 1.7; flex: 1; }
.card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--text-mute); }
.card-meta .read { color: var(--accent); font-weight: 500; }

/* 精选大卡 */
.featured-card { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr 1fr; }
.featured-card .card-cover { height: auto; min-height: 280px; }
.featured-card .card-body { justify-content: center; padding: 36px 40px; }
.featured-card .card-title { font-size: 1.7rem; }
.featured-card .card-excerpt { font-size: 1rem; }

/* ===== 文章详情阅读视图 ===== */
.article-view { padding: 56px 0 80px; }
.article-back { display: inline-flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 0.9rem; margin-bottom: 28px; transition: color 0.2s; }
.article-back:hover { color: var(--accent); }
.article-header { max-width: 720px; margin: 0 auto; text-align: center; padding-bottom: 12px; }
.article-header .card-tags { justify-content: center; margin-bottom: 18px; }
.article-header h1 { font-family: var(--serif); font-size: clamp(1.9rem, 4.5vw, 2.8rem); font-weight: 900; line-height: 1.25; }
.article-header .meta { margin-top: 20px; color: var(--text-mute); font-size: 0.9rem; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.article-header .meta .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--text-mute); }
.article-cover { max-width: 820px; margin: 36px auto 0; height: clamp(220px, 36vw, 380px); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 4rem; color: rgba(255,255,255,0.95); font-weight: 700; }
.article-body { max-width: 720px; margin: 44px auto 0; font-size: 1.06rem; color: var(--text); line-height: 1.95; }
.article-body p { margin-bottom: 1.4em; }
.article-body h2 { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; margin: 2em 0 0.8em; }
.article-body h3 { font-family: var(--serif); font-size: 1.2rem; font-weight: 700; margin: 1.6em 0 0.6em; }
.article-body blockquote { border-left: 3px solid var(--accent); padding: 6px 0 6px 20px; margin: 1.6em 0; color: var(--text-soft); font-style: italic; font-family: var(--serif); font-size: 1.1rem; }
.article-body ul, .article-body ol { margin: 1.2em 0 1.4em; padding-left: 1.4em; }
.article-body li { margin-bottom: 0.5em; }
.article-body code { font-family: "SF Mono", Consolas, monospace; background: var(--bg-soft); padding: 2px 7px; border-radius: 5px; font-size: 0.9em; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 2.4em 0; }
.article-footer { max-width: 720px; margin: 48px auto 0; padding-top: 28px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.article-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.share-row { display: flex; gap: 8px; }
.share-row .icon-btn { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 9px; }
.author-card { max-width: 720px; margin: 40px auto 0; display: flex; gap: 18px; align-items: center; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; }
.author-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 1.4rem; font-weight: 700; flex-shrink: 0; }
.author-info h4 { font-family: var(--serif); font-size: 1.1rem; }
.author-info p { color: var(--text-soft); font-size: 0.9rem; margin-top: 2px; }

/* ===== 标签云 ===== */
.tags-cloud { display: flex; flex-wrap: wrap; gap: 12px; }
.tags-cloud .tag { font-size: 0.95rem; padding: 8px 18px; cursor: pointer; transition: transform 0.15s, background 0.2s; }
.tags-cloud .tag:hover { transform: translateY(-2px); }
.tags-cloud .tag .count { opacity: 0.6; margin-left: 6px; font-size: 0.8rem; }

/* ===== 关于页 ===== */
.about-wrap { max-width: 720px; margin: 0 auto; padding: 56px 0 80px; }
.about-cover { height: 220px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 3.4rem; color: rgba(255,255,255,0.95); font-weight: 700; margin-bottom: 36px; }
.about-wrap h1 { font-family: var(--serif); font-size: 2.2rem; font-weight: 900; }
.about-wrap .lead { color: var(--text-soft); font-size: 1.1rem; margin-top: 12px; }
.about-wrap .body { margin-top: 32px; font-size: 1.04rem; line-height: 1.95; color: var(--text); }
.about-wrap .body p { margin-bottom: 1.3em; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-top: 36px; }
.about-grid .item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px; }
.about-grid .item .k { font-size: 0.82rem; color: var(--text-mute); }
.about-grid .item .v { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; margin-top: 4px; }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-mute); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }

/* ===== 页脚 ===== */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--border); margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 2fr; gap: 40px; padding: 56px 24px 40px; }
.footer-brand .footer-title { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; margin-top: 12px; }
.footer-brand .footer-sub { color: var(--text-soft); font-size: 0.92rem; margin-top: 6px; max-width: 280px; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.footer-col h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); margin-bottom: 14px; }
.footer-col a { display: block; color: var(--text-soft); font-size: 0.92rem; padding: 4px 0; transition: color 0.2s; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-top: 1px solid var(--border); flex-wrap: wrap; gap: 8px; }
.footer-bottom p { font-size: 0.85rem; color: var(--text-mute); }
.footer-quote { font-family: var(--serif); font-style: italic; }

/* ===== 回到顶部 ===== */
.back-to-top { position: fixed; right: 24px; bottom: 24px; width: 46px; height: 46px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-soft); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.3s; z-index: 90; }
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { color: var(--accent); border-color: var(--accent); }

/* ===== 进入动画 ===== */
.fade-up { animation: fadeUp 0.6s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.stagger > * { animation: fadeUp 0.6s ease both; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.12s; }
.stagger > *:nth-child(3) { animation-delay: 0.19s; }
.stagger > *:nth-child(4) { animation-delay: 0.26s; }
.stagger > *:nth-child(5) { animation-delay: 0.33s; }
.stagger > *:nth-child(6) { animation-delay: 0.4s; }

/* ===== 响应式 ===== */
@media (max-width: 860px) {
  .featured-card { grid-template-columns: 1fr; }
  .featured-card .card-cover { min-height: 200px; }
  .featured-card .card-body { padding: 28px; }
  .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav-menu {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    flex-direction: column; gap: 0; padding: 8px 0;
    transform: translateY(-130%); transition: transform 0.3s ease;
    box-shadow: var(--shadow);
  }
  .nav-menu.open { transform: translateY(0); }
  .nav-menu a { padding: 14px 24px; border-radius: 0; }
  .menu-toggle { display: inline-flex; }
  .hero { padding: 56px 0 40px; }
  .hero-stats { gap: 28px; }
  .section { padding: 48px 0; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
  .article-body { font-size: 1rem; }
}
@media (max-width: 480px) {
  .container { padding: 0 18px; }
  .footer-cols { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}
