/* components.css — 内页组件（分类页 / 详情页），颜色、字号、圆角一律走 tokens.css
   直接复用 style.css 的：.site-header .main-nav .brand .btn .site-footer .container */

/* ------------------------------------------------------------ 面包屑 */

.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-4);
  color: var(--muted);
}

.crumb a { color: var(--ink-soft); border-bottom: 1px solid transparent; }
.crumb a:hover { color: var(--accent); border-color: var(--accent); }
.crumb span[aria-hidden="true"] { color: var(--line-strong); }
.crumb [aria-current="page"] { color: var(--accent); }

/* ------------------------------------------------------------ 分类页头 */

.page-hero {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  padding: 30px 0 34px;
}

.page-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 40px;
  align-items: end;
  margin-top: 20px;
}

.page-hero h1 {
  font-size: var(--fs-19);
  font-size: clamp(30px, 3.2vw, 42px);
  font-weight: var(--fw-black);
  line-height: 1.15;
  letter-spacing: -.02em;
}

.page-hero-sub {
  margin-top: 8px;
  font-size: var(--fs-11);
  font-weight: var(--fw-medium);
  color: var(--muted);
}

.page-hero-lead {
  margin-top: 14px;
  max-width: 62ch;
  font-size: var(--fs-7);
  line-height: 1.85;
  color: var(--muted);
}

.page-meta {
  display: grid;
  gap: 8px;
  padding-left: 22px;
  border-left: 1px solid var(--line-strong);
  font-size: var(--fs-5);
  color: var(--muted);
}

.page-meta strong {
  display: block;
  font-size: var(--fs-17);
  font-weight: var(--fw-black);
  color: var(--ink);
  line-height: 1.2;
}

/* ------------------------------------------------------------ 筛选排序条 */

.toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  background: rgba(247, 244, 240, .96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.toolbar-inner {
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: 58px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.toolbar-label {
  font-size: var(--fs-2);
  letter-spacing: .12em;
  color: var(--muted);
  flex: 0 0 auto;
  white-space: nowrap;
}

.filter-tags,
.sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.sort-group { margin-left: 0; }

.chip {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 6px 14px;
  font: inherit;
  font-size: var(--fs-4);
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: color .18s, border-color .18s, background-color .18s;
}

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

.chip[aria-pressed="true"] {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--ink-invert);
}

.result-count {
  font-size: var(--fs-4);
  color: var(--muted);
  white-space: nowrap;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------ 卡片网格 */

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.list-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 22px 22px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  transition: background-color .2s, border-color .2s, transform .2s;
}

.list-card:hover {
  background: var(--panel);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.list-card[hidden] { display: none; }

.card-tag {
  align-self: flex-start;
  padding: 2px 9px;
  font-size: var(--fs-1);
  letter-spacing: .08em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-tag);
}

.list-card h3 {
  font-size: var(--fs-11);
  line-height: 1.45;
  font-weight: var(--fw-bold);
}

.list-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.list-card p {
  font-size: var(--fs-5);
  line-height: 1.72;
  color: var(--muted);
}

.card-arrow {
  margin-top: auto;
  padding-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-4);
  color: var(--accent);
}

.card-arrow svg { width: 12px; height: 12px; }

.empty-state {
  margin-top: 24px;
  padding: 40px 0;
  font-size: var(--fs-7);
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-card);
  text-align: center;
}

.empty-state[hidden] { display: none; }

/* ------------------------------------------------------------ 分类说明 */

.list-seo {
  max-width: 78ch;
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.list-seo h2 { font-size: var(--fs-17); font-weight: var(--fw-black); }

.list-seo p {
  margin-top: 12px;
  font-size: var(--fs-7);
  line-height: 1.9;
  color: var(--ink-soft);
}

.list-seo a { color: var(--accent); border-bottom: 1px solid var(--line-strong); }
.list-seo a:hover { border-color: var(--accent); }

/* ------------------------------------------------------------ 相邻分类 / 相关条目 */

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  transition: border-color .2s, background-color .2s;
}

.related-card:hover { border-color: var(--line-strong); }

.related-card h3 { font-size: var(--fs-10); font-weight: var(--fw-bold); }

.related-card p {
  font-size: var(--fs-4);
  line-height: 1.65;
  color: var(--muted);
}

/* ------------------------------------------------------------ 详情页头 */

.article-head {
  padding: 26px 0 30px;
  border-bottom: 1px solid var(--line);
}

.article-head-main { max-width: 900px; margin-top: 18px; }

.article-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: var(--fs-2);
  letter-spacing: .08em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-tag);
}

.article-head h1 {
  margin-top: 12px;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.28;
  font-weight: var(--fw-black);
  letter-spacing: -.02em;
}

