/* Element defaults. Everything here is a bare tag selector, so plain
 * semantic HTML already looks right before a single class is added.
 *
 * Type roles follow the brand guide: Open Sans ExtraBold for headings,
 * Roboto Thin for contrasting subheads, Roboto Regular for body copy.
 */

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--color-page);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: var(--weight-regular);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

/* Headings are the brand's display face. ExtraBold is the only weight the
   guide supplies, so there is no lighter heading option by design. */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  line-height: var(--leading-tight);
  text-wrap: balance;
}

h1 { font-size: var(--text-3xl); letter-spacing: -0.015em; }
h2 { font-size: var(--text-2xl); letter-spacing: -0.01em; }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }

/* The guide's recurring label treatment: small, uppercase, tracked out. */
h6 {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-text-muted);
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
/* Links are underlined rather than coloured: brand green reaches only 2.27:1
   on white, so colour alone could not carry them accessibly in the light
   theme. Underline is the reliable affordance in both themes. */
a:hover { text-decoration-thickness: 2px; }

strong { font-weight: 700; }
small { font-size: var(--text-sm); }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  padding: 0.125em 0.35em;
  background: var(--color-surface-sunken);
  border-radius: var(--radius-sm);
}

pre {
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  overflow-x: auto;
  background: var(--color-surface-sunken);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
}
pre code { padding: 0; background: none; }

hr {
  height: 0;
  margin: var(--space-6) 0;
  border: 0;
  border-top: var(--border-width) solid var(--color-border);
}

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

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

button { font: inherit; color: inherit; }

/* One focus treatment for the whole system. :focus-visible only, so pointer
 * users don't see rings on click but keyboard users always do. */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

[hidden] { display: none !important; }

/* ---- Type utilities ------------------------------------------------------ */

/* Roboto Thin. Never below --text-subhead-min; the weight falls apart small. */
.subhead {
  font-family: var(--font-body);
  font-weight: var(--weight-thin);
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

/* The brand's uppercase ExtraBold label. */
.label-caps {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
}

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