/* 版式与页面布局：首页 / 分类页 / 详情页 */

/* ---------- 首页首屏 ---------- */
.hero {
  position: relative;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 30px;
}
.hero-copy {
  /* 左对齐容器：padding 不参与 max-width，否则宽屏下文字区被挤成一条 */
  --hero-gutter: max(0px, calc((100vw - var(--wrap)) / 2));
  padding-block: 30px;
  padding-left: var(--hero-gutter);
  padding-right: 10px;
  max-width: calc(600px + var(--hero-gutter) + 10px);
}
.hero h1 {
  font-size: var(--fs-h1);
  line-height: 1.18;
  letter-spacing: -.4px;
  margin-bottom: 16px;
}
.hero-lead {
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--ink-soft);
  max-width: 560px;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.hero-media {
  width: 100%;
  aspect-ratio: 720 / 334;
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- 通用区块 ---------- */
.section { padding-block: 17px; }
.section-tight { padding-block: 14px; }
.section-tint { background: var(--surface); }
.section-lead {
  font-size: 15.5px;
  color: var(--ink-soft);
  line-height: 1.75;
  max-width: 1180px;
}

/* ---------- 结尾引导带 ---------- */
.cta-band {
  position: relative;
  background: var(--brand-mid);
  color: var(--white);
}
.cta-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  padding-block: 36px;
}
.cta-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: none;
  color: var(--white);
}
.cta-icon svg { width: 46px; height: 46px; }
.cta-text { flex: 1 1 auto; }
.cta-text p {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--white);
}
.cta-text span {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  color: var(--deep-4);
  font-weight: 400;
}

/* ---------- 内页分类头 ---------- */
.page-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-block: 14px 0;
  font-size: 13px;
  color: var(--muted);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb span[aria-current] { color: var(--ink); }
.page-hero h1 {
  font-size: clamp(26px, 2.6vw, 38px);
  margin: 10px 0 8px;
}
.page-hero .page-lead {
  max-width: 900px;
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.8;
  padding-bottom: 20px;
}

/* ---------- 筛选工具条 ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.chip:hover,
.chip:focus { border-color: var(--brand-soft); color: var(--brand); text-decoration: none; }
.chip[aria-pressed="true"],
.chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--white);
}
.chip.is-active:hover { color: var(--white); }
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.result-count {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.sort-select {
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- 列表页卡片 ---------- */
.list-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  padding-block: 22px;
}
.list-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--ink);
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.list-card:hover {
  border-color: var(--brand-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  color: var(--ink);
}
.card-media { display: block; }
.list-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.list-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
  flex: 1 1 auto;
}
.list-card h2 { font-size: 18px; }
.list-card h2 a { color: inherit; }
.list-card h2 a:hover { color: var(--brand); }
.list-card p { font-size: 14px; color: var(--ink-soft); line-height: 1.7; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tag {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--brand);
  font-size: 12px;
}
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--brand);
}
.card-link::after { content: "→"; transition: transform .16s ease; }
.list-card:hover .card-link::after { transform: translateX(3px); }
.empty-state {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-block: 6px 26px;
}
.pager a,
.pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: none;
}
.pager a:hover {
  border-color: var(--brand-soft);
  color: var(--brand);
  text-decoration: none;
}
.pager-current {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: var(--white) !important;
  font-weight: 600;
}
.pager-gap,
.pager-info {
  border: 0 !important;
  background: none !important;
  color: var(--muted) !important;
}
.pager-info {
  margin-left: auto;
  font-size: 12.5px;
}

/* ---------- 分类说明长文 ---------- */
.list-description {
  padding-block: 26px 34px;
  border-top: 1px solid var(--line);
}
.list-description h2 {
  font-size: var(--fs-h2);
  margin-bottom: 14px;
}
.list-description p {
  max-width: 78ch;
  margin-bottom: 12px;
  color: var(--ink-soft);
}
.related-cats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  padding-block: 20px 30px;
  border-top: 1px solid var(--line);
}
.related-cats a {
  display: block;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 600;
  transition: border-color .16s ease, color .16s ease, transform .16s ease;
}
.related-cats a:hover {
  border-color: var(--brand-soft);
  color: var(--brand);
  transform: translateY(-2px);
}
.eyebrow.is-spaced { margin-top: 18px; }
.related-cats.is-flush { border-top: 0; padding-top: 0; }
.list-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.list-grid.is-tight { padding-bottom: 0; }
.related-cats small {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 400;
}

