/* ==========================================================================
   components.css — 内页（category.html / detail.html）组件
   只放内页新增组件；页面框架（.site-header / .container / .btn / .section /
   .section-title / .tag / .site-footer）直接复用 style.css，不复制
   颜色、字号、圆角一律走 tokens.css 的 var(--…)
   ========================================================================== */

/* ---------------------------------------------------------- 通用小件 */
.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-3);
  color: var(--muted-2);
}
.crumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.crumb a { color: var(--muted-2); }
.crumb a:hover { color: var(--accent-dark); }
.crumb span[aria-current] { color: var(--ink); }
.crumb li { display: flex; align-items: center; gap: 6px; }
.crumb-sep { color: var(--muted-light); }

/* 锚点目标的滚定位，避开粘顶头部 */
[id] { scroll-margin-top: 84px; }

/* ------------------------------------------------------ 列表页标题区 */
.page-hero {
  padding: 96px 0 26px;
  background: var(--paper);
}
.page-hero h1 {
  margin-top: 12px;
  font-size: var(--fs-21);
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.page-lead {
  max-width: 680px;
  margin-top: 14px;
  font-size: var(--fs-11);
  line-height: var(--lh-loose);
  color: #3f4d56;
}
.page-hero .crumb { margin-bottom: 2px; }

/* 分类导航条：7 个一级分类互相切换 */
.cat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.cat-strip a {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--fs-4);
  color: var(--ink-soft);
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}
.cat-strip a:hover { border-color: var(--accent); color: var(--accent-dark); }
.cat-strip a[aria-current="page"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-dark);
}

/* ------------------------------------------------------- 筛选与排序条 */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  background: rgba(247, 246, 243, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.toolbar-label {
  font-size: var(--fs-3);
  color: var(--muted);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 1;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--fs-4);
  font-family: inherit;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-dark);
}
.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: var(--fs-3);
  color: var(--muted);
}
.sort-wrap label { cursor: pointer; }
.sort-wrap select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--fs-4);
  color: var(--ink);
  cursor: pointer;
}
.result-count { font-size: var(--fs-3); color: var(--muted-2); }

/* --------------------------------------------------------- 列表卡片 */
.list-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px 24px;
  padding: 28px 0 8px;
}
.list-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-5);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.list-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.list-card[hidden] { display: none; }
.list-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
}
.list-card__media {
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--image-placeholder);
  overflow: hidden;
}
.list-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.list-card:hover .list-card__media img { transform: scale(1.04); }
.list-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 18px;
}
.tag--data::after { content: attr(data-tag); }
.list-card__meta {
  order: -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-1);
  color: var(--muted-2);
}
.list-card__title {
  font-size: var(--fs-9);
  line-height: var(--lh-title);
  font-weight: 700;
  color: var(--ink);
}
.list-card:hover .list-card__title { color: var(--accent-dark); }
.list-card__summary {
  font-size: var(--fs-3);
  line-height: 1.7;
  color: var(--muted-2);
}
.empty-state {
  padding: 48px 0 56px;
  text-align: center;
  font-size: var(--fs-8);
  color: var(--muted);
}
.empty-state[hidden] { display: none; }

/* ------------------------------------------------------ 列表说明区块 */
.list-seo {
  padding: 36px 0 48px;
  border-top: 1px solid var(--line);
}
.list-seo h2 {
  font-size: var(--fs-14);
  font-weight: 700;
  margin-bottom: 14px;
}
.list-seo p {
  max-width: 860px;
  font-size: var(--fs-9);
  line-height: 1.95;
  color: #33424b;
}

/* ------------------------------------------------------------ 详情页 */
.article { padding: 96px 0 56px; }
.article-head { max-width: 800px; margin-inline: auto; }
.article-kicker--spaced { margin-top: 14px; }
.article-kicker {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-2);
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-size: var(--fs-1);
  font-weight: 600;
}
.article-title {
  margin-top: 14px;
  font-size: var(--fs-21);
  line-height: 1.24;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.article-lead {
  margin-top: 16px;
  font-size: var(--fs-11);
  line-height: 1.85;
  color: #3f4d56;
}

/* 长文目录 */
.toc {
  max-width: 800px;
  margin: 26px auto 0;
  padding: 18px 22px;
  background: var(--paper-2);
  border-radius: var(--r-5);
}
.toc h2 {
  font-size: var(--fs-3);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.toc ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-6);
  color: var(--ink-soft);
}
.toc a { color: var(--ink-soft); }
.toc a:hover { color: var(--accent-dark); }
.toc a[aria-current="true"] { color: var(--accent-dark); font-weight: 600; }

/* 正文 */
.article-body {
  max-width: 800px;
  margin: 34px auto 0;
}
.article-body h2 {
  margin: 38px 0 14px;
  font-size: var(--fs-16);
  line-height: 1.4;
  font-weight: 700;
  color: var(--ink);
}
.article-body h2:first-child { margin-top: 0; }
.article-body p {
  margin-top: 14px;
  font-size: var(--fs-10);
  line-height: 1.95;
  color: #33424b;
}
.article-body ul {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-left: 20px;
  list-style: disc;
  font-size: var(--fs-10);
  line-height: 1.9;
  color: #33424b;
}
.article-body ul::marker { color: var(--accent); }

/* 相关阅读 */
.related {
  max-width: 800px;
  margin: 48px auto 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.related h2 {
  font-size: var(--fs-8);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 14px;
}
.related ul { display: grid; gap: 10px; }
.related li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  font-size: var(--fs-8);
  color: var(--ink);
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.related li a:hover { border-color: var(--accent); transform: translateX(2px); }
.related li a::after {
  content: "→";
  color: var(--accent);
  font-size: var(--fs-6);
}

/* ------------------------------------------------------------ 响应式 */
@media (max-width: 1240px) {
  .list-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .page-hero { padding: 78px 0 20px; }
  .page-hero h1 { font-size: var(--fs-18); }
  .page-lead { font-size: var(--fs-8); }
  .toolbar { gap: 10px; padding: 10px 0; }
  .sort-wrap { margin-left: 0; }
  .list-grid { grid-template-columns: 1fr; gap: 20px; }
  .list-seo { padding: 26px 0 34px; }
  .list-seo h2 { font-size: var(--fs-6); }
  .list-seo p { font-size: var(--fs-5); }
  .article { padding: 78px 0 40px; }
  .article-title { font-size: var(--fs-16); }
  .article-lead { font-size: var(--fs-8); }
  .article-body p,
  .article-body ul { font-size: var(--fs-6); line-height: 1.9; }
  .article-body h2 { font-size: var(--fs-14); margin-top: 30px; }
  .toc { padding: 14px 16px; }
}

/* ------------------------------------------------------ 数据对接补充 */
.list-card__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.list-card__summary {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.article-body figure { margin: 24px 0 6px; }
.article-body figure img {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--r-5);
  border: 1px solid var(--line);
}
.article-body figure figcaption { margin-top: 8px; font-size: 12px; color: var(--muted-2); }
.article-body .article-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  font-size: 54px;
  background: var(--image-placeholder);
  border-radius: var(--r-5);
  margin: 24px 0 6px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 34px 0 6px;
}
.pager a, .pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  color: var(--ink-soft);
  font-size: 13px;
}
.pager [aria-current="page"] { border-color: var(--accent); color: var(--accent-dark); }
.article-body .pager { justify-content: space-between; }
.article-body .pager a {
  max-width: 48%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
