

/* ============================================================
   components.css — 三页共享组件
   导航 / 页脚 / 按钮 / 区块标题 / 标签 / 卡片 / 面包屑 / 分页 / 正文
   ============================================================ */

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

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

body {
  margin: 0;
  background: var(--paper);
  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.7;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  width: min(var(--shell), calc(100% - 2 * var(--pad)));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--lime);
  color: var(--green);
  font-size: var(--fs-4);
}
.skip-link:focus { left: 12px; top: 12px; }

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

/* ---------------------------------------------------------- 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(242, 238, 227, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 74px;
}

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

.brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  border: 1px solid var(--green);
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--lime);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px 12px;
  border: 1px solid rgba(36, 72, 56, 0.7);
  border-radius: 50%;
}

.brand-name {
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.35vw, 20px);
  margin-left: auto;
}

.main-nav a {
  position: relative;
  padding: 6px 0;
  font-size: var(--fs-4);
  color: var(--ink-soft);
  white-space: nowrap;
  transition: color 0.2s var(--ease);
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transition: right 0.25s var(--ease);
}
.main-nav a:hover { color: var(--ink); }
.main-nav a:hover::after,
.main-nav a[aria-current="page"]::after { right: 0; }
.main-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }

.header-cta {
  flex-shrink: 0;
  margin-left: 8px;
  padding: 8px 17px;
  border: 1px solid var(--ink);
  border-radius: var(--r-1);
  font-size: var(--fs-4);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.header-cta:hover { background: var(--ink); color: var(--paper); }

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  margin-left: auto;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  background: transparent;
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  height: 1.5px;
  background: var(--ink);
  margin: 4px 0;
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}

/* ---------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: var(--r-1);
  font-size: var(--fs-5);
  font-weight: 700;
  line-height: 1.2;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-lime { background: var(--accent); color: var(--paper); }
.btn-lime:hover { background: var(--accent-deep); }
.btn-ghost { border-color: rgba(243, 239, 228, 0.5); color: var(--on-dark); }
.btn-ghost:hover { background: rgba(243, 239, 228, 0.12); }
.btn-sm { padding: 9px 18px; font-size: var(--fs-4); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-4);
  font-weight: 700;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}
.text-link::after { content: "→"; transition: transform 0.2s var(--ease); }
.text-link:hover::after { transform: translateX(3px); }

/* ---------------------------------------------------------- 区块标题 */
.section { padding-block: var(--section-y); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 14px;
}
.section-head h2 {
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-12);
  line-height: 1.25;
  letter-spacing: 0.01em;
  font-weight: 700;
}
.section-head p {
  max-width: 460px;
  font-size: var(--fs-4);
  color: var(--muted);
  line-height: 1.55;
  text-align: right;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  background: var(--accent);
  color: var(--paper);
  border-radius: var(--r-1);
  font-size: var(--fs-1);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.eyebrow {
  font-size: var(--fs-1);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--lime);
}

/* ---------------------------------------------------------- 页脚 */
.site-footer {
  background: var(--green);
  color: var(--on-dark);
  padding-top: 8px;
  margin-top: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.7fr 1.3fr 1.1fr;
  gap: 18px;
  padding-bottom: 4px;
}
.brand-dark .brand-name { color: var(--on-dark); }
.footer-tagline {
  margin-top: 4px;
  max-width: 260px;
  font-size: var(--fs-4);
  color: var(--on-dark-soft);
  line-height: 1.6;
}
.footer-title {
  margin-bottom: 4px;
  font-size: var(--fs-1);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--lime);
  text-transform: uppercase;
}
.footer-col ul { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.footer-col a {
  font-size: 11px;
  line-height: 1.45;
  color: var(--on-dark-soft);
  transition: color 0.2s var(--ease);
}
.footer-col a:hover { color: var(--lime); }
.footer-bottom {
  padding: 4px 0 6px;
  border-top: 1px solid var(--line-dark);
  font-size: var(--fs-1);
  color: var(--on-dark-soft);
}

/* ---------------------------------------------------------- 内页共享：面包屑 / 目录 / 正文 / 分页 */
.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-3);
  color: var(--muted);
}
.crumb a:hover { color: var(--ink); }
.crumb li { display: inline-flex; align-items: center; gap: 6px; }
.crumb li + li::before { content: "/"; color: var(--line-strong); }
.crumb [aria-current="page"] { color: var(--ink-soft); }

