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

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--ff-body);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* 数字与域名统一等宽 + 表格化数字，避免计数跳动 */
.mono,
.card-host,
.group-count,
.stat-value { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; }

/* ---------- 焦点可见性: 2px 描边 + 2px 偏移 ---------- */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
:focus:not(:focus-visible) { outline: none; }

/* ---------- 跳转链接 ---------- */
.skip-link {
  position: fixed;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: 100;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--c-accent);
  color: var(--c-accent-ink);
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus { transform: none; }

/* ============================================================================
   氛围层 —— 渐变网格 + 细网格 + 颗粒
   三层叠加制造纵深，替代纯色平铺
   ========================================================================= */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: var(--z-atmo);
  pointer-events: none;
}

/* 1) 三个大尺寸径向渐变，制造光源方向 */
.atmosphere::before {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(58rem 42rem at 8% -12%,  var(--c-aura-1), transparent 62%),
    radial-gradient(52rem 40rem at 102% 4%,   var(--c-aura-2), transparent 58%),
    radial-gradient(40rem 34rem at 62% 108%,  var(--c-aura-3), transparent 60%);
  filter: blur(0.5px);
}

/* 2) 极淡科技网格，向下渐隐 —— 强化工业务气质 */
.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right,  rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 12%, transparent 78%);
          mask-image: radial-gradient(120% 90% at 50% 0%, #000 12%, transparent 78%);
}

/* 3) 颗粒噪点，消除渐变的塑料感 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-atmo);
  pointer-events: none;
  opacity: 0.042;
  mix-blend-mode: overlay;
  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='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 滚动条 ---------- */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-pill);
}
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.26); background-clip: content-box; }

/* ============================================================================
   入场序列 —— 一次编排好的错峰浮现
   由 JS 打上 .in，--i 决定延迟；只动 opacity / transform
   ========================================================================= */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(14px);
  }
  .reveal.in {
    opacity: 1;
    transform: none;
    transition:
      opacity   var(--dur-base) var(--ease-out),
      transform var(--dur-base) var(--ease-out);
    transition-delay: calc(var(--i, 0) * var(--stagger, 55ms));
  }
}

/* 降级: 用户要求减少动效 → 全部关闭 */
@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;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}

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