/* components.css — 跨页复用组件：页头 / 页脚 / 按钮 / 标题 / 卡片 / 标签 / 面包屑 / 筛选器 */

/* ---------- 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 50%;
  top: -60px;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--ink-invert);
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 60;
  transition: top 0.2s var(--ease);
}
.skip-link:focus-visible { top: 0; }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(252, 253, 254, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.site-header.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: 0 8px 20px rgba(20, 44, 78, 0.05);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: none; }
.site-logo-text { display: inline-block; }

.primary-nav-wrap { margin-left: auto; }
.primary-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 34px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.primary-nav > li { position: relative; }
.primary-nav a {
  position: relative;
  font-size: var(--fs-body);
  color: var(--ink-soft);
  padding: 6px 0;
  transition: color 0.2s var(--ease);
}
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-soft);
  transform: translateX(-50%);
  transition: width 0.24s var(--ease);
}
.primary-nav a:hover,
.primary-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.primary-nav a[aria-current="page"]::after { width: 22px; }
.primary-nav a:hover::after { width: 14px; }

/* 下拉子菜单 */
.dropdown-menu {
  display: none;
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  min-width: 148px;
  max-height: 360px;
  overflow-y: auto;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: var(--surface-white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 30px rgba(20, 44, 78, 0.14);
  z-index: 55;
}
.dropdown-menu li { margin: 0; }
.dropdown-menu a {
  display: block;
  padding: 8px 16px;
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.dropdown-menu a::after { display: none; }
.dropdown-menu a:hover { background: var(--surface); color: var(--accent); }
.primary-nav .dropdown:hover > .dropdown-menu { display: block; }

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-white);
  cursor: pointer;
}
.nav-toggle svg { width: 18px; height: 18px; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

/* ---------- 区块标题 ---------- */
.section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 22px;
}
.section-title {
  margin: 0;
  font-size: var(--fs-h2);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 0.86em;
  margin-right: 12px;
  border-radius: 2px;
  background: var(--accent-soft);
  vertical-align: -0.06em;
}
.section-link {
  margin-left: auto;
  white-space: nowrap;
  font-size: var(--fs-sm);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.section-link:hover { color: var(--accent-deep); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: var(--fs-body);
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary {
  background: var(--surface-white);
  color: var(--accent);
  box-shadow: 0 8px 18px rgba(20, 44, 78, 0.08);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(20, 44, 78, 0.14); }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent-soft);
}
.btn-ghost:hover { background: var(--accent-tint); }
.btn-solid {
  background: var(--accent);
  color: var(--ink-invert);
}
.btn-solid:hover { background: var(--accent-deep); transform: translateY(-2px); }
.btn-outline-invert {
  border-color: rgba(247, 250, 253, 0.6);
  color: var(--ink-invert);
}
.btn-outline-invert:hover { background: rgba(247, 250, 253, 0.12); }

