/* =========================================================================
   排版基础与共享组件(header/footer/按钮/警示)
   ========================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-5));
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  color: var(--ink);
  background: var(--bg-warm);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 锚点跳转不被固定 header 遮挡 */
:target {
  scroll-margin-top: calc(var(--header-h) + var(--sp-5));
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent-deep);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
a:hover {
  color: var(--ink);
}

/* —— 容器 —— */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

/* —— 标题排版 —— */
h1,
h2,
h3 {
  line-height: var(--lh-tight);
  font-weight: var(--w-semibold);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--w-semibold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

/* =========================================================================
   Header
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(250, 248, 244, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
}
.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: var(--w-semibold);
  color: var(--ink);
  font-size: var(--fs-small);
}
.brand__logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: none;
}
.brand__mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-warm));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.8rem;
  font-weight: var(--w-bold);
  letter-spacing: 0;
}
.brand__name b {
  font-weight: var(--w-semibold);
}
.brand__name span {
  color: var(--ink-faint);
  font-weight: var(--w-regular);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  margin-left: auto;
}
.main-nav a {
  color: var(--ink-soft);
  font-size: var(--fs-small);
  font-weight: var(--w-medium);
}
.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--ink);
}

/* —— 科普系列下拉菜单 —— */
.nav-drop {
  position: relative;
}
.nav-drop summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  font-size: var(--fs-small);
  font-weight: var(--w-medium);
  user-select: none;
  transition: color var(--dur) var(--ease);
}
.nav-drop summary::-webkit-details-marker {
  display: none;
}
.nav-drop summary:hover,
.nav-drop[open] summary {
  color: var(--ink);
}
.nav-drop__caret {
  transition: transform var(--dur) var(--ease);
}
.nav-drop[open] .nav-drop__caret {
  transform: rotate(180deg);
}
.nav-drop__menu {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 228px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  padding: var(--sp-2);
  display: flex;
  flex-direction: column;
  z-index: 60;
}
.nav-drop__menu a {
  padding: 9px 14px;
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: var(--fs-small);
  font-weight: var(--w-medium);
  white-space: nowrap;
}
.nav-drop__menu a:hover {
  background: var(--accent-soft);
  color: var(--ink);
}
.nav-drop__menu a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: var(--w-semibold);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 40px;
  padding-inline: var(--sp-5);
  border-radius: var(--radius-full);
  font-size: var(--fs-small);
  font-weight: var(--w-medium);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
    color var(--dur) var(--ease), transform var(--dur) var(--ease);
  white-space: nowrap;
}
.btn--primary {
  background: var(--ink);
  color: var(--bg-warm);
}
.btn--primary:hover {
  background: #000;
  color: #fff;
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn--ghost:hover {
  background: var(--bg-card);
  border-color: var(--ink-faint);
}

/* 移动端菜单按钮 */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}
.nav-toggle span {
  position: relative;
  width: 20px;
  height: 1.5px;
  background: var(--ink);
  transition: transform var(--dur) var(--ease);
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 1.5px;
  background: var(--ink);
}
.nav-toggle span::before {
  top: -6px;
}
.nav-toggle span::after {
  top: 6px;
}

/* =========================================================================
   急救警示带(首页与详情页共用)
   ========================================================================= */
.urgent-bar {
  background: var(--urgent-bg);
  border-block: 1px solid var(--urgent-border);
}
.urgent-bar__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-block: var(--sp-3);
  font-size: var(--fs-small);
  color: var(--urgent);
  line-height: var(--lh-snug);
}
.urgent-bar__icon {
  flex: none;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
}
.urgent-bar__text strong {
  font-weight: var(--w-semibold);
}
.urgent-bar__text {
  color: var(--ink);
}
.urgent-bar__text em {
  font-style: normal;
  color: var(--urgent);
  font-weight: var(--w-semibold);
}

