/* 共用组件：三页共享（首页 + 分类页 + 详情页）。首页专用样式在 style.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;
}

/* 面包屑 */
.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 18px 0 0;
  font-size: var(--fs-2);
  color: var(--muted);
}
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb li { display: inline-flex; align-items: center; gap: 8px; }
.crumb li + li::before { content: "/"; color: #b3bdcb; }
.crumb [aria-current="page"] { color: var(--ink-2); }

/* 分类页页头 */
.page-hero { padding: 20px 0 26px; border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: 40px; font-weight: 700; color: var(--ink); letter-spacing: 0.01em; line-height: 1.25; }
.page-hero .count { margin-top: 10px; font-size: var(--fs-3); color: var(--accent); font-weight: 600; }
.page-hero .lead { margin-top: 12px; max-width: 720px; font-size: 15px; line-height: 1.85; color: var(--ink-3); }

/* 筛选排序条 */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.toolbar-label { font-size: var(--fs-2); font-weight: 600; color: var(--muted); }
label.toolbar-label { cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: #fff;
  color: var(--ink-2);
  font-size: var(--fs-3);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--dur) ease, color var(--dur) ease, background-color var(--dur) ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
a.chip { text-decoration: none; display: inline-block; }
.chip.is-active,
a.chip.is-active:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.toolbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.select-wrap { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.select-wrap svg { width: 14px; height: 14px; color: var(--muted); }
.select {
  appearance: none;
  padding: 6px 30px 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: #fff url("../images/ui-chevron-down.svg") no-repeat right 10px center / 12px auto;
  font-family: inherit;
  font-size: var(--fs-3);
  color: var(--ink-2);
  cursor: pointer;
}
.result-count { font-size: var(--fs-2); color: var(--muted); white-space: nowrap; }

/* 列表标题行 */
.list-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; padding: 20px 0 0; }
.list-head h2 { font-size: 22px; font-weight: 700; color: var(--ink); }
.list-count { font-size: var(--fs-2); font-weight: 600; color: var(--accent); }
.list-order { font-size: var(--fs-2); color: var(--muted); }

/* 列表卡 */
.list-item { display: block; min-width: 0; }
.list-item[hidden] { display: none; }
.list-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 26px 0 8px;
}
.list-grid[hidden] { display: none; }
.list-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  overflow: hidden;
  transition: transform var(--dur) ease, box-shadow var(--dur) ease;
}
.list-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.list-thumb { aspect-ratio: 16 / 10; background: #f8fafc; overflow: hidden; }
.list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.list-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.list-tag { font-size: var(--fs-1); font-weight: 700; color: var(--accent); letter-spacing: 0.04em; }
.list-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-summary {
  font-size: var(--fs-2);
  line-height: 1.72;
  color: var(--muted);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-spec { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: var(--fs-1); color: var(--ink-3); }

/* 分页 */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 26px 0 6px;
  font-size: var(--fs-3);
}
.pager a,
.pager .pager__current,
.pager .pager__dots {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: #fff;
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color var(--dur) ease, color var(--dur) ease;
}
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager .pager__current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pager .pager__dots { border-color: transparent; background: transparent; color: var(--muted); }
.pager .pager__step { padding: 0 14px; }
.pager .pager__info { margin-left: auto; font-size: var(--fs-2); color: var(--muted); white-space: nowrap; }

.empty-state { padding: 40px 0; font-size: var(--fs-3); color: var(--muted); }

/* 分类说明（data-content="list-description"） */
.list-desc {
  margin: 34px 0 10px;
  padding: 30px 0 6px;
  border-top: 1px solid var(--line);
  max-width: 860px;
}
.list-desc h2 { font-size: 24px; font-weight: 700; color: var(--ink); margin-bottom: 14px; }
.list-desc p { font-size: 15px; line-height: 1.95; color: var(--ink-3); }
.list-desc p + p { margin-top: 12px; }

/* 详情页 */
.detail-hero { padding: 6px 0 0; }
.detail-head { padding: 18px 0 26px; border-bottom: 1px solid var(--line); }
.detail-head h1 { font-size: 44px; font-weight: 700; color: var(--ink); line-height: 1.2; letter-spacing: 0.01em; }
.detail-meta { margin-top: 12px; font-size: var(--fs-3); color: var(--accent); font-weight: 600; }
.detail-lead { margin-top: 12px; max-width: 760px; font-size: 16px; line-height: 1.9; color: var(--ink-3); }
.detail-lead p + p { margin-top: 8px; }

.detail-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 760px) 1fr;
  gap: 40px;
  align-items: start;
  padding: 28px 0 10px;
}

