/* ===================================================================
   CKM 健康科普网站 — 自定义样式
   技术栈：HTML + Tailwind CSS (CDN) + 自定义 CSS
   设计理念：医疗权威感 + 科普可读性，避免 AI 模板化审美
   =================================================================== */

/* ---------- 字体 ---------- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700&family=Noto+Serif+SC:wght@500;600;700;900&display=swap');

/* ---------- 设计令牌 ---------- */
:root {
  /* 基础中性色（暖灰，非纯黑纯白） */
  --bg: #faf9f7;
  --surface: #ffffff;
  --surface-2: #f5f3ef;
  --text: #1c1917;
  --text-muted: #57534e;
  --text-subtle: #78716c;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;

  /* 主品牌色 — 深青绿，医疗信任感 */
  --primary: #0f766e;
  --primary-dark: #134e4a;
  --primary-light: #ccfbf1;
  --primary-tint: #f0fdfa;

  /* CKM 三大系统强调色（深沉、不霓虹） */
  --heart: #be123c;       /* 心血管 — 玫红 */
  --heart-tint: #fff1f2;
  --kidney: #b45309;      /* 肾脏 — 琥珀 */
  --kidney-tint: #fffbeb;
  --metabolic: #0d9488;   /* 代谢 — 青绿 */
  --metabolic-tint: #f0fdfa;

  /* 语义色 */
  --accent: #0369a1;      /* 链接/CTA */
  --warning: #b45309;
  --danger: #b91c1c;
  --success: #15803d;

  /* COR 证据等级配色 */
  --cor1: #15803d;        /* 1 强推荐 */
  --cor2a: #0369a1;       /* 2a 中等 */
  --cor2b: #7c3aed;       /* 2b 弱 — 紫仅限此小徽章 */
  --cor3: #b91c1c;        /* 3 有害 */

  --shadow-ambient: 0 1px 2px rgba(28, 25, 23, 0.04), 0 1px 3px rgba(28, 25, 23, 0.06);
  --shadow-direct: 0 4px 6px -1px rgba(28, 25, 23, 0.08), 0 2px 4px -2px rgba(28, 25, 23, 0.05);
  --shadow-lift: 0 10px 25px -5px rgba(28, 25, 23, 0.10), 0 8px 10px -6px rgba(28, 25, 23, 0.06);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;

  --maxw: 1180px;
  --maxw-prose: 760px;
}

/* ---------- 基础重置 ---------- */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  font-family: 'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-weight: 400;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 {
  font-family: 'Noto Serif SC', 'Noto Sans SC', serif;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--primary); }

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

::selection { background: var(--primary); color: #fff; }

/* 等宽数字用于数据展示 */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ---------- 排版工具 ---------- */
.prose-ckm { max-width: var(--maxw-prose); }
.prose-ckm p { margin-bottom: 1.1em; }
.prose-ckm strong { font-weight: 600; color: var(--text); }

.eyebrow {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
}

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 249, 247, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-link {
  position: relative;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.5rem 0.1rem;
  transition: color 0.15s ease;
  white-space: nowrap;
}
.nav-link:hover { color: var(--primary); }
.nav-link[aria-current="page"] { color: var(--primary); }
.nav-link[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* 移动端菜单 */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.mobile-menu.open { max-height: 80vh; overflow-y: auto; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.18s ease;
  cursor: pointer;
  line-height: 1.2;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-ambient);
}
.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-direct);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-ambient);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card-hover:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

/* 分期卡片侧边条 */
.stage-card { position: relative; overflow: hidden; }
.stage-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
}

