/* base.css — reset, typography, global elements (Phase 1) */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  line-height: var(--lh-normal);
  font-size: var(--fs-09);
  font-variant-east-asian: proportional;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
html[lang="zh-Hant"] body { line-height: var(--lh-relaxed); }

h1, h2, h3, h4 { font-family: var(--font-serif); color: var(--navy); margin: 0 0 0.5em; line-height: var(--lh-tight); font-weight: 600; }
h1 { font-size: var(--fs-05); }
h2 { font-size: var(--fs-06); }
h3 { font-size: var(--fs-07); }
h4 { font-size: var(--fs-08); }

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.5em; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--red); }

/* Focus visibility */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}
:where(.btn, .btn-primary):focus-visible { box-shadow: var(--focus-ring-blue); }

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

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--navy); color: #fff; padding: var(--sp-3) var(--sp-5);
  z-index: 100; border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; color: #fff; }

/* Utility: sr-only */
.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;
}

/* Container */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--sp-5); }
.container-narrow { max-width: var(--content-narrow); margin: 0 auto; padding: 0 var(--sp-5); }

/* Site shell */
.site-main { min-height: 60vh; }

/* Error page (404/500) */
.page-error { max-width: var(--content-narrow); margin: 0 auto; padding: var(--sp-8) var(--sp-5); text-align: center; }
.page-error h1 { font-size: var(--fs-04); margin-bottom: var(--sp-4); }
.page-error .code { font-size: var(--fs-05); color: var(--red); font-family: var(--font-serif); font-weight: 700; }

/* Selection */
::selection { background: var(--red); color: #fff; }
