/* ==========================================================================
   base.css — 重置 / 排版基础 / 氛围层 / 降级
   字体说明：全部使用本机字体，不引用任何外部 CDN（国内打开不等待网络）。
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 任何宽度都不出现横向滚动条 */
  overflow-x: hidden;
}

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

h1,
h2,
h3,
p,
ul,
ol,
figure,
blockquote {
  margin: 0;
}

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

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

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

/* ---- 焦点可见：2px 描边 + 2px 偏移，键盘用户始终能看到 ---- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection {
  background: rgba(0, 245, 160, 0.24);
  color: #fff;
}

/* ==========================================================================
   氛围层
   ========================================================================== */

/* 淡网格：整层比视口高 40px，方便做滚动位移 */
.grid-bg {
  position: fixed;
  inset: -40px 0 0 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  /* 越往下越淡，首屏之外几乎消失 */
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 88%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 88%);
  will-change: transform;
}

/* 两团低透明度径向光晕：左上青绿，右下偏蓝 */
.glow {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(40px);
}

.glow--a {
  top: -18vmax;
  left: -14vmax;
  width: 52vmax;
  height: 52vmax;
  background: radial-gradient(closest-side, rgba(0, 245, 160, 0.16), transparent 70%);
}

.glow--b {
  bottom: -22vmax;
  right: -16vmax;
  width: 48vmax;
  height: 48vmax;
  background: radial-gradient(closest-side, rgba(20, 216, 255, 0.1), transparent 70%);
}

/* 颗粒：SVG feTurbulence 生成，5% 透明度 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 内容层永远在氛围层之上 */
.statusbar,
main,
.footer {
  position: relative;
  z-index: 2;
}

/* ==========================================================================
   排版基础
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: calc(var(--measure-wide) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* 长文阅读宽度：宽构图里保持 680px 测量，避免一行太长 */
.measure {
  max-width: var(--measure);
}

/* 等宽小标签：#01 / 平台名 / 编号 */
.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.accent {
  color: var(--color-accent);
}

/* 章节标题：中文用系统黑体最重字重压紧字距，做出硬朗的标题感 */
.section-title {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-top: var(--space-2);
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

/* 锚点跳转时躲开吸顶状态条 */
[id] {
  scroll-margin-top: 64px;
}

/* 标题 + 头像并排：头像紧跟标题，成组不散开 */
.section-head--row {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-4);
}

/* 纵向节奏：标准档与紧凑档交替，避免通篇一个间距 */
.section {
  padding-block: clamp(56px, 6.4vw, 88px);
}

.section--compact {
  padding-block: clamp(40px, 4.6vw, 60px);
}

.section + .section {
  padding-top: 0;
}

/* 发丝分隔线 */
.hairline {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(
    to right,
    transparent,
    var(--color-hairline) 12%,
    var(--color-hairline) 88%,
    transparent
  );
}

/* ==========================================================================
   滚动渐显（只动 opacity / transform）
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* 同一组内错峰：60–120ms */
.reveal[data-delay="1"] { transition-delay: 70ms; }
.reveal[data-delay="2"] { transition-delay: 140ms; }
.reveal[data-delay="3"] { transition-delay: 210ms; }
.reveal[data-delay="4"] { transition-delay: 280ms; }

/* ==========================================================================
   动效降级：系统开启"减少动态效果"时全部关闭
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

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