/* ==========================================================================
   components.css — 按钮 / 标签 / 卡片 / 图位 / 手风琴 / 榜单行 / 二维码 / 步骤
   组件的断点覆盖紧跟在组件定义之后（同一个文件），否则会被后在的 blocks.css 盖掉
   ========================================================================== */

/* ---------- 眉标 & 区块标题 ---------- */
.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--brand-ink);
}

.section-title {
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
}

.section-lead {
  max-width: 640px;
  font-size: var(--fs-lead);
  line-height: 1.78;
  color: var(--text-body);
}

.section-head--center .section-lead {
  margin-inline: auto;
}

/* ---------- 徽标胶囊 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 13px;
  border-radius: var(--r-pill);
  background: var(--brand-surface);
  color: var(--brand-deep);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge--plain {
  background: var(--bg-soft);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text-body);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 24px;
  border-radius: var(--r-md);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  transition: background-color var(--duration) ease, color var(--duration) ease,
    box-shadow var(--duration) ease, transform var(--duration) ease;
}

.btn svg {
  flex: 0 0 auto;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
}

.btn--primary:hover {
  background: var(--brand-hover);
}

.btn--ghost {
  background: #fff;
  color: var(--text);
  /* 用 inset 描边，不用 border：1px 实边框会把按钮撑高 2px，和实心按钮对不齐 */
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.btn--ghost:hover {
  box-shadow: inset 0 0 0 1px var(--text-muted);
}

.btn--dark {
  background: var(--bg-dark);
  color: #fff;
}

.btn--dark:hover {
  background: #000;
}

.btn--on-brand {
  background: #fff;
  color: var(--brand-deep);
}

.btn--on-brand:hover {
  background: #ffe5e7;
}

.btn--sm {
  padding: 10px 16px;
  font-size: 13.5px;
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn:active {
  transform: translateY(1px);
}

/* 文字箭头链接 */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand-ink);
  white-space: nowrap;
}

.arrow-link:hover {
  color: var(--brand-hover);
}

.arrow-link svg {
  transition: transform var(--duration) ease;
}

.arrow-link:hover svg {
  transform: translateX(3px);
}

/* ---------- 筛选片 ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: color var(--duration) ease, background-color var(--duration) ease,
    box-shadow var(--duration) ease;
}

.pill:hover {
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--text-muted);
}

.pill[aria-pressed="true"] {
  background: var(--brand);
  box-shadow: none;
  color: #fff;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* ---------- 卡片 ---------- */
.card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-7);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.card__title {
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.card__text {
  font-size: 14px;
  line-height: 1.72;
  color: var(--text-body);
}

.card--flat {
  background: var(--bg-soft);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------- 图标块 ---------- */
.icon-tile {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 11px;
  background: var(--brand-surface);
  color: var(--brand-mark);
}

.icon-tile svg {
  width: 22px;
  height: 22px;
}

.icon-tile--sm {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.icon-tile--sm svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 560px) {
  .card {
    padding: var(--sp-5);
  }
  .icon-tile {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }
  .icon-tile svg {
    width: 20px;
    height: 20px;
  }
}

/* ---------- 封面卡 ---------- */
.work {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.work__cover {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 10px;
  background: #f4f4f5;
  box-shadow: inset 0 0 0 1px rgba(24, 24, 27, 0.06);
}

.work__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 260ms ease;
}

/* 卡片为纯展示（不外跳），不再提供可点击的 hover 反馈 */

.work__title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.work__meta {
  font-size: var(--fs-xs);
  line-height: 1.4;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 720px) {
  .work__title {
    font-size: 13px;
  }
  .work__meta {
    font-size: 11.5px;
  }
}

/* ---------- 手风琴 ---------- */
.qa {
  display: block;
  border-top: 1px solid var(--line);
}

.qa__sum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: 22px 0;
  cursor: pointer;
  list-style: none;
}

.qa__sum::-webkit-details-marker {
  display: none;
}

.qa__q {
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}

.qa__icon {
  position: relative;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
}

.qa__icon::before,
.qa__icon::after {
  content: "";
  position: absolute;
  background: var(--brand-mark);
  border-radius: 1px;
  transition: transform var(--duration) ease;
}

.qa__icon::before {
  top: 8px;
  left: 1px;
  right: 1px;
  height: 2px;
}

.qa__icon::after {
  top: 1px;
  bottom: 1px;
  left: 8px;
  width: 2px;
}

.qa[open] .qa__icon::after {
  transform: scaleY(0);
}

.qa__a {
  max-width: var(--w-prose);
  padding-bottom: var(--sp-6);
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--text-body);
}