/* ---------- 卡片通用 ---------- */
.card {
  background: var(--surface-white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: var(--line-strong);
}
.card-media {
  position: relative;
  overflow: hidden;
  background: var(--surface);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.card:hover .card-media img { transform: scale(1.04); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  line-height: 1;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- 面包屑 ---------- */
.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  padding: 18px 0 0;
}
.crumb a:hover { color: var(--accent); }
.crumb a + a::before,
.crumb a + span::before,
.crumb span + span::before {
  content: "/";
  margin: 0 8px;
  color: var(--line-strong);
}
.crumb [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ---------- 筛选器（分类页） ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 26px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  font-weight: 600;
}
.chip {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface-white);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.chip:hover { border-color: var(--accent-soft); color: var(--accent); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink-invert);
}
.sort-field { position: relative; display: inline-flex; align-items: center; }
.sort-field svg {
  position: absolute;
  right: 12px;
  width: 11px;
  height: 8px;
  color: var(--ink-soft);
  pointer-events: none;
}
.sort-select {
  height: 34px;
  padding: 0 32px 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface-white);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  appearance: none;
  cursor: pointer;
}
.result-count {
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.result-count strong { color: var(--ink); font-weight: 700; }
.empty-state {
  display: none;
  padding: 56px 0;
  text-align: center;
  color: var(--ink-muted);
  font-size: var(--fs-body);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.empty-state.is-visible { display: block; }

/* ---------- 页脚 ---------- */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 34px 0 30px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px 40px;
}
.footer-brand,
.footer-col {
  flex: 1 1 180px;
  min-width: 170px;
}
.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.footer-brand .brand-mark { width: 34px; height: 34px; }
.footer-brand strong { display: block; font-size: 17px; font-weight: 800; }
.footer-brand p {
  margin: 8px 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  line-height: 1.7;
  max-width: 34em;
}
.footer-col h3 {
  margin: 0 0 10px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink);
}
.footer-links {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 6px 18px;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}
.footer-links a:hover { color: var(--accent); }
.footer-about p { margin: 0; font-size: var(--fs-sm); color: var(--ink-muted); line-height: 1.7; }
.footer-legal {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- 滚动入场 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (max-width: 1080px) {
  :root { --gutter: 28px; }
  .footer-inner { flex-direction: row; }
}

@media (max-width: 860px) {
  :root { --gutter: 22px; --header-h: 62px; }
  .header-inner { gap: 16px; }
  .brand { flex: none; font-size: 17px; }
  .primary-nav-wrap {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: auto;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .primary-nav-wrap::-webkit-scrollbar { display: none; }
  .primary-nav { gap: 18px; white-space: nowrap; }
  .primary-nav a { padding: 6px 0; font-size: 15px; }
  .primary-nav a::after { display: none; }
  .dropdown-menu { display: none !important; }
  .footer-inner { flex-direction: column; }
  .footer-links { grid-template-columns: repeat(4, max-content); }
}

@media (max-width: 560px) {
  :root { --fs-body: 15px; }
  .btn { height: 46px; padding: 0 20px; }
  .footer-links { grid-template-columns: repeat(2, max-content); }
  .toolbar { padding: 14px 16px; }
  .result-count { margin-left: 0; width: 100%; }
}

/* ---------- 内页：页面头 ---------- */
.page-hero {
  display: flex;
  align-items: flex-end;
  gap: 32px;
  padding: 22px 0 26px;
  border-bottom: 1px solid var(--line);
}
.page-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 2.6vw, 36px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.4px;
}
.page-hero .lede {
  margin: 0;
  max-width: 44em;
  font-size: var(--fs-lede);
  color: var(--ink-soft);
  line-height: 1.75;
}
.page-hero .hero-facts {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  flex: none;
  padding-bottom: 4px;
}
.hero-facts .fact { text-align: center; }
.hero-facts strong {
  display: block;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.hero-facts span { font-size: var(--fs-xs); color: var(--ink-muted); }
.hero-facts .divider { width: 1px; height: 30px; background: var(--line); }

/* ---------- 内页：列表区 ---------- */
.list-section { padding: 26px 0 0; }
.item-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-top: 20px;
}
.item-card { display: flex; flex-direction: column; scroll-margin-top: calc(var(--header-h) + 16px); }
.item-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
}
.item-card .card-media { aspect-ratio: 1.6 / 1; }
.item-card .card-body { padding: 14px 16px 18px; }
.item-card h2 { margin: 0 0 8px; font-size: 17px; font-weight: 700; line-height: 1.4; }
.item-card .card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.item-card p { margin: 0; font-size: var(--fs-sm); line-height: 1.7; color: var(--ink-soft); }
.list-description {
  margin: 34px 0 0;
  padding: 26px 0 0;
  border-top: 1px solid var(--line);
  max-width: 860px;
}
.list-description h2 {
  margin: 0 0 12px;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.35;
}
.list-description p {
  margin: 0;
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-soft);
}

/* ---------- 内页：文章 ---------- */
.article-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  padding: 26px 0 46px;
  align-items: start;
}
.article-toc {
  position: sticky;
  top: calc(var(--header-h) + 18px);
  border-left: 2px solid var(--line);
  padding-left: 16px;
}
.article-toc h2 {
  margin: 0 0 10px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.4px;
}
.article-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: toc; }
.article-toc a {
  display: block;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--ink-soft);
  padding: 2px 0;
  border-left: 2px solid transparent;
  margin-left: -18px;
  padding-left: 16px;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.article-toc a:hover { color: var(--accent); }
