/**
 * 基础样式：重置 + 排版工具类（开发清单 2.2 / 2.3 / 2.8）。
 *
 * 依赖 tokens.css，必须在它之后引入。
 */

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

html {
  /* 不设 font-size:62.5%。那个技巧会让所有 rem 依赖一个非默认根值，
     用户在浏览器里放大字体的设置会被削弱 —— 可达性上是倒退 */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body-2);
  line-height: var(--text-body-2-lh);
  color: var(--color-text-primary);
  background: var(--color-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  /* iOS/微信里点击表单元素默认闪一下浅蓝矩形,全局关掉——
     组件层需要焦点提示的再自己加 outline/box-shadow */
  -webkit-tap-highlight-color: transparent;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

a:hover {
  color: var(--color-primary-600);
}

table {
  border-collapse: collapse;
  width: 100%;
}

/**
 * 焦点样式。
 *
 * 用 :focus-visible 而不是 :focus —— 后者会让鼠标点击也套上焦点环，
 * 于是有人为了好看写 outline:none，把键盘用户一起废掉。
 * :focus-visible 只在键盘导航时出现，两边都满足。
 */
:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 1px;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-s);
}

/* 尊重系统的「减少动态效果」设置。前庭功能障碍者会因动效头晕 */
@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;
  }
}

/* ---------- 排版工具类（H5 阶梯）---------- */

.t-display-xl,
.t-display-l {
  font-family: var(--font-num);
  /* **600 不用 700**（清单 2.3）：苹方无 700，Safari 会合成加粗，
     桌号巨字放到 72px 时边缘发毛。这是本项目最容易被"顺手改回去"的一条 */
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.t-display-xl {
  font-size: var(--text-display-xl);
  line-height: var(--text-display-xl-lh);
}

.t-display-l {
  font-size: var(--text-display-l);
  line-height: var(--text-display-l-lh);
}

.t-title-1 {
  font-size: var(--text-title-1);
  line-height: var(--text-title-1-lh);
  font-weight: var(--weight-semibold);
}

.t-title-2 {
  font-size: var(--text-title-2);
  line-height: var(--text-title-2-lh);
  font-weight: var(--weight-semibold);
}

.t-body-1 {
  font-size: var(--text-body-1);
  line-height: var(--text-body-1-lh);
}

.t-body-2 {
  font-size: var(--text-body-2);
  line-height: var(--text-body-2-lh);
}

.t-caption {
  font-size: var(--text-caption);
  line-height: var(--text-caption-lh);
  color: var(--color-text-tertiary);
}

.t-secondary { color: var(--color-text-secondary); }
.t-tertiary  { color: var(--color-text-tertiary); }
.t-danger    { color: var(--color-danger-500); }
.t-success   { color: var(--color-success-500); }
.t-warning   { color: var(--color-warning-700); }

/* 屏幕阅读器专用文本：视觉隐藏但仍被朗读。
   用 display:none 会让读屏软件也读不到 */
.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;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
