/* ============================================================================
   AIChainWatch · 基础层（Base）
   ----------------------------------------------------------------------------
   作用：重置浏览器默认样式 + 全局排版 + 通用工具类 + 页面氛围背景。
   约定：本文件不出现具体业务组件，只做“地基”。
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: dark; /* 让浏览器原生控件（滚动条、输入框）跟随深色 */
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.65;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

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

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

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

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

/* 选中文本用品牌紫，细节上也保持统一 */
::selection {
  background: rgba(124, 92, 255, 0.35);
  color: #fff;
}

/* 键盘可访问性：只在键盘聚焦时显示描边，鼠标点击不显示 */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- 2. 页面氛围背景（品牌记忆点，全部用 CSS 绘制，零图片请求） ---------- */
/* ① 顶部两团柔光：左侧紫、右侧蓝，制造“数据流动”的科技感 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(124, 92, 255, 0.2), transparent 62%),
    radial-gradient(820px 480px at 96% 0%, rgba(59, 130, 246, 0.15), transparent 64%),
    radial-gradient(700px 500px at 50% 112%, rgba(124, 92, 255, 0.09), transparent 62%);
}

/* ② 细网格纹理：强化“链上 / 数据”的秩序感，向上渐隐 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 78%);
}

/* ---------- 3. 排版刻度 ---------- */
/* 大标题：字号随视口缩放（clamp），字距收紧，营造现代感 */
.display {
  font-size: clamp(2.15rem, 4.6vw, 3.5rem);
  line-height: 1.06;
  font-weight: 640;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* 中文标题不需要负字距，单独覆盖，避免中文字“挤在一起” */
html[lang="zh"] .display,
html[lang="zh"] .h2 {
  letter-spacing: -0.012em;
  line-height: 1.16;
}

.h2 {
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  line-height: 1.14;
  font-weight: 620;
  letter-spacing: -0.028em;
  text-wrap: balance;
}

.h3 {
  font-size: 1.1rem;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.lead {
  font-size: clamp(1rem, 1.35vw, 1.125rem);
  line-height: 1.7;
  color: var(--text-2);
  text-wrap: pretty;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

.muted {
  color: var(--text-2);
}

.dim {
  color: var(--text-3);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  letter-spacing: -0.01em;
}

/* 数字统一用等宽数字，纵向对齐更整齐 */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---------- 4. 通用工具类 ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

/* 竖向堆叠：用 --gap 控制间距，避免到处写 margin */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap, var(--s-4));
}

.row {
  display: flex;
  align-items: center;
  gap: var(--gap, var(--s-3));
}

.row--between {
  justify-content: space-between;
}

.row--wrap {
  flex-wrap: wrap;
}

/* 更紧凑的横排（例如徽章 + 链接的次级操作行） */
.row--tight {
  gap: 10px;
}

/* 横排靠右对齐 */
.row--end {
  justify-content: flex-end;
}

.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 0;
}

/* 少量一次性间距微调（避免在 HTML 里写 style=""） */
.mt-3 {
  margin-top: var(--s-3);
}

.mb-2 {
  margin-bottom: var(--s-2);
}

.mb-4 {
  margin-bottom: var(--s-4);
}
.mt-4 {
  margin-top: var(--s-4);
}

.mt-6 {
  margin-top: var(--s-6);
}

.mt-8 {
  margin-top: var(--s-8);
}

/* 小字号辅助文本 */
.text-xs {
  font-size: 12px;
}

/* 仅供屏幕阅读器（无障碍必需，视觉上隐藏） */
.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;
}

/* ---------- 5. 移动端基础调整 ---------- */
@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .container {
    padding-inline: 18px;
  }
}

/* 尊重系统「减少动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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