/* =====================================================================
   Base: reset, document, typography defaults, layout primitives.
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-2));
  background: var(--c-bg);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: clip;
  background: var(--c-bg);
  color: var(--c-body);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--c-ink);
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, picture { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
strong, b { color: var(--c-ink); font-weight: var(--fw-bold); }

/* Text links: ink text with a green underline (green text alone fails contrast on white) */
.link {
  color: var(--c-ink);
  font-weight: var(--fw-semibold);
  text-decoration: underline;
  text-decoration-color: var(--c-green);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: text-decoration-color var(--dur-fast) var(--ease);
}
.link:hover { text-decoration-color: var(--c-ink); }

/* Focus: ink outline + green halo, readable on white, grey and photo */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--c-ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--c-green);
  border-radius: var(--r-xs);
}

::selection { background: var(--c-green); color: var(--c-ink); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  top: var(--sp-1); left: var(--sp-1);
  z-index: 100;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-btn);
  background: var(--c-ink);
  color: #fff;
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

/* ---- Layout primitives ---- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: calc(var(--container-wide) + var(--gutter) * 2); }

.section { position: relative; padding-block: var(--section-y); background: var(--c-bg); }
.section--alt { background: var(--c-bg-alt); }

:lang(zh) body { line-height: 1.75; }

[hidden] { display: none !important; }