.deck {
  margin-top: 14px;
  font-size: var(--fs-11);
  line-height: 1.8;
  color: var(--ink-soft);
  max-width: 62ch;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 18px;
  font-size: var(--fs-4);
  color: var(--muted);
}

.article-meta span { display: inline-flex; align-items: center; gap: 6px; }
.article-meta span + span::before { content: "·"; color: var(--line-strong); }

/* ------------------------------------------------------------ 正文 + 目录 */

.article-layout {
  display: grid;
  grid-template-columns: var(--toc-width) minmax(0, 1fr) 258px;
  gap: 48px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 38px 0 46px;
  align-items: start;
}

.toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  padding: 18px 18px 20px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.toc h2 {
  font-size: var(--fs-2);
  letter-spacing: .14em;
  color: var(--muted);
  font-weight: var(--fw-medium);
}

.toc ol { margin-top: 12px; display: grid; gap: 9px; counter-reset: toc; }

.toc li { counter-increment: toc; }

.toc a {
  display: block;
  padding-left: 20px;
  position: relative;
  font-size: var(--fs-4);
  line-height: 1.55;
  color: var(--ink-soft);
  border-bottom: 0;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  font-size: var(--fs-1);
  color: var(--line-strong);
  letter-spacing: .04em;
}

.toc a:hover,
.toc a[aria-current="true"] { color: var(--accent); }

.article {
  max-width: none;
}

/* 右侧「关键数字」栏：数值全部来自正文，不额外造数据 */
.keyfacts {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--panel);
}

.keyfacts h2 {
  font-size: var(--fs-2);
  letter-spacing: .14em;
  color: var(--muted);
  font-weight: var(--fw-medium);
}

.keyfacts dl { margin-top: 14px; display: grid; gap: 12px; }

.keyfacts dt {
  font-size: var(--fs-11);
  font-weight: var(--fw-bold);
  color: var(--accent);
  line-height: 1.3;
}

.keyfacts dd {
  margin-top: 3px;
  font-size: var(--fs-2);
  line-height: 1.6;
  color: var(--muted);
}

.keyfacts > p {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-1);
  line-height: 1.65;
  color: var(--muted);
}

.article h2 {
  font-size: var(--fs-19);
  font-size: clamp(20px, 1.8vw, 25px);
  line-height: 1.4;
  font-weight: var(--fw-black);
  letter-spacing: -.015em;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.article h2 + p { margin-top: 14px; }

.article p {
  font-size: var(--fs-9);
  line-height: 1.95;
  color: var(--ink-soft);
}

.article p + p { margin-top: 14px; }

.article section + section { margin-top: 32px; }

.article strong { color: var(--ink); font-weight: var(--fw-bold); }

.article-note {
  margin-top: 34px;
  padding: 16px 20px;
  background: var(--bg-soft);
  border-left: 2px solid var(--line-strong);
  border-radius: 0 var(--r-card) var(--r-card) 0;
  font-size: var(--fs-4);
  line-height: 1.8;
  color: var(--muted);
}

/* ------------------------------------------------------------ 内页底栏区块 */

.inner-section { margin-top: 46px; padding-bottom: 54px; }

.inner-section-head h2 {
  font-size: var(--fs-18);
  font-weight: var(--fw-black);
}

.inner-section-head p {
  margin-top: 8px;
  font-size: var(--fs-6);
  color: var(--muted);
}

/* ------------------------------------------------------------ 响应式 */

@media (max-width: 1100px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-layout { grid-template-columns: 180px minmax(0, 1fr); gap: 32px; }
  .keyfacts { display: none; }
  .page-hero-grid { grid-template-columns: 1fr; gap: 22px; }
  .page-meta { grid-template-columns: repeat(2, auto); justify-content: start; border-left: 0; padding-left: 0; }
  .page-meta div { padding-left: 16px; border-left: 1px solid var(--line-strong); }
  .page-meta div:first-child { padding-left: 0; border-left: 0; }
}

@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .related-grid { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; gap: 24px; padding-top: 26px; }
  .toc { position: static; }
  .toolbar-inner { gap: 12px 18px; }
  .sort-group { margin-left: 0; }
}

@media (max-width: 620px) {
  .card-grid { grid-template-columns: 1fr; }
  .page-hero h1 { font-size: 30px; }
  .article-head h1 { font-size: 26px; }
  .toolbar { position: static; }
  .toolbar-inner { flex-wrap: nowrap; overflow-x: auto; padding: 10px 0; scrollbar-width: thin; gap: 10px; }
  .filter-tags, .sort-group { flex-wrap: nowrap; }
  .toolbar-right { margin-left: 0; gap: 8px; }
  .toolbar-label { display: none; }
  .result-count { display: none; }
}

/* ------------------------------------------------------------ 正文配图 */

.article-figure {
  margin: 0 0 28px;
  overflow: hidden;
  border-radius: var(--r-card);
  background: var(--line);
}

.article-figure img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
