/* Reset, typography and layout primitives. */
/* 自托管字体的 @font-face 在 fonts.css，不是默认加载的：仓库里不带字体二进制，
   直接声明会让每个页面都去拉三个不存在的 woff2（控制台三条 404，排版仍然是回退字体）。
   全站现用 tokens.css 里的单一系统字族；要改用自托管字体，先改 tokens.css 的 --font-sans，
   再把 fonts.css 加进四个壳的 <link>。 */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--size-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  margin: 0;
  letter-spacing: -.01em;
  /* 避免出现“稿 / 子。”这种只剩一两个字的孤行。 */
  text-wrap: balance;
}
h1 { font-size: var(--size-display); }
h2 { font-size: var(--size-xl); }
h3 { font-size: var(--size-lg); line-height: var(--leading-snug); }
p { margin: 0 0 var(--s-4); }
p:last-child { margin-bottom: 0; }
a { color: var(--pine); text-underline-offset: 3px; }
a:hover { color: var(--terra); }
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
code, kbd, samp, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-5) 0; }
::selection { background: var(--terra-soft); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip-link {
  /* 用 transform 推出视口，而不是 left:-9999px：后者在 RTL 下会把页面往左撑出
     一万像素的横向滚动条（阿拉伯语页实测 scrollWidth 11796）。 */
  position: absolute;
  top: var(--s-2);
  inset-inline-start: var(--s-4);
  transform: translateY(-200%);
  padding: var(--s-2) var(--s-4);
  background: var(--pine);
  color: var(--pine-ink);
  z-index: 60;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); color: var(--pine-ink); }

.shell { width: min(100% - var(--s-6), var(--shell-max)); margin-inline: auto; }
.shell--narrow { width: min(100% - var(--s-6), 880px); margin-inline: auto; }
.stack { display: grid; gap: var(--s-4); }
.stack--lg { gap: var(--s-6); }
.row { display: flex; gap: var(--s-3); align-items: center; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }
/* [hidden] 必须胜过布局声明：.auth-form / .grid 之类的 display 会盖掉 UA 默认样式，
   否则认证页会把登录、注册、找回、验证码、重置五张表全部堆在页面上。 */
[hidden] { display: none !important; }
.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;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--muted);
}
.lede { font-size: var(--size-lg); line-height: 1.5; color: var(--ink-2); max-width: var(--measure); }
.muted { color: var(--muted); }
.small { font-size: var(--size-sm); }
.caption { font-size: var(--size-xs); color: var(--muted); letter-spacing: .02em; }
.serif { font-family: var(--font-display); }

/* Keyboard focus inside dense panels stays visible without moving layout. */
.icon { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 18px; height: 18px; }

/* Small utilities shared by shells and view modules. */
.field-label { font-size: var(--size-xs); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-2); }
.field-hint { font-size: var(--size-xs); color: var(--muted); margin: 0; }
.form-error { font-size: var(--size-sm); color: var(--danger); margin: 0; }
.row--end { justify-content: flex-end; }
.row--start { justify-content: flex-start; }
.section__sub { font-family: var(--font-sans); font-size: var(--size-sm); font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); margin: var(--s-6) 0 var(--s-3); }
.linklike { border: 0; background: none; padding: 0; color: var(--pine); text-decoration: underline; cursor: pointer; font: inherit; }
.linklike:hover { color: var(--terra); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.skeleton--line { height: 14px; }
.skeleton--block { height: 160px; }
.measure { max-width: var(--measure); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
