/* ==========================================================================
   base.css — 重置、排版基座、可访问性、氛围层
   ========================================================================== */

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

* { margin: 0; }

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

body {
  background-color: var(--paper-1);
  color: var(--ink-1);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  letter-spacing: .012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

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

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

table { border-collapse: collapse; width: 100%; }

/* ---------- 排版基座 ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-display);
  text-wrap: balance;
}

p { text-wrap: pretty; }

strong { font-weight: 600; }

::selection {
  background: var(--gold-300);
  color: var(--navy-900);
}

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

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

/* 跳转到主内容（屏幕阅读器与键盘用户） */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: 200;
  padding: var(--sp-3) var(--sp-5);
  background: var(--navy-800);
  color: var(--ink-onDark-1);
  border-radius: var(--r-sm);
  transition: top var(--dur-fast) ease-out;
}
.skip-link:focus { top: var(--sp-4); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 布局容器 ---------- */
.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}
.container--narrow { width: min(100% - 2.5rem, var(--container-narrow)); }

.section {
  position: relative;
  background-color: var(--color-bg);
  color: var(--color-text);
  padding-block: var(--section-y);
  isolation: isolate;
}

/* 深底区块之间的发丝分隔 */
.section[data-surface="deep"] + .section[data-surface="deep"]::before,
.section[data-surface="deepest"] + .section[data-surface="deepest"]::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: var(--line-onDark-1);
}

/* ---------- 氛围层：渐变网格 + 颗粒 ---------- */
.atmosphere { position: relative; }

/* 深底区的渐变网格：两点低透明径向光，避免纯色平铺 */
.atmosphere[data-surface="deep"]::before,
.atmosphere[data-surface="deepest"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(52rem 32rem at 88% -12%, rgba(196, 161, 93, .16), transparent 62%),
    radial-gradient(44rem 30rem at 6% 108%, rgba(75, 124, 184, .22), transparent 60%);
}

/* 浅底区的极淡网格纹，破掉"纯平背景" */
.atmosphere[data-surface="paper"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .5;
  background-image:
    linear-gradient(var(--line-1) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-1) 1px, transparent 1px);
  background-size: 88px 88px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000 0%, transparent 100%);
          mask-image: radial-gradient(70% 60% at 50% 40%, #000 0%, transparent 100%);
}

/* 全站颗粒叠加，透明度 3.5% */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: .035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 入场编排：错峰 3–6 组 ---------- */
.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);
  transition-delay: var(--reveal-delay, 0ms);
}

/* ---------- 降级：尊重系统减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- 无 JS 兜底：内容必须可见 ---------- */
.no-js .reveal { opacity: 1; transform: none; }
