/* 个人知识文库 · 静态站样式
   设计方向：纸感底色 + 墨色文字 + 青绿点缀，适合长时间阅读 */

:root {
  --paper: #f6f3ec;
  --paper-deep: #efe9de;
  --card: #fffdf8;
  --ink: #22262b;
  --ink-soft: #4d5560;
  --ink-faint: #7b8490;
  --line: #e2dbcd;
  --accent: #1f6b62;
  --accent-soft: #e3f0ec;
  --accent-dark: #154d46;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --radius: 14px;
  --shadow: 0 18px 40px -28px rgba(40, 45, 50, 0.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 12% -8%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

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

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

.page-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px 72px;
}

/* 顶部 */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 22px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #f7f4ed;
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 2px;
  box-shadow: 0 10px 24px -16px rgba(31, 107, 98, 0.8);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-family: var(--serif); font-size: 19px; letter-spacing: 0.5px; }
.brand-text small { color: var(--ink-faint); font-size: 12px; letter-spacing: 0.4px; }

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

.site-nav a {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-soft);
  border: 1px solid transparent;
  transition: 0.2s ease;
}

.site-nav a:hover {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: rgba(31, 107, 98, 0.18);
}

.site-main { padding-top: 44px; }

/* 首页 Hero */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding: 10px 0 46px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 600;
  letter-spacing: 1px;
  line-height: 1.25;
}

.hero-sub { margin: 14px 0 0; color: var(--ink-soft); font-size: 15px; letter-spacing: 0.6px; }

.hero-stats { display: flex; gap: 10px; flex-shrink: 0; }

.stat {
  min-width: 92px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  text-align: center;
}

.stat-num { display: block; font-family: var(--serif); font-size: 26px; color: var(--accent-dark); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--ink-faint); letter-spacing: 1px; }

/* 区块标题 */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.6px;
}

.section-head h2 a { border-bottom: 2px solid transparent; transition: border-color 0.2s; }
.section-head h2 a:hover { border-color: var(--accent); }

.section-note { margin: 6px 0 0; color: var(--ink-faint); font-size: 13px; }

.section-actions { display: flex; align-items: center; gap: 14px; }
.count { color: var(--ink-faint); font-size: 13px; letter-spacing: 0.5px; white-space: nowrap; }

.more-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-dark);
  font-size: 14px;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(31, 107, 98, 0.35);
  transition: 0.2s;
}

.more-link:hover { border-color: var(--accent); color: var(--accent); }

/* 精选 */
.featured-section { padding-bottom: 52px; }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.featured-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s;
}

.featured-card:hover {
  transform: translateY(-3px);
  border-color: rgba(31, 107, 98, 0.35);
  box-shadow: 0 26px 48px -30px rgba(24, 60, 56, 0.5);
}

.featured-cover { aspect-ratio: 16 / 9; background: var(--paper-deep); overflow: hidden; }
.featured-cover img { width: 100%; height: 100%; object-fit: cover; }

.featured-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 8px; }
.featured-body h3 { margin: 2px 0 0; font-family: var(--serif); font-size: 19px; line-height: 1.45; }
.featured-body p { margin: 0; color: var(--ink-soft); font-size: 13.5px; line-height: 1.7; }

.tag {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.meta { color: var(--ink-faint); font-size: 12px; letter-spacing: 0.4px; }

/* 分类区块 */
.category-stack { display: flex; flex-direction: column; gap: 54px; }

.category-block {
  padding-top: 34px;
  border-top: 1px dashed var(--line);
}

.article-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.article-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s, box-shadow 0.2s;
}

.article-card:hover {
  transform: translateY(-2px);
  border-color: rgba(31, 107, 98, 0.3);
  box-shadow: var(--shadow);
}

.article-card-cover { aspect-ratio: 16 / 9; overflow: hidden; background: var(--paper-deep); }
.article-card-cover img { width: 100%; height: 100%; object-fit: cover; }

.article-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.article-card-body h3 { margin: 0; font-family: var(--serif); font-size: 17px; line-height: 1.5; }
.article-card-body p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-hint {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink-faint);
  text-align: center;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.45);
}

