/* assets/css/base.css
 * Reset, page defaults, typographic scale, shared layout helpers.
 */

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

html {
  -webkit-text-size-adjust: 100%;

  /* THE SCROLLBAR.

     With no color-scheme declared, the browser assumes `normal` and paints its
     own widgets — scrollbar included — to the operating system's preference.
     On a machine set to dark that produced a dark-mode scrollbar hard against
     a white page, which is where the mismatched bar came from.

     This site is light. Saying so is what makes the scrollbar predictable
     rather than a function of the reader's OS setting, and it fixes the same
     thing for form controls and date pickers.

     scrollbar-color then puts it in the site's own greens instead of the
     browser's grey. Two values: thumb, then track. */
  color-scheme: light;
  scrollbar-color: var(--band) var(--paper);
  scrollbar-width: thin;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--body);
  line-height: var(--body-lh);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin: 0;
}

/* ---- Headings ------------------------------------------------------ */

h1,
.h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--h1);
  line-height: var(--h1-lh);
}

h2,
.h2 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--h2);
  line-height: var(--h2-lh);
}

h3,
.h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--h3);
  line-height: var(--h3-lh);
}

h4,
.h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--h4);
  line-height: var(--h4-lh);
}

h5,
.h5 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--h5);
  line-height: var(--h5-lh);
}

h6,
.h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--h6);
  line-height: var(--h6-lh);
}

/* ---- Layout helpers ------------------------------------------------ */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
}

/* ---- Accessibility floor ------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.section--dark :focus-visible,
.footer :focus-visible {
  outline-color: var(--accent);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 20px;
  background: var(--band);
  border: 1px solid var(--forest);
}

.skip-link:focus {
  left: 16px;
  top: 16px;
}

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

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

/* ---- Fluid type step-down ------------------------------------------ */

@media (max-width: 1100px) {
  :root {
    --h1: 56px;
    --h1-lh: 68px;
    --h2: 46px;
    --h2-lh: 58px;
    --h3: 38px;
    --h3-lh: 48px;
  }
}

@media (max-width: 640px) {
  :root {
    --h1: 40px;
    --h1-lh: 50px;
    --h2: 34px;
    --h2-lh: 44px;
    --h3: 28px;
    --h3-lh: 36px;
    --h6: 20px;
    --h6-lh: 27px;
    --gutter: 20px;
  }
}
