/* components.css — 首页与内页共用组件：按钮、分类卡、入门卡、阶段条、场景卡、说明面板、页脚、筛选条、条目卡、正文与表格。
   尺寸按 03-ui/home-ui-desktop.png 的剖面预算落位（1440 设计宽）。 */

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 26px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  letter-spacing: .01em;
  transition: background-color .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.btn-primary {
  background: var(--accent);
  color: var(--ink-white);
  border: 1px solid var(--accent);
}
.btn-primary:hover,
.btn-primary:focus-visible { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-ghost {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: transparent;
}
.btn-ghost:hover,
.btn-ghost:focus-visible { border-color: var(--accent); color: var(--accent-deep); }

/* ---------- hero copy ---------- */
.hero h1 {
  font-family: var(--serif);
  font-size: var(--fs-h1);
  line-height: 1.42;
  font-weight: 600;
  letter-spacing: .005em;
  color: var(--ink);
}
.hero-lead {
  margin-top: 19px;
  font-size: 17px;
  line-height: 2;
  color: var(--ink-body);
  max-width: 30em;
}
.hero-stats {
  display: flex;
  gap: 34px;
  margin-top: 24px;
}
.hero-stats li { display: flex; align-items: baseline; gap: 7px; }
.hero-stats strong {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}
.hero-stats span { font-size: var(--fs-xs); color: var(--ink-soft); }
.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 26px;
}

/* ---------- M2 category cards ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 14px;
}
.cat-card > a {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 8px 8px 9px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: border-color .18s var(--ease), background-color .18s var(--ease);
}
.cat-card > a:hover,
.cat-card > a:focus-visible { border-color: var(--line-strong); background: var(--surface-hover); }
.cat-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 2px;
  height: 81px;
  background: var(--thumb-bg);
}
.cat-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease);
}
.cat-card > a:hover .cat-thumb img { transform: scale(1.04); }
.cat-num {
  position: absolute;
  top: 6px;
  left: 7px;
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: .14em;
  color: var(--ink-white);
  text-shadow: 0 1px 3px rgba(15,42,24,.55);
}
.cat-name {
  display: block;
  margin-top: 11px;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}
.cat-note {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.cat-count {
  display: block;
  margin-top: auto;
  padding-top: 5px;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: .02em;
  color: var(--ink-soft);
}

/* ---------- M3 starter grid ---------- */
.starter-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 17px;
}
.starter-item {
  padding: 0 2px;
  text-align: center;
}
.starter-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 130px;
  color: var(--accent-deep);
}
.starter-icon svg { width: 130px; height: 130px; }
.starter-name {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.38;
  color: var(--ink);
}
.starter-spec {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink-soft);
}

/* ---------- M4 stage path ---------- */
.stage-panel {
  background: var(--surface-band);
  border-radius: var(--radius);
  padding: 28px 16px 26px;
}
.stage-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.stage-col {
  padding: 0 18px;
  border-left: 1px solid var(--line-strong);
}
.stage-col:first-child { border-left: 0; }
.stage-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.stage-num {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--accent-deep);
}
.stage-name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
.stage-note {
  margin-top: 11px;
  font-size: 13.5px;
  line-height: 1.86;
  color: var(--ink-body);
}
.stage-list {
  margin-top: 11px;
  font-size: 12.5px;
  line-height: 1.78;
  color: var(--ink-soft);
}

/* ---------- M5 scene cards ---------- */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 31px;
}
.scene-thumb {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 1400 / 412;
  background: var(--thumb-bg);
}
.scene-thumb img { width: 100%; height: 100%; object-fit: cover; }
.scene-name {
  margin-top: 18px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}
.scene-note {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink-body);
}
.scene-diff {
  margin-top: 13px;
  font-size: 13px;
  line-height: 1.72;
  color: var(--accent-deep);
}

/* ---------- M6 editorial note ---------- */
.note-panel {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 34px;
  padding: 30px 40px 30px 44px;
  background: var(--surface-note);
  border-radius: var(--radius);
}
.note-mark { color: var(--accent-deep); width: 34px; height: 34px; }
.note-title {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.note-body {
  display: grid;
  gap: 9px;
  font-size: 14.5px;
  line-height: 1.95;
  color: var(--ink-body);
}

/* ---------- 分类页：页头 / 面包屑 ---------- */
.crumbs {
  font-size: var(--fs-xs);
  color: var(--ink-soft);
}
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.crumbs li::after { content: "/"; margin-left: 8px; color: var(--line-strong); }
.crumbs li:last-child::after { content: ""; }
.crumbs a:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }
.crumbs [aria-current="page"] { color: var(--ink-body); }

