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

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

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans-cjk);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 200ms ease, color 200ms ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif-cjk);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin: var(--space-5) 0 var(--space-3);
}

h1 { font-size: clamp(1.875rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 1.875rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }

p { margin: 0 0 var(--space-3); }

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 150ms ease;
}

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

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

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre {
  background: var(--bg-subtle);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

blockquote {
  border-left: 3px solid var(--brand-accent);
  padding-left: var(--space-3);
  margin: var(--space-4) 0;
  color: var(--text-secondary);
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
