/* =============================================================================
 *  01-base.css — reset + 排版基础
 * ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

/* RTL：阿拉伯语等自动镜像（逻辑属性已在各组件使用，这里补少数例外） */
html[dir="rtl"] body { text-align: right; }
html[dir="rtl"] .num, html[dir="rtl"] .code { direction: ltr; display: inline-block; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 .6em;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(28px, 4.4vw, 46px); }
h2 { font-size: clamp(22px, 2.8vw, 31px); }
h3 { font-size: clamp(19px, 2.1vw, 23px); }
h4 { font-size: 17px; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; height: auto; }
ul, ol { margin: 0 0 1em; padding-inline-start: 1.35em; }
li { margin-bottom: .4em; }

strong { color: var(--ink); font-weight: 700; }
em { font-style: normal; color: var(--accent-2); font-weight: 600; }

hr {
  border: 0; border-top: 1px solid var(--line);
  margin: 32px 0;
}

code, .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  background: var(--paper-3);
  padding: .12em .4em;
  border-radius: 5px;
}

blockquote {
  margin: 1.2em 0;
  padding: 12px 18px;
  border-inline-start: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  color: var(--ink-2);
}

/* 中文/日文/韩文正文的标点与断行优化 */
:lang(zh), :lang(ja), :lang(ko) { text-spacing-trim: space-first; }

/* 焦点可见（无障碍） */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* 隐藏但对读屏可见 */
.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;
}

/* 数字/英文表格 */
table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .95em; }
th, td { border: 1px solid var(--line); padding: 9px 12px; text-align: start; vertical-align: top; }
th { background: var(--paper-3); font-weight: 700; }

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 跳转到正文（键盘/读屏用户） */
/* 无障碍：跳转到正文。离屏用标准「视觉隐藏」而不是 left:-9999px——
   后者在 RTL（阿语/希伯来语）下会把文档撑宽 9999px，导致整站横向溢出。 */
.skip-link{position:absolute;width:1px;height:1px;margin:0;padding:0;border:0;overflow:hidden;
  clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;background:var(--accent,#C8102E);color:#fff;font-weight:600}
.skip-link:focus{position:fixed;inset-block-start:8px;inset-inline-start:8px;width:auto;height:auto;
  overflow:visible;clip:auto;clip-path:none;z-index:200;padding:10px 16px;border-radius:8px;outline:2px solid #fff;outline-offset:-4px}
