/* ============ 基础 ============ */
:root {
  --bg: #faf9f6;
  --bg-card: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #6b6b6b;
  --ink-faint: #9c9c9c;
  --line: #e8e5df;
  --accent: #b5502a;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

/* ============ 头部 ============ */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 6vw;
  position: sticky;
  top: 0;
  background: rgba(250, 249, 246, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  border-bottom: 1px solid var(--line);
}

.logo {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.logo-dot { color: var(--accent); }

.site-nav { display: flex; gap: 32px; }

.site-nav a {
  font-size: 0.9rem;
  color: var(--ink-soft);
  transition: color 0.25s;
  position: relative;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 1px;
  background: var(--ink);
  transition: width 0.3s ease;
}

.site-nav a:hover { color: var(--ink); }
.site-nav a:hover::after { width: 100%; }
.site-nav a.active { color: var(--ink); }
.site-nav a.active::after { width: 100%; background: var(--accent); }

/* ============ 布局 ============ */
.container { max-width: 1200px; margin: 0 auto; padding: 60px 6vw 100px; }

.page-head { margin-bottom: 48px; }

.page-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.page-sub { color: var(--ink-faint); font-size: 0.95rem; }

/* ============ 筛选 ============ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.filter-btn {
  font-family: var(--sans);
  font-size: 0.82rem;
  padding: 6px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.25s;
}

.filter-btn:hover { border-color: var(--ink); color: var(--ink); }

.filter-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* ============ 卡片网格 ============ */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 40px 32px;
}

.post-card {
  display: block;
  animation: rise 0.6s ease both;
}

.post-card .cover {
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 18px;
  position: relative;
}

.post-card .cover img,
.post-card .cover .cover-ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 无图文章的渐变占位 */
.cover-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 2.4rem;
  color: rgba(255, 255, 255, 0.85);
}

.post-card:hover .cover img,
.post-card:hover .cover .cover-ph {
  transform: scale(1.04);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-bottom: 8px;
}

.post-tag {
  color: var(--accent);
  letter-spacing: 0.05em;
}

.post-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 8px;
  transition: color 0.25s;
}

.post-card:hover .post-title { color: var(--accent); }

.post-excerpt {
  font-size: 0.9rem;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============ 文章页 ============ */
.article-wrap { max-width: 720px; margin: 0 auto; }

.article-head { margin-bottom: 48px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }

.article-title {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  line-height: 1.4;
  margin: 16px 0 20px;
}

.article-body {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 2;
  letter-spacing: 0.01em;
}

.article-body p { margin-bottom: 1.6em; }
.article-body h2 {
  font-size: 1.4rem;
  margin: 2.2em 0 1em;
}
.article-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 20px;
  margin: 1.8em 0;
  color: var(--ink-soft);
}
.article-body code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 0.88em;
  background: #efece6;
  padding: 2px 6px;
  border-radius: 3px;
}
.article-body pre {
  background: #1e1e1e;
  color: #e6e6e6;
  padding: 20px 24px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.8em 0;
}
.article-body pre code { background: transparent; padding: 0; }

.article-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 72px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.article-nav a { color: var(--ink-soft); transition: color 0.25s; }
.article-nav a:hover { color: var(--accent); }

.back-link {
  display: inline-block;
  margin-bottom: 40px;
  font-size: 0.85rem;
  color: var(--ink-faint);
  transition: color 0.25s;
}

.back-link:hover { color: var(--ink); }

/* ============ 关于页 ============ */
.about-wrap { max-width: 640px; margin: 0 auto; }

.about-text {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 2;
}

.about-text p { margin-bottom: 1.6em; }

/* ============ 页脚 ============ */
.site-footer {
  padding: 36px 6vw;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.site-footer a { color: var(--ink-soft); border-bottom: 1px solid var(--line); }

/* ============ 动画 ============ */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ 响应式 ============ */
@media (max-width: 640px) {
  .site-header { padding: 20px 5vw; }
  .container { padding: 40px 5vw 80px; }
  .post-grid { gap: 36px 24px; grid-template-columns: 1fr; }
}