/* —— 图片灯箱（点击大图 · 滚轮/双指缩放 · 拖拽平移 · 查看原图） —— */
.prose figure { cursor: zoom-in; position: relative; }
.prose figure::after {
  content: "点击查看大图";
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; line-height: 1; color: var(--ink-soft);
  background: color-mix(in srgb, var(--bg-warm) 92%, transparent);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px;
  opacity: 0; transition: opacity var(--dur) var(--ease); pointer-events: none;
}
.prose figure:hover::after { opacity: 1; }
@media (hover: none) {
  .prose figure::after { opacity: 1; background: color-mix(in srgb, var(--bg-warm) 80%, transparent); }
}
.lb { position: fixed; inset: 0; z-index: 100; display: none; }
.lb.is-on { display: block; }
.lb__backdrop { position: absolute; inset: 0; background: rgba(43, 42, 40, 0.9); }
.lb__stage { position: absolute; inset: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.lb__img {
  /* 缩放由 JS 改布局宽度（SVG 重新矢量渲染，放大保持锐利），transform 只用于平移 */
  max-width: none; max-height: none; transform-origin: 0 0;
  touch-action: none; user-select: none; -webkit-user-drag: none; cursor: grab;
}
.lb__img.is-grab { cursor: grabbing; }
.lb__close {
  position: absolute; top: 16px; right: 16px; width: 36px; height: 36px;
  border-radius: 999px; border: 1px solid rgba(250, 248, 244, 0.4);
  background: transparent; color: #faf8f4; font-size: 15px; line-height: 1; cursor: pointer;
}
.lb__close:hover, .lb__close:focus-visible { border-color: #faf8f4; outline: none; }
.lb__ctrl {
  position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
}
.lb__ctrl button {
  height: 32px; min-width: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid rgba(250, 248, 244, 0.4); background: transparent; color: #faf8f4;
  font-size: 14px; line-height: 1; cursor: pointer;
}
.lb__ctrl button:hover, .lb__ctrl button:focus-visible { border-color: #faf8f4; outline: none; }
.lb__pct {
  font-family: var(--font-mono); font-size: 11px; color: rgba(250, 248, 244, 0.85);
  min-width: 44px; text-align: center;
}
.lb__open {
  position: absolute; top: 22px; left: 24px;
  font-family: inherit;
  font-size: 12px; color: rgba(250, 248, 244, 0.85); text-decoration: none;
  background: transparent; cursor: pointer;
  border: 1px solid rgba(250, 248, 244, 0.4); border-radius: 999px; padding: 6px 14px;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.lb__open:hover { border-color: #faf8f4; color: #faf8f4; }
.lb__cap {
  position: absolute; left: 24px; right: 24px; bottom: 18px; text-align: center;
  color: rgba(250, 248, 244, 0.7); font-size: 12px; line-height: var(--lh-relaxed); margin: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { .prose figure::after { transition: none; } }

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--line);
  padding-block: var(--sp-8) var(--sp-6);
  margin-top: var(--sp-9);
}
/* 品牌区：logo + 站点名 + 一句话简介（统一展示品牌与备案的前奏） */
.site-footer__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding-bottom: var(--sp-6);
  margin-bottom: var(--sp-7);
  border-bottom: 1px solid var(--line);
}
.site-footer__logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
}
.site-footer__name {
  font-size: var(--fs-lead);
  font-weight: var(--w-semibold);
  color: var(--ink);
  letter-spacing: 0.02em;
}
.site-footer__slogan {
  margin-top: var(--sp-1);
  font-size: var(--fs-small);
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 560px;
}
.site-footer__qrs {
  margin-left: auto;
  display: flex;
  gap: var(--sp-3);
  align-items: flex-end;
  flex-shrink: 0;
}
.site-footer__qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 6px 5px;
  box-shadow: 0 1px 8px rgba(90, 100, 80, 0.10);
}
.site-footer__qr {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  flex-shrink: 0;
}
.site-footer__qr-label {
  font-size: 0.65rem;
  line-height: 1.3;
  color: var(--ink-faint);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.4fr;
  gap: var(--sp-7);
}
.site-footer h4 {
  font-size: var(--fs-xs);
  font-weight: var(--w-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: var(--sp-4);
}
.site-footer p,
.site-footer li {
  font-size: var(--fs-small);
  color: var(--ink-soft);
  line-height: 1.7;
}
.site-footer ul {
  list-style: none;
}
.site-footer ul li {
  margin-bottom: var(--sp-2);
}
.footer-links {
  column-count: 2;
  column-gap: var(--sp-5);
}
.footer-links li {
  break-inside: avoid;
}
.site-footer a {
  color: var(--ink-soft);
}
.site-footer a:hover {
  color: var(--ink);
}
.footer-about__disclaimer {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--ink-faint);
}
.site-footer__bottom {
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  text-align: center;
}
.site-footer__bottom a {
  color: var(--ink-faint);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-footer__bottom a:hover {
  color: var(--ink);
}

/* =========================================================================
   工具类
   ========================================================================= */
.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;
}

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

/* =========================================================================
   响应式
   ========================================================================= */
/* 七个系列导航：中宽屏收紧间距，避免溢出（≤1120px 视口） */
@media (max-width: 1120px) {
  .main-nav {
    gap: var(--sp-4);
  }
  .main-nav a {
    font-size: 0.85rem;
  }
}
@media (max-width: 960px) {
  .main-nav {
    gap: var(--sp-3);
  }
  .main-nav a {
    font-size: 0.8rem;
  }
}

@media (max-width: 860px) {
  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-6);
  }
  .footer-about {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .table-wrap::before { content: "← 左右滑动查看完整表格 →"; display: block; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); color: var(--ink-faint); background: var(--bg-soft); border-bottom: 1px solid var(--line); }
  .site-footer__brand {
    flex-wrap: wrap;
    row-gap: var(--sp-3);
  }
  .site-footer__brand > div {
    flex: 1 1 220px;
    min-width: 0;
  }
  .site-footer__logo {
    width: 48px;
    height: 48px;
  }
  .site-footer__qrs {
    margin-left: 0;
    flex-basis: 100%;
    justify-content: center;
    padding-top: var(--sp-2);
  }
  .main-nav > a:not(.btn) {
    display: none;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .main-nav.is-open {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-4);
    padding: var(--sp-5);
    background: var(--bg-warm);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-hover);
  }
  .main-nav.is-open a {
    display: block;
  }
  .main-nav.is-open .nav-drop {
    position: static;
  }
  .main-nav.is-open .nav-drop__menu {
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
    min-width: 0;
    gap: 0;
  }
  .main-nav.is-open .nav-drop__menu a {
    padding: 8px 0;
  }
}
@media (max-width: 540px) {
  .site-footer__grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   全站搜索（首页跨系列）
   ========================================================================= */
.site-search { max-width: 620px; margin: 0 auto var(--sp-8); position: relative; }
.site-search__inner {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--bg-card); border: 1px solid var(--line-strong);
  border-radius: var(--radius-full); padding: var(--sp-3) var(--sp-5);
  box-shadow: 0 4px 18px rgba(90, 100, 80, 0.08);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.site-search__inner:focus-within { border-color: var(--accent); box-shadow: 0 6px 22px rgba(90, 100, 80, 0.14); }
.site-search__icon { color: var(--ink-faint); flex: none; }
.site-search input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-size: var(--fs-small); color: var(--ink); font-family: var(--font-sans);
}
.site-search input::placeholder { color: var(--ink-faint); }
.site-search__results {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover); overflow: hidden; z-index: 70;
}
.site-search__results.is-on { display: block; }
.ss-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); text-decoration: none; }
.ss-item + .ss-item { border-top: 1px solid var(--line); }
.ss-title { flex: 1; min-width: 0; font-size: var(--fs-small); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-item:hover .ss-title { color: var(--accent-deep); }
.ss-meta { flex: none; font-size: var(--fs-xs); color: var(--ink-faint); background: var(--bg-soft); border-radius: var(--radius-full); padding: 2px 10px; }
.ss-empty { padding: var(--sp-4) var(--sp-5); font-size: var(--fs-small); color: var(--ink-faint); text-align: center; }

/* =========================================================================
   表格（Markdown 表格解析）
   ========================================================================= */
.table-wrap {
  position: relative;
  overflow-x: auto;
  margin: var(--sp-5) 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.table-wrap table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.table-wrap th, .table-wrap td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.7;
}
.table-wrap th {
  background: var(--bg-soft);
  font-weight: var(--w-semibold);
  color: var(--ink);
  letter-spacing: 0.04em;
}
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover { background: var(--bg-soft); }
