/* components.css — 全站公共组件（吸顶导航 / 按钮 / 卡片 / 表格 / 问答 / 页脚）
   首页与内页共用；只引用 tokens.css 的变量，不写字面量颜色。 */

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

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

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

img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; color: var(--ink); font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif; font-weight: 700; }

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 99;
  padding: 8px 14px; border-radius: var(--r-2);
  background: var(--navy); color: var(--ink-invert); font-size: var(--fs-4);
}
.skip:focus { top: 12px; }

/* ── 吸顶导航 ─────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: var(--paper-nav);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: 20px;
  height: 69px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-9); font-weight: 700; color: var(--ink);
  letter-spacing: .2px; white-space: nowrap; flex: none;
}
.brand-mark {
  width: 15px; height: 26px; flex: none;
  background: var(--blue);
  border-radius: 1px;
  box-shadow: 6px 0 0 -2px var(--blue);
}
.nav {
  display: flex; align-items: center; gap: 4px;
  margin-left: auto; flex-wrap: nowrap;
}
.nav a {
  padding: 6px 6px;
  font-size: var(--fs-5); color: var(--ink-2); white-space: nowrap;
  border-radius: var(--r-1);
  transition: color .15s ease, background .15s ease;
}
.nav a:hover { color: var(--blue); background: var(--band); }
.header-cta {
  flex: none; margin-left: 12px;
  display: inline-flex; align-items: center;
  height: 32px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  font-size: var(--fs-4); color: var(--ink-2); background: #fff;
  transition: border-color .15s ease, color .15s ease;
}
.header-cta:hover { border-color: var(--blue); color: var(--blue); }
.nav-toggle { display: none; cursor: pointer; }

/* ── 药丸主按钮 ───────────────────────────────────────── */
.btn-amber {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 26px;
  border-radius: var(--r-pill);
  background: var(--amber); color: var(--amber-ink);
  font-size: var(--fs-7); font-weight: 600;
  box-shadow: 0 6px 16px var(--on-amber-shadow);
  transition: background .16s ease, transform .16s ease;
}
.btn-amber:hover { background: var(--amber-deep); transform: translateY(-1px); }
.btn-amber-lg { height: 50px; padding: 0 30px; font-size: var(--fs-8); }

/* ── 区块导语（左侧竖条 + 单行说明）──────────────────── */
.lede {
  position: relative;
  margin: 0 0 16px;
  padding-left: 22px;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-6); font-weight: 400; line-height: 1.62;
  color: var(--ink-2); letter-spacing: normal;
}
.lede::before {
  content: ""; position: absolute; left: 0; top: 4px;
  width: 8px; height: 25px; border-radius: 1px;
  background: var(--blue);
}

/* ── 卡片通用 hover ───────────────────────────────────── */
.cat-tile img,
.feat-card img,
.recipe-card img { transition: transform .22s ease, filter .22s ease; }
.cat-tile:hover img,
.feat-card:hover img,
.recipe-card:hover img { transform: translateY(-2px); filter: saturate(1.06); }

