/* Reset, document defaults, typography and the accessibility baseline. */

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

html {
  color-scheme: light;
  background: var(--ivory);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ivory);
  color: var(--soil);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset {
  margin: 0;
}

ul, ol {
  padding: 0;
}

fieldset {
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

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

img {
  height: auto;
}

svg {
  fill: none;
}

/* Headings: weight 500, never heavy. */
h1, h2, h3 {
  font-weight: 500;
  text-wrap: balance;
  overflow-wrap: break-word;
}

h1 {
  font-size: var(--text-display);
  line-height: .96;
  letter-spacing: -.028em;
  max-width: var(--measure-display);
}

h2 {
  font-size: var(--text-h2);
  line-height: 1.05;
  letter-spacing: -.02em;
  max-width: 22ch;
}

h3 {
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.005em;
}

/* The serif italic: one emphasized phrase per section, never body copy. */
h1 em, h2 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

h2 em {
  font-size: 1.04em;
}

p {
  max-width: var(--measure);
}

a {
  color: inherit;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: .18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-color: currentColor;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
}

summary {
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

::selection {
  background: var(--harvest-soft);
  color: var(--soil);
}

/* Focus: always visible. Dark grounds swap --focus-ring to harvest. */
:focus-visible {
  outline: 2px solid var(--focus-ring, var(--crop));
  outline-offset: 3px;
  border-radius: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Skip link: visually hidden until it receives focus. */
.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: .7em 1em;
  background: var(--soil);
  color: var(--ivory);
  font-weight: 600;
  font-size: var(--text-small);
  text-decoration: none;
  border-radius: var(--radius-button);
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
  outline-color: var(--harvest);
}

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

main:focus {
  outline: none;
}

/* In-page anchors land below the compact navigation bar. */
[id] {
  scroll-margin-top: calc(var(--nav-compact-height, 56px) + 16px);
}

/* Figures: tabular, lining numerals wherever a number appears. Never on running text,
   where the tabular feature would also widen commas and periods. */
.figure,
.tabular {
  font-variant-numeric: tabular-nums lining-nums;
}
