/* ==========================================================================
   components.css — 内页组件（分类页 / 详情页）
   只引用 tokens.css 的变量，不写字面色值。
   复用 style.css 的：.container .site-header .header-inner .brand .site-nav
                      .header-cta .menu-toggle .btn .site-footer .footer-* .cat-*
   ========================================================================== */

/* ------------------------------------------------------------ 面包屑 */
.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-meta);
  color: var(--ink-muted);
  padding-top: 26px;
}

.crumb a { color: var(--ink-muted); }
.crumb a:hover, .crumb a:focus-visible { color: var(--green-soft); }
.crumb .sep { color: var(--ink-faint); }
.crumb [aria-current="page"] { color: var(--ink-strong); }

/* ------------------------------------------------------- 分类页页头 */
.list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px;
  gap: 0 40px;
  align-items: start;
  padding: 18px 0 26px;
}

.list-head h1 {
  font-size: 52px;
  font-weight: var(--fw-black);
  line-height: 1.1;
  letter-spacing: -1px;
  color: var(--ink-strong);
}

.list-lead {
  margin-top: 12px;
  max-width: 760px;
  font-size: var(--fs-body-lg);
  line-height: 1.85;
  color: var(--ink-muted);
}

.list-head-rule {
  align-self: stretch;
  width: 1px;
  background: var(--line);
}

/* ------------------------------------------------------ 筛选与排序 */
.filters {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.filters-label {
  font-size: var(--fs-meta);
  font-weight: var(--fw-bold);
  letter-spacing: 0.6px;
  color: var(--ink-faint);
}

.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-chip {
  padding: 6px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-small);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-chip:hover { border-color: var(--green-soft); color: var(--green-soft); }

.filter-chip[aria-pressed="true"],
.filter-chip.is-active {
  background: var(--green);
  border-color: var(--green);
  color: var(--ink-invert);
}

.filter-chip.is-active:hover { color: var(--ink-invert); }

.filter-count {
  font-size: var(--fs-small);
  color: var(--green-soft);
  font-weight: var(--fw-medium);
  min-width: 62px;
  text-align: right;
}

/* ------------------------------------------------------- 网格上方注记 */
.grid-note {
  padding-top: 20px;
  font-size: var(--fs-small);
  color: var(--ink-muted);
}

/* ------------------------------------------------------------ 列表网格 */
.list-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  padding: 12px 0 8px;
}

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

.list-card:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }

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

.list-media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-card); }
.list-media img { width: 100%; height: 100%; object-fit: cover; }

.list-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }

.list-tag {
  align-self: flex-start;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-chip);
  font-size: 10.5px;
  color: var(--green-soft);
}

.list-body h3 {
  margin-top: 8px;
  font-size: var(--fs-title-sm);
  font-weight: var(--fw-black);
  color: var(--ink-strong);
  line-height: 1.4;
}

.list-body h3 a:hover, .list-body h3 a:focus-visible { color: var(--green-soft); }

.list-summary {
  margin-top: 6px;
  font-size: var(--fs-small);
  line-height: 1.75;
  color: var(--ink-muted);
}

.list-specs {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  gap: 6px;
  font-size: var(--fs-caption);
  color: var(--ink-faint);
}

/* ------------------------------------------------------------- 空状态 */
.empty-state {
  display: none;
  padding: 42px 0 46px;
  text-align: center;
  color: var(--ink-muted);
}

.empty-state.is-visible { display: block; }

.empty-state p { font-size: var(--fs-body-lg); }

.empty-state button {
  margin-top: 12px;
  padding: 8px 20px;
  border: 1px solid var(--green-soft);
  border-radius: var(--radius-pill);
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-small);
  color: var(--green-soft);
  cursor: pointer;
}

.empty-state button:hover { background: var(--green); color: var(--ink-invert); border-color: var(--green); }

/* --------------------------------------------------------- 分类说明长文 */
.list-desc {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0 44px;
  padding: 30px 0 34px;
  border-top: 1px solid var(--line);
}

.list-desc h2 {
  font-size: 26px;
  font-weight: var(--fw-black);
  letter-spacing: -0.6px;
  color: var(--ink-strong);
  line-height: 1.25;
}

.list-desc-body p {
  font-size: var(--fs-body-lg);
  line-height: 1.95;
  color: var(--ink);
}

.list-desc-body p + p { margin-top: 18px; }

/* ------------------------------------------------------- 其他分类入口 */
.rel-cats { padding: 26px 0 34px; border-top: 1px solid var(--line); }

.rel-cats h2 {
  font-size: 20px;
  font-weight: var(--fw-black);
  color: var(--ink-strong);
}

.rel-cat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 14px;
}

.rel-cat-list a {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: var(--fs-body-lg);
  color: var(--ink);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.rel-cat-list a:hover, .rel-cat-list a:focus-visible {
  color: var(--green-soft);
  border-bottom-color: var(--green-soft);
}

.rel-cat-list a[aria-current="page"] { color: var(--green-soft); font-weight: var(--fw-medium); }

.rel-cat-list .kw { font-size: var(--fs-caption); color: var(--ink-faint); }

/* ------------------------------------------------------------ 详情页 */
.article-wrap {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 0 48px;
  align-items: start;
  padding: 22px 0 40px;
}

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

.article-head h1 {
  font-size: 42px;
  font-weight: var(--fw-black);
  line-height: 1.15;
  letter-spacing: -0.8px;
  color: var(--ink-strong);
}

.article-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: var(--fs-meta);
  color: var(--ink-muted);
}

.article-meta .dot { color: var(--ink-faint); }

.article-note {
  margin-top: 10px;
  font-size: var(--fs-caption);
  color: var(--ink-faint);
}

/* 目录 */
.toc {
  position: sticky;
  top: 84px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card-alt);
}

