/* Reset and the primitives both pages share. */

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  /* The whole page is one fixed-pitch face. Every rule downstream inherits it;
     none of them restate it. */
  font-family: var(--font-mono);
  font-size: var(--step-0);
  /* Fixed pitch needs more air between lines than a serif does; the eye has
     no varying word-shape to lock onto, so the leading has to do that job. */
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

ul,
ol {
  padding: 0;
  list-style: none;
}

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

a {
  color: inherit;
}

canvas {
  display: block;
}

::selection {
  background: rgba(var(--ink-rgb), 0.22);
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  padding: 0.6rem 1rem;
  background: var(--ground);
  border: 1px solid var(--rule-strong);
  font-size: var(--step--1);
}

.skip-link:focus {
  left: 4.2rem;
  top: 0.8rem;
}

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

/* Paper grain. A single tiled noise texture, generated once in grain.js and
   set as a background-image; decorative, so its absence without JS is fine. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: screen;
}

.meta {
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
}

/* Links read as underlined ink; the underline thickens rather than the colour
   changing, which keeps the two-colour palette intact. */
.link {
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}

.link:hover,
.link:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    /* Zeroing only the duration would leave a delayed step change waiting out
       its delay long after everything around it had already arrived. */
    transition-delay: 0s !important;
  }
}
