/* ============================================================
   components.css · 三页共用组件（首页 / 分类页 / 详情页）
   变量一律取自 tokens.css，不写颜色/字号字面量。
   ============================================================ */

/* ---------------- 跳转链接（视觉隐藏，聚焦显示） ---------------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 60;
  padding: 10px 18px;
  border-radius: var(--radius-card);
  background: var(--accent);
  color: var(--white);
  font-size: var(--fs-4);
  text-decoration: none;
  transition: top .18s ease;
}
.skip-link:focus,
.skip-link:focus-visible { top: 12px; }

/* ---------------- 页头 ---------------- */
.site-header {
  height: var(--h-header);
  background: var(--navy);
  color: var(--on-dark);
}
.site-header__inner {
  height: 100%;
  padding: 0 42px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  font-family: var(--font-serif);
  font-size: 19px;
  letter-spacing: .04em;
  text-decoration: none;
  white-space: nowrap;
}
.brand__mark {
  width: 26px;
  height: 26px;
  flex: none;
  color: #7fb3ea;
}
.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 30px;
}
.site-nav a {
  color: var(--on-dark-soft);
  font-size: var(--fs-5);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.site-nav a:hover,
.site-nav a:focus-visible { color: var(--white); border-bottom-color: #7fb3ea; }
.site-nav a[aria-current="page"] { color: var(--white); border-bottom-color: #7fb3ea; }
.nav-toggle {
  display: none;
  margin-left: auto;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border: 1px solid var(--line-inverse);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--on-dark);
  font: inherit;
  font-size: var(--fs-3);
  cursor: pointer;
}

/* ---------------- 区块标题 ---------------- */
.sec-title {
  margin: 0 0 14px;
  padding-left: 1px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .02em;
}
.sec-title--tight { margin-bottom: 12px; }

/* ---------------- 药丸按钮 ---------------- */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 53px;
  padding: 0 33px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-5);
  letter-spacing: .04em;
  text-decoration: none;
  transition: transform .18s ease, background-color .18s ease, color .18s ease;
}
.pill--solid {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--white);
}
.pill--solid:hover, .pill--solid:focus-visible { background: var(--accent-bright); border-color: var(--accent-bright); }
.pill--ghost {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: rgba(255, 255, 255, .55);
}
.pill--ghost:hover, .pill--ghost:focus-visible { background: var(--accent-soft); }

.btn-warm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 34px;
  border-radius: var(--radius-pill);
  background: var(--warm);
  color: #2a1a04;
  font-size: var(--fs-6);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-warm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.btn-warm:hover, .btn-warm:focus-visible { transform: translateY(-1px); box-shadow: var(--shadow-warm-hover); }

/* ---------------- 页脚 ---------------- */
.site-footer {
  height: var(--h-footer);
  background: var(--navy);
  color: var(--on-dark-soft);
  padding: 0 42px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.site-footer__top {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  padding: 28px 0 0;
}
.site-footer__brand { width: 360px; max-width: 100%; flex: none; }
.site-footer__name {
  margin: 0 0 10px;
  color: var(--white);
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  letter-spacing: .04em;
}
.site-footer__desc {
  margin: 0;
  font-size: var(--fs-4);
  line-height: 1.72;
  color: #93a9c2;
}
.site-footer__col { flex: none; min-width: 0; max-width: 100%; }
.site-footer__col--about { margin-left: 60px; }
.site-footer__head {
  margin: 0 0 10px;
  font-size: var(--fs-4);
  color: var(--on-dark-soft);
  letter-spacing: .08em;
}
.site-footer__col ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}
.site-footer__col a {
  color: #9db4cd;
  font-size: var(--fs-4);
  text-decoration: none;
}
.site-footer__col a:hover, .site-footer__col a:focus-visible { color: var(--white); }
.site-footer__bottom {
  margin-top: auto;
  padding: 16px 0 20px;
  border-top: 1px solid var(--line-inverse);
}
.site-footer__bottom p {
  margin: 0;
  font-size: var(--fs-3);
  color: #7e94ad;
  line-height: 1.7;
}
.site-footer__icp {
  margin-top: 6px;
  color: #7e94ad;
  font-size: var(--fs-3);
  letter-spacing: .02em;
}

