/* components.css — 全站复用组件：基础排版、页头、按钮、区块头、卡片、页脚 */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

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-7);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, dl, dd, dt, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 60;
  padding: 10px 16px;
  background: var(--accent-deep);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: var(--fs-4);
  transition: top .18s ease;
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid rgba(226, 232, 227, .9);
  backdrop-filter: saturate(140%) blur(6px);
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 6px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.brand-mark { width: 22px; height: 22px; color: var(--accent); }

.brand-name {
  font-size: var(--fs-11);
  font-weight: var(--fw-black);
  letter-spacing: -.01em;
  color: var(--accent-deep);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.main-nav a {
  font-size: var(--fs-7);
  color: var(--muted);
  letter-spacing: .01em;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color .16s ease, border-color .16s ease;
}
.main-nav a:hover { color: var(--accent-deep); }
.main-nav a[aria-current="page"] {
  color: var(--accent-deep);
  font-weight: var(--fw-semibold);
  border-bottom-color: var(--accent);
}

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle-bar {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--accent-deep);
  transition: transform .18s ease, opacity .18s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:first-child { transform: translateY(2.75px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:last-child { transform: translateY(-2.75px) rotate(-45deg); }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 22px;
  border-radius: var(--r-pill);
  font-size: var(--fs-4);
  font-weight: var(--fw-semibold);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.btn-solid { background: var(--accent); color: #fff; }
.btn-solid:hover { background: var(--accent-hover); }

.btn-ghost {
  background: rgba(255, 255, 255, .82);
  color: var(--accent-deep);
  border-color: var(--line-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ----------------------------------------------------------- section head */

.section { padding: 0; }

.section-head {
  display: grid;
  gap: 4px;
  align-content: center;
}

.section-head h2 {
  font-size: var(--fs-14);
  font-weight: var(--fw-black);
  letter-spacing: -.01em;
  color: var(--accent-deep);
  line-height: 1.3;
}

.section-head p {
  font-size: var(--fs-4);
  color: var(--muted);
  max-width: 62ch;
}

.section-head--split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}
.section-head--split .section-copy { display: grid; gap: 4px; }
.section-head--split h2 { max-width: 26ch; }

.eyebrow {
  font-size: var(--fs-2);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: var(--fw-bold);
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  background: var(--accent-deep);
  color: var(--cream);
  padding: 14px 0 7px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px 40px;
}

.footer-brand,
.footer-col {
  flex: 1 1 180px;
  min-width: 170px;
}

.footer-cats a, .footer-read a { line-height: 1.75; }

.footer-brand { display: grid; gap: 6px; }

.footer-brand .brand-name { color: var(--cream); }

.footer-brand p {
  font-size: var(--fs-3);
  color: var(--cream-soft);
  max-width: 30ch;
  line-height: 1.65;
}

.footer-title {
  font-size: var(--fs-2);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(234, 246, 238, .5);
  margin-bottom: 8px;
}

.footer-cats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 18px;
}

.footer-cats a,
.footer-read a {
  font-size: var(--fs-3);
  color: var(--cream-soft);
  transition: color .16s ease;
}
.footer-cats a:hover,
.footer-read a:hover { color: #fff; }

.footer-read { display: grid; gap: 4px; }

.footer-legal {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--cream-line);
  font-size: 10px;
  color: rgba(234, 246, 238, .55);
  line-height: 1.6;
}

/* ------------------------------------------------------------- utilities */

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: var(--fs-2);
  font-weight: var(--fw-semibold);
  letter-spacing: .02em;
}

.arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--accent);
  flex: 0 0 auto;
  transition: background .16s ease, border-color .16s ease;
}
.arrow svg { width: 12px; height: 12px; }

@media (max-width: 1080px) {
  .footer-inner { flex-direction: row; gap: 26px 32px; }
  .footer-brand { flex: 1 1 100%; }
}

@media (max-width: 760px) {
  .footer-inner { flex-direction: column; gap: 22px; }
  .footer-brand { flex: 1 1 auto; }
  .footer-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

/* ===================================================== 内页组件（环节 6） */

/* 面包屑 */
.crumb {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: var(--fs-3);
  color: var(--muted);
}
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.crumb span[aria-current] { color: var(--accent-deep); font-weight: var(--fw-semibold); }
.crumb .sep { color: var(--line-strong); }

/* 内页页头 */
.page-hero {
  padding: 26px 0 22px;
  border-bottom: 1px solid var(--line);
}
.page-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
}
.page-hero h1 {
  font-size: var(--fs-16);
  line-height: 1.22;
  font-weight: var(--fw-black);
  letter-spacing: -.01em;
  color: var(--accent-deep);
  margin: 10px 0 8px;
}
.page-hero .lede {
  font-size: var(--fs-6);
  line-height: 1.72;
  color: var(--muted);
  max-width: 68ch;
}
.page-hero .page-sub {
  font-size: var(--fs-7);
  color: var(--accent);
  font-weight: var(--fw-semibold);
  margin-bottom: 2px;
}
.page-meta {
  display: grid;
  gap: 4px;
  text-align: right;
  font-size: var(--fs-3);
  color: var(--muted);
  padding-bottom: 4px;
}
.page-meta strong { color: var(--accent-deep); font-size: var(--fs-9); }

/* 筛选排序条 */
.toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(6px);
}
.toolbar-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 54px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-label {
  font-size: var(--fs-2);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}