.page-hero {
  background: var(--bg-hero);
  padding: 34px 0 44px;
}
.page-hero h1 {
  margin-top: 20px;
  font-family: var(--serif);
  font-size: 44px;
  line-height: 1.24;
  font-weight: 600;
  color: var(--ink);
}
.page-lead {
  margin-top: 15px;
  max-width: 46em;
  font-size: var(--fs-lg);
  line-height: 1.85;
  color: var(--ink-body);
}
.page-tag {
  display: inline-flex;
  align-items: center;
  height: 27px;
  padding: 0 11px;
  margin-top: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  font-size: 12.5px;
  color: var(--accent-deep);
  background: rgba(255,255,255,.5);
}

/* ---------- 筛选条 ---------- */
.toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.toolbar-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 62px;
  flex-wrap: wrap;
  padding: 10px 0;
}
.chip-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-label {
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  margin-right: 2px;
}
.chip {
  height: 32px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: transparent;
  font-size: var(--fs-sm);
  color: var(--ink-body);
  cursor: pointer;
  transition: background-color .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent-deep); }
.chip[aria-pressed="true"],
.chip[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink-white);
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.sort-group { display: flex; align-items: center; gap: 8px; }
.sort-group label { font-size: var(--fs-xs); color: var(--ink-soft); cursor: pointer; }
.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.4px solid var(--ink-soft);
  border-bottom: 1.4px solid var(--ink-soft);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select {
  height: 34px;
  padding: 0 30px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: var(--fs-sm);
  color: var(--ink-body);
  appearance: none;
  cursor: pointer;
}
.result-count {
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ---------- 条目卡 ---------- */
.entry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 30px;
}
.entry-card {
  display: flex;
  flex-direction: column;
  padding: 20px 22px 18px;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.entry-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 14px 28px -26px rgba(15,42,24,.5);
  transform: translateY(-1px);
}
.entry-media {
  display: block;
  margin: -20px -22px 14px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 2px 2px 0 0;
  background: var(--thumb-bg);
}
.entry-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease);
}
.entry-card:hover .entry-media img { transform: scale(1.03); }
.entry-media .entry-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 44px;
  line-height: 1;
}
.entry-tag {
  align-self: flex-start;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--accent-deep);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}
.entry-title {
  margin-top: 11px;
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
}
.entry-title a:hover { color: var(--accent-deep); }
.entry-summary {
  margin-top: 9px;
  font-size: var(--fs-sm);
  line-height: 1.78;
  color: var(--ink-body);
}
.entry-spec {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.entry-more {
  margin-top: 12px;
  font-size: 13px;
  color: var(--accent-deep);
}
.entry-more::after { content: " →"; }

.empty-state {
  display: none;
  padding: 56px 0 64px;
  text-align: center;
}
.empty-state.is-visible { display: block; }
.empty-state p {
  font-size: var(--fs-lg);
  color: var(--ink-soft);
}
.empty-state button {
  margin-top: 16px;
  height: 40px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent-deep);
  cursor: pointer;
}

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 36px;
}
.pager a,
.pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  color: var(--ink-body);
  background: var(--bg);
  transition: border-color .16s var(--ease), color .16s var(--ease), background-color .16s var(--ease);
}
.pager a:hover { border-color: var(--accent); color: var(--accent-deep); }
.pager .is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink-white);
  font-weight: 600;
}
.pager .pager-gap {
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
  min-width: 22px;
  padding: 0;
}
.pager .pager-arrow { letter-spacing: .02em; }

/* ---------- 列表说明长文 ---------- */
.section-desc { padding: 56px 0 0; }
.desc-inner { max-width: 860px; }
.section-heading {
  font-family: var(--serif);
  font-size: var(--fs-h2);
  line-height: 1.34;
  font-weight: 600;
  color: var(--ink);
}
.desc-body { margin-top: 20px; display: grid; gap: 16px; }
.desc-body p {
  font-size: 16.5px;
  line-height: 1.95;
  color: var(--ink-body);
}
.desc-body h3 {
  margin-top: 10px;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}

/* ---------- 表格 ---------- */
.table-wrap {
  margin-top: 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-card);
}
.table-wrap:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 3px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  min-width: 0;
}
th, td { word-break: break-word; }
caption {
  caption-side: top;
  padding: 14px 16px;
  text-align: left;
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
}
th, td {
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
thead th {
  background: var(--surface-band);
  font-weight: 600;
  color: var(--ink);
  font-size: 13.5px;
}
tbody tr:nth-child(even) { background: var(--surface-band); }
tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }

/* ---------- 相关分类卡 ---------- */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 26px;
}
.related-card {
  display: block;
  padding: 22px 24px;
  background: var(--surface);
  border-radius: var(--radius);
  transition: background-color .18s var(--ease);
}
.related-card:hover { background: var(--surface-hover); }
.related-card h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
}
.related-card p {
  margin-top: 8px;
  font-size: var(--fs-sm);
  line-height: 1.75;
  color: var(--ink-soft);
}
.section-related { padding: 52px 0 0; }

