/* ==========================================================================
   Base: reset, typography, accessibility
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  /* Anchor jumps land below the floating chrome instead of underneath it. */
  scroll-padding-block-start: 5.5rem;
  scroll-behavior: smooth;
}

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

body {
  min-height: 100dvh;
  background: var(--bg-live, var(--bg));
  color: var(--fg);
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: 1.62;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* The dark passages transition rather than snapping; an abrupt full-page
     brightness jump is unpleasant and, for some people, worse than that. */
  transition: color 480ms ease;
  overflow-x: clip;
}

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

img {
  height: auto;
}

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

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

a {
  color: inherit;
}

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

/* ---- type -------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-weight: 600;
  text-wrap: balance;
}

.display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
  font-weight: 600;
}

.h1 {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
  letter-spacing: var(--tr-h1);
}

.h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  letter-spacing: var(--tr-h2);
}

.h3 {
  font-size: var(--fs-h3);
  line-height: 1.28;
  letter-spacing: var(--tr-h3);
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.42;
  letter-spacing: -0.012em;
  color: var(--fg-muted);
  max-width: 26em;
  text-wrap: pretty;
}

p {
  max-width: var(--measure);
  text-wrap: pretty;
}

/* Small type gets positive tracking; it needs the air that display type
   needs taken away. */
.label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--fg-faint);
  font-weight: 500;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.small {
  font-size: var(--fs-small);
  letter-spacing: 0.006em;
}

/* His words, kept in his language. Never translated inline, never italicised
   into a foreign-word tic -- it's just how he writes. */
.id-voice {
  font-style: normal;
}

em,
.em {
  font-style: italic;
}

strong {
  font-weight: 650;
}

/* ---- layout scaffolding ------------------------------------------------- */

.wrap {
  width: min(var(--page), 100% - var(--gutter) * 2);
  margin-inline: auto;
}

.section {
  position: relative;
  padding-block: clamp(var(--s-8), 12vh, var(--s-10));
}

.stack > * + * {
  margin-block-start: var(--flow, var(--s-4));
}

/* ---- accessibility ------------------------------------------------------ */

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

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

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

.skip-link {
  position: absolute;
  inset-block-start: var(--s-3);
  inset-inline-start: var(--s-3);
  z-index: 200;
  padding: var(--s-3) var(--s-4);
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--r-sm);
  font-size: var(--fs-small);
  font-weight: 600;
  transform: translateY(-160%);
}

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

/* Reduced motion: travel, parallax and overshoot go. Function stays -- every
   interaction on this page is still fully operable below. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body {
    transition: none;
  }
}

/* Print: the page is already paper. */
@media print {
  .halftone-canvas,
  .site-nav,
  .reticle {
    display: none !important;
  }
}
