/* Design tokens, reset and shared typography.
   Warm paper palette, quiet green accents, editorial spacing. */

:root {
  --ink: #3d3329;
  --ink-soft: #6f6357;
  --muted: #938678;
  --rule: #e4e0da;
  --rule-strong: #d6cec3;
  --canvas: #f9f8f6;
  --paper: #fffdfa;
  --surface-soft: #f3eee6;
  --accent: #2f6b4f;
  --accent-ink: #23523c;
  --accent-soft: #eaf2ec;
  --gold: #b99861;
  --answer: #c0392b;
  --focus: #2f6b4f;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(61, 51, 41, 0.05);
  --shadow-md: 0 12px 30px rgba(61, 51, 41, 0.1);
  --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-sheet: "Segoe UI", "Helvetica Neue", Arial, "Liberation Sans", sans-serif;
  --max-page: 1236px;

  /* Generator layout and button sizes (architecture doc 15). */
  --gen-max-width: 1192px;
  --gen-radius: 26px;
  --gen-rail-width: 510px;
  --control-h-sm: 36px;
  --control-h-md: 38px;
  --control-h-lg: 42px;
  --cta-h: 52px;
  --control-radius: 10px;
  --cta-radius: 12px;
  --chip-radius: 999px;
  --control-gap: 8px;

  /* Generator layout and button sizes (architecture doc 15). */
  --gen-max-width: 1192px;
  --gen-radius: 26px;
  --gen-rail-width: 510px;
  --control-h-sm: 36px;
  --control-h-md: 38px;
  --control-h-lg: 42px;
  --cta-h: 52px;
  --control-radius: 10px;
  --cta-radius: 12px;
  --chip-radius: 999px;
  --control-gap: 8px;

  /* Generator layout and button sizes (architecture doc 15). */
  --gen-max-width: 1192px;
  --gen-radius: 26px;
  --gen-rail-width: 510px;
  --control-h-sm: 36px;
  --control-h-md: 38px;
  --control-h-lg: 42px;
  --cta-h: 52px;
  --control-radius: 10px;
  --cta-radius: 12px;
  --chip-radius: 999px;
  --control-gap: 8px;
}

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

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5em;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.028em;
}

h1 {
  font-size: clamp(1.9rem, 2.1rem + 1.6vw, 2.9rem);
  line-height: 1.06;
}

h2 {
  font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.85rem);
  line-height: 1.15;
  margin-top: 1.6em;
}

h3 {
  font-family: var(--font-ui);
  font-size: 1.02rem;
  font-weight: 650;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--accent-ink);
}

ul,
ol {
  margin: 0 0 1em;
  padding-left: 1.3em;
}

li {
  margin-bottom: 0.35em;
}

img {
  max-width: 100%;
  height: auto;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.wrap {
  width: 100%;
  max-width: var(--max-page);
  margin: 0 auto;
  padding: 0 22px;
}

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

/* Fields that do not apply to the chosen topic are hidden with [hidden], which
   the flex rules above would otherwise override. */
[hidden] {
  display: none !important;
}
