/* 基础层：重置、排版、焦点与降级 */

/* 本地字体：三套手写体，子集化后离线可用 */
@font-face {
  font-family: "Ma Shan Zheng";
  src: url("../assets/fonts/mashanzheng.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LXGW WenKai";
  src: url("../assets/fonts/lxgwwenkai.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("../assets/fonts/caveat.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.78;
  letter-spacing: 0.025em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 暗底上的纸感：极淡的径向光 + 颗粒 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(58rem 42rem at 78% -8%, rgba(126, 99, 216, 0.16), transparent 64%),
    radial-gradient(50rem 42rem at -10% 46%, rgba(90, 75, 150, 0.10), transparent 60%),
    var(--color-bg);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

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

::selection { background: var(--color-violet-deep); color: #fff; }

:focus-visible {
  outline: 2px solid var(--color-violet);
  outline-offset: 4px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--color-surface-2);
  transform: translateY(-160%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible { transform: none; }

/* 入场：只在允许动效时生效 */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition:
      opacity var(--dur-slow) var(--ease-out) var(--d, 0ms),
      transform var(--dur-slow) var(--ease-out) var(--d, 0ms);
  }
  .reveal.is-in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
