/* ==========================================================================
   CSS 重置 — 消除浏览器默认样式差异
   ========================================================================== */

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

html {
  /* 防止移动端横向溢出 */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-base);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 关键：禁止横向滚动，避免移动端溢出 */
  overflow-x: hidden;
  max-width: 100%;
}

/* 图片自适应 —— 防止宽度溢出 */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 防止 flex/grid 子元素内容撑宽容器 */
*, *::before, *::after {
  min-width: 0;
}

/* 移除列表默认样式 */
ul,
ol {
  list-style: none;
}

/* 链接重置 */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary);
}

/* 表单元素继承字体 */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

/* 表格 —— 关键：移动端不溢出 */
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

td,
th {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* 防止长文本/URL 撑破容器 */
p,
h1, h2, h3, h4, h5, h6,
li,
blockquote {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* 标题统一 */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--color-text);
}

/* 焦点可见性 */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
