/* ==========================================================================
   base.css —— 设计令牌 / 重置 / 排版 / 主题 / 通用动画
   ========================================================================== */

:root {
  /* 品牌色 */
  --brand: #2563eb;
  --brand-600: #1d4fd0;
  --brand-400: #5b9bff;
  --brand-300: #9cc8ff;
  --brand-200: #cfe6ff;
  --brand-100: #eaf4ff;
  --brand-50: #f5f9ff;
  --deep: #071a3a;
  --deep-800: #0b254f;
  --deep-700: #123a6b;
  --accent: #00e5ff;
  --accent-mint: #22b982;
  --accent-coral: #f4775c;

  /* 页面扩展版式 */
  --page-pad: 74px;
  --page-pad-sm: 30px;

  /* 语义色（浅色） */
  --bg: #ffffff;
  --bg-soft: #f6faff;
  --section: #f6faff;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --line: rgba(37, 99, 235, 0.14);
  --line-soft: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --text-soft: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --shadow-card: 0 10px 30px -12px rgba(7, 26, 58, 0.15);
  --shadow-glass: 0 20px 60px -20px rgba(7, 26, 58, 0.18);
  --shadow-hover: 0 24px 60px -24px rgba(37, 99, 235, 0.35);

  /* 字体 */
  --font-display: 'Space Grotesk', 'Orbitron', system-ui, sans-serif;
  --font-sans: Inter, 'Source Han Sans SC', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --radius: 22px;
  --radius-sm: 14px;
  --maxw: 1600px;
}

/* 深色主题：html.dark */
html.dark {
  --bg: #050d1f;
  --bg-soft: #071129;
  --section: #071129;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-soft: rgba(255, 255, 255, 0.03);
  --line: rgba(255, 255, 255, 0.1);
  --line-soft: rgba(255, 255, 255, 0.06);
  --text: #e2e8f0;
  --text-soft: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --shadow-card: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-glass: 0 20px 60px -20px rgba(0, 0, 0, 0.65);
  --shadow-hover: 0 24px 60px -24px rgba(0, 229, 255, 0.18);
}

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

html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: linear-gradient(180deg, #edf5ff 0%, #f8fbff 160px, #ffffff 420px);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s ease, color .3s ease;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { display: block; }
::selection { background: rgba(0, 229, 255, 0.28); color: var(--deep); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.28);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
html.dark ::-webkit-scrollbar-thumb { background: rgba(0, 229, 255, 0.25); background-clip: content-box; }

/* ---------- 排版 ---------- */
.h2 { font-size: 34px; line-height: 1.12; color: var(--text); font-weight: 600; }
.h3 { font-size: 22px; line-height: 1.35; color: var(--text); }
@media (min-width: 1024px) {
  .h2 { font-size: 52px; }
}
.h3--white { color: #fff; }
.lead { margin-top: 16px; max-width: 42rem; color: var(--text-muted); font-size: 15.5px; line-height: 1.85; }
.muted { color: var(--text-muted); font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--brand); }
html.dark .mono { color: var(--brand-300); }
.text-gradient {
  background: linear-gradient(90deg, var(--brand), var(--brand-400) 55%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
html.dark .text-gradient { background: linear-gradient(90deg, var(--brand-300), var(--brand-400) 55%, var(--accent)); -webkit-background-clip: text; background-clip: text; }

/* ---------- 布局 ---------- */
.container {
  width: min(100%, calc(var(--maxw) + (var(--page-pad) * 2)));
  margin: 0 auto;
  padding: 0 var(--page-pad-sm);
}
@media (min-width: 640px) {
  .container { padding: 0 38px; }
}
@media (min-width: 1024px) {
  .container {
    width: min(100%, calc(var(--maxw) + 360px));
    padding: 0 72px;
  }
}

.grid-2 { display: grid; gap: 24px; }
.grid-4 { display: grid; gap: 20px; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; } }
@media (min-width: 640px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 14px; } .mt-5 { margin-top: 18px; }
.mt-6 { margin-top: 22px; } .mt-7 { margin-top: 26px; } .mt-14 { margin-top: 52px; } .mt-16 { margin-top: 64px; }

/* ---------- 背景装饰 ---------- */
.grid-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(37, 99, 235, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(37, 99, 235, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
}
.grid-bg--soft { opacity: .45; }
.grid-bg--dark {
  background-image:
    linear-gradient(to right, rgba(0, 229, 255, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 229, 255, 0.1) 1px, transparent 1px);
  opacity: .55;
}
html.dark .grid-bg {
  background-image:
    linear-gradient(to right, rgba(0, 229, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 229, 255, 0.06) 1px, transparent 1px);
}

/* ---------- 滚动淡入 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .8s cubic-bezier(.22, 1, .36, 1), transform .8s cubic-bezier(.22, 1, .36, 1);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- 关键帧 ---------- */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sweep { 0% { transform: translateX(-130%); } 100% { transform: translateX(240%); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes live { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes flowdot { 0% { left: 0; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { left: 100%; opacity: 0; } }

.ring-slow { transform-origin: 260px 260px; animation: spin 60s linear infinite; }
.ring-rev { transform-origin: 260px 260px; animation: spin 26s linear infinite reverse; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