.toc {
  border-left: 1px solid var(--line-strong);
  padding-left: 16px;
}
.toc-title {
  margin-bottom: 8px;
  font-size: var(--fs-1);
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.toc ol { display: grid; gap: 6px; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex;
  gap: 6px;
  font-size: var(--fs-3);
  color: var(--muted);
  line-height: 1.45;
}
.toc a::before { content: counter(toc, decimal-leading-zero); color: var(--accent); font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif; }
.toc a:hover,
.toc a[aria-current="true"] { color: var(--ink); }

.article {
  max-width: 760px;
  font-size: var(--fs-7);
  line-height: 1.95;
  color: var(--ink-soft);
}
.article h2 {
  margin: 26px 0 8px;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-10);
  line-height: 1.4;
  color: var(--ink);
}
.article p + p { margin-top: 10px; }
.article strong { color: var(--ink); font-weight: 700; }
.article a { border-bottom: 1px solid var(--lime-deep); }

.pager {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 22px;
}
.pager a,
.pager span {
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  font-size: var(--fs-3);
}
.pager [aria-current="page"] { background: var(--green); border-color: var(--green); color: var(--paper); }

/* ---------------------------------------------------------- 响应式 */
@media (max-width: 1100px) {
  .header-inner { gap: 12px; }
  .main-nav { gap: 10px; }
  .main-nav a { font-size: var(--fs-3); }
  .header-cta { padding: 7px 12px; font-size: var(--fs-3); }
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .header-cta { margin-left: 0; }
  .main-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--pad) 16px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-1);
  }
  .site-header.is-open .main-nav { display: flex; }
  .main-nav a { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .main-nav a::after { display: none; }
  .site-header.is-open .nav-toggle-bar:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
  .site-header.is-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
  .site-header.is-open .nav-toggle-bar:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 26px; }
}

@media (max-width: 640px) {
  .section-head { display: block; }
  .section-head h2 { font-size: var(--fs-11); }
  .section-head p { margin-top: 6px; text-align: left; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .toc { border-left: 0; border-top: 1px solid var(--line-strong); padding-left: 0; padding-top: 8px; }
}

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

/* ============================================================
   内页：分类列表 / 文章详情（与首页共用同一套 tokens）
   ============================================================ */

/* ---------------------------------------------------------- 内页页头 */
.page-hero,
.article-hero {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  padding: 30px 0 26px;
}

.page-hero h1,
.article-hero h1 {
  margin: 12px 0 8px;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: clamp(30px, 3.2vw, 42px);
  line-height: 1.22;
  letter-spacing: 0.01em;
}

.page-stats {
  font-size: var(--fs-3);
  color: var(--accent);
  letter-spacing: 0.04em;
}

.page-intro {
  max-width: 760px;
  margin-top: 8px;
  font-size: var(--fs-6);
  line-height: 1.75;
  color: var(--muted);
}

/* ---------------------------------------------------------- 列表布局 */
.list-section { padding: 22px 0 10px; }

.list-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 38px;
  align-items: start;
}

