/* ============================================================
   base.css — 重置、字体系统、滚动、无障碍、降级
   ============================================================ */

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg-night);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.01em;
}

/* 选中态：暖橘微光 */
::selection {
  background: rgba(255, 154, 77, 0.32);
  color: #fff;
}

/* 滚动条：细、克制、暗色（呼应洁癖） */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 184, 112, 0.16);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-deep);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 184, 112, 0.32);
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

p {
  color: var(--ink-soft);
}

a {
  color: var(--lamp-bright);
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

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

/* ---------- 无障碍：键盘聚焦环 ---------- */
:focus-visible {
  outline: 2px solid var(--lamp);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* ---------- 屏幕阅读器专用 ---------- */
.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;
}

/* ---------- 通用工具 ---------- */
.is-hidden {
  display: none !important;
}

.visually-muted {
  color: var(--ink-faint);
}

/* ---------- 减少动效偏好：温柔降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* 手动"安静模式"：由 JS 在 <html> 上加 .calm，全局收敛动效 */
html.calm *,
html.calm *::before,
html.calm *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.15s !important;
}
html.calm .ambience__particles,
html.calm .ambience__pulse {
  display: none !important;
}
