/* public/styles/base.css
 * reset + 排版（中文可读性优先、等宽数字、标题层级）+ 无障碍基线
 * 全部引用二期新 token（tokens.css）；旧 token 已废止。
 */

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  /* 正文行高 1.6（PRD §2.4）——长看不累 */
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: .01em;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--sp-3);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: .01em;
  color: var(--text-primary);
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-body); font-weight: 600; }
h4 { font-size: var(--fs-sm); }
h5, h6 { font-size: var(--fs-xs); color: var(--text-secondary); }

p { margin: 0 0 var(--sp-3); }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a:hover { border-bottom-color: var(--accent-soft); }

ul, ol { margin: 0 0 var(--sp-3); padding-left: 1.4em; }
li { margin: 2px 0; }

blockquote {
  margin: var(--sp-3) 0;
  padding: var(--sp-2) var(--sp-4);
  border-left: 3px solid var(--accent-soft);
  background: var(--bg-surface-2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0; /* token-lint-ignore sharp */
  color: var(--text-secondary);
}

code, pre, kbd, samp { font-family: var(--font-mono); font-size: .92em; }

code {
  background: var(--bg-sunken);
  padding: 1px 5px;
  border-radius: var(--r-xs);
}

pre {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  overflow-x: auto;
  line-height: var(--lh-body);
}
pre code { background: none; padding: 0; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-4) 0;
}

/* 分隔线（显式工具类，和 hr 同规格） */
.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: var(--sp-3) 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
}
th { color: var(--text-secondary); font-weight: 600; font-size: var(--fs-sm); }
td.num, th.num { text-align: right; }

/* 表单元素基础 */
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input[type="checkbox"] { accent-color: var(--accent); }

/* 焦点可见性（键盘优先）——统一焦点环 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* 减少动效偏好（PRD §2.6）：全局降为即切，无位移/缩放/闪烁 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 滚动条（低调） */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-xs); }
*::-webkit-scrollbar-track { background: transparent; }

/* 仅供读屏 */
.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;
}