/* ---------------- 面包屑 ---------------- */
.crumb {
  padding: 22px 0 0;
  font-size: var(--fs-4);
  color: var(--muted);
}
.crumb a { color: var(--accent); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.crumb span[aria-current] { color: var(--ink-2); }
.crumb i { font-style: normal; padding: 0 8px; color: var(--muted-2); }

/* ---------------- 移动导航 ---------------- */
@media (max-width: 1080px) {
  .site-header__inner { padding: 0 20px; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: var(--h-header);
    z-index: 40;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 10px 20px 16px;
    background: var(--navy);
    border-top: 1px solid var(--line-inverse);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .nav-toggle { display: inline-flex; }
}

/* ============================================================
   内页组件（分类页 / 详情页）—— 只消费 tokens，不写颜色/字号字面量
   ============================================================ */

/* ---------------- 面包屑 ---------------- */
.crumb__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.crumb__list li { display: flex; align-items: center; gap: 8px; }
.crumb__list li + li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1px solid var(--muted-2);
  border-bottom: 1px solid var(--muted-2);
  transform: rotate(-45deg);
}

/* ---------------- 分类页：页面头 ---------------- */
.page-hero {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.page-hero__inner {
  position: relative;
  z-index: 1;
  padding: 20px 0 30px;
}
.page-hero h1 {
  margin: 14px 0 0;
  font-family: var(--font-serif);
  font-size: 42px;
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: .03em;
}
.page-lead {
  max-width: 880px;
  margin: 16px 0 0;
  color: var(--ink-2);
  font-size: var(--fs-6);
  line-height: 1.78;
}
.page-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 34px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.page-stats li { display: flex; flex-direction: column; gap: 4px; }
.page-stats b {
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}
.page-stats span { font-size: var(--fs-3); letter-spacing: .1em; color: var(--muted-2); }

/* ---------------- 筛选 / 排序工具条 ---------------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(245, 249, 254, .95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.toolbar__inner {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 13px 0;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  flex: 1 1 auto;
  min-width: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-4);
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}
.chip:hover, .chip:focus-visible { color: var(--accent); border-color: var(--accent-bright); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}
.sort {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-4);
  color: var(--muted);
  white-space: nowrap;
}
.sort select {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--card);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--fs-4);
}
.list-count {
  font-size: var(--fs-4);
  color: var(--muted-2);
  white-space: nowrap;
}
.list-count b { color: var(--accent); }

/* ---------------- 分类页：条目网格 ---------------- */
.items { padding: 30px 0 10px; }
.item-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.item-card {
  height: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--card);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.item-card__link {
  display: flex;
  gap: 16px;
  height: 100%;
  text-decoration: none;
}
.item-card:hover, .item-card:focus-within {
  border-color: var(--accent-bright);
  box-shadow: 0 10px 24px rgba(19, 74, 144, .10);
  transform: translateY(-2px);
}
.item-card__thumb {
  flex: none;
  width: 148px;
  aspect-ratio: 148 / 112;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--accent-soft);
}
.item-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-card__body { min-width: 0; }
.item-card__tag {
  display: inline-block;
  margin-bottom: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-3);
  letter-spacing: .04em;
}
.item-card h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}
.item-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--fs-4);
  line-height: 1.68;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  word-break: break-word;
}
.empty {
  padding: 44px 0;
  color: var(--muted);
  font-size: var(--fs-5);
  text-align: center;
}

/* ---------------- 分类页：列表说明 ---------------- */
.list-description {
  padding: 26px 0 34px;
}
.list-description__panel {
  padding: 26px 34px;
  border-radius: var(--radius-panel);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.list-description h2 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
}
.list-description p {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: var(--fs-5);
  line-height: 1.94;
}
.list-description p:last-child { margin-bottom: 0; }

/* ---------------- 详情页：文章头 ---------------- */
.article-head { padding: 18px 0 6px; }
.article-head__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
}
.article-head h1 {
  margin: 10px 0 0;
  font-family: var(--font-serif);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: .02em;
}
.article-head__sub {
  margin: 12px 0 0;
  color: var(--accent);
  font-size: var(--fs-4);
  letter-spacing: .16em;
}
.article-head__lede {
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: var(--fs-6);
  line-height: 1.78;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin: 18px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: var(--fs-4);
  color: var(--muted);
}
.article-meta b { color: var(--ink); font-weight: 600; }