.toc-title {
  font-size: var(--fs-caption);
  font-weight: var(--fw-black);
  letter-spacing: 1.4px;
  color: var(--ink-faint);
}

.toc-list { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }

.toc-list a {
  display: block;
  padding: 5px 6px;
  border-left: 2px solid transparent;
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--ink-muted);
}

.toc-list a:hover, .toc-list a:focus-visible { color: var(--green-soft); }

.toc-list a.is-active {
  border-left-color: var(--accent-strong);
  color: var(--ink-strong);
  font-weight: var(--fw-medium);
  background: var(--bg-note);
}

.toc-toggle { display: none; cursor: pointer; }

.toc-arrow { width: 11px; height: 8px; transition: transform 0.18s ease; }

.toc[data-open="true"] .toc-arrow { transform: rotate(180deg); }

/* 正文 */
.article { padding-top: 6px; }

.article-body h2 {
  margin-top: 30px;
  font-size: 24px;
  font-weight: var(--fw-black);
  line-height: 1.35;
  letter-spacing: -0.4px;
  color: var(--ink-strong);
  scroll-margin-top: 8px;
}

.article-body p {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.95;
  color: var(--ink);
}

.article-body p:first-of-type { margin-top: 6px; }

.article-body .lead {
  margin-top: 18px;
  font-size: var(--fs-body-lg);
  color: var(--ink-muted);
}

/* 规格表 */
.spec-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: var(--fs-body);
}

.spec-table caption {
  caption-side: top;
  text-align: left;
  padding-bottom: 8px;
  font-size: var(--fs-caption);
  color: var(--ink-faint);
}

.spec-table th, .spec-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.spec-table th {
  width: 38%;
  font-weight: var(--fw-medium);
  color: var(--ink-muted);
  background: var(--bg-card-alt);
}

.spec-table td { color: var(--ink-strong); text-align: right; }

/* 相关条目 */
.related { padding: 26px 0 34px; border-top: 1px solid var(--line); }

.related h2 { font-size: 20px; font-weight: var(--fw-black); color: var(--ink-strong); }

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

.related-card {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: var(--bg-card-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.related-card:hover { box-shadow: var(--shadow-card); }

.related-media { width: 84px; flex: none; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius-xs); }
.related-media img { width: 100%; height: 100%; object-fit: cover; }

.related-body h3 { font-size: var(--fs-small); font-weight: var(--fw-bold); color: var(--ink-strong); }
.related-body p { margin-top: 4px; font-size: var(--fs-caption); line-height: 1.6; color: var(--ink-muted); }

/* ------------------------------------------------------- 无图占位 */
.media-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 84px;
  background: var(--bg-card);
  font-size: 44px;
  line-height: 1;
}

/* --------------------------------------------------------- 空态链接 */
.empty-link {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 20px;
  border: 1px solid var(--green-soft);
  border-radius: var(--radius-pill);
  font-size: var(--fs-small);
  color: var(--green-soft);
}

.empty-link:hover, .empty-link:focus-visible {
  background: var(--green);
  border-color: var(--green);
  color: var(--ink-invert);
}

/* ------------------------------------------------------------- 分页 */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 26px 0 8px;
  font-size: var(--fs-small);
}

.pager a, .pager-current {
  min-width: 34px;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  text-align: center;
  color: var(--ink);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.pager a:hover, .pager a:focus-visible { border-color: var(--green-soft); color: var(--green-soft); }

.pager-current {
  background: var(--green);
  border-color: var(--green);
  color: var(--ink-invert);
  font-weight: var(--fw-medium);
}

.pager-gap { padding: 0 2px; color: var(--ink-faint); }

.pager-info { margin-left: auto; color: var(--ink-muted); }

/* --------------------------------------------------- 正文插图 */
.article-figure {
  margin: 18px 0 4px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.article-figure img { width: 100%; height: auto; display: block; }

/* ------------------------------------------------- 上一篇 / 下一篇 */
.article-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 22px 0 4px;
  border-top: 1px solid var(--line);
}

.article-nav-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card-alt);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.article-nav-item:hover, .article-nav-item:focus-visible {
  border-color: var(--green-soft);
  box-shadow: var(--shadow-card);
}

.article-nav-item--next { text-align: right; }

.article-nav-label { font-size: var(--fs-caption); color: var(--ink-faint); }

.article-nav-title {
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
  color: var(--ink-strong);
  line-height: 1.5;
}

/* ------------------------------------------------------------ 响应式 */
@media (max-width: 1199px) {
  .list-head { grid-template-columns: 1fr; padding-bottom: 20px; }
  .list-head-rule { display: none; }
  .list-head h1 { font-size: 40px; }
  .list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-desc { grid-template-columns: 1fr; gap: 14px; }
  .article-wrap { grid-template-columns: 1fr; gap: 0; }
  .toc { position: static; margin-bottom: 18px; padding: 12px 14px; }
  .toc-toggle {
    display: flex;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: var(--fs-small);
    font-weight: var(--fw-bold);
    color: var(--ink-strong);
    cursor: pointer;
  }
  .toc[data-open="false"] .toc-list { display: none; }
  .toc-title { display: none; }
  .article-head h1 { font-size: 34px; }
  .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .list-head h1 { font-size: 32px; }
  .list-grid { grid-template-columns: 1fr; }
  .filters { gap: 10px; }
  .filter-count { margin-left: auto; }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav-item--next { text-align: left; }
  .article-head h1 { font-size: 28px; }
  .article-body h2 { font-size: 20px; margin-top: 24px; }
  .article-body p { font-size: 15px; line-height: 1.9; }
  .spec-table th, .spec-table td { padding: 8px 10px; font-size: var(--fs-small); }
}
