/* Reset and base typography. */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0 0 var(--space-3) 0;
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--color-fg);
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { margin: 0 0 var(--space-3) 0; }

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--space-4) 0;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.95em;
}
pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3);
  overflow-x: auto;
}

input, button, select, textarea {
  font: inherit;
  color: inherit;
}

img, svg { max-width: 100%; display: block; }

table { border-collapse: collapse; width: 100%; }

/* Question stem text uses serif. */
.stem, .question-stem {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  line-height: var(--leading-loose);
}

/* Visually hidden but accessible to screen readers. */
.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-to-content link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-primary);
  color: var(--color-primary-fg);
  padding: var(--space-2) var(--space-3);
  z-index: 1000;
}
.skip-link:focus { left: var(--space-3); }