.toc { position: sticky; top: 82px; }
.toc h2 { font-size: var(--fs-3); font-weight: 700; color: var(--ink); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.toc ol { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: block;
  padding: 5px 0 5px 26px;
  position: relative;
  font-size: var(--fs-2);
  line-height: 1.5;
  color: var(--ink-3);
  text-decoration: none;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 5px;
  font-size: 11px;
  color: var(--muted);
}
.toc a:hover { color: var(--accent); }
.toc a[aria-current="true"] { color: var(--accent); font-weight: 600; }
.toc-toggle { display: none; cursor: pointer; }

.article { min-width: 0; }
.article h2 { font-size: 25px; font-weight: 700; color: var(--ink); line-height: 1.45; margin: 30px 0 12px; scroll-margin-top: 84px; }
.article h2:first-of-type { margin-top: 8px; }
.article p { font-size: 15.5px; line-height: 1.95; color: var(--ink-3); }
.article p + p { margin-top: 10px; }
.article-figure {
  margin: 20px 0 24px;
  border-radius: var(--r-2);
  overflow: hidden;
  background: var(--bg-soft);
}
.article-figure img { display: block; width: 100%; max-width: 100%; height: auto; }

.spec-table-wrap { margin: 4px 0 22px; overflow-x: auto; }
.spec-table { width: 100%; border-collapse: collapse; font-size: var(--fs-2); }
.spec-table caption { text-align: left; font-size: var(--fs-3); font-weight: 700; color: var(--ink); padding-bottom: 8px; }
.spec-table th, .spec-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.spec-table th { width: 42%; font-weight: 600; color: var(--ink-2); background: var(--bg-soft); }
.spec-table td { color: var(--ink-3); }

.detail-aside { position: sticky; top: 82px; }
.aside-card { padding: 18px; background: var(--bg-soft); border-radius: var(--r-2); }
.aside-card h2 { font-size: var(--fs-3); color: var(--ink); font-weight: 700; }
.aside-card p { margin-top: 8px; font-size: var(--fs-1); line-height: 1.75; color: var(--muted); }
.aside-card .btn { margin-top: 14px; height: 38px; font-size: var(--fs-2); }
.aside-image { margin: 0 0 16px; border-radius: var(--r-2); overflow: hidden; }
.aside-image img { width: 100%; height: auto; }

/* 相关条目 */
.related { padding: 28px 0 34px; border-top: 1px solid var(--line); margin-top: 24px; }
.related h2 { font-size: 22px; font-weight: 700; color: var(--ink); }
.related-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.related-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  text-decoration: none;
  background: #fff;
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}
.related-card:hover { border-color: var(--accent); box-shadow: var(--shadow-card); }
.related-thumb { width: 96px; height: 68px; flex: none; border-radius: var(--r-1); overflow: hidden; background: var(--bg-soft); }
.related-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-name { display: block; font-size: 15px; font-weight: 700; color: var(--ink); }
.related-note { display: block; margin-top: 3px; font-size: var(--fs-1); line-height: 1.6; color: var(--muted); }

@media (max-width: 1080px) {
  .list-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-body { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .toc { position: static; margin-bottom: 18px; }
  .toc h2 { display: none; }
  .toc-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--on-dark); font-family: inherit; font-size: var(--fs-3); color: var(--ink); cursor: pointer; }
  .toc ol { display: none; }
  .toc.open ol { display: flex; }
  .detail-aside { position: static; display: none; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .page-hero h1 { font-size: 30px; }
  .list-grid { grid-template-columns: 1fr; }
  .detail-head h1 { font-size: 32px; }
  .detail-head { padding-top: 10px; }
  .related-grid { grid-template-columns: 1fr; }
  .toolbar { gap: 12px; }
  .toolbar-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .chips { max-width: 100%; }
  .pager .pager__info { width: 100%; margin-left: 0; }
}
