/* ==========================================================================
 * base.css —— 重置、排版、可访问性、工具类
 * ========================================================================== */

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

html,
body { height: 100%; margin: 0; }

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

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 650;
  line-height: 1.3;
}

p { margin: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--c-accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

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

/* 焦点可见，但鼠标点击时不出现难看的外框 */
:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection {
  background: var(--c-accent-soft);
  color: var(--c-text);
}

/* 滚动条（桌面端） */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--c-line-2) transparent;
}

*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb {
  background: var(--c-line-2);
  border-radius: var(--r-pill);
}
*::-webkit-scrollbar-track { background: transparent; }

/* ---- 工具类 ---- */
.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;
}

[hidden] { display: none !important; }

.split {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.muted { color: var(--c-text-2); }
.mute2 { color: var(--c-text-3); }
.nowrap { white-space: nowrap; }

/* 尊重系统的减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
