/* ==========================================================================
   兔聊 · 基础层 (Reset / 排版 / 可访问性)
   只放全局规则，不放具体组件。
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  letter-spacing: var(--ls-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ---------- 排版 ---------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: var(--fw-black);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-heading);
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

ul, ol { margin: 0; padding: 0; }
li { list-style: none; }

a {
  color: inherit;
  text-decoration: none;
}

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

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

/* ---------- 焦点可见性（键盘用户） ---------- */
:focus { outline: none; }

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

/* 跳过导航：键盘用户第一个 Tab 就能跳过顶部导航 */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-5);
  z-index: 999;
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-accent);
  color: var(--c-accent-ink);
  font-weight: var(--fw-bold);
  border-radius: 0 0 var(--r-md) var(--r-md);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 0; }

/* ---------- 视觉隐藏但读屏可读 ---------- */
.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;
}

/* ---------- 布局容器 ---------- */
.wrap {
  width: 100%;
  max-width: var(--w-page);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
.wrap--wide { max-width: var(--w-wide); }

/* 非对称栅格：左窄右宽，用来打破「居中三卡」的惯性 */
.split {
  display: grid;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
/* grid / flex 子项默认 min-width:auto，内部若有 min-width 的表格或长单词，
   会把整列撑破容器（移动端横向溢出的元凶）。统一压回 0。 */
.split > *,
.hero__grid > *,
.grid > *,
.stats > *,
.steps > * { min-width: 0; }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }
  .split--flip { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
}

/* ---------- 区块节奏 ---------- */
.section {
  position: relative;
  padding-block: var(--section-y);
}
.section--tight { padding-block: clamp(48px, 6vw, 80px); }

/* ---------- 氛围层：渐变网格 + 颗粒噪点 ---------- */
/* 铺在内容之下，pointer-events 关闭以免挡住交互 */
.atmos { position: relative; isolation: isolate; }

.atmos::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(58rem 38rem at 8% -12%, rgba(255, 77, 121, 0.20), transparent 62%),
    radial-gradient(48rem 34rem at 96% 4%, rgba(123, 92, 255, 0.20), transparent 58%),
    radial-gradient(40rem 30rem at 50% 108%, rgba(88, 224, 232, 0.09), transparent 62%);
}

/* 全站颗粒：4% 透明度，抑制渐变的塑料感 */
.grain::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 入场序列：滚动触发的错峰上升 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
}
/* 同一容器内的兄弟节点错峰 70ms，形成一次编排好的入场 */
.reveal.is-in:nth-child(2) { transition-delay: 70ms; }
.reveal.is-in:nth-child(3) { transition-delay: 140ms; }
.reveal.is-in:nth-child(4) { transition-delay: 210ms; }
.reveal.is-in:nth-child(5) { transition-delay: 280ms; }
.reveal.is-in:nth-child(6) { transition-delay: 350ms; }

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .reveal,
  .reveal.is-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 选中文字 ---------- */
::selection {
  background: var(--c-accent);
  color: var(--c-accent-ink);
}

/* ---------- 滚动条（桌面 Webkit） ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--c-bg-deep); }
::-webkit-scrollbar-thumb {
  background: var(--c-surface-3);
  border-radius: var(--r-pill);
  border: 2px solid var(--c-bg-deep);
}
::-webkit-scrollbar-thumb:hover { background: var(--c-muted-2); }

/* ---------- 打印：去掉氛围层，省墨 ---------- */
@media print {
  .atmos::before, .grain::after, .nav, .fab-top { display: none !important; }
  body { background: #fff; color: #000; }
}
