/* ============================================================
   Keyarium 基础样式：重置、排版、通用组件
   依赖 tokens.css，所有颜色只走令牌，不写字面值。
   ============================================================ */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  font-weight: 300;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── 排版 ── */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.012em;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: var(--step-5); font-weight: 900; letter-spacing: -.022em; }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { margin: 0; }
a { color: var(--brand-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 2px;
}

img { max-width: 100%; height: auto; display: block; }

code, kbd, .mono { font-family: var(--mono); font-size: .9em; }

kbd {
  background: var(--paper-3);
  border: 1px solid var(--rule-2);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  padding: 1px 6px;
  font-size: .82em;
  color: var(--ink-2);
}

/* ── 通用文字部件 ── */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.65;
  color: var(--ink-2);
  max-width: var(--measure);
}

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 2em; }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-inline-start: 1.3em; margin-top: .8em; }
.prose li + li { margin-top: .4em; }

/* ── 布局 ── */
.wrap {
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section { padding-block: clamp(48px, 8vw, 92px); }
.section + .section { border-top: 1px solid var(--rule); }

.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }

/* ── 按钮 ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--body);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1;
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.btn-primary { background: var(--brand-bg); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); color: var(--brand-ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--edge); }
.btn-ghost:hover { background: var(--paper-3); color: var(--ink); border-color: var(--ink-3); }

/* ── 标签 ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 100px;
  border: 1px solid currentColor;
}
.pill-passive { color: var(--passive); }
.pill-combat { color: var(--combat); }

/* ── 可访问性 ── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 10px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: top .18s ease;
}
.skip-link:focus { top: 12px; color: var(--brand-ink); }
