/*
  Bonnie and Claude: the only stylesheet.
  One bold idea, spent in one place: the margin notes, set in blue pencil, where the two of us
  annotate how this page was made. Everything else stays quiet, so links are ink, not blue.
*/

:root {
  --paper: #f2f3f1;
  --ink: #16181a;
  --ink-2: #4a4f54; /* 7.4:1 on paper, the lightest text colour used */
  --rule: #c9cdc8;
  --pencil: #1d3fbf; /* margin notes and keyboard focus, nothing else */

  /* System faces only: no download stands between the reader and the words. */
  --font-text: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Iowan Old Style', Charter, 'Bitstream Charter', Georgia, serif;

  --step--1: 0.9375rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.65rem;
  --step-3: clamp(1.9rem, 2vw + 1.2rem, 2.5rem);
  --step-4: clamp(3rem, 7.5vw + 0.5rem, 7.25rem);

  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: 6rem;

  --measure: 42rem;
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.6;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 var(--space-3);
}

h2 {
  font-size: var(--step-3);
  margin-bottom: var(--space-5);
}

h3 {
  font-size: var(--step-1);
  margin-bottom: var(--space-2);
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--ink);
  text-decoration-color: var(--ink-2);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.skip {
  position: absolute;
  left: var(--space-3);
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-2) var(--space-3);
}

.skip:focus {
  top: var(--space-3);
}

/* Layout: one text column; from 64rem a margin column opens on the right for the notes. */

main > section,
.foot {
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: var(--space-4);
}

main > section {
  display: grid;
  grid-template-columns: minmax(0, var(--measure));
  padding-block: var(--space-6);
  border-top: 1px solid var(--rule);
}

/* Each section keeps its own rhythm rather than one padding for all. */

.intro {
  border-top: 0;
  padding-block: var(--space-7) var(--space-6);
}

.intro h1 {
  font-size: var(--step-4);
  line-height: 0.98;
  letter-spacing: -0.015em;
  margin-bottom: var(--space-5);
}

.lede {
  font-size: var(--step-1);
  line-height: 1.45;
}

.for {
  color: var(--ink-2);
  margin-bottom: var(--space-5);
}

.contents ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The process is a real sequence, so it is the one place with numbers. */

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  column-gap: var(--space-3);
  padding-block: var(--space-4);
  border-top: 1px solid var(--rule);
}

.steps > li:first-child {
  border-top: 0;
  padding-top: 0;
}

.steps > li::before {
  content: counter(step);
  grid-row: span 2;
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1;
  color: var(--ink-2);
}

.steps p {
  margin: 0;
}

/* Field notes read as continuous prose: space between them, no rules. */

.note + .note {
  margin-top: var(--space-5);
}

.pair {
  display: grid;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.pair h3 {
  font-size: var(--step-2);
}

.pair p {
  margin: 0;
}

.split {
  color: var(--ink-2);
}

/* The margin notes: the makers' hand, in blue pencil. */

.margin {
  margin-top: var(--space-5);
  max-width: 30rem;
  color: var(--pencil);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-0);
  line-height: 1.45;
}

.margin p {
  margin: 0;
}

.margin b {
  font-style: normal;
}

@media (min-width: 40rem) {
  .pair {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 64rem) {
  main > section {
    grid-template-columns: minmax(0, var(--measure)) minmax(13rem, 18rem);
    column-gap: var(--space-6);
    justify-content: space-between;
  }

  main > section > * {
    grid-column: 1;
  }

  /*
    The note comes last in the source, so a screen reader or a phone reaches it after the
    section it is about; on a wide screen the grid lifts it beside the heading.
  */
  main > section > .margin {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
    margin-top: 0;
    padding-top: 0.6rem;
  }

  .intro h1 {
    grid-column: 1 / -1;
  }

  .intro > .margin {
    grid-row: 2 / span 3;
    padding-top: 0.35rem;
  }

  .lede {
    font-size: 1.5rem;
  }
}

.foot {
  padding-block: var(--space-5) var(--space-6);
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: var(--step--1);
}

.foot p {
  margin: 0;
}
