/* components.css — 公共组件：跳转链、页头、按钮、页脚、卡片基座 */

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  background: var(--surface-header);
  color: var(--ink-on-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 100%;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-on-dark);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  flex: none;
}
.brand-mark {
  font-size: 18.4px;
  line-height: 1;
  color: var(--accent);
}
.brand-name { font-size: 18.4px; }
.site-header .brand-name { font-size: 16.8px; }

.primary-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
  font-size: 14px;
}
.primary-nav a {
  position: relative;
  color: rgba(247, 248, 248, 0.82);
  text-decoration: none;
  padding: 6px 0;
  white-space: nowrap;
  transition: color var(--dur) var(--ease);
}
.primary-nav a:hover { color: #fff; }
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.primary-nav a:hover::after,
.primary-nav a.is-active::after { transform: scaleX(1); }
.primary-nav a.is-active { color: #fff; }

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 40px;
  padding: 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 1.5px;
  margin: 4px 0;
  background: #fff;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 24px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn-solid { background: var(--accent); color: #fff; }
.btn-solid:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: #fff; }
.header-cta {
  height: 32px;
  padding: 0 16px;
  font-size: 13px;
  border-radius: var(--radius-pill);
  flex: none;
}

/* ---------- 卡片基座 ---------- */
.thumb {
  position: relative;
  overflow: hidden;
  background: #dfe3e2;
}
.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.card-link {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* ---------- 页脚 ---------- */
.site-footer {
  background: var(--surface-footer);
  color: var(--ink-on-dark-muted);
  padding-top: 36px;
  font-size: 14px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.8fr;
  gap: 48px;
  padding-bottom: 24px;
}
.footer-brand .brand { color: #fff; }
.footer-brand p { margin: 12px 0 0; color: var(--ink-on-dark-muted); }
.footer-col h2 {
  margin: 0 0 14px;
  font-size: 15px;
  color: #fff;
  font-weight: 600;
}
.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.footer-col a {
  color: var(--ink-on-dark-muted);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
.footer-col a:hover { color: #fff; }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: var(--fs-xs);
  color: rgba(247, 248, 248, 0.55);
}
.footer-bottom p { margin: 0; }
.to-top {
  color: rgba(247, 248, 248, 0.7);
  text-decoration: none;
}
.to-top:hover { color: #fff; }

/* ============================================================
   内页组件（环节 6 新增）：面包屑 / 列表工具栏 / 条目卡 / 正文排版
   仅内页使用，首页不加载额外规则（同文件但选择器限定 .page-* / .article）
   ============================================================ */

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

/* ---------- 分类页 hero ---------- */
.page-hero {
  padding-block: 34px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.page-hero h1 {
  margin-top: 16px;
  font-size: clamp(30.4px, 3.2vw, 41.6px);
  letter-spacing: -0.015em;
}
.page-hero p {
  margin-top: 12px;
  max-width: 52em;
  color: var(--ink-muted);
  line-height: 1.85;
}
.page-hero-meta {
  display: flex;
  gap: 18px;
  margin-top: 14px;
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

/* ---------- 筛选排序 ---------- */
.list-body { padding-block: 26px 46px; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar-label {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}
.chip {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent-strong); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink-invert);
}
.select {
  height: 32px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface) url("../images/select-arrow.svg") no-repeat right 12px center;
  color: var(--ink-body);
  font-family: inherit;
  font-size: var(--fs-sm);
  appearance: none;
  cursor: pointer;
}
.select:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.result-count { font-size: var(--fs-sm); color: var(--ink-muted); }
.result-count strong { color: var(--ink); font-weight: 600; }

/* ---------- 条目卡 ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px 22px;
  margin-top: 26px;
}
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.post-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
  box-shadow: 0 14px 26px rgba(20, 30, 40, 0.07);
}
.post-card .thumb { aspect-ratio: 16 / 10; }
.post-card:hover .thumb img { transform: scale(1.04); }
.post-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 20px; }
.post-scene {
  align-self: flex-start;
  margin-bottom: 9px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.post-card h3 { font-size: 17px; line-height: 1.5; }
.post-card:hover h3 { color: var(--accent-strong); }
.post-summary {
  margin-top: 8px;
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  line-height: 1.7;
  flex: 1;
}
.post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--ink-faint);
}
.post-meta .arrow { color: var(--accent); }

.empty-state {
  margin-top: 26px;
  padding: 44px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--ink-muted);
  font-size: var(--fs-sm);
}
.empty-state strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 16px; }

/* ---------- 关联分类 / 列表说明 ---------- */
.rel-cats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 40px;
}
.rel-cats h2 { grid-column: 1 / -1; font-size: var(--fs-h2); }
.rel-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.rel-cat:hover { border-color: var(--accent); }
.rel-cat strong { display: block; font-size: 15px; color: var(--ink); }
.rel-cat span { font-size: var(--fs-xs); color: var(--ink-muted); }
.rel-cat::after { content: "→"; color: var(--accent); font-size: 16px; line-height: 1; }

.list-desc {
  margin-top: 38px;
  padding: 26px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
}
.list-desc h2 { font-size: 18px; margin-bottom: 10px; }
.list-desc p { color: var(--ink-body); line-height: 1.9; font-size: var(--fs-body); }

/* ---------- 详情页 ---------- */
.article-head {
  padding-block: 30px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.article-head .kicker {
  display: inline-block;
  margin-top: 16px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
}
.article-head h1 {
  margin-top: 12px;
  max-width: 22em;
  font-size: clamp(29.6px, 3.3vw, 40.8px);
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.article-head .dek {
  margin-top: 14px;
  max-width: 46em;
  color: var(--ink-muted);
  line-height: 1.85;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.article-wrap {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 48px;
  padding-block: 34px 10px;
  align-items: start;
}
.article-toc {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.article-toc h2 {
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.article-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.article-toc li { counter-increment: toc; }
.article-toc a {
  display: block;
  padding: 7px 0 7px 24px;
  position: relative;
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.article-toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 4px;
  color: var(--ink-faint);
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: 11px;
}
.article-toc a:hover, .article-toc a.is-current {
  color: var(--accent-strong);
  border-left-color: var(--accent);
}
.article-toc-toggle { display: none; }

.article { max-width: 760px; }
.article-body h2 {
  position: relative;
  scroll-margin-top: calc(var(--header-h) + 22px);
  margin: 34px 0 12px;
  padding-left: 16px;
  font-size: 21px;
  line-height: 1.45;
}
.article-body h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.22em;
  bottom: 0.22em;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
}
.article-body h2:first-child { margin-top: 4px; }
.article-body p { color: var(--ink-body); line-height: 1.95; font-size: 16px; }
.article-body p + p { margin-top: 14px; }
.key-points {
  margin-top: 34px;
  padding: 22px 26px;
  background: var(--accent-soft);
  border-radius: var(--radius-lg);
}
.key-points h2 { font-size: 17px; margin-bottom: 12px; }
.key-points ol { margin: 0; padding-left: 1.25em; }
.key-points li { color: var(--ink-body); font-size: var(--fs-sm); line-height: 1.9; }
.key-points li + li { margin-top: 6px; }

.related { padding-block: 34px 50px; }
.related h2 { font-size: var(--fs-h2); margin-bottom: 18px; }
.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.related-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.related-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.related-card h3 { font-size: 15px; line-height: 1.55; }
.related-card p { font-size: var(--fs-xs); color: var(--ink-muted); line-height: 1.7; }
.related-card::after { content: "→"; color: var(--accent); font-size: var(--fs-sm); line-height: 1; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-wrap { grid-template-columns: 1fr; gap: 20px; }
  .article-toc { position: static; }
  .article-toc-toggle { display: inline-flex; }
  .article-toc ol { display: none; }
  .article-toc.is-open ol { display: block; }
  .article { max-width: none; }
}
@media (max-width: 720px) {
  .post-grid { grid-template-columns: 1fr; }
  .rel-cats, .related-grid { grid-template-columns: 1fr; }
  .list-desc { padding: 20px; }
  .page-hero { padding-block: 24px 20px; }
  .toolbar { padding: 10px 12px; }
  .article-body p { font-size: 15.5px; line-height: 1.9; }
}

/* 列表卡片外层用 article 包裹，保持栅格拉伸与卡片等高 */
.post-grid > article { display: flex; }
.post-grid > article > .post-card { width: 100%; }
.toolbar-label[for] { cursor: pointer; }

/* 正文配图 */
.article-body figure { margin: 20px 0; }
.article-body figure img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; }

/* 移动端：头部高度自适应，导航换行（components.css 后加载，需在此覆盖固定高度） */
@media (max-width: 900px) {
  .site-header { height: auto; }
  .site-header .header-inner { height: auto; flex-wrap: wrap; gap: 4px 14px; padding: 8px 0 6px; }
}
