/* Base: reset, typography, layout primitives. Uses tokens only. */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  overflow-wrap: break-word;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1 0 auto; }

:lang(km) { line-height: var(--lh-body-km); }
:lang(zh-Hans) { font-family: var(--font-sans-zh); }

h1, h2, h3, h4 { margin: 0 0 var(--space-4); line-height: var(--lh-heading); font-weight: 700; }
:lang(km) :is(h1, h2, h3, h4), :is(h1, h2, h3, h4):lang(km) { line-height: var(--lh-heading-km); }
h1 { font-size: var(--fs-h1); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
:lang(km) h1 { letter-spacing: 0; }

p, ul, ol { margin: 0 0 var(--space-4); }
img, svg { max-width: 100%; height: auto; }
img { display: block; }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }

code { font-size: 0.95em; }

/* Layout primitives */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section-pad); }
.measure { max-width: var(--measure); }
.measure-wide { max-width: var(--measure-wide); }
.stack > * + * { margin-top: var(--space-5); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.small { font-size: var(--fs-small); color: var(--ink-muted); }

.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: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--bg);
  color: var(--ink);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-4); }

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