.chip {
  height: 30px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-soft);
  font-size: var(--fs-4);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: var(--fw-semibold);
}
.toolbar-result {
  margin-left: auto;
  font-size: var(--fs-4);
  color: var(--muted);
}
.toolbar-result strong { color: var(--accent-deep); }

/* 卡片网格 */
.card-grid-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin: 26px 0 14px;
}
.card-grid-head h2 {
  font-size: var(--fs-12);
  font-weight: var(--fw-black);
  color: var(--accent-deep);
  letter-spacing: -.01em;
}
.card-grid-head .count { font-size: var(--fs-4); color: var(--accent); font-weight: var(--fw-semibold); }
.card-grid-head p { font-size: var(--fs-4); color: var(--muted); width: 100%; margin-top: 2px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 30px;
}

.entry {
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.entry:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}
.entry h3 {
  font-size: var(--fs-9);
  font-weight: var(--fw-bold);
  line-height: 1.42;
  color: var(--accent-deep);
}
.entry p { font-size: var(--fs-4); line-height: 1.62; color: var(--muted); }
.entry .entry-more {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-2);
  font-weight: var(--fw-semibold);
  color: var(--accent);
  margin-top: 2px;
}
.entry .entry-more svg { width: 11px; height: 11px; }
.entry[hidden] { display: none; }

.empty-state {
  grid-column: 1 / -1;
  padding: 28px 0 34px;
  font-size: var(--fs-5);
  color: var(--muted);
  text-align: center;
}
.empty-state[hidden] { display: none; }

