/* components.css — 分类页与详情页新增组件（颜色/字号/圆角一律用 tokens.css） */

/* 通用工具 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] { display: none !important; }

/* 页头滚动边界（三页共用） */
.site-header.is-scrolled { box-shadow: 0 8px 24px rgba(76, 83, 45, .07); }

/* 面包屑 */
.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.crumb span[aria-hidden] { color: var(--line-strong); }

/* 列表页标题区 */
.page-hero {
  padding: 30px 0 26px;
  background:
    radial-gradient(90% 150% at 88% 0%, rgba(233, 236, 216, .75) 0%, rgba(252, 245, 228, 0) 62%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.page-hero h1 {
  font-family: var(--font-serif);
  font-size: 44px;
  line-height: 1.2;
  letter-spacing: -.01em;
}
.page-lead { margin-top: 10px; max-width: 720px; font-size: 15px; line-height: 1.75; color: var(--muted); }

/* 筛选与排序 */
.filter-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  background: rgba(252, 245, 228, .96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font-size: 12.8px;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--white); font-weight: 600; }
.filter-right { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.sort-wrap { display: block; }
.sort-wrap select {
  min-height: 34px;
  padding: 0 30px 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background:
    linear-gradient(45deg, transparent 50%, var(--accent-dark) 50%) calc(100% - 15px) 14px / 5px 5px no-repeat,
    linear-gradient(135deg, var(--accent-dark) 50%, transparent 50%) calc(100% - 10px) 14px / 5px 5px no-repeat,
    var(--surface-2);
  color: var(--ink-2);
  font-size: 12.8px;
  appearance: none;
  cursor: pointer;
}
.result-count { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* 列表卡片 */
.listing { padding: 28px 0 40px; }
.list-head { display: flex; align-items: baseline; gap: 16px; }
.list-head h2 { font-size: 26px; line-height: 1.25; font-weight: 700; }
.list-head p { font-size: 13.5px; color: var(--muted); }
.list-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.list-card {
  display: flex;
  flex-direction: column;
  min-height: 200px;
  padding: 20px 20px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.list-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.list-thumb {
  display: block;
  margin: -20px -20px 14px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--accent-soft);
  border-radius: var(--r-3) var(--r-3) 0 0;
}
.list-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.list-card:hover .list-thumb img { transform: scale(1.04); }
.list-card .tag { align-self: flex-start; }
.list-card h3 {
  margin: 10px 0 7px;
  font-size: 19px;
  line-height: 1.42;
  font-weight: 700;
}
.list-card h3 a:hover { color: var(--accent-dark); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.list-card p { font-size: 13.3px; line-height: 1.7; color: var(--muted); }
.list-card .meta {
  margin-top: auto;
  padding-top: 13px;
  font-size: 11.3px;
  color: var(--muted-2);
  border-top: 1px dashed var(--line);
}
.empty-state {
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-3);
  font-size: 13.5px;
}

/* 分页 */
.pager {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.pager-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.pager-btn.is-active { background: var(--accent); border-color: var(--accent); color: var(--white); }
.pager-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  color: var(--muted-2);
  font-size: 13px;
}
.pager-info { margin-left: 6px; font-size: 12px; color: var(--muted); }

/* 三步核对 */
.guide { padding: 34px 0 36px; background: var(--accent-soft-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.guide-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.guide-step {
  position: relative;
  padding: 22px 22px 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
}
.guide-step::before {
  display: block;
  margin-bottom: 8px;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--accent);
}
.guide-step:nth-child(1)::before { content: "01"; }
.guide-step:nth-child(2)::before { content: "02"; }
.guide-step:nth-child(3)::before { content: "03"; }
.guide-step h3 { font-size: 17px; line-height: 1.4; font-weight: 700; }
.guide-step p { margin-top: 7px; font-size: 13px; line-height: 1.7; color: var(--muted); }

/* 分类说明 */
.cat-desc { padding: 40px 0; }
.cat-desc-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 34px; align-items: start; }
.cat-desc h2 { font-size: 24px; line-height: 1.3; font-weight: 700; padding-top: 2px; }
.cat-desc [data-content="list-description"] p {
  font-size: 14.8px;
  line-height: 1.95;
  color: var(--ink-2);
  max-width: 920px;
}

/* 继续看 */
.continue { padding: 4px 0 52px; }
.continue-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.continue-card {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.continue-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.continue-card h3 { font-size: 17px; font-weight: 700; }
.continue-card p { margin-top: 5px; font-size: 12.8px; line-height: 1.55; color: var(--muted); }
.continue-card span { margin-top: 12px; font-size: 12px; font-weight: 600; color: var(--accent-dark); }

/* 详情页 */
.article-head {
  padding: 30px 0 30px;
  background:
    radial-gradient(80% 160% at 92% 0%, rgba(233, 236, 216, .8) 0%, rgba(252, 245, 228, 0) 60%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.article-head-inner { max-width: 1040px; }
.article-head h1 {
  margin-top: 2px;
  font-family: var(--font-serif);
  font-size: 42px;
  line-height: 1.3;
  letter-spacing: -.01em;
}
.article-meta { margin-top: 12px; font-size: 12px; letter-spacing: .03em; color: var(--muted); }
.article-lead { margin-top: 12px; max-width: 820px; font-size: 15.5px; line-height: 1.8; color: var(--ink-2); }

.article-layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 52px;
  align-items: start;
  padding: 38px 0 46px;
}
.toc-panel {
  position: sticky;
  top: calc(var(--header-h) + 22px);
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
}
.toc-progress { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; margin-bottom: 14px; }
.toc-progress span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .12s linear; }
.toc-panel h2 { font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.toc-panel nav { margin-top: 10px; display: flex; flex-direction: column; }
.toc-panel nav a {
  padding: 7px 9px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.toc-panel nav a:hover { color: var(--accent-dark); background: var(--surface-2); }
.toc-panel nav a[aria-current="true"] { color: var(--accent-dark); border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.toc-all { display: block; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11.8px; font-weight: 600; color: var(--accent-dark); }

.article { max-width: 820px; }
.article section { padding: 0 0 26px; margin-bottom: 26px; border-bottom: 1px solid var(--line); counter-increment: sec; }
.article section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.article { counter-reset: sec; }
.article h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--font-serif);
  font-size: 26px;
  line-height: 1.4;
  font-weight: 700;
  color: var(--ink);
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.article h2::before {
  content: counter(sec, decimal-leading-zero);
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: .06em;
  flex: 0 0 auto;
}
.article p { margin-top: 10px; font-size: 16px; line-height: 1.95; color: var(--ink-2); }
.article p::first-letter { letter-spacing: .01em; }
.article-figure {
  margin: 16px 0 0;
  overflow: hidden;
  border-radius: var(--r-3);
  border: 1px solid var(--line);
  background: var(--accent-soft);
}
.article-figure img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }

/* 相关阅读 */
.related { padding: 4px 0 54px; border-top: 1px solid var(--line); }
.related .section-head { padding-top: 30px; }
.related-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.related-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  min-height: 104px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  transition: transform .18s ease, box-shadow .18s ease;
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.related-card .thumb { display: block; height: 100%; overflow: hidden; background: var(--accent-soft); }
.related-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-body { padding: 11px 13px 10px; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.related-body .tag { font-size: 9.8px; }
.related-body h3 { margin-top: 5px; font-size: 13.5px; line-height: 1.42; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-body p { margin-top: 3px; font-size: 11.2px; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 响应式 */
@media (max-width: 1080px) {
  .filter-bar { top: var(--header-h); }
  .list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .related-grid { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; gap: 22px; }
  .toc-panel { position: static; }
  .toc-panel nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; }
  .toc-all { margin-top: 8px; }
}

@media (max-width: 720px) {
  .page-hero { padding: 24px 0 20px; }
  .page-hero h1 { font-size: 34px; }
  .page-lead { font-size: 14px; }
  .filter-bar { flex-direction: column; align-items: stretch; gap: 10px; padding: 11px 0; }
  .filter-chips { gap: 6px; }
  .chip { min-height: 32px; padding: 0 11px; font-size: 11.8px; }
  .filter-right { justify-content: space-between; }
  .list-head { flex-direction: column; gap: 3px; align-items: flex-start; }
  .list-grid { grid-template-columns: 1fr; gap: 12px; }
  .list-card { min-height: 0; padding: 17px 16px 13px; }
  .guide-grid { grid-template-columns: 1fr; gap: 10px; }
  .cat-desc { padding: 30px 0; }
  .cat-desc-grid { grid-template-columns: 1fr; gap: 12px; }
  .cat-desc [data-content="list-description"] p { font-size: 14px; line-height: 1.85; }
  .continue-grid { grid-template-columns: 1fr; gap: 10px; }
  .article-head { padding: 22px 0 24px; }
  .article-head h1 { font-size: 30px; }
  .article-lead { font-size: 14.5px; }
  .article-layout { padding: 24px 0 34px; }
  .toc-panel nav { grid-template-columns: 1fr; }
  .article h2 { font-size: 22px; }
  .article p { font-size: 15.2px; line-height: 1.9; }
  .related-card { grid-template-columns: 100px minmax(0, 1fr); }
}