/* ── 对照表 ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.spec-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.6px; line-height: 1.34; color: var(--ink-2);
  background: transparent;
}
.spec-table caption { text-align: left; }
.spec-table thead th {
  background: var(--steel); color: var(--ink-invert);
  font-weight: 500; text-align: left; letter-spacing: .2px;
  padding: 7px 13px; white-space: nowrap;
  border-right: 1px solid var(--on-invert-hairline);
}
.spec-table thead th:first-child { border-radius: var(--r-2) 0 0 0; }
.spec-table thead th:last-child { border-radius: 0 var(--r-2) 0 0; border-right: 0; }
.spec-table tbody th {
  font-weight: 600; color: var(--ink); text-align: left;
  padding: 1px 13px; white-space: nowrap;
}
.spec-table tbody td { padding: 1px 13px; }
.spec-table tbody tr { border-bottom: 1px solid var(--line); }
.spec-table tbody tr:nth-child(even) { background: var(--card-2); }
.spec-table tbody tr:last-child { border-bottom: 0; }
.table-note { margin: 7px 0 0; font-size: var(--fs-1); color: var(--ink-3); }

/* ── 问答（details 原生展开）─────────────────────────── */
.faq-item {
  background: var(--card);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--line);
}
.faq-item summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px;
  font-size: var(--fs-6); font-weight: 600; color: var(--ink);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; flex: none;
  width: 8px; height: 8px; margin-right: 2px;
  border-right: 1.7px solid var(--ink-3);
  border-bottom: 1.7px solid var(--ink-3);
  transform: rotate(45deg) translateY(-2px);
  transition: transform .2s ease;
}
.faq-item[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.faq-item[open] summary { color: var(--blue); }
.faq-body {
  margin: 0; padding: 0 18px 16px;
  font-size: var(--fs-4); line-height: 1.8; color: var(--ink-2);
}
.faq-item + .faq-item { }

/* ── 页脚 ─────────────────────────────────────────────── */
.site-footer {
  background: var(--navy-deep);
  color: var(--footer-ink);
  font-size: var(--fs-3);
}
.site-footer a { color: inherit; }
.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr);
  grid-template-areas:
    "brand note links"
    "cats cats cats"
    "copy copy copy";
  gap: 14px 30px;
}
.footer-brand {
  grid-area: brand;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px;
}
.brand-footer { color: var(--ink-invert); font-size: var(--fs-9); }
.brand-footer .brand-mark { background: var(--steel-soft); box-shadow: 6px 0 0 -2px var(--steel-soft); }
.footer-dot { color: var(--footer-ink-3); }
.footer-tag { font-size: var(--fs-3); color: var(--footer-ink-2); }
.footer-note {
  grid-area: note; margin: 0;
  color: var(--footer-ink-2); line-height: 1.95;
}
.footer-links {
  grid-area: links; display: flex; flex-wrap: wrap; gap: 4px 18px;
  align-items: flex-start; justify-content: flex-end; text-align: right;
}
.footer-links a { color: var(--footer-ink-2); }
.footer-links a:hover { color: var(--ink-invert); }
.footer-cats {
  grid-area: cats; color: var(--footer-ink-2); line-height: 1.9;
  padding-top: 14px; border-top: 1px solid var(--line-invert);
}
.footer-cats-label { color: var(--footer-ink-3); }
.footer-cats a:hover { color: var(--ink-invert); text-decoration: underline; text-underline-offset: 3px; }
.footer-copy {
  grid-area: copy; margin: 0;
  font-size: var(--fs-1); color: var(--footer-ink-3);
}

/* ── 内页组件（分类页 / 详情页）────────────────────────
   首页不用这些类；响应式覆盖留在 style.css 的媒体查询里。 */
.page-hero {
  background: var(--navy); color: var(--ink-invert);
  padding: 30px 0 34px;
}
.crumbs { font-size: var(--fs-3); color: var(--on-navy-ink-5); margin-bottom: 14px; }
.crumbs a:hover { color: var(--ink-invert); text-decoration: underline; }
.crumbs span { margin: 0 6px; }
.page-hero h1 { color: var(--ink-invert); font-size: var(--fs-13); line-height: 1.24; }
.page-hero p { margin: 16px 0 0; max-width: 40em; font-size: var(--fs-8); line-height: 1.8; color: var(--on-navy-ink-2); }
.page-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.meta-note {
  display: inline-flex; align-items: center; height: 26px; padding: 0 12px;
  border-radius: var(--r-pill); border: 1px solid var(--on-navy-line);
  font-size: var(--fs-3); color: var(--on-navy-ink-4);
}

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.toolbar-group { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.toolbar-label { font-size: var(--fs-3); color: var(--ink-3); margin-right: 2px; }
.toolbar-label[for] { cursor: pointer; }
.chip {
  height: 30px; padding: 0 13px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--white); color: var(--ink-2); font-size: var(--fs-3); font-family: inherit;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: var(--white); }
.toolbar-sort { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.toolbar-sort select {
  height: 30px; padding: 0 10px; border: 1px solid var(--line-strong);
  border-radius: var(--r-2); background: var(--white); color: var(--ink-2);
  font-size: var(--fs-3); font-family: inherit;
}
.toolbar-reset {
  height: 30px; padding: 0 12px; cursor: pointer;
  border: 0; background: none; color: var(--blue);
  font-size: var(--fs-3); font-family: inherit; text-decoration: underline; text-underline-offset: 3px;
}
.toolbar-count { font-size: var(--fs-3); color: var(--ink-3); }

.card-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px; margin-top: 22px;
}
.item-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-3); overflow: hidden; box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column;
}
.item-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.item-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.item-card h3 { font-size: var(--fs-7); line-height: 1.4; }
.item-card h3 a:hover { color: var(--blue); }
.item-card p { margin: 0; font-size: var(--fs-3); line-height: 1.7; color: var(--ink-2); }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 8px; }
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: var(--r-1); background: var(--band); color: var(--ink-3);
  font-size: var(--fs-1);
}
.empty-state {
  margin: 22px 0 0; padding: 30px 20px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--r-3);
  font-size: var(--fs-4); color: var(--ink-3);
}

