/* ============================================================================
   基础样式 Base
   重置 + 排版 + 全局约定
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;   /* 防止 iOS 横屏自动放大 */
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 触摸设备去掉点击高亮，改用自定义反馈 */
  -webkit-tap-highlight-color: transparent;
  /* 输入时禁止横向橡皮筋 */
  overscroll-behavior-x: none;
}

/* ---------- 标题 ---------- */
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; line-height: var(--lh-tight); }
h1 { font-size: var(--fs-title); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-base); }
p  { margin: 0 0 var(--sp-md); }

/* ---------- 链接 ---------- */
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 列表 ---------- */
ul, ol { margin: 0; padding-left: var(--sp-lg); }
/* 布局用列表时去掉样式 */
.list-reset { list-style: none; padding: 0; margin: 0; }

/* ---------- 表格基础 ---------- */
table { border-collapse: collapse; width: 100%; }

/* ---------- 表单元素继承字体 ---------- */
input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { cursor: pointer; border: none; background: none; padding: 0; }
button:disabled { cursor: not-allowed; }

/* ---------- 焦点可见（键盘导航必须）---------- */
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}
/* 鼠标点击不显示焦点框，键盘导航才显示 */
:focus:not(:focus-visible) { outline: none; }

/* ---------- 选中文字 ---------- */
::selection { background: var(--c-primary-light); color: var(--c-text); }

/* ---------- 滚动条（桌面常显，给出"还有内容"的暗示）---------- */
@media (pointer: fine) {
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--c-border-strong);
    border-radius: var(--r-full);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--c-text-3); }
}

/* ---------- 工具类（只允许这几个，禁止随意加）---------- */
.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;
}
.text-2 { color: var(--c-text-2); }
.text-3 { color: var(--c-text-3); }
.text-sm { font-size: var(--fs-xs); }
.text-danger { color: var(--c-danger); }
.text-success { color: var(--c-success); }
.text-warning { color: var(--c-warning); }
.num {
  font-variant-numeric: tabular-nums;   /* 数字等宽，列对齐 */
  text-align: right;
}
.mono {
  /* 等宽字体在同样字号下看起来更大，但要缩到 .92em 就跌破 12px 了
     （12px × .92 = 11.04），小屏上编码看不清。字号继承，靠字体本身区分。 */
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: -.01em;
}
.nowrap { white-space: nowrap; }
.ellipsis {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 减少动效（系统设置）---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