/* ---------- 详情页 ---------- */
.article-head { background: var(--bg-hero); padding: 30px 0 40px; }
.article-head h1 {
  margin-top: 18px;
  font-family: var(--serif);
  font-size: 44px;
  line-height: 1.26;
  font-weight: 600;
  color: var(--ink);
}
.article-meta {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: var(--fs-xs);
  color: var(--ink-soft);
}
.article-lead {
  margin-top: 16px;
  max-width: 44em;
  font-size: var(--fs-lg);
  line-height: 1.85;
  color: var(--ink-body);
}

.article-layout {
  display: grid;
  grid-template-columns: 226px 1fr;
  gap: 48px;
  align-items: start;
  padding-top: 44px;
}
.toc {
  position: sticky;
  top: calc(var(--header-h) + 22px);
  border-left: 1px solid var(--line);
  padding-left: 18px;
}
.toc-title {
  font-size: 12.5px;
  letter-spacing: .14em;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.toc ol { display: grid; gap: 3px; }
.toc a {
  display: flex;
  gap: 7px;
  padding: 6px 0 6px 8px;
  margin-left: -8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
  transition: color .16s var(--ease), border-color .16s var(--ease), background-color .16s var(--ease);
}
.toc a span { font-family: var(--serif); color: var(--line-strong); }
.toc a:hover { color: var(--ink); }
.toc a.is-current {
  color: var(--accent-deep);
  border-left-color: var(--accent);
  background: var(--accent-wash);
}
.toc a.is-current span { color: var(--accent-deep); }

.article-body { min-width: 0; }
.article-body section + section { margin-top: 34px; }
.article-body h2 {
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1.42;
  font-weight: 600;
  color: var(--ink);
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.article-body p {
  margin-top: 15px;
  font-size: 16.5px;
  line-height: 1.98;
  color: var(--ink-body);
}
.article-body section:first-child p:first-of-type { margin-top: 16px; }
.article-body figure {
  margin: 22px 0 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--thumb-bg);
}
.article-body figure img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: cover;
}
.article-body figcaption {
  margin-top: 0;
  padding: 9px 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}

.article-foot {
  margin-top: 46px;
  padding: 20px 24px;
  background: var(--surface-note);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  line-height: 1.8;
  color: var(--ink-body);
}
.section-toc-mobile { display: none; }

@media (max-width: 1000px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .starter-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
  .stage-grid { grid-template-columns: repeat(2, 1fr); gap: 26px 0; }
  .stage-col:nth-child(3) { border-left: 0; }
  .scene-grid { grid-template-columns: 1fr; gap: 26px; }
  .note-panel { grid-template-columns: 1fr; gap: 12px; padding: 24px 26px; }
  .entry-grid { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; gap: 24px; padding-top: 30px; }
  .toc {
    position: static;
    border-left: 0;
    padding-left: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
  }
  .toc ol { display: flex; flex-wrap: wrap; gap: 6px; }
  .toc li { flex: 0 0 auto; }
  .toc a { border: 1px solid var(--line-strong); border-radius: 16px; padding: 5px 12px; margin-left: 0; }
  .toc a.is-current { border-color: var(--accent); background: var(--accent-wash); }
  .hero h1 { font-size: 38px; }
  .page-hero h1, .article-head h1 { font-size: 34px; }
}

@media (max-width: 700px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .starter-grid { grid-template-columns: repeat(2, 1fr); gap: 22px 14px; }
  .starter-icon { height: 78px; }
  .starter-icon svg { width: 58px; height: 58px; }
  .starter-name { font-size: 17px; }
  .stage-grid { grid-template-columns: 1fr; gap: 22px; }
  .stage-col { padding: 0; border-left: 0; border-top: 1px solid var(--line-strong); padding-top: 18px; }
  .stage-col:first-child { border-top: 0; padding-top: 0; }
  .entry-grid { grid-template-columns: 1fr; gap: 14px; }
  .hero h1 { font-size: 30px; }
  .hero-lead { font-size: 15.5px; }
  .hero-stats { gap: 22px; flex-wrap: wrap; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; }
  .desc-body p, .article-body p { font-size: 16px; }
  .article-body h2 { font-size: 23px; }
  .page-hero h1, .article-head h1 { font-size: 28px; }
  .toolbar { position: static; }
  .toolbar-inner { gap: 12px; }
  .chip-group { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; width: 100%; }
  .toolbar-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .section-heading { font-size: 25px; }
  .result-count { margin-left: auto; }
}
