/*
 * Reset and element defaults.
 * Reads from tokens.css. No literal colours or sizes below this line.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /*
   * No scroll-padding here. Clearing the fixed header is already handled by
   * `[id] { scroll-margin-top }` in components.css, and the two add up: set
   * both and an anchor lands a header's height too far down the page.
   */
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /*
   * Belt and braces against sideways scroll. The real defence is that every
   * component sizes itself, but one overflowing embed should not be able to
   * shift the whole page.
   */
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  text-wrap: balance;
}

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

p:last-child {
  margin-bottom: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

ul, ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
}

/*
 * Browsers indent dd by 40px. Description lists are the honest markup for a
 * figure and its label, so this has to be zeroed or every one of them sits
 * 40px right of the column it belongs to.
 */
dl, dt, dd {
  margin: 0;
}

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

strong, b {
  font-weight: var(--fw-semibold);
}

/*
 * Focus. Never removed, only restyled. Two rings so it is visible on the
 * dark sections and the light ones without needing a variant per context.
 */
:focus-visible {
  outline: var(--focus-w) solid var(--color-accent);
  outline-offset: var(--focus-offset);
}

/* Skip link: present for keyboard users, out of the way for everyone else. */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100vh;
  z-index: var(--z-skip);
  padding: var(--space-3) var(--space-5);
  background: var(--color-accent);
  /* Charcoal on orange measures 5.85:1. White on orange is 3.37:1 and fails
   * AA at this size. The skip link is ours, not the design's, so it takes the
   * accessible pairing. */
  color: var(--sgh-charcoal);
  font-size: var(--fs-btn);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps-tight);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-4);
}

/* Visually hidden but available to screen readers. */
.screen-reader-text,
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