/* 分类说明长文 */
.list-description {
  max-width: 78ch;
  padding: 26px 0 30px;
  border-top: 1px solid var(--line);
}
.list-description h2 {
  font-size: var(--fs-12);
  font-weight: var(--fw-black);
  color: var(--accent-deep);
  letter-spacing: -.01em;
  margin-bottom: 10px;
}
.list-description p {
  font-size: var(--fs-6);
  line-height: 1.85;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.list-description p:last-child { margin-bottom: 0; }
.list-description a { color: var(--accent); border-bottom: 1px solid var(--accent-line); }
.list-description a:hover { border-bottom-color: var(--accent); }

/* 相邻分类 */
.related-cats { padding: 6px 0 34px; }
.related-cats h2 {
  font-size: var(--fs-11);
  font-weight: var(--fw-black);
  color: var(--accent-deep);
  margin-bottom: 12px;
}
.related-cats ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.related-cats a {
  display: grid;
  gap: 5px;
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--panel);
  transition: border-color .18s ease, background .18s ease;
}
.related-cats a:hover { border-color: var(--accent-line); background: #fff; }
.related-cats .rc-name {
  font-size: var(--fs-8);
  font-weight: var(--fw-bold);
  color: var(--accent-deep);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.related-cats .rc-name svg { width: 13px; height: 13px; color: var(--accent); }
.related-cats p { font-size: var(--fs-4); line-height: 1.6; color: var(--muted); }

/* 详情页文章头 */
.article-head { padding: 24px 0 20px; }
.article-head h1 {
  font-size: var(--fs-15);
  line-height: 1.32;
  font-weight: var(--fw-black);
  letter-spacing: -.005em;
  color: var(--accent-deep);
  margin: 12px 0 12px;
  max-width: 30ch;
}
.article-head .lede {
  font-size: var(--fs-6);
  line-height: 1.8;
  color: var(--ink-soft);
  max-width: 60ch;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-3);
  color: var(--muted);
}
.article-meta span { display: inline-flex; align-items: center; gap: 6px; }
.article-meta span + span::before {
  content: "";
  width: 1px;
  height: 11px;
  background: var(--line-strong);
  margin-right: 10px;
}

/* 详情页正文布局 */
.article-layout {
  display: grid;
  grid-template-columns: var(--toc-width) minmax(0, 1fr);
  gap: 44px;
  padding-bottom: 34px;
}

.article-toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  align-self: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--panel);
}
.article-toc > p {
  font-size: var(--fs-2);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.article-toc ol { display: grid; gap: 2px; counter-reset: toc; }
.article-toc a {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: var(--fs-4);
  line-height: 1.45;
  color: var(--muted);
  transition: background .16s ease, color .16s ease;
}
.article-toc a::before {
  counter-increment: toc;
  content: counter(toc, decimal-leading-zero) " ";
  color: var(--accent);
  font-size: var(--fs-1);
  font-weight: var(--fw-bold);
}
.article-toc a:hover { background: rgba(6, 154, 78, .07); color: var(--accent-deep); }
.article-toc a[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: var(--fw-semibold);
}

.article { max-width: var(--article-width); }
.article > p.article-lead {
  font-size: var(--fs-7);
  line-height: 1.9;
  color: var(--ink-soft);
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  margin-bottom: 22px;
}
.article h2 {
  font-size: var(--fs-11);
  font-weight: var(--fw-bold);
  color: var(--accent-deep);
  line-height: 1.5;
  margin: 28px 0 10px;
}
.article h2:first-of-type { margin-top: 0; }
.article p {
  font-size: var(--fs-9);
  line-height: 1.95;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.article strong { color: var(--accent-deep); font-weight: var(--fw-semibold); }

/* 相关条目 */
.related-articles { padding: 26px 0 34px; border-top: 1px solid var(--line); }
.related-articles h2 {
  font-size: var(--fs-12);
  font-weight: var(--fw-black);
  color: var(--accent-deep);
  margin-bottom: 14px;
}
.related-articles ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* 正文页脚注 */
.article-footnote {
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: var(--r-card);
  background: var(--band);
  font-size: var(--fs-4);
  line-height: 1.7;
  color: var(--ink-soft);
}

@media (max-width: 1180px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-layout { grid-template-columns: 1fr; gap: 18px; }
  .article-toc { position: static; }
  .article-toc details > summary { cursor: pointer; }
  .page-hero-inner { grid-template-columns: 1fr; gap: 12px; }
  .page-meta { text-align: left; grid-auto-flow: column; justify-content: start; gap: 18px; }
  .related-cats ul, .related-articles ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .card-grid { grid-template-columns: 1fr; }
  .related-cats ul, .related-articles ul { grid-template-columns: 1fr; }
  .toolbar-inner { gap: 10px; }
  .toolbar-group { gap: 6px; }
  .chip { height: 32px; padding: 0 13px; font-size: var(--fs-3); }
  .toolbar-result { margin-left: 0; width: 100%; font-size: var(--fs-3); }
  .article-head h1 { font-size: var(--fs-13); }
  .toolbar { top: var(--header-h); }
}

/* ---------------------------------------------- nav dropdown / all link */

.nav-dropdown { position: relative; display: inline-flex; align-items: center; }
.nav-link { display: inline-flex; align-items: center; gap: 4px; }
.nav-caret { width: 12px; height: 12px; flex: 0 0 auto; transition: transform .18s ease; }
.nav-dropdown:hover .nav-caret { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 172px;
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  z-index: 50;
}
.nav-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: var(--fs-4);
  color: var(--ink-soft);
  border-bottom: 0;
  white-space: nowrap;
}
.dropdown-menu a:hover { background: var(--accent-soft); color: var(--accent-deep); }

.nav-all { font-weight: var(--fw-semibold); }

/* --------------------------------------------------- list entry media */

.entry-media {
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-img);
  overflow: hidden;
  background: var(--panel);
  margin-bottom: 2px;
}
.entry-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.entry:hover .entry-media img { transform: scale(1.03); }

/* ------------------------------------------------------------- pager */

.pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 30px;
}
.pager a,
.pager-current,
.pager-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  font-size: var(--fs-4);
  color: var(--ink-soft);
  transition: border-color .16s ease, color .16s ease;
}
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: var(--fw-semibold);
}
.pager-step { font-weight: var(--fw-semibold); }
.pager-gap { padding: 0 2px; color: var(--muted); }
.pager-info { margin-left: auto; font-size: var(--fs-3); color: var(--muted); }

/* ------------------------------------------------- article body figure */

.article figure.article-figure { margin: 4px 0 20px; }
.article-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r-img);
}
.article img { max-width: 100%; height: auto; }

/* --------------------------------------------------- article prev / next */

.article-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 0 30px;
}
.article-pager-link {
  display: grid;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--panel);
  transition: border-color .18s ease, background .18s ease;
}
.article-pager-link:hover { border-color: var(--accent-line); background: #fff; }
.article-pager-link span {
  font-size: var(--fs-2);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.article-pager-link strong {
  font-size: var(--fs-6);
  font-weight: var(--fw-semibold);
  line-height: 1.45;
  color: var(--accent-deep);
}
.article-pager-link.is-next { text-align: right; }
.article-pager-link.is-empty {
  border-style: dashed;
  background: transparent;
  pointer-events: none;
}

/* --------------------------------------------------------- footer bottom */

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--cream-line);
  font-size: var(--fs-2);
  color: rgba(234, 246, 238, .58);
}
.footer-bottom a { color: inherit; }
.footer-bottom a:hover { color: #fff; }

@media (max-width: 760px) {
  .article-pager { grid-template-columns: 1fr; }
  .pager-info { margin-left: 0; width: 100%; }
}