/* ---------------- 详情页：参数表 ---------------- */
.spec { padding: 16px 0 8px; }
.spec h2 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
}
.spec dl {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  margin: 0;
  border-top: 1px solid var(--line);
}
.spec dt, .spec dd {
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-5);
  line-height: 1.66;
}
.spec dt {
  color: var(--ink);
  font-weight: 600;
  background: rgba(225, 237, 250, .5);
}
.spec dd { color: var(--ink-2); }
.spec__note {
  margin: 10px 0 0;
  color: var(--muted-2);
  font-size: var(--fs-3);
  line-height: 1.7;
}

/* ---------------- 详情页：正文 + 目录 ---------------- */
.article-body { padding: 20px 0 10px; }
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 250px) minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}
.toc {
  position: sticky;
  top: 20px;
  align-self: start;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--card);
}
.toc__title {
  margin: 0 0 10px;
  color: var(--muted-2);
  font-size: var(--fs-3);
  letter-spacing: .18em;
}
.toc__toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-4);
  cursor: pointer;
}
.toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}
.toc__list li { counter-increment: toc; }
.toc__list a {
  display: flex;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line-soft);
  color: var(--muted);
  font-size: var(--fs-4);
  line-height: 1.5;
  text-decoration: none;
  transition: color .16s ease;
}
.toc__list a::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--muted-2);
  font-size: var(--fs-3);
  letter-spacing: .06em;
}
.toc__list a:hover, .toc__list a:focus-visible, .toc__list a.is-active {
  color: var(--accent);
}
.toc__list li:last-child a { border-bottom: 0; }

.article {
  min-width: 0;
  color: var(--ink-2);
}
.article h2 {
  margin: 34px 0 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}
.article h2:first-of-type { margin-top: 8px; padding-top: 0; border-top: 0; }
.article p {
  margin: 0 0 18px;
  font-size: var(--fs-5);
  line-height: 1.94;
}
.article__scope {
  margin: 0 0 22px;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  background: rgba(225, 237, 250, .5);
  color: var(--muted-2);
  font-size: var(--fs-4);
  line-height: 1.8;
}
.article__figure {
  margin: 6px 0 26px;
  overflow: hidden;
  border-radius: var(--radius-panel);
  background: var(--accent-soft);
}
.article__figure img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* ---------------- 列表页：分页 ---------------- */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 26px 0 6px;
}
.pager__item,
.pager__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--card);
  color: var(--ink-2);
  font-size: var(--fs-4);
  text-decoration: none;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}
.pager__item:hover,
.pager__step:hover { border-color: var(--accent); color: var(--accent); }
.pager__item.is-current {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.pager__jump {
  margin-left: 6px;
  color: var(--muted);
  font-size: var(--fs-3);
}

/* ---------------- 详情页：相关条目 ---------------- */
.related { padding: 26px 0 36px; border-top: 1px solid var(--line-soft); }
.related h2 {
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
}
.rel-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.rel {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--card);
  overflow: hidden;
}
.rel a { display: block; text-decoration: none; }
.rel__thumb {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--accent-soft);
}
.rel__thumb img { width: 100%; height: 100%; object-fit: cover; }
.rel__body { padding: 12px 14px 15px; }
.rel h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-6);
  font-weight: 700;
}
.rel p {
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--fs-3);
  line-height: 1.66;
}
.rel a:hover h3, .rel a:focus-visible h3 { color: var(--accent); }

/* ---------------- 内页响应式 ---------------- */
@media (max-width: 1080px) {
  .page-hero h1 { font-size: 34px; }
  .toolbar__inner { flex-wrap: wrap; gap: 12px; }
  .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-head__grid { grid-template-columns: 1fr; gap: 22px; }
  .article-head h1 { font-size: 34px; }
  .article-layout { grid-template-columns: 1fr; gap: 22px; }
  .toc { position: static; padding: 14px 16px; }
  .toc__toggle { display: flex; }
  .toc.is-open .toc__list { display: block; }
  .toc__list { display: none; }
  .rel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .item-grid { grid-template-columns: 1fr; }
  .item-card__link { flex-direction: column; }
  .item-card__thumb { width: 100%; aspect-ratio: 16 / 10; }
  .spec dl { grid-template-columns: 1fr; }
  .spec dt { border-bottom: 0; }
  .page-stats { gap: 22px; }
  .rel-grid { grid-template-columns: 1fr; }
  .list-description__panel { padding: 20px 18px; }
  .article h2 { font-size: 22px; }
}
