/* ============================================================
   组件与版式（§7.4 呼吸节奏）+ 留白
   ============================================================ */

/* ---------- 页头 / 导航 ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-nav {
  margin: 0 auto;
  padding: calc(var(--gap) * 1.5) calc(var(--gap) * 3);
  display: flex;
  align-items: center;
  gap: calc(var(--gap) * 3);
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
}
.nav-links {
  list-style: none;
  display: flex;
  gap: calc(var(--gap) * 3);
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--ink-body);
  font-size: 16px;
}
.nav-links a.active,
.nav-links a:hover { color: var(--clay-text); text-decoration: none; }

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: calc(var(--gap) * 2);
}
.view-switcher {
  display: flex;
  gap: var(--gap);
}
.view-switcher a {
  color: var(--ink-muted);
  font-size: 14px;
  padding-bottom: 2px;
}
.view-switcher a.active {
  color: var(--ink);
  border-bottom: 2px solid var(--clay);
}
.theme-toggle {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-body);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font-sans);
}

/* ---------- 主区域 ---------- */
.site-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(var(--gap) * 6) calc(var(--gap) * 3) calc(var(--gap) * 10);
  min-height: 60vh;
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: calc(var(--gap) * 6) calc(var(--gap) * 3);
  color: var(--ink-muted);
  font-size: 14px;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--gap) * 3);
  justify-content: space-between;
  align-items: center;
}
.site-footer a { color: var(--ink-muted); }
.site-footer a:hover { color: var(--clay-text); }

/* ---------- 卡片（3 变体） ---------- */
.entry-card {
  display: block;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
  transition: border-color .2s ease;
}
.entry-card:hover { border-color: var(--clay); text-decoration: none; }
.entry-card .cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: saturate(0.85);
  background: var(--paper-sunk);
}
.entry-card--original .cover { filter: none; }
.entry-card .body { padding: calc(var(--gap) * 2); }
.entry-card .title { font-family: var(--font-serif); color: var(--ink); font-size: 19px; margin: 0 0 var(--gap) 0; }
.entry-card .summary { color: var(--ink-muted); font-size: 14px; margin: 0; }

/* 紧凑变体（档案表） */
.entry-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: calc(var(--gap) * 2);
  align-items: baseline;
  padding: calc(var(--gap) * 1.5) 0;
  border-bottom: 1px solid var(--rule);
}
.entry-row .date { color: var(--ink-muted); font-size: 14px; }
.entry-row .title { color: var(--ink); }
.entry-row .meta { color: var(--ink-muted); font-size: 13px; white-space: nowrap; }

/* ---------- 徽标 / 标签 ---------- */
.type-badge, .stage-badge, .tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  line-height: 1;
}
.type-badge {
  color: var(--ink-muted);
  font-family: var(--font-sans);
}
.stage-badge { color: var(--clay-text); }
.stage-badge svg { width: 14px; height: 14px; }
.tag-chip {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--clay-text);
  background: var(--paper-sunk);
}
.tag-chip:hover { text-decoration: none; border-color: var(--clay); }

/* ---------- 网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: calc(var(--gap) * 3);
}
.archive-table { margin-top: calc(var(--gap) * 3); }

/* ---------- 年表 ---------- */
.timeline-year {
  font-family: var(--font-serif);
  font-size: 30px;
  color: var(--ink);
  margin: calc(var(--gap) * 5) 0 calc(var(--gap) * 2);
  border-bottom: 2px solid var(--clay);
  display: inline-block;
}
.timeline-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: calc(var(--gap) * 2);
  padding: calc(var(--gap) * 2) 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}

/* ---------- 详情页 ---------- */
.detail-header { margin-bottom: calc(var(--gap) * 4); }
.detail-title { font-size: 44px; }
.detail-meta { color: var(--ink-muted); font-size: 14px; display: flex; gap: calc(var(--gap)*2); flex-wrap: wrap; align-items: center; }
.prose { max-width: var(--measure); }
.prose img { margin: calc(var(--gap)*3) 0; border-radius: var(--radius); }
.prose h2 { font-size: 26px; }
.prose h3 { font-size: 21px; }

/* 诗：留白 60% */
.poem {
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 2.0;
  white-space: pre-wrap;
  max-width: 36em;
  margin: 0 auto;
}

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1000;
  flex-direction: column;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 82vh; object-fit: contain; }
.lightbox .lb-close, .lightbox .lb-nav {
  position: absolute; color: #fff; background: transparent; border: 0;
  font-size: 32px; cursor: pointer; padding: 12px;
}
.lightbox .lb-close { top: 8px; right: 12px; }
.lightbox .lb-prev { left: 8px; top: 50%; }
.lightbox .lb-next { right: 8px; top: 50%; }