.filter-bar {
  position: sticky;
  top: 82px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.filter-chips,
.filter-sort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.chip {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  background: transparent;
  font-size: var(--fs-3);
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: var(--paper);
}

.sort-btn {
  padding: 4px 2px;
  border: 0;
  background: transparent;
  font-size: var(--fs-3);
  color: var(--muted);
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.sort-btn[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.result-count {
  margin-left: 4px;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-2);
  color: var(--muted);
}

.list-head { margin: 16px 0 10px; }
.list-head h2 { font-size: 24px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 18px;
}

.list-card { min-width: 0; }
.list-thumb {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--paper-3);
  border-radius: var(--r-1);
}
.list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.list-card:hover .list-thumb img { transform: scale(1.04); }

.list-body { padding-top: 9px; }
.list-body .tag { margin-bottom: 5px; }
.list-body h3 {
  font-size: var(--fs-6);
  font-weight: 700;
  line-height: 1.45;
}
.list-body h3 a { display: block; }
.list-body h3 a:hover { color: var(--accent); }
.list-body p {
  margin-top: 4px;
  font-size: var(--fs-2);
  line-height: 1.6;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-date {
  display: block;
  margin-top: 5px;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-1);
  color: var(--muted-2);
}

.empty-state {
  margin: 22px 0;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  font-size: var(--fs-4);
  color: var(--muted);
}

/* ---------------------------------------------------------- 侧栏 */
.list-sidebar {
  position: sticky;
  top: 90px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}
.side-title {
  margin-bottom: 8px;
  font-size: var(--fs-2);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.side-title-2 { margin-top: 22px; }
.side-cats { display: grid; gap: 5px; }
.side-cats a {
  display: block;
  padding: 3px 0;
  font-size: var(--fs-3);
  color: var(--ink-soft);
}
.side-cats a:hover,
.side-cats a[aria-current="page"] { color: var(--accent); }
.side-cats ul {
  display: grid;
  gap: 2px;
  margin: 2px 0 4px 10px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}
.side-cats ul a { font-size: var(--fs-2); color: var(--muted); }
.hot-list { display: grid; gap: 8px; }
.hot-list a {
  display: block;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-2);
  line-height: 1.5;
  color: var(--ink-soft);
}
.hot-list a:hover { color: var(--accent); }

/* ---------------------------------------------------------- 列表说明 */
.list-description {
  margin-top: 16px;
  padding: 34px 0 38px;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
}
.list-description h2 {
  margin-bottom: 10px;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: 24px;
  line-height: 1.3;
}
.list-description p {
  max-width: 900px;
  font-size: var(--fs-6);
  line-height: 1.9;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------- 详情页 */
.article-hero .tag { margin-top: 4px; }
.article-deck {
  max-width: 820px;
  margin-top: 10px;
  font-size: var(--fs-7);
  line-height: 1.75;
  color: var(--ink-soft);
}
.article-meta {
  margin-top: 12px;
  font-size: var(--fs-2);
  color: var(--muted);
}

.article-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  padding: 30px 0 20px;
}
.article-layout .toc { position: sticky; top: 92px; }
.article-main { max-width: 820px; min-width: 0; }

.article h2 { font-size: 24px; }
.article p { font-size: 16px; line-height: 1.95; }
.article p + p { margin-top: 12px; }

.quick-table { margin-top: 34px; }
.quick-table h2,
.related h2 {
  margin-bottom: 10px;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: 24px;
  line-height: 1.3;
}
.table-scroll { overflow-x: auto; }
.quick-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-3);
}
.quick-table th,
.quick-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.quick-table thead th {
  background: var(--paper-2);
  font-size: var(--fs-2);
  letter-spacing: 0.04em;
  color: var(--muted);
}
.quick-table tbody th { font-weight: 700; }
.quick-table td:last-child { white-space: normal; min-width: 170px; }
.table-hint { margin-top: 8px; font-size: var(--fs-2); color: var(--muted); }

.related { margin-top: 38px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.related-card .related-thumb {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--paper-3);
  border-radius: var(--r-1);
}
.related-card img { width: 100%; height: 100%; object-fit: cover; }
.related-card h3 {
  margin-top: 7px;
  font-size: var(--fs-4);
  line-height: 1.5;
}
.related-card a:hover h3 { color: var(--accent); }

/* ---------------------------------------------------------- 内页响应式 */
@media (max-width: 1100px) {
  .list-layout { grid-template-columns: 1fr; gap: 26px; }
  .list-sidebar {
    position: static;
    padding: 18px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .side-cats { grid-template-columns: 1fr 1fr; }
  .hot-list { grid-template-columns: 1fr 1fr 1fr; }
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .article-layout .toc { position: static; }
  .article-main { max-width: none; }
}

@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { position: static; }
  .related-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .page-hero,
  .article-hero { padding: 22px 0 20px; }
  .page-hero h1,
  .article-hero h1 { font-size: 28px; }
  .card-grid { grid-template-columns: 1fr; }
  .list-sidebar { padding-top: 14px; }
  .side-cats { grid-template-columns: 1fr; }
  .hot-list { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .article h2 { font-size: 21px; }
  .article p { font-size: 15px; }
  .list-description { padding: 26px 0 30px; }
  .quick-table th,
  .quick-table td { padding: 8px 8px; }
}

/* 目录使用自定义序号，隐藏 ol 默认标记 */
.toc ol { list-style: none; margin: 0; padding: 0; }
