/* ==========================================================================
   JimmyXiao · 全站共享基础样式
   由 index.html / 404.html 共用：设计变量、重置、环境背景、按钮、动效
   ========================================================================== */

/* ============ Design tokens ============ */
:root {
  --bg: #05060e;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --text: #e8ecf8;
  --text-dim: #9aa3bd;
  --text-faint: #7b85a3;
  --accent: #8b7cf8;
  --accent-2: #38bdf8;
  --accent-3: #22d3ee;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-pill: 999px;
  color-scheme: dark;
}

/* ============ Reset ============ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

.font-display {
  font-family: "Sora", "Noto Sans SC", system-ui, sans-serif;
}

a {
  color: inherit;
}

::selection {
  background: rgba(139, 124, 248, 0.35);
  color: #fff;
}

/* 键盘焦点环：鼠标点击不显示，键盘 Tab 才显示 */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

/* ============ 无障碍：跳转到主内容 ============ */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--glass-strong);
  border: 1px solid var(--stroke-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 12px;
}

/* ============ Ambient background ============ */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(139, 124, 248, 0.12), transparent 60%),
    var(--bg);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  will-change: transform;
}
.blob-1 {
  width: 520px;
  height: 520px;
  right: -120px;
  top: 8%;
  background: radial-gradient(circle, #7c3aed 0%, #4f46e5 60%, transparent 75%);
  animation: drift1 18s ease-in-out infinite alternate;
}
.blob-2 {
  width: 420px;
  height: 420px;
  left: -140px;
  top: 40%;
  background: radial-gradient(circle, #0ea5e9 0%, #2563eb 60%, transparent 75%);
  opacity: 0.35;
  animation: drift2 22s ease-in-out infinite alternate;
}
.blob-3 {
  width: 380px;
  height: 380px;
  left: 30%;
  bottom: -160px;
  background: radial-gradient(circle, #22d3ee 0%, #0891b2 60%, transparent 75%);
  opacity: 0.28;
  animation: drift3 26s ease-in-out infinite alternate;
}
@keyframes drift1 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-60px, 40px) scale(1.15); }
}
@keyframes drift2 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(50px, -50px) scale(1.1); }
}
@keyframes drift3 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-40px, -30px) scale(1.2); }
}

/* 细颗粒噪点，避免大面积渐变出现色带 */
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 26px;
  border-radius: var(--radius-pill);
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.25s ease, background 0.25s ease,
    border-color 0.25s ease, box-shadow 0.25s ease;
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.13);
  border-color: var(--stroke-strong);
  box-shadow: 0 10px 28px rgba(139, 124, 248, 0.22);
}
.btn:active {
  transform: translateY(0);
}

/* ============ Reveal on scroll ============ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* ============ Motion preference ============ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
  .skip-link {
    transition: none;
  }
}