.list-layout {
  display: grid; grid-template-columns: minmax(0, 44em) 288px;
  gap: 48px; padding-top: 30px; justify-content: center;
}
.list-desc h2 { font-size: var(--fs-h2-sm); line-height: 1.4; margin-bottom: 14px; }
.list-desc p { margin: 0 0 14px; font-size: var(--fs-7); line-height: 1.92; color: var(--ink-2); }
.side-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-3);
  padding: 18px; box-shadow: var(--shadow-xs);
}
.side-card h2 { font-size: var(--fs-7); margin-bottom: 10px; }
.side-card p { margin: 0 0 10px; font-size: var(--fs-3); line-height: 1.7; color: var(--ink-2); }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.side-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-radius: var(--r-2); background: var(--band);
  font-size: var(--fs-4); color: var(--ink); transition: background .15s ease, color .15s ease;
}
.side-list a:hover { background: var(--blue); color: var(--white); }

.article-head { padding: 26px 0 22px; border-bottom: 1px solid var(--line); }
.article-head h1 { font-size: var(--fs-13); line-height: 1.26; margin: 12px 0 0; }
.article-head .standfirst { margin: 14px 0 0; max-width: 56em; font-size: var(--fs-8); line-height: 1.85; color: var(--ink-2); }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; font-size: var(--fs-3); color: var(--ink-3); }

.article-layout {
  display: grid; grid-template-columns: minmax(0, 44em) 260px;
  gap: 48px; padding: 26px 0 40px; justify-content: center;
}
.toc {
  position: sticky; top: 90px; align-self: start;
  border-left: 2px solid var(--line); padding-left: 16px;
}
.toc p { margin: 0 0 8px; font-size: var(--fs-3); color: var(--ink-3); }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: toc; }
.toc a {
  display: block; font-size: var(--fs-4); line-height: 1.5; color: var(--ink-2);
  padding: 2px 0; transition: color .15s ease;
}
.toc a:hover { color: var(--blue); }
.toc a.is-current { color: var(--blue); font-weight: 600; }

.article-body h2 { font-size: var(--fs-h2); line-height: 1.4; margin: 30px 0 12px; }
.article-body h2:first-child { margin-top: 0; }
.article-body p { margin: 0 0 15px; font-size: var(--fs-7); line-height: 1.95; color: var(--ink-2); }
.article-body a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

.sec-inline { padding-top: 30px; }
.sec-inline > h2 { font-size: var(--fs-h2-sm); line-height: 1.45; margin-bottom: 14px; }
.related-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px; margin-top: 16px;
}

/* ── 内页补充：工具条第二行 / 网格说明 / 面包屑浅底版 ── */
.toolbar-label-wrap {
  flex-basis: 100%; margin: 0; max-width: 54em;
  font-size: var(--fs-3); line-height: 1.7; color: var(--ink-2);
}
.toolbar-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 12px 22px; width: 100%;
}
.grid-note {
  margin: 20px 0 0;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-6); font-weight: 400;
  line-height: 1.7; color: var(--ink-2);
}
.list-note {
  margin: 0 0 14px;
  font-size: var(--fs-4); line-height: 1.8; color: var(--ink-2);
}
.crumbs-ink { color: var(--ink-3); margin-bottom: 10px; }
.crumbs-ink a { color: var(--blue); }
.crumbs-ink a:hover { text-decoration: underline; }

/* ── 详情页补充：导语段 / 相关条目卡（a > span 结构）── */
.article-intro {
  margin: 0 0 18px; padding: 12px 16px;
  border-left: 2px solid var(--blue); background: var(--card-2);
  font-size: var(--fs-4); line-height: 1.8; color: var(--ink-2);
}
.related-grid .item-card { text-decoration: none; }
.related-title {
  display: block; font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-7); font-weight: 700; color: var(--ink);
}
.related-note {
  display: block; margin-top: 4px;
  font-size: var(--fs-3); line-height: 1.6; color: var(--ink-3);
}

/* ── 列表分页 ───────────────────────────────────────── */
.pager {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 26px 0 0; padding-top: 20px; border-top: 1px solid var(--line);
}
.pager-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 12px; border-radius: var(--r-2);
  border: 1px solid var(--line-strong); background: var(--white);
  font-size: var(--fs-3); color: var(--ink-2); text-decoration: none;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
a.pager-link:hover { border-color: var(--blue); color: var(--blue); }
.pager-link.is-current { background: var(--blue); border-color: var(--blue); color: var(--white); }
.pager-link.is-disabled { color: var(--ink-3); opacity: .55; cursor: default; }
.pager-gap { display: inline-flex; align-items: center; height: 34px; padding: 0 4px; color: var(--ink-3); font-size: var(--fs-3); }
