/* ============================================================
   基础重置 / 版式 / 通用组件
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-base)/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "tnum";
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
h1 { font-size: var(--fs-4xl); letter-spacing: -.035em; }
h2 { font-size: var(--fs-2xl); letter-spacing: -.028em; }
h3 { font-size: var(--fs-lg); }
p  { margin: 0; }

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

img { max-width: 100%; display: block; }
code, kbd, pre, .mono { font-family: var(--font-mono); font-variant-ligatures: none; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--accent-fg); }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-2); border-radius: var(--r-full);
  border: 3px solid var(--bg); background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-4); background-clip: padding-box; }

/* ---------- 布局 ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(18px, 4.2vw, 44px); }
.wrap-narrow { max-width: var(--wrap-narrow); }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
}

@media (min-width: 1440px) {
  :root { --wrap: 1360px; }
}
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.col { display: flex; flex-direction: column; }
.spacer { flex: 1; }
.hide { display: none !important; }

/* ---------- 文本工具 ---------- */
.t-xs { font-size: var(--fs-xs); }
.t-sm { font-size: var(--fs-sm); }
.t-lg { font-size: var(--fs-lg); }
.muted  { color: var(--text-3); }
.muted2 { color: var(--text-4); }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.clamp1, .clamp2, .clamp3 {
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
}
.clamp1 { -webkit-line-clamp: 1; }
.clamp2 { -webkit-line-clamp: 2; }
.clamp3 { -webkit-line-clamp: 3; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm); font-weight: 560;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast),
              transform var(--t-fast), box-shadow var(--t-fast), color var(--t-fast);
}
.btn:hover { background: var(--surface-3); border-color: var(--border-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; flex: none; }

.btn-primary {
  background: var(--accent); border-color: transparent; color: var(--accent-fg);
  box-shadow: 0 1px 2px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.14);
}
.btn-primary:hover { background: var(--brand-600); border-color: transparent; }
html[data-theme="dark"] .btn-primary:hover { background: var(--brand-300); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-sm { height: 29px; padding: 0 11px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-lg { height: 44px; padding: 0 22px; font-size: var(--fs-md); border-radius: var(--r-lg); }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 29px; }

/* ---------- 标签 / 徽章 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 8px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 550;
  white-space: nowrap; letter-spacing: .01em;
}
.tag-mono { font-family: var(--font-mono); font-size: 10.5px; }
.tag-accent { background: var(--accent-soft); color: var(--brand-600); }
html[data-theme="dark"] .tag-accent { color: var(--brand-300); }
.tag-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .85; flex: none;
}
.tag-outline { background: transparent; border: 1px solid var(--border); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: var(--r-full);
  font-size: 10.5px; font-weight: 650; letter-spacing: .02em;
  text-transform: uppercase;
}
.badge-fresh  { background: rgba(34,197,94,.13);  color: #15803d; }
.badge-active { background: rgba(20,184,166,.13); color: #0f766e; }
.badge-stale  { background: rgba(148,163,184,.16); color: #64748b; }
.badge-low    { background: rgba(245,158,11,.15); color: #b45309; }
.badge-official { background: var(--accent-soft); color: var(--brand-600); }
html[data-theme="dark"] .badge-fresh  { background: rgba(34,197,94,.16);  color: #4ade80; }
html[data-theme="dark"] .badge-active { background: rgba(20,184,166,.16); color: #2dd4bf; }
html[data-theme="dark"] .badge-stale  { background: rgba(148,163,184,.14); color: #94a3b8; }
html[data-theme="dark"] .badge-low    { background: rgba(245,158,11,.16); color: #fbbf24; }
html[data-theme="dark"] .badge-official { background: var(--accent-soft); color: var(--brand-300); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-base), transform var(--t-base);
}
.card-hover:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ---------- 分隔与骨架 ---------- */
.hr { height: 1px; background: var(--border); border: 0; margin: 0; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- 动效 ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn  { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
.anim-up { animation: fadeUp var(--t-slow) both; }
.anim-in { animation: fadeIn var(--t-base) both; }

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

/* ---------- 无障碍 ---------- */
.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;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 999;
  padding: 9px 16px; background: var(--accent); color: var(--accent-fg);
  border-radius: var(--r-md); font-weight: 600; transition: top var(--t-fast);
}
.skip-link:focus { top: 12px; }