/* 面包屑 / 页面标题 */
.breadcrumb {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink-faint);
  font-size: 13px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-current { color: var(--ink-soft); max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page-head { padding-bottom: 30px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.page-head h1 { margin: 0 0 10px; font-family: var(--serif); font-size: clamp(30px, 4vw, 40px); font-weight: 600; }
.page-head p { margin: 0 0 10px; color: var(--ink-soft); font-size: 14.5px; }

/* 分类目录列表 */
.article-list { display: flex; flex-direction: column; }

.article-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 22px 6px;
  border-bottom: 1px solid var(--line);
  transition: background 0.2s, padding 0.2s;
}

.article-row:hover { background: rgba(255, 253, 248, 0.85); padding-left: 14px; padding-right: 14px; }

.row-index { font-family: var(--serif); font-size: 22px; color: var(--accent); opacity: 0.75; }
.row-main h2 { margin: 0 0 4px; font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.45; }
.row-main p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row-date { color: var(--ink-faint); font-size: 12px; letter-spacing: 0.4px; white-space: nowrap; }

.back-line { margin-top: 40px; font-size: 14px; color: var(--ink-faint); }
.back-line a:hover { color: var(--accent); }

/* 文章详情 */
.article-detail { max-width: 820px; }

.article-head h1 {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.5px;
}

.article-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-bottom: 26px; border-bottom: 1px solid var(--line); }

.article-cover { margin: 30px 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }

.prose { padding: 30px 0 10px; font-size: 16px; color: #2b3138; }

.prose h2, .prose h3, .prose h4 {
  font-family: var(--serif);
  margin: 1.9em 0 0.7em;
  line-height: 1.45;
}

.prose h2 { font-size: 24px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 19px; }
.prose p { margin: 0 0 1.15em; }
.prose img { border-radius: 10px; margin: 26px auto; border: 1px solid var(--line); }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.15em; }
.prose li { margin-bottom: 0.4em; }
.prose blockquote {
  margin: 1.4em 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
  color: var(--accent-dark);
}
.prose pre {
  background: #23292f;
  color: #e8eef2;
  padding: 18px 20px;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
}
.prose code { font-family: "JetBrains Mono", Consolas, monospace; font-size: 0.92em; }
.prose :not(pre) > code {
  background: var(--paper-deep);
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--accent-dark);
}
.prose table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.prose th { background: var(--paper-deep); }
.prose a { color: var(--accent-dark); border-bottom: 1px solid rgba(31, 107, 98, 0.4); }

.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 48px; }

.nav-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  transition: 0.2s;
}

.nav-card:hover { border-color: rgba(31, 107, 98, 0.35); transform: translateY(-1px); }
.nav-next { text-align: right; }
.nav-label { font-size: 12px; color: var(--ink-faint); letter-spacing: 1px; }
.nav-title { font-family: var(--serif); font-size: 15px; }

/* 图库 */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.gallery-item {
  position: relative;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper-deep);
  cursor: zoom-in;
  aspect-ratio: 4 / 3;
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }

.gallery-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 12px;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(to top, rgba(20, 24, 28, 0.72), rgba(20, 24, 28, 0));
  text-align: left;
  letter-spacing: 0.4px;
}

.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 44px; flex-wrap: wrap; }

.page-btn, .page-num {
  min-width: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
  transition: 0.18s;
}

.page-btn:hover, .page-num:hover { border-color: var(--accent); color: var(--accent-dark); }
.page-num.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn.disabled { opacity: 0.45; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(18, 22, 26, 0.86);
  backdrop-filter: blur(6px);
  padding: 30px;
}

.lightbox[hidden] { display: none; }
.lightbox-inner { max-width: 92vw; max-height: 88vh; text-align: center; }
.lightbox-inner img { max-height: 78vh; margin: 0 auto; border-radius: 10px; object-fit: contain; }
.lightbox-inner p { color: #dbe2e6; font-size: 12px; margin-top: 12px; }

.lightbox-close {
  position: fixed;
  top: 22px;
  right: 26px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

/* 404 */
.not-found { padding: 90px 0; text-align: center; }
.not-found-code { margin: 0; font-family: var(--serif); font-size: 72px; color: var(--accent); letter-spacing: 6px; }
.not-found h1 { font-family: var(--serif); font-size: 26px; margin: 12px 0 10px; }
.not-found p { color: var(--ink-faint); margin-bottom: 26px; }

/* 页脚 */
.site-footer {
  margin-top: 72px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.site-footer p { margin: 0; }
.footer-meta { letter-spacing: 0.5px; }

/* 图片渐显 */
img[loading="lazy"] { opacity: 0; transition: opacity 0.5s ease; }
img[loading="lazy"].loaded { opacity: 1; }

@media (max-width: 860px) {
  .page-shell { padding: 0 20px 56px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 26px; }
  .hero-stats { width: 100%; }
  .stat { flex: 1; min-width: 0; }
  .site-header { flex-wrap: wrap; gap: 16px; }
  .article-row { grid-template-columns: 42px 1fr; }
  .row-date { display: none; }
  .article-nav { grid-template-columns: 1fr; }
  .nav-next { text-align: left; }
  .featured-grid, .article-cards { grid-template-columns: 1fr; }
}