.qa__a a {
  color: var(--brand-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 720px) {
  .qa__sum {
    padding: 18px 0;
    gap: var(--sp-4);
  }
  .qa__q {
    font-size: 15px;
  }
  .qa__a {
    font-size: 14px;
  }
}

/* ---------- 榜单行：名次 + 封面 + 书名/题材/简介 ---------- */
.rank-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: rank;
}

.rank-row {
  display: grid;
  grid-template-columns: 54px 56px minmax(0, 1fr);
  align-items: center;
  gap: var(--sp-4);
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
}

.rank-row__no {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text-muted);
  line-height: 1;
  text-align: center;
}

/* 前三名用品牌色，一眼能看出是头部 */
.rank-row:nth-child(-n + 3) .rank-row__no {
  color: var(--brand-mark);
}

.rank-row__cover {
  display: block;
  width: 56px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-soft);
}

.rank-row__cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.rank-row__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.rank-row__title {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 标题不可点击（纯展示），无 hover 反馈 */

.rank-row__meta {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row__desc {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .rank-row {
    grid-template-columns: 34px 48px minmax(0, 1fr);
    gap: var(--sp-3);
    padding-block: 12px;
  }
  .rank-row__no {
    font-size: 19px;
  }
  .rank-row__cover {
    width: 48px;
  }
  .rank-row__title {
    font-size: 15px;
  }
  .rank-row__meta,
  .rank-row__desc {
    font-size: 11.5px;
  }
}

/* 紧凑版：首页预览用，只有「名次 + 书名 + 题材」三列，不带封面 */
.rank-row--compact {
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: var(--sp-4);
  padding-block: 15px;
}

.rank-row__tag {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .rank-row--compact {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: var(--sp-3);
    padding-block: 13px;
  }
  .rank-row__tag {
    font-size: 11.5px;
  }
}

/* ---------- 题材入口 ---------- */
.tag-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-2);
}

.tag-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
}

.tag-link:hover {
  color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.tag-link span {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 加载更多 ---------- */
.load-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-7);
}

.load-more__hint {
  font-size: 13px;
  color: var(--text-muted);
}

.load-more[hidden] {
  display: none;
}

/* ---------- 二维码 ---------- */
.qr-plate {
  display: block;
  flex: 0 0 auto;
  width: 150px;
  padding: 8px;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.qr-plate img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

.qr-plate--sm {
  width: 116px;
}

/* ---------- 步骤 ---------- */
.steps {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: start;
}

.step__no {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-surface);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.step__text {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-body);
}

.step__text b {
  color: var(--text);
  font-weight: 600;
}

.on-dark .step__no,
.section--brand .step__no,
.dl-band .step__no {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.on-dark .step__text,
.section--brand .step__text,
.dl-band .step__text {
  color: rgba(255, 255, 255, 0.92);
}

.on-dark .step__text b,
.section--brand .step__text b,
.dl-band .step__text b {
  color: #fff;
}

/* ---------- 说明条 ---------- */
.note {
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  background: var(--bg-soft);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--fs-sm);
  line-height: 1.7;
  color: var(--text-body);
}

.note b {
  color: var(--text);
  font-weight: 600;
}

/* ---------- 元信息行 ---------- */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.meta-row > * + *::before {
  content: "·";
  margin-right: var(--sp-3);
  color: var(--line-strong);
}

.on-dark .meta-row,
.section--brand .meta-row {
  color: rgba(255, 255, 255, 0.78);
}

.on-dark .meta-row > * + *::before,
.section--brand .meta-row > * + *::before {
  color: rgba(255, 255, 255, 0.4);
}
