/* ==========================================================================
   澄清南北 · 基础层（reset + 排版 + 全局保护）
   依赖：tokens.css。不含任何组件样式。
   ========================================================================== */

/* ---- 现代化 reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  min-height: 100vh;        /* 兜底 */
  min-height: 100dvh;
  background: var(--cqnb-bg);
  color: var(--cqnb-ink);
  font-family: var(--cqnb-font-body);
  font-size: var(--cqnb-text-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg, video, canvas { display: block; max-width: 100%; }
input, button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }   /* 全局保护：hidden 属性永远生效 */
.hidden { display: none !important; }    /* 项目既有工具类，与 hidden 同义 */

/* ---- 焦点：明确高对比焦点环，只在键盘聚焦时出现 ---- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--cqnb-focus);
  outline-offset: 2px;
  border-radius: var(--cqnb-radius-sm);
}

/* ---- 基础排版 ---- */
h1, h2, h3, h4 {
  font-family: var(--cqnb-font-title);
  font-weight: 700;
  line-height: 1.3;
  color: var(--cqnb-ink);
  overflow-wrap: anywhere;
}
h1 { font-size: var(--cqnb-text-2xl); letter-spacing: .04em; }
h2 { font-size: var(--cqnb-text-xl); letter-spacing: .03em; }
h3 { font-size: var(--cqnb-text-lg); }
h4 { font-size: var(--cqnb-text-md); }
p { line-height: 1.7; overflow-wrap: anywhere; }
p + p { margin-top: var(--cqnb-space-2); }
small, .cq-small { font-size: var(--cqnb-text-sm); color: var(--cqnb-muted); }
code, kbd, pre {
  font-family: var(--cqnb-font-mono);
  font-size: .92em;
  background: var(--cqnb-bg-soft);
  border: 1px solid var(--cqnb-line-faint);
  border-radius: var(--cqnb-radius-sm);
  padding: 1px 5px;
}
pre { padding: var(--cqnb-space-3); overflow-x: auto; line-height: 1.6; }
pre code { background: none; border: 0; padding: 0; }
hr { border: 0; border-top: 1px solid var(--cqnb-line); margin: var(--cqnb-space-4) 0; }
strong, b { font-weight: 700; }

/* 数字表格场景：等宽数字，便于对齐 */
.cq-nums, table, .cq-metric { font-variant-numeric: tabular-nums; }

/* ---- 链接 ---- */
a { color: var(--cqnb-accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
a:active { color: var(--cqnb-accent-strong); }

/* ---- 滚动条（克制美化） ---- */
* { scrollbar-width: thin; scrollbar-color: var(--cqnb-line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--cqnb-line-strong); border-radius: var(--cqnb-radius-pill); }
*::-webkit-scrollbar-thumb:hover { background: var(--cqnb-muted); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---- 选中色 ---- */
::selection { background: var(--cqnb-accent-soft); color: var(--cqnb-accent-strong); }

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

/* ---- 无障碍工具类 ---- */
.cq-visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
