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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-size: var(--text-body);
  line-height: 1.6;
  overflow-x: hidden;
}

h1,
h2,
h3,
p,
ul,
ol,
figure,
blockquote {
  margin: 0;
  padding: 0;
}

h1,
h2,
h3 {
  font-size: inherit;
  font-weight: inherit;
}

ul,
ol {
  list-style: none;
}

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

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

img,
svg {
  display: block;
}

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

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

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-inverse);
  color: var(--fg-inverse);
  font-size: var(--text-small);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The first things on the page rise in one after another. */
@keyframes rise-in {
  from {
    opacity: 0;
    filter: blur(2px);
    translate: 0 8px;
  }
}

.rise-in {
  animation: rise-in 0.35s var(--ease-out) both;
  animation-delay: calc(var(--n, 0) * 90ms);
}

/* Later sections fade up as they scroll into view. Only when JS is on. */
.js [data-reveal] {
  opacity: 0;
  translate: 0 12px;
  transition:
    opacity 0.5s var(--ease-out),
    translate 0.5s var(--ease-out);
}

.js [data-reveal].is-visible {
  opacity: 1;
  translate: 0 0;
}

/* Colours ease across for a moment when the theme is switched by hand. */
/* The toggle's own icons are left out so their swap animation still plays. */
.theme-switching,
.theme-switching *:not(.theme-toggle__icon),
.theme-switching *::before,
.theme-switching *::after {
  transition:
    background-color 0.25s ease-out,
    color 0.25s ease-out,
    border-color 0.25s ease-out,
    outline-color 0.25s ease-out,
    box-shadow 0.25s ease-out !important;
}

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

  .theme-switching,
  .theme-switching *,
  .theme-switching *::before,
  .theme-switching *::after {
    transition: none !important;
  }

  .rise-in {
    animation: none;
  }

  .js [data-reveal] {
    opacity: 1;
    translate: 0 0;
    transition: none;
  }
}
