/* Reset and element defaults. Component styles live in components.css. */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-5));
}

body {
  background-color: var(--c-bg);
  color: var(--c-text-muted);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Headings ----------------------------------------------------------
   Headings are the only place the display font is used. */

h1,
h2,
h3,
h4 {
  color: var(--c-text);
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-display);
}

h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p {
  text-wrap: pretty;
}

/* ---- Links -------------------------------------------------------------- */

a {
  color: var(--c-text);
  text-decoration-color: var(--c-accent-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--dur) var(--ease),
              text-decoration-color var(--dur) var(--ease);
}

a:hover {
  color: var(--c-accent-text);
  text-decoration-color: currentColor;
}

/* ---- Lists -------------------------------------------------------------- */

ul,
ol {
  padding-inline-start: var(--space-5);
}

li + li {
  margin-top: var(--space-2);
}

/* ---- Media -------------------------------------------------------------- */

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

/* ---- Forms -------------------------------------------------------------- */

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

button {
  background: none;
  border: none;
  cursor: pointer;
}

/* ---- Rules and code ----------------------------------------------------- */

hr {
  border: none;
  border-top: 1px solid var(--c-border-soft);
}

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

/* ---- Selection ---------------------------------------------------------- */

::selection {
  background-color: var(--c-accent);
  color: #fff;
}

/* ---- Focus -------------------------------------------------------------
   Visible on keyboard navigation only. Never remove without a replacement. */

:focus-visible {
  outline: var(--focus-width) solid var(--c-focus);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

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

/* ---- Skip link ---------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-skip);
  padding: var(--space-3) var(--space-5);
  background-color: var(--c-text);
  color: var(--c-text-inverse);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(calc(-100% - var(--space-5)));
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

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

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

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--section-gap);
}

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

/* ---- Motion ------------------------------------------------------------- */

@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;
    scroll-behavior: auto !important;
  }
}
