/* Self-hosted Fraunces (variable). Fallbacks render instantly via font-display. */
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-wght-italic.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

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

html {
  font-size: 100%; /* 19px comes from --fs-body, not root zoom */
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--ink);
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-2);
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); margin-top: var(--space-5); }
h3 { font-size: var(--fs-h3); margin-top: var(--space-4); }

p { margin: 0 0 var(--space-2); max-width: var(--measure); }
.prose p { max-width: var(--measure); }

a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--brass); text-underline-offset: 3px; }
a:hover { color: var(--brass); }

img { max-width: 100%; height: auto; display: block; }

/* Eyebrow label (brass small-caps) */
.eyebrow {
  font-family: var(--font-serif);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 var(--space-1);
}

/* Layout */
.container { width: min(var(--container), calc(100% - 2.5rem)); margin-inline: auto; }
.container-narrow { width: min(var(--container-narrow), calc(100% - 2rem)); margin-inline: auto; }
.section { padding-block: var(--space-5); }
.section--tight { padding-block: var(--space-4); }

hr.rule { border: 0; border-top: 1px solid var(--hairline); margin-block: var(--space-4); }

/* Visually-hidden (a11y) */
.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 */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1000;
  background: var(--ink); color: var(--on-ink); padding: 0.75rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* Focus visibility */
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; border-radius: 2px; }

/* Paper grain — printed, archival texture on the cream surface.
   mix-blend-mode: multiply is a no-op on the dark ink footer/hero and the
   lightbox overlay, so only the light paper gains texture. Static (no motion). */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  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.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  opacity: 0.06;
  mix-blend-mode: multiply;
}

/* Simplified Chinese: keep Fraunces for Latin text (brand consistency) and fall
   back to the operating system's CJK serif/sans for Han characters. System
   fonts only — no webfont is downloaded, so the GDPR/Datenschutz self-hosting
   rule is preserved. CJK reads better with a little more leading. */
html[lang="zh-CN"] {
  --font-serif: "Fraunces", "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
html[lang="zh-CN"] body { line-height: 1.8; }
