/* 基础层：reset + 排版 + 表单 + 焦点 + 无障碍（6.6）——只引用 tokens 变量 */

*,
*::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: 0ms !important;
    transition-duration: 0ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--t-base);
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--s-3);
  line-height: 1.3;
  font-weight: 650;
}

h1 {
  font-size: var(--t-2xl);
}
h2 {
  font-size: var(--t-xl);
}
h3 {
  font-size: var(--t-lg);
}

p {
  margin: 0 0 var(--s-3);
}

a {
  color: var(--info);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* 论文标题衬线（6.1：建立"这是论文"的直觉） */
.paper-title,
h1.paper-title,
.font-serif {
  font-family: var(--font-serif);
}

code,
kbd,
.num {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

img,
svg {
  max-width: 100%;
  vertical-align: middle;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

/* 表单控件 */
input[type="text"],
input[type="search"],
input[type="number"],
input[type="password"],
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  min-height: 40px;
  color: var(--fg);
}
input::placeholder {
  color: var(--fg-3);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

::selection {
  background: var(--accent-soft);
}

/* 屏幕阅读器专用 */
.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;
}

kbd {
  display: inline-block;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
  padding: 0 var(--s-1);
  background: var(--surface-2);
  font-size: var(--t-xs);
}

/* 200% 缩放保护（6.6） */
@media (min-width: 1280px) {
  body {
    text-size-adjust: 100%;
  }
}
