/* ============================================================
   base.css — Global Reset, Background, Fonts & Shared Chrome
   ============================================================ */

/* ── Font Faces ──────────────────────────────────────── */
/* 自托管字体（assets/fonts，scripts/build-fonts.js 生成），不再依赖 Google Fonts */
@import url("/assets/css/fonts.css?v=20260611");
/* ── Reset ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Root Elements ───────────────────────────────────── */
html {
  height: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  height: 100%;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: 1.7;
  overflow-x: hidden;

  background: var(--bg-grad);

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  animation: paper-soak 0.55s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ── Paper Noise — SVG Turbulence Overlay ────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--noise-opacity);
  mix-blend-mode: var(--noise-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.0' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.07 0 0 0 0 0.04 0 0 0 0.4 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ── Ink Bloom — Pointer-tracked Ink Bloom & Paper metaphor ────────── */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 2;
  background:
    radial-gradient(circle at var(--mx, 30%) var(--my, 70%),
      rgba(var(--verm-rgb), 0.06) 0%,
      rgba(var(--verm-rgb), 0.012) 30%,
      transparent 55%),
    radial-gradient(circle at 78% 22%, rgba(var(--shadow-rgb), 0.045) 0%, transparent 45%),
    radial-gradient(circle at 88% 84%, rgba(var(--verm-rgb), 0.035) 0%, transparent 38%);
  transition: background 0.4s ease;
}

/* ── Binding Gutter — Fixed Left Shadow Bar ──────────── */
.binding {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: clamp(14px, 1.8vw, 28px);
  z-index: 10;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(var(--shadow-rgb), 0.09) 0%,
    rgba(var(--shadow-rgb), 0.035) 30%,
    transparent 70%
  );
}

/* ── Anchor Defaults ─────────────────────────────────── */
a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--verm);
}

/* ── Image Defaults ──────────────────────────────────── */
img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Selection ───────────────────────────────────────── */
::selection {
  background: rgba(var(--verm-rgb), 0.20);
  color: var(--ink);
}

::-moz-selection {
  background: rgba(var(--verm-rgb), 0.20);
  color: var(--ink);
}

/* ── Reduced Motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  /* 对齐原站：仅关闭循环/装饰性动画，保留交互过渡（sweep、下划线、视差），
     避免把所有 transition 压成 0.01ms 导致按钮"瞬间全红"、人物视差跳动。 */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  /* 例外：标题打字光标始终闪烁（对齐原站，签名级细节） */
  .hero-title__cursor {
    animation: caret-blink 1.6s step-end infinite !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ── Grid Overlay Canvas ────────────────────────── */
#grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 1;
  transition: opacity 0.3s ease;
}
