/* ==========================================================================
   base.css — reset + 基础排版 + 全局无障碍
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

/* figure 的 UA 默认是 margin: 1em 40px，不清掉会顶破 390 视口 */
figure {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 0;
}

svg {
  display: block;
}

a {
  color: var(--brand-ink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* hr 的 UA 样式带 border + margin，不清掉会多出一条线 */
hr {
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--line);
}

strong,
b {
  font-weight: 700;
}

/* 组件常用 display:flex，会盖掉 UA 的 [hidden]，所以这里必须 !important */
[hidden] {
  display: none !important;
}

/* 键盘焦点始终可见 */
:focus-visible {
  outline: 2px solid var(--brand-ink);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: var(--sp-3);
  top: -60px;
  z-index: 100;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--text-invert);
  font-size: var(--fs-xs);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: var(--sp-3);
  text-decoration: none;
}

/* 只给读屏看的文本（表格标题、区块说明等） */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
