/* Reset, typography and layout primitives. */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-ui);
  overflow-wrap: break-word;
  /* Thai has no spaces between words; let the browser break lines by dictionary. */
  word-break: normal;
  line-break: auto;
}

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

h1, h2, h3, h4 {
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-3);
  font-weight: 700;
  text-wrap: balance;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
@media (min-width: 48rem) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
}

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

a { color: var(--primary); text-underline-offset: 0.18em; }
a:hover { color: var(--primary-hover); }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -100px;
  z-index: 100;
  background: var(--primary);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-control);
  font-weight: 600;
}
.skip-link:focus { top: var(--space-3); color: #fff; }

.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;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
@media (min-width: 48rem) { .container { padding-inline: var(--space-5); } }

.prose {
  font-size: var(--text-body);
  line-height: var(--leading-body);
  max-width: var(--measure);
}

.muted { color: var(--muted); }
.text-sm { font-size: var(--text-sm); }

.stack > * + * { margin-top: var(--space-4); }

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