/* ---------- 详情页 ---------- */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 44px;
  padding-block: 26px 40px;
  align-items: start;
}
.article-head h1 {
  font-size: clamp(26px, 2.5vw, 36px);
  line-height: 1.3;
  margin-bottom: 12px;
}
.article-lead {
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.8;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding-block: 12px 4px;
  font-size: 13px;
  color: var(--muted);
}
.article-meta strong { color: var(--ink-soft); font-weight: 600; }
.article-figure {
  margin: 18px 0 6px;
  border-radius: var(--radius);
  overflow: hidden;
}
.article-figure img {
  width: 100%;
  aspect-ratio: 16 / 8;
  object-fit: cover;
}
.article-figure figcaption {
  padding: 8px 2px 0;
  font-size: 12.5px;
  color: var(--muted);
}
.article-body > h2 {
  font-size: var(--fs-h2);
  margin: 28px 0 10px;
  padding-left: 12px;
  border-left: 4px solid var(--brand);
  line-height: 1.4;
}
.article-body > p {
  color: var(--ink-soft);
  line-height: 1.9;
  margin-bottom: 12px;
  max-width: 74ch;
}
.article-body > ul {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--ink-soft);
}
.article-body > ul li { margin-bottom: 6px; line-height: 1.8; }

.article-toc {
  position: sticky;
  top: 90px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13.5px;
}
.article-toc h2 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--ink);
}
.article-toc ol {
  list-style: none;
  counter-reset: toc;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.article-toc li { counter-increment: toc; }
.article-toc a {
  display: flex;
  gap: 7px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.article-toc a::before {
  content: counter(toc) ".";
  color: var(--brand-soft);
  font-variant-numeric: tabular-nums;
}
.article-toc a:hover,
.article-toc a.is-active { color: var(--brand); }
.article-toc a.is-active { font-weight: 600; }
.toc-note { margin-top: 12px; font-size: 12.5px; color: var(--muted); }

.faq-block { margin-top: 30px; }
.faq-block h2 {
  font-size: var(--fs-h2);
  margin-bottom: 12px;
}
.related-items { padding-block: 24px 40px; border-top: 1px solid var(--line); }
.related-items .container > h2 { font-size: var(--fs-h2); margin-bottom: 14px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); }
  .article-toc { position: static; order: -1; }
  .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .featured-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; row-gap: 34px; }
  .step + .step::before { display: none; }
  .space-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .related-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { gap: 24px; }
  .footer-col { flex: 1 1 160px; }
  .footer-col:first-child { flex: 1 1 100%; }
}

@media (max-width: 980px) {
  .header-inner { flex-wrap: wrap; gap: 2px 18px; padding-block: 9px; }
  .main-nav {
    flex: 1 1 100%;
    margin-left: 0;
    gap: 2px 4px;
    padding-bottom: 2px;
  }
  .main-nav a { padding: 6px 8px; font-size: 14px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hero-copy { padding-inline: var(--pad-x); max-width: none; }
  .hero-media { min-height: 0; order: -1; }
  .hero-media img { aspect-ratio: 16 / 9; }
  .list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  :root { --pad-x: 18px; }
  .header-inner { gap: 12px; }
  .logo-text { font-size: 17px; }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .space-grid { grid-template-columns: minmax(0, 1fr); }
  .list-grid { grid-template-columns: minmax(0, 1fr); }
  .related-cats { grid-template-columns: minmax(0, 1fr); }
  .footer-inner { gap: 22px; }
  .footer-col { flex: 1 1 100%; }
  .cta-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .cta-text p { font-size: 17px; }
  .hero-copy { padding-block: 22px; }
  .hero h1 { letter-spacing: 0; }
  .section { padding-block: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  .cat-card:hover, .item-card:hover, .list-card:hover, .related-cats a:hover { transform: none; }
  .space-card:hover img { transform: none; }
}
