/* ============================================================
   基础层：重置、排版、氛围、焦点与降级动效
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.75;
  letter-spacing: 0.02em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(46, 160, 255, 0.4); color: #fff; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

h1, h2, h3 { font-family: var(--font-body); font-weight: 900; line-height: 1.15; letter-spacing: -0.01em; }
.latin { font-family: var(--font-display); }

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

/* ---- 氛围层：渐变网格 + 网格线 + 颗粒 ---- */
.atmosphere::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(55rem 38rem at 8% -8%, rgba(46, 160, 255, 0.16), transparent 60%),
    radial-gradient(45rem 32rem at 96% 12%, rgba(70, 224, 122, 0.10), transparent 55%),
    radial-gradient(60rem 44rem at 50% 120%, rgba(46, 160, 255, 0.10), transparent 60%);
}
.grid-lines::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(142, 180, 240, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(142, 180, 240, 0.05) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 30%, transparent 100%);
}
.grain::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, header, footer, section { position: relative; z-index: 2; }

/* ---- 容器 ---- */
.container { width: min(1200px, 92vw); margin-inline: auto; }
.section { padding-block: var(--space-7); }

/* ---- 滚动进度条 ---- */
#scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--color-gradient); z-index: 120;
  box-shadow: 0 0 12px rgba(46, 160, 255, 0.6);
}

/* ---- 入场动效骨架（滚动触发） ---- */
.reveal { opacity: 0; transform: translateY(28px); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.reveal[data-delay="1"].in { transition-delay: 80ms; }
.reveal[data-delay="2"].in { transition-delay: 160ms; }
.reveal[data-delay="3"].in { transition-delay: 240ms; }
.reveal[data-delay="4"].in { transition-delay: 320ms; }
.reveal[data-delay="5"].in { transition-delay: 400ms; }

/* ---- 降级：关闭全部动效 ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 768px) {
  .section { padding-block: var(--space-6); }
}
