/* components.css — 分类页 / 详情页复用组件
   与首页共用 tokens.css 的变量，不允许出现第二套颜色/字号字面量。 */

/* ------------------------------------------------------------ page hero */
.crumb-top {
  padding-top: 18px;
  margin-bottom: 0;
}

.page-hero {
  padding: 22px 0 24px;
  background: linear-gradient(180deg, #eef1e2 0%, #fbfbfa 100%);
  border-bottom: 1px solid var(--line-soft);
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted-2);
  margin-bottom: 12px;
}
.crumb a:hover { color: var(--green); text-decoration: underline; }
.crumb span[aria-hidden] { color: var(--muted-2); }

.page-hero h1 {
  font-size: 33px;
  letter-spacing: 0.01em;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--green);
}
.meta-line span { position: relative; }
.meta-line span + span::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--gold);
}

.page-hero .lead {
  margin-top: 10px;
  max-width: 76ch;
  font-size: 14px;
  line-height: 1.68;
  color: var(--body);
}

/* --------------------------------------------------------------- toolbar */
.toolbar {
  position: sticky;
  top: var(--h-header);
  z-index: 20;
  background: rgba(251, 251, 250, 0.96);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(8px);
}

.toolbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 46px;
  padding: 6px 0;
  flex-wrap: wrap;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  height: 27px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  color: var(--body);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.chip:hover { border-color: var(--green); color: var(--green); }
.chip[aria-pressed="true"],
.chip.is-active {
  background: var(--green);
  border-color: var(--green);
  color: var(--ink-invert);
}

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

.sort-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.sort-field select {
  height: 27px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
}