/* 视频封面懒加载 */
.video-poster {
  position: relative; cursor: pointer; aspect-ratio: 16/9;
  background: var(--paper-sunk); display: flex; align-items: center; justify-content: center;
  color: var(--ink-muted);
}
.video-poster .play { width: 64px; height: 64px; border-radius: 50%; background: var(--clay); color:#fff; display:flex; align-items:center; justify-content:center; font-size:28px; }

/* 表单（后台） */
.field { margin-bottom: calc(var(--gap)*3); }
.field label { display:block; font-size:14px; color: var(--ink-muted); margin-bottom: var(--gap); }
.field input, .field textarea, .field select {
  width: 100%; padding: calc(var(--gap)*1.5); font: inherit;
  background: var(--paper); color: var(--ink-body);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
.btn {
  display:inline-block; padding: calc(var(--gap)*1.5) calc(var(--gap)*3);
  background: var(--clay); color:#fff; border:0; border-radius: var(--radius);
  cursor:pointer; font: inherit; text-decoration:none;
}
.btn:hover { text-decoration:none; opacity:.92; }
.btn-ghost { background: transparent; color: var(--clay-text); border:1px solid var(--rule); }

/* 空态 */
.empty { color: var(--ink-muted); padding: calc(var(--gap)*6) 0; text-align:center; }

/* 筛选条 */
.filter-bar { display:flex; flex-wrap:wrap; gap: var(--gap); margin-bottom: calc(var(--gap)*3); align-items:center; }
.filter-bar select { padding: 6px 10px; border:1px solid var(--rule); border-radius: var(--radius); background: var(--paper); color: var(--ink-body); font: inherit; }

/* 首屏自画像（hero .fact/.poem-line/.bio 已并入 home.css 的降级视图作用域） */
.facets { list-style:none; display:flex; gap: calc(var(--gap)*4); padding:0; justify-content:center; }
.facets a { font-family: var(--font-serif); font-size: 30px; color: var(--ink); }
.facets a:hover { color: var(--clay-text); text-decoration:none; }

.now-list { list-style: none; padding: 0; }
.now-list li { padding: var(--gap) 0; border-bottom: 1px solid var(--rule); }

.writing-list { display:flex; flex-direction:column; gap: calc(var(--gap)*3); max-width: var(--measure); }
.poem-wrap { max-width: 40em; margin: 0 auto; }
.photo-gallery { display:grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: calc(var(--gap)*2); margin: calc(var(--gap)*3) 0; }
.photo-gallery img { width:100%; border-radius: var(--radius); cursor: zoom-in; background: var(--paper-sunk); }

.meta-table { width:100%; border-collapse: collapse; margin: calc(var(--gap)*2) 0; }
.meta-table th, .meta-table td { text-align:left; padding: calc(var(--gap)*1.5); border-bottom: 1px solid var(--rule); }
.meta-table th { color: var(--ink-muted); font-weight:400; }

.empty { color: var(--ink-muted); padding: calc(var(--gap)*4) 0; }

/* 后台 */
.admin-nav { list-style:none; padding:0; display:flex; flex-direction:column; gap: var(--gap); }
.admin-nav a { color: var(--clay-text); }
.admin-list { list-style:none; padding:0; }
.admin-list li { padding: calc(var(--gap)*1.5) 0; border-bottom: 1px solid var(--rule); display:flex; gap: calc(var(--gap)*2); align-items:center; }
.admin-list .grow { flex:1; }

/* ============================================================
   首页重设计（区块 1–11）— 纸/墨重述，全部走 tokens.css
   硬约束：--clay 仅用于 ≥16px 标题/分割线/图标/色块；小字强调用 --clay-text
   ============================================================ */

.site-main section { margin-bottom: calc(var(--gap) * 8); }
.site-main section:last-child { margin-bottom: calc(var(--gap) * 4); }

/* ---- 1. 开场并置 ---- */
.hero-open {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--gap) * 5);
  flex-wrap: wrap;
  text-align: center;
}
.hero-copy { max-width: 640px; }
.tagline {
  color: var(--clay-text);
  font-size: 18px;
  line-height: 1.6;
  margin: calc(var(--gap) * 1.5) 0;
}
.hero-avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 2px solid var(--clay);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow);
  background: var(--paper-sunk);
}
.hero-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- 内联图标（IconSprite via <use>） ---- */
.ic {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.15em;
}

/* ---- 信条（motto） ---- */
.motto {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  border-left: 3px solid var(--clay);
  padding: calc(var(--gap) * 2) calc(var(--gap) * 3);
  background: var(--paper-sunk);
  border-radius: var(--radius);
  margin-top: calc(var(--gap) * 6);
}
.motto-en { font-family: var(--font-serif); font-size: 20px; color: var(--ink); line-height: 1.5; }
.motto-zh { font-size: 14px; color: var(--ink-muted); }

/* ---- 四切面：移动端 2×2 ---- */
.facets { flex-wrap: wrap; }
.facets li { flex: 1 1 30%; text-align: center; min-width: 120px; }

/* ---- scroll-reveal 淡入（仅在 .js 可用时启用初始隐藏） ---- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
.js .reveal.in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================================================
   响应式（≤640px）：头像缩小、开场竖排、四切面 2×2
   ============================================================ */
@media (max-width: 640px) {
  .hero-avatar { width: 120px; height: 120px; }
  .hero-open { flex-direction: column; gap: calc(var(--gap) * 3); }
  .tagline { font-size: 16px; }
  .facets li { flex: 1 1 45%; }
}
