/* ============================================================
   base.css — 字体 / reset / 底色 / 全局颗粒
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 纸张网点 + 渐变光 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-tex);
  pointer-events: none;
  opacity: 0.55;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(25, 20, 16, 0.15) 1px, transparent 1.4px),
    radial-gradient(1000px 640px at 6% -8%, rgba(255, 204, 26, 0.44), transparent 64%),
    radial-gradient(820px 520px at 98% 8%, rgba(245, 155, 24, 0.16), transparent 62%);
  background-size: 13px 13px, 100% 100%, 100% 100%;
}

/* 纸纹 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-tex);
  pointer-events: none;
  opacity: 0.32;
  background-image: repeating-linear-gradient(0deg, rgba(25, 20, 16, 0.035) 0 1px, transparent 1px 4px);
  mix-blend-mode: multiply;
}

/* 全局颗粒（SVG feTurbulence，内嵌，不额外请求） */
.grain {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: multiply;
  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='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--red-ink);
}

a.btn {
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
p,
dl,
dd,
dt,
ol,
ul,
figure,
figcaption {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0.01em;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--yellow);
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}

[hidden] {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.doc {
  font-family: var(--font-doc);
}

.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;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--yellow);
  border-radius: 999px;
  font-weight: 700;
  transition: top var(--dur) var(--ease-out);
}

.skip-link:focus-visible {
  top: 12px;
}

.ticker,
.page,
.foot {
  position: relative;
  z-index: var(--z-content);
}

/* 滚动入场（由 effects.js 添加 .is-in） */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px) rotate(0.4deg);
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.7s var(--ease-out);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

[data-reveal].is-in .pose,
[data-reveal].is-in .meme {
  animation: card-pop 0.7s var(--ease-spring) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .grain {
    display: none;
  }
}