/* ---------- COR / LOE 徽章 ---------- */
.cor-badge, .loe-badge {
  display: inline-flex;
  align-items: center;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  line-height: 1.4;
  white-space: nowrap;
}
.cor-1 { background: #ecfdf5; color: var(--cor1); border: 1px solid #bbf7d0; }
.cor-2a { background: #eff6ff; color: var(--cor2a); border: 1px solid #bfdbfe; }
.cor-2b { background: #f5f3ff; color: var(--cor2b); border: 1px solid #ddd6fe; }
.cor-3 { background: #fef2f2; color: var(--cor3); border: 1px solid #fecaca; }
.cor-econ { background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; }

.loe-badge { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border-strong); }

/* ---------- 推荐意见卡片 ---------- */
.recommendation {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
}
.recommendation[data-cor="1"] { border-left-color: var(--cor1); }
.recommendation[data-cor="2a"] { border-left-color: var(--cor2a); }
.recommendation[data-cor="2b"] { border-left-color: var(--cor2b); }
.recommendation[data-cor="3"] { border-left-color: var(--cor3); }
.recommendation[data-cor="econ"] { border-left-color: var(--accent); }

.rec-badges { display: flex; flex-direction: column; gap: 0.35rem; min-width: 64px; }
.rec-body { font-size: 0.95rem; line-height: 1.7; color: var(--text); }
.rec-econ {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-strong);
  font-size: 0.85rem;
  color: var(--text-subtle);
}
.rec-econ strong { color: var(--accent); font-weight: 600; }

/* ---------- 数据表格 ---------- */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.tbl thead th {
  background: var(--surface-2);
  text-align: left;
  font-weight: 600;
  color: var(--text);
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border-strong);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}
.tbl tbody td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.6;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 横向滚动容器 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap .tbl { min-width: 100%; }

/* ---------- 提示框 ---------- */
.callout {
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 0.95rem;
  line-height: 1.7;
}
.callout-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}
.callout-info { background: var(--primary-tint); border-color: #99f6e4; color: #134e4a; }
.callout-warn { background: var(--kidney-tint); border-color: #fde68a; color: #78350f; }
.callout-danger { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.callout-note { background: #f0f9ff; border-color: #bae6fd; color: #0c4a6e; }

/* ---------- 分期进度条 ---------- */
.stage-track {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}
.stage-pill {
  text-align: center;
  padding: 0.6rem 0.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all 0.2s ease;
  cursor: default;
}
.stage-pill:hover { border-color: var(--primary); color: var(--primary); }
.stage-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 折叠面板 ---------- */
.accordion-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  text-align: left;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}
.accordion-trigger:hover { background: var(--surface-2); }
.accordion-trigger .chev { transition: transform 0.25s ease; flex-shrink: 0; color: var(--text-subtle); }
.accordion-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); }
.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.accordion-panel.open { max-height: 4000px; }
.accordion-panel-inner { padding: 1rem 1.25rem 1.25rem; }

/* ---------- 标签页 ---------- */
.tab-btn {
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); background: var(--surface); }
.tab-btn[aria-selected="true"] {
  color: #fff;
  background: var(--primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadein 0.25s ease; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 标签 chip ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ---------- 三系统图标圆 ---------- */
.tri-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'Noto Serif SC', serif;
}

/* ---------- 返回顶部 ---------- */
#toTop {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 46px; height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  box-shadow: var(--shadow-direct);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 40;
}
#toTop.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#toTop:hover { background: var(--primary-dark); transform: translateY(-2px); }

/* ---------- 阅读进度条 ---------- */
#progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: var(--primary);
  z-index: 60;
  transition: width 0.1s linear;
}

/* ---------- 页脚 ---------- */
.site-footer {
  background: #1c1917;
  color: #d6d3d1;
  border-top: 4px solid var(--primary);
}
.site-footer a { color: #a8a29e; }
.site-footer a:hover { color: #5eead4; }

/* ---------- 动画进入 ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.rise { animation: rise 0.6s ease-out both; }
.rise-d1 { animation-delay: 0.08s; }
.rise-d2 { animation-delay: 0.16s; }
.rise-d3 { animation-delay: 0.24s; }
.rise-d4 { animation-delay: 0.32s; }

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

/* ---------- 响应式微调 ---------- */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .recommendation { grid-template-columns: 1fr; }
  .rec-badges { flex-direction: row; }
}

/* ---------- 打印 ---------- */
@media print {
  .site-header, .site-footer, #toTop, #progress, .mobile-menu { display: none !important; }
  body { background: #fff; }
  .card, .recommendation, .tbl { box-shadow: none; break-inside: avoid; }
}
