/* Base: reset, type, links, focus, the screen-reader helper, and the side gutter.
 * Nothing here is specific to a component. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

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

main { flex: 1 0 auto; display: block; }
main:focus { outline: none; }

[hidden] { display: none !important; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-serif);
  margin: 0;
  color: var(--ink);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  hyphens: manual;
}
h1 { font-size: var(--fs-4); line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-3); line-height: 1.25; }
h3 { font-size: var(--fs-2); line-height: 1.3; }
h4 { font-size: var(--fs-1); line-height: 1.3; }
h5 { font-size: var(--fs-0); line-height: 1.3; }

p, ul, ol, dl, figure, table { margin: 0; }
p { max-width: 68ch; text-wrap: pretty; }
ul, ol { padding-left: 1.25em; }
img, svg, video { max-width: 100%; height: auto; }
svg:not([width]) { height: auto; }

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

strong, b { font-weight: 700; }
small { font-size: var(--fs--1); }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 0.1em 0.4em;
  border-radius: 5px;
}

hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-6) 0; }

::selection { background: var(--accent-soft); color: var(--ink); }

/* Keyboard focus is always visible. Mouse clicks do not draw a ring. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Text for screen readers only. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Figures line up in columns and do not jump as they change. */
.tabnum, .count, time, table td.num, .stat__value {
  font-variant-numeric: tabular-nums;
}

/* The page's side gutter: 16px on a phone, 24px from tablet up. */
.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -120px;
  z-index: var(--z-skip);
  padding: 12px 16px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus { top: 10px; color: var(--bg); }

/* Phones: stop the page itself from ever scrolling sideways. */
html, body { max-width: 100%; overflow-x: clip; }

@media print {
  .site-header, .site-footer, .skip-link, .scroll-progress, .pause-motion, .filter-bar { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}

/* Titles and names inside cards, tiles and steps are headings in all but tag. They follow the same
 * rules: balanced lines, a long word breaks rather than runs over its neighbour, and the line
 * height leaves room for the lines above and below. */
[class*="__title"], [class*="__name"], [class*="__head"], .choice__label {
  text-wrap: balance;
  overflow-wrap: anywhere;
  min-width: 0;
}
