/* ==========================================================================
   base.css — reset + 排版基线（须在 tokens.css 之后加载）
   只定义元素级规则；组件类见 components.css。
   ========================================================================== */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: var(--body-leading);
  background: var(--bg);
  color: var(--text);
}

/* ── 标题层级（字重 + 字号斜坡，修复 P1；h2 分节带底边，§4.2） ── */
h1 { font: var(--h1); margin: 0 0 0.4rem; }
h2 {
  font: var(--h2);
  margin: 1.8rem 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}
h3 { font: var(--h3); margin: 1.4rem 0 0.5rem; }
h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  margin: 1.2rem 0 0.4rem;
}
h4 { font-size: 0.9rem; }
h5 { font-size: 0.85rem; }
h6 { font-size: 0.8rem; }

/* ── 正文与列表 ── */
p { margin-bottom: 0.85rem; }
ul, ol { margin: 0.4rem 0 0.8rem 1.4rem; }
li { margin-bottom: 0.4rem; line-height: 1.75; }
li > ul, li > ol { margin-top: 0.3rem; margin-bottom: 0.3rem; }

/* ── 链接 ── */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 表单元素 ── */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
textarea {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  resize: vertical;
  line-height: 1.6;
}
input[type="text"],
input[type="number"],
input[type="search"],
input[type="url"],
select {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
}
button { cursor: pointer; }
/* 触控目标下限（P3：≥44px；kid 主题 token 覆盖为 52px） */
button, .btn, input[type="button"], input[type="submit"] {
  min-height: var(--tap-min);
}

/* ── 焦点可见（§3.4：不再裸 outline:none） ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── 图片 ── */
img { max-width: 100%; height: auto; }

/* ── 代码（成人页含公式/代码） ── */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(127,127,127,0.14);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 0.8rem 0;
  overflow-x: auto;
}
pre code { background: none; padding: 0; font-size: inherit; }

/* ── 表格基础 ── */
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; margin: 0.8rem 0; }
th, td { padding: 0.4rem 0.6rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-secondary); font-weight: 500; }
