/**
 * CSS Reset - 现代化CSS重置
 * 基于 Josh Comeau's CSS Reset 和 Andy Bell's Modern Reset
 */

/* Box sizing 规则 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 移除默认margin和padding */
* {
  margin: 0;
  padding: 0;
}

/* 防止字体大小膨胀 */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 设置核心body默认值 */
body {
  min-height: 100vh;
  line-height: 1.5;
}

/* 设置更短的行高用于标题和交互元素 */
h1, h2, h3, h4, h5, h6,
button, input, label {
  line-height: 1.2;
}

/* 平衡标题的文本换行 */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

/* 段落文本优化 */
p {
  text-wrap: pretty;
}

/* 链接继承颜色 */
a {
  color: inherit;
  text-decoration: none;
}

/* 使图片更容易处理 */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 继承表单元素的字体 */
input, button, textarea, select {
  font: inherit;
  color: inherit;
}

/* 文本区域没有resize-x */
textarea {
  resize: vertical;
}

/* 按钮重置 */
button {
  background: none;
  border: none;
  cursor: pointer;
}

/* 列表重置 */
ul, ol {
  list-style: none;
}

/* 表格重置 */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* 移除动画给偏好减少动画的用户 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !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;
}

/* 焦点可见性 */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* 移除默认焦点样式 */
:focus:not(:focus-visible) {
  outline: none;
}