.result-count {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* ------------------------------------------------------------ item list */
.list-section { padding: 22px 0 8px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
/* 同一行卡片等高：li 撑满行高，内层 card 再 100% 填充 */
.card-grid > li { display: flex; }

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.card:hover {
  border-color: var(--green);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-thumb {
  display: block;
  aspect-ratio: 2.4 / 1;
  overflow: hidden;
  background: var(--bg-soft);
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.card:hover .card-thumb img { transform: scale(1.03); }

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 13px 15px 15px;
}

.card-scene {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.card h3 {
  margin-top: 4px;
  font-size: 17px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.card-spec {
  margin-top: 4px;
  font-size: 12px;
  color: var(--green);
}

.card-summary {
  margin-top: 7px;
  font-size: 12.2px;
  line-height: 1.66;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.card-more {
  margin-top: auto;
  padding-top: 9px;
  font-size: 12px;
  color: var(--green);
}
.card-more:hover { text-decoration: underline; }

.empty-state {
  display: none;
  padding: 26px 0;
  font-size: 13px;
  color: var(--muted);
}
.empty-state.is-visible { display: block; }

/* ---------------------------------------------------------------- pager */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 22px 0 6px;
  font-size: 12.5px;
}
.pager a,
.pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--body);
  background: var(--bg-card);
}
.pager a:hover { border-color: var(--green); color: var(--green); }
.pager span[aria-current="page"] {
  background: var(--green);
  border-color: var(--green);
  color: var(--ink-invert);
}
.pager .disabled { color: var(--muted-2); background: transparent; cursor: default; }
.pager .pager-gap { border-color: transparent; background: transparent; padding: 0 2px; color: var(--muted-2); }

/* -------------------------------------------------------- list description */
.list-desc {
  padding: 28px 0 10px;
  margin-top: 6px;
  border-top: 1px solid var(--line-soft);
}

.list-desc-inner {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}

.list-desc h2 {
  font-size: 21px;
  line-height: 1.4;
  position: sticky;
  top: calc(var(--h-header) + 70px);
}

.desc-body p {
  font-size: 13px;
  line-height: 1.82;
  color: var(--body);
}
.desc-body p + p { margin-top: 11px; }

/* ------------------------------------------------------------ inner cta */
.inner-cta {
  margin: 20px 0 6px;
  padding: 24px 26px;
  display: flex;
  align-items: center;
  gap: 26px;
  background: var(--green);
  border-radius: var(--radius);
  color: var(--ink-invert);
}
.inner-cta h2 {
  flex: none;
  font-size: 20px;
  color: #f5f3e3;
}
.inner-cta > p {
  flex: 1;
  font-size: 12.4px;
  line-height: 1.66;
  color: #c6d1bd;
  max-width: 52ch;
}
.inner-cta .cta-actions { display: flex; gap: 9px; flex: none; }
.inner-cta .btn { height: 34px; font-size: 12.5px; padding: 0 16px; }

/* ------------------------------------------------------------ article */
.article-topline { padding-top: 0; }

/* 正文分节图：不要整宽铺满，避免单图撑高页面 */
.body-figure {
  margin: 14px 0 4px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
}
.body-figure img {
  width: 100%;
  max-width: 560px;
  height: auto;
  object-fit: cover;
}

.prevnext {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.8px;
  color: var(--green);
}
.prevnext a:hover { text-decoration: underline; }
.prevnext span { color: var(--muted-2); }
.article-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 44px;
  align-items: start;
  padding-top: 18px;
  padding-bottom: 30px;
}

.article-head {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.kicker {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.article-head h1 {
  margin-top: 7px;
  font-size: 34px;
  line-height: 1.22;
}

.article-lead {
  margin-top: 11px;
  font-size: 14px;
  line-height: 1.76;
  color: var(--body);
}

.article-head figure {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
  aspect-ratio: 4 / 3;
}
.article-head figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.article-head figcaption {
  display: none;
}

/* spec table */
.spec-table {
  width: 100%;
  margin: 18px 0 22px;
  border-collapse: collapse;
  background: var(--bg-tint);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 12.8px;
}
.spec-table caption {
  text-align: left;
  padding: 0 0 7px;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.spec-table th,
.spec-table td {
  padding: 7px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(30, 72, 40, 0.12);
  vertical-align: top;
}
.spec-table tr:last-child th,
.spec-table tr:last-child td { border-bottom: 0; }
.spec-table th {
  width: 132px;
  font-weight: 600;
  color: var(--green-deep);
  white-space: nowrap;
}
.spec-table td { color: var(--body); }

/* article body */
.article-body h2 {
  margin: 26px 0 9px;
  font-size: 21px;
  line-height: 1.4;
  scroll-margin-top: calc(var(--h-header) + 18px);
}
.article-body h2:first-child { margin-top: 0; }
.article-body p {
  font-size: 14px;
  line-height: 1.86;
  color: var(--body);
}
.article-body p + p { margin-top: 10px; }

/* toc */
.article-aside {
  position: sticky;
  top: calc(var(--h-header) + 20px);
}
.toc {
  padding: 14px 16px;
  background: var(--bg-warm);
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
}
.toc[hidden] { display: block; }   /* 桌面端目录常显，hidden 只用于窄屏折叠 */

.toc h2 {
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}
.toc ol { counter-reset: toc; }
.toc li + li { margin-top: 2px; }
.toc-link {
  display: block;
  padding: 5px 0 5px 22px;
  position: relative;
  font-size: 12.8px;
  color: var(--body);
}
.toc-link::before {
  counter-increment: toc;
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  font-size: 11px;
  color: var(--muted-2);
}
.toc-link:hover, .toc-link.is-active { color: var(--green); font-weight: 600; }

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

/* related */
.related {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.related h2 { font-size: 18px; margin-bottom: 12px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.related-grid a {
  display: block;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease;
}
.related-grid a:hover { border-color: var(--green); }
.related-grid strong { display: block; font-family: var(--font-serif); font-size: 15px; color: var(--ink); }
.related-grid p { margin-top: 4px; font-size: 11.6px; color: var(--muted); line-height: 1.5; }

/* --------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .article-wrap { grid-template-columns: 1fr; gap: 22px; }
  .article-aside { position: static; }
  .toc-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 38px;
    padding: 0 14px;
    background: var(--bg-warm);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
  }
  .toc-toggle i {
    margin-left: auto;
    width: 12px; height: 12px;
    border-right: 1.5px solid var(--green);
    border-bottom: 1.5px solid var(--green);
    transform: rotate(45deg) translateY(-2px);
    transition: transform .18s ease;
  }
  .toc-toggle[aria-expanded="true"] i { transform: rotate(-135deg) translateY(-2px); }
  .toc { margin-top: 8px; }
  .toc[hidden] { display: none; }
  .toc h2 { display: none; }
  .list-desc-inner { grid-template-columns: 1fr; gap: 12px; }
  .list-desc h2 { position: static; }
  .body-figure img { max-width: 100%; }
}

@media (max-width: 960px) {
  .page-hero h1 { font-size: 27px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-head { grid-template-columns: 1fr; gap: 16px; }
  .inner-cta { flex-direction: column; align-items: flex-start; gap: 12px; }
  .inner-cta .cta-actions { flex-wrap: wrap; }
  .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .page-hero h1 { font-size: 24px; }
  .card-grid { grid-template-columns: 1fr; }
  .toolbar-right { width: 100%; margin-left: 0; justify-content: space-between; }
  .article-head h1 { font-size: 26px; }
  .spec-table th { width: 104px; }
  .article-body p { font-size: 13.4px; }
}