.article-toc a.is-active { color: var(--accent); border-left-color: var(--accent-soft); font-weight: 600; }
.toc-toggle { display: none; cursor: pointer; }

.article-head { padding: 8px 0 22px; border-bottom: 1px solid var(--line); }
.article-head h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 2.8vw, 38px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.4px;
}
.article-head .article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.article-head { max-width: 900px; }
.article-head .lede {
  margin: 0;
  font-size: var(--fs-lede);
  line-height: 1.85;
  color: var(--ink-soft);
}
.article-meta {
  margin: 14px 0 0;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0 4px;
  font-size: var(--fs-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.spec-table caption {
  caption-side: top;
  text-align: left;
  font-size: var(--fs-h3);
  font-weight: 700;
  padding: 0 0 10px;
  color: var(--ink);
}
.spec-table th,
.spec-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.spec-table tr:last-child th,
.spec-table tr:last-child td { border-bottom: 0; }
.spec-table th { width: 42%; background: var(--surface); font-weight: 600; color: var(--ink-soft); }
.spec-table td { color: var(--ink); font-variant-numeric: tabular-nums; }

.grid-title { margin-top: 26px; }
.cta-wrap-inner { padding-top: 40px; }
.article-figure { margin: 22px 0 0; }
.article-figure img { width: 100%; height: auto; border-radius: var(--radius-md); }
.related-title { font-size: 21px; }
.grid-note {
  margin: 8px 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
}
.related-note {
  margin: 8px 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  max-width: 52em;
}
.article-body { max-width: 740px; }
.article-body h2 {
  margin: 34px 0 12px;
  font-size: 22px;
  line-height: 1.4;
  font-weight: 800;
  letter-spacing: -0.2px;
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.article-body p { margin: 0 0 14px; font-size: 15px; line-height: 1.95; color: var(--ink-soft); }
.article-body strong { color: var(--ink); }

.related {
  padding: 30px 0 8px;
  border-top: 1px solid var(--line);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 18px;
}
.related-card { display: flex; gap: 14px; align-items: center; padding: 12px; }
.related-card .thumb {
  width: 96px;
  height: 72px;
  flex: none;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--surface);
}
.related-card img { width: 100%; height: 100%; object-fit: cover; }
.related-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.related-card span { font-size: var(--fs-xs); color: var(--ink-muted); }

@media (max-width: 1080px) {
  .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-layout { grid-template-columns: 1fr; gap: 0; }
  .article-toc {
    position: static;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    padding: 14px 16px;
    margin-bottom: 20px;
  }
  .article-toc a { margin-left: 0; padding-left: 10px; border-left-width: 2px; }
  .toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    background: transparent;
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    padding: 0;
  }
  .toc-toggle svg { width: 12px; height: 8px; transition: transform 0.2s var(--ease); }
  .article-toc[data-open="true"] .toc-toggle svg { transform: rotate(180deg); }
.article-toc .toc-toggle svg { transform: rotate(0); }
  .article-toc ol { margin-top: 12px; }
  .article-toc[data-open="false"] ol { display: none; }
  .article-toc h2 { display: none; }
}

@media (max-width: 860px) {
  .page-hero { flex-direction: column; align-items: flex-start; gap: 18px; }
  .page-hero .hero-facts { margin-left: 0; }
  .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .item-grid { grid-template-columns: 1fr; }
  .article-head h1 { font-size: 26px; }
  .grid-title { margin-top: 26px; }
.cta-wrap-inner { padding-top: 40px; }
.article-figure { margin: 22px 0 0; }
.article-figure img { width: 100%; height: auto; border-radius: var(--radius-md); }
.related-title { font-size: 21px; }
.grid-note {
  margin: 8px 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
}
.related-note {
  margin: 8px 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  max-width: 52em;
}
.article-body { max-width: 740px; }
.article-body h2 { font-size: 19px; }
  .spec-table { font-size: 13px; }
  .spec-table th, .spec-table td { padding: 9px 10px; }
  .related-card .thumb { width: 80px; height: 60px; }
}
