/* =========================================================================
   Promise Oluwatosin Grace · the notebook

   Every colour, face and rhythm value used here is declared in tokens.css,
   which this file expects to have been loaded first. Nothing below invents
   a colour.

   The notebook is carried structurally, not as decoration. Three rules do
   most of that work:

   1. --baseline is one ruled line. It drives the vertical rhythm AND draws
      the ruling, so text physically sits on the lines by construction rather
      than by eye.
   2. The pen colours stay functional. --correction only ever marks a thing
      students get wrong, --aside only ever marks a margin afterthought.
      Search this file for either token and you will find only those uses.
   3. Emphasis inside body copy is a coloured underline, never bold, because
      she never bolds. She underlines in a second pen.

   WHAT CHANGED IN THE REDESIGN, AND WHAT DID NOT

   The paper, the ruling, the margin channel and the two functional pens are
   exactly as they were. What went is --sage, which was described in this
   file as "every interface element" and which is the honest admission that
   it never meant anything: it was simply the colour interface elements
   happened to be. Every one of those fifty uses is now --brand, the royal
   blue the whole site shares, so a link in the notebook and a link in the
   laboratory are the same link.
   ========================================================================= */

:root {
  /* Kept as an alias so the two files that read it by name still work.
     Nothing in this stylesheet uses it. */
  --sage: var(--brand);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-variant-numeric: oldstyle-nums;
}

img { display: block; }

/* The box model, the focus ring, the selection colour and the skip link all
   live in tokens.css now, because five pages needed the same four rules and
   four of them were carrying their own copy. */


/* -------------------------------------------------------------------------
   THE PAGE ITSELF
   The ruling is generated from --baseline, so the text sits on the lines
   instead of near them. The vertical margin line is the second gradient.
   ------------------------------------------------------------------------- */

.sheet {
  --margin-x: clamp(1.25rem, 7vw, 6rem);
  position: relative;
  max-width: 78rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 5vw, 3rem);
}

.entry-main,
.cover {
  position: relative;
  padding-left: var(--margin-x);
  background-image:
    /* the ruling */
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--baseline) - 1px),
      var(--rule) calc(var(--baseline) - 1px),
      var(--rule) var(--baseline)
    ),
    /* the vertical margin line */
    linear-gradient(to right, transparent 0, transparent calc(var(--margin-x) - 0.75rem),
      var(--rule) calc(var(--margin-x) - 0.75rem),
      var(--rule) calc(var(--margin-x) - 0.75rem + 1px),
      transparent calc(var(--margin-x) - 0.75rem + 1px));
  background-size: 100% var(--baseline), 100% 100%;
  background-repeat: repeat, no-repeat;
  background-position: 0 0.35rem, 0 0;
}

/* The ruling is a texture behind reading, never a competitor. */
.entry-main, .cover { --rule-alpha: 0.55; }
.entry-main::before, .cover::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--paper);
  opacity: 0.38;
  pointer-events: none;
}
.entry-main > *, .cover > * { position: relative; z-index: 1; }


/* -------------------------------------------------------------------------
   TYPE
   ------------------------------------------------------------------------- */

.display {
  font-family: var(--f-display);
  font-variation-settings: "SOFT" 40, "WONK" 1;
  font-weight: 600;
  font-size: clamp(2.4rem, 6.5vw, 4.6rem);
  line-height: 1.0;
  letter-spacing: -0.02em;
  margin: 0 0 var(--baseline);
  max-width: 20ch;
  text-wrap: balance;
}

h2 {
  font-family: var(--f-display);
  font-variation-settings: "SOFT" 40, "WONK" 1;
  font-weight: 500;
  font-size: clamp(1.5rem, 3.2vw, 2.2rem);
  line-height: 1.15;
  margin: 0 0 calc(var(--baseline) * 0.75);
  text-wrap: balance;
}

h3 {
  font-family: var(--f-display);
  font-variation-settings: "SOFT" 40, "WONK" 1;
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.35;
  margin: calc(var(--baseline) * 1.25) 0 calc(var(--baseline) * 0.4);
}

p { margin: 0 0 var(--baseline); max-width: var(--measure); }

.mono {
  font-family: var(--f-mono);
  font-size: 0.8125rem;
  line-height: 1.45;
  letter-spacing: 0.03em;
}

.hand {
  font-family: var(--f-hand);
  font-size: 1.1rem;
  line-height: 1.5;
}

.lede { font-size: 1.1875rem; }

.quiet { color: var(--ink-soft); }

a { color: var(--brand); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

.ulink {
  font-family: var(--f-display);
  font-size: 1.0625rem;
  text-decoration: underline;
  text-decoration-color: var(--brand);
  text-decoration-thickness: 1.5px;
}

/* Load-bearing term. She underlines these in her red pen, so we do too.
   This is the only emphasis inside body copy. Bold is deliberately unused. */
u.term {
  text-decoration: none;
  border-bottom: 2px solid var(--correction);
  padding-bottom: 1px;
}

em { font-style: italic; }


/* -------------------------------------------------------------------------
   THE THREE PENS
   ------------------------------------------------------------------------- */

/* A misconception, or the thing students get wrong. Nothing else. */
.correction {
  color: var(--correction);
  padding-left: 0.9rem;
  border-left: 2px solid var(--correction);
}

/* An afterthought squeezed into the margin, the way she does when she runs
   out of room. Smaller, tighter, and never quite straight. */
.aside-note {
  color: var(--aside);
  font-family: var(--f-hand);
  font-size: 1rem;
  line-height: 1.35;
}

.margin-note {
  color: var(--aside);
  margin: 0 0 calc(var(--baseline) * 0.5);
  transform: rotate(-1deg);
  transform-origin: left center;
}


/* -------------------------------------------------------------------------
   TOP BAR
   ------------------------------------------------------------------------- */

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem clamp(1rem, 5vw, 3rem);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar[hidden] { display: none; }

.topbar-name {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
}

.topbar-nav {
  display: flex; align-items: center; gap: 1.1rem;
  font-family: var(--f-mono); font-size: 0.75rem;
  letter-spacing: 0.04em;
}
.topbar-nav a { text-decoration: none; border-bottom: 1px solid transparent; }
.topbar-nav a:hover { border-bottom-color: var(--brand); }

.hurry-open {
  font: inherit; color: var(--paper); background: var(--brand);
  border: 0; padding: 0.4em 0.9em; border-radius: 2px 6px 3px 7px;
  cursor: pointer; letter-spacing: 0.04em;
}
.hurry-open:hover { background: var(--ink); }


/* -------------------------------------------------------------------------
   COVER
   ------------------------------------------------------------------------- */

.cover {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: calc(var(--baseline) * 3);
  padding-bottom: calc(var(--baseline) * 3);
}

.eyebrow { color: var(--ink-soft); margin: 0 0 var(--baseline); }

.cover-note { font-size: 1.25rem; }

.cover-links {
  display: flex; flex-wrap: wrap; gap: 1.75rem;
  margin-top: calc(var(--baseline) * 0.5);
}

.cover-foot {
  margin: calc(var(--baseline) * 2) 0 0;
  display: flex; flex-direction: column; gap: 0.35rem;
  max-width: none;
}
.cover-foot .quiet { font-size: 0.9375rem; }


/* -------------------------------------------------------------------------
   ENTRIES
   Two channels. Reading on the left, her questions and asides on the right,
   which is exactly how the water hardness page is laid out.
   ------------------------------------------------------------------------- */

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 20rem);
  gap: var(--gap);
  align-items: start;
  padding: calc(var(--baseline) * 2.5) 0;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 4.5rem;
}
.entry:not(:has(.channel)) { grid-template-columns: minmax(0, 1fr); }

.entry-main { padding-top: calc(var(--baseline) * 0.5); padding-bottom: var(--baseline); }

.entry-no { color: var(--ink-soft); margin: 0 0 0.35rem; }

/* Entry 05 deliberately gets no special treatment. It carries its own weight
   through the scan and the writing, and a background wash would be the site
   telling you it matters instead of showing you. */

.entry-dated .updated { color: var(--ink-soft); margin: 0; }


/* The right hand channel. On a narrow screen it stops being a margin, so it
   is given a title instead. A question with no position and no label reads
   as a fragment. */
.channel {
  padding: calc(var(--baseline) * 0.75) 1.25rem calc(var(--baseline) * 0.5);
  background: var(--paper-deep);
  border-left: 2px solid var(--aside);
  border-radius: 3px 9px 4px 8px;
  position: relative;
  top: calc(var(--baseline) * 3);
}
.channel-title { color: var(--aside); margin: 0 0 0.5rem; }
.channel ol { margin: 0; padding-left: 1.2rem; }
.channel li {
  margin-bottom: calc(var(--baseline) * 0.5);
  font-size: 0.9375rem; line-height: 1.55;
}
.channel-foot {
  font-family: var(--f-hand); color: var(--aside);
  font-size: 1rem; margin: var(--baseline) 0 0;
}


/* -------------------------------------------------------------------------
   CARDS, the definition then misconception shape
   Two slots. The correction slot is required, which is what keeps this
   section as evidence that she teaches by heading off error.
   ------------------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: var(--baseline) var(--gap);
  margin-top: var(--baseline);
}

.card {
  background: var(--paper-deep);
  padding: calc(var(--baseline) * 0.75) 1.25rem;
  /* Slightly irregular, as if taped in. */
  border-radius: 4px 10px 5px 9px;
  border: 1px solid var(--rule);
}
.card h3 { margin-top: 0; }
.card p { max-width: none; }
.card p:last-child { margin-bottom: 0; }
.claim { color: var(--ink); }


/* -------------------------------------------------------------------------
   PROJECTS
   ------------------------------------------------------------------------- */

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: var(--baseline) var(--gap);
  margin: var(--baseline) 0;
}
.project { border-top: 2px solid var(--brand); padding-top: 0.6rem; }
.project h3 { margin-top: 0; }
.project p { max-width: none; font-size: 1rem; }

.criteria {
  color: var(--brand);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 0.7rem 0;
  margin: var(--baseline) 0;
  max-width: none;
}

.skills { color: var(--ink-soft); max-width: none; }


/* -------------------------------------------------------------------------
   FIGURES AND INTERACTIVES
   ------------------------------------------------------------------------- */

.fig { margin: calc(var(--baseline) * 1.5) 0; }
.fig figcaption { color: var(--ink-soft); margin-top: 0.6rem; }

.two-panel {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.panel {
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 3px 9px 4px 8px;
  padding: 0.7rem;
}
.panel-tag { margin: 0 0 0.5rem; }
/* The constrained case, marked the way she marks a thing that goes wrong. */
.tag-correction { color: var(--correction); }
.tag-brand { color: var(--brand); }

.stage { width: 100%; height: auto; display: block; border-radius: 2px; }

.controls {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  margin-top: 0.9rem;
}
.controls button {
  font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.04em;
  color: var(--brand); background: transparent;
  border: 1px solid var(--brand); border-radius: 2px 7px 3px 6px;
  padding: 0.45em 0.9em; cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.controls button:hover,
.controls button[aria-pressed="true"],
.controls button.on { background: var(--brand); color: var(--paper); }

/* Shown only when JavaScript has not taken over. */
.nojs-note { color: var(--ink-soft); font-size: 1rem; }
.js .nojs-note { display: none; }


/* Phase diagram */
.phase-wrap {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}
.phase-canvas {
  width: 100%; height: auto; display: block;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 3px 9px 4px 8px;
  cursor: grab; touch-action: none;
}
.phase-canvas:active { cursor: grabbing; }
.phase-hint { color: var(--ink-soft); margin: 0.5rem 0 0; }

.readout-line {
  display: flex; justify-content: space-between; gap: 1rem;
  border-bottom: 1px solid var(--rule);
  padding: 0.35rem 0; margin: 0; max-width: none;
}
.readout-line span { color: var(--ink-soft); }
.readout-line b { font-weight: 400; color: var(--ink); text-align: right; }

.beaker { margin: var(--baseline) 0; }
.beaker-canvas {
  width: 100%; max-width: 15rem; height: auto; display: block; margin: 0 auto;
}

.lever-title { color: var(--ink-soft); margin: 0 0 0.4rem; }
.lever-bars { display: flex; flex-direction: column; gap: 0.4rem; }
.lever-bar { display: grid; grid-template-columns: 5.5rem 1fr 3rem; gap: 0.5rem; align-items: center; }
.lever-bar span:first-child,
.lever-bar span:last-child {
  font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-soft);
}
.lever-bar span:last-child { text-align: right; color: var(--ink); }
.lever-track { height: 0.55rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 2px; overflow: hidden; }
.lever-fill { height: 100%; background: var(--brand); }
.lever-none { color: var(--ink-soft); margin: 0; }

.crossing {
  color: var(--aside); font-family: var(--f-hand); font-size: 1.05rem;
  min-height: calc(var(--baseline) * 1.5);
  margin: var(--baseline) 0 0; max-width: none;
}


/* Titration */
.titration { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--gap); align-items: start; }
.titration-canvas {
  width: 100%; max-width: 18rem; height: auto; display: block;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 3px 9px 4px 8px;
}
.titration-msg {
  font-family: var(--f-hand); font-size: 1.05rem; color: var(--aside);
  margin: var(--baseline) 0 0; min-height: calc(var(--baseline) * 2);
}
.titration-msg.over { color: var(--correction); }


/* Study walkthrough */
.walk { list-style: none; counter-reset: step; margin: var(--baseline) 0; padding: 0; }
.walk > li {
  counter-increment: step;
  border-left: 2px solid var(--rule);
  padding: 0 0 var(--baseline) 1.5rem;
  position: relative;
}
.walk > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: -1.4rem; top: calc(var(--baseline) * 1.25);
  font-family: var(--f-mono); font-size: 0.75rem;
  color: var(--paper); background: var(--brand);
  width: 2.6rem; text-align: center; border-radius: 2px;
}
.walk > li:last-child { border-left-color: var(--brand); }
.walk h3 { margin-top: calc(var(--baseline) * 0.5); }

.choices { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: var(--baseline); }
.choices button {
  font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.04em;
  color: var(--brand); background: transparent;
  border: 1px solid var(--brand); border-radius: 2px 7px 3px 6px;
  padding: 0.5em 1em; cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.choices button:hover, .choices button[aria-pressed="true"] { background: var(--brand); color: var(--paper); }
.choice-reply:not(:empty) {
  background: var(--paper-deep);
  border-radius: 4px 10px 5px 9px;
  padding: calc(var(--baseline) * 0.6) 1.1rem;
  margin-bottom: var(--baseline);
}
.choice-reply p:last-child { margin-bottom: 0; }

.citation {
  border-top: 1px solid var(--rule);
  padding-top: var(--baseline);
  color: var(--ink-soft);
  font-size: 1rem;
}
.citation cite { font-style: italic; }


/* A verifiable record. The link carries the name, because the link is the
   whole point: every one of these opens the certificate itself. */
.record { list-style: none; margin: var(--baseline) 0; padding: 0; max-width: 42rem; }
.record li {
  padding-left: 0.9rem;
  border-left: 2px solid var(--rule);
  margin-bottom: calc(var(--baseline) * 0.55);
}
.record-name {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.0625rem;
}
.record-meta {
  display: block;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-top: 0.2rem;
}


/* -------------------------------------------------------------------------
   SCANS
   ------------------------------------------------------------------------- */

/* -------------------------------------------------------------------------
   TRANSCRIPTIONS

   The handwriting is the evidence. The transcription is what makes it usable,
   and it is the same text a screen reader gets, so both audiences read the
   same page. Built on <details> so it opens with no JavaScript, is keyboard
   operable without being taught how, and sits in the DOM where the browser's
   own find can reach it.

   Her three pens carry straight over. The main thread is --ink, a correction
   is --correction, and anything squeezed in afterwards is --aside.
   ------------------------------------------------------------------------- */

.transcript { margin: calc(var(--baseline) * 0.4) 0 var(--baseline); }

.transcript > summary {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--brand);
  cursor: pointer;
  padding: 0.35rem 0;
}
.transcript > summary:hover { text-decoration: underline; }

.transcript-body {
  border-left: 2px solid var(--rule);
  padding-left: 1rem;
  margin-top: calc(var(--baseline) * 0.4);
  max-width: 46rem;
}
.transcript-body p { margin: 0 0 calc(var(--baseline) * 0.45); }
.transcript-body p:last-child { margin-bottom: 0; }

.t-part {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  font-weight: 400;
  color: var(--ink-soft);
  margin: var(--baseline) 0 calc(var(--baseline) * 0.4);
}
.transcript-body > .t-part:first-child { margin-top: 0; }

.t-key { color: var(--ink-soft); font-size: 0.9375rem; }

/* Already bordered by .transcript-body, so the correction carries on colour
   alone in here rather than stacking a second rule inside the first. */
.transcript-body .correction { padding-left: 0; border-left: 0; }

/* Squeezed in above a line or out in the margin, after the fact. */
.t-ins { color: var(--aside); font-family: var(--f-hand); font-size: 1.05rem; }

/* Struck out on the page. Kept, because what she rejected is also evidence. */
.t-del { text-decoration: line-through; color: var(--ink-soft); }

/* Unreadable, or running off the edge of the photograph. Never guessed. */
.t-gap { color: var(--ink-soft); font-style: italic; }


/* Three links downloaded the CV and none of them showed it. This one does. */
.cv-preview { margin: var(--baseline) 0; max-width: 19rem; }
.cv-preview img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  background: var(--paper);
}
.cv-preview figcaption { margin-top: 0.45rem; color: var(--ink-soft); }


.scan-figure { margin: var(--baseline) 0; max-width: 32rem; }
.scan-figure.sm { max-width: none; margin: 0; }
.scan-figure figcaption { color: var(--ink-soft); margin-top: 0.5rem; }

.scan-btn {
  display: block; padding: 0; border: 1px solid var(--rule);
  background: var(--paper-deep); cursor: zoom-in; width: 100%;
  border-radius: 3px 9px 4px 8px; overflow: hidden;
  position: relative;
}
.scan-btn img { width: 100%; }
.scan-zoom {
  position: absolute; right: 0.5rem; bottom: 0.5rem;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  color: var(--paper); padding: 0.3em 0.7em; border-radius: 2px;
  opacity: 0; transition: opacity 160ms var(--ease);
}
.scan-btn:hover .scan-zoom, .scan-btn:focus-visible .scan-zoom { opacity: 1; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: var(--gap);
  margin: var(--baseline) 0;
}


/* -------------------------------------------------------------------------
   FORM AND CONTACT
   ------------------------------------------------------------------------- */

.signup { margin: var(--baseline) 0; max-width: var(--measure); }
.signup label { color: var(--ink-soft); display: block; margin-bottom: 0.4rem; }
.signup-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.signup input {
  flex: 1 1 14rem;
  font-family: var(--f-body); font-size: 1rem;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 2px 7px 3px 6px;
  padding: 0.6em 0.8em;
}
.signup input:focus-visible { border-color: var(--brand); }
.signup button {
  font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.04em;
  color: var(--paper); background: var(--brand);
  border: 1px solid var(--brand); border-radius: 2px 7px 3px 6px;
  padding: 0.6em 1.2em; cursor: pointer;
}
.signup button:hover { background: var(--ink); border-color: var(--ink); }
.signup-msg {
  font-family: var(--f-hand); font-size: 1.05rem; color: var(--aside);
  margin: 0.7rem 0 0; min-height: 1.5rem;
}
.signup-msg.bad { color: var(--ink); font-weight: 600; }

/* Honeypot. Moved off screen rather than set to display none, because a
   bot that skips undisplayed fields would skip the trap as well. */
.honey {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.email-wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.9rem; max-width: none; }
.email {
  font-family: var(--f-display);
  font-variation-settings: "SOFT" 40, "WONK" 1;
  font-weight: 500;
  font-size: clamp(1.25rem, 4vw, 2rem);
  color: var(--ink); background: transparent;
  border: 0; border-bottom: 2px solid var(--brand);
  padding: 0 0 0.1em; cursor: copy;
  word-break: break-all; text-align: left;
}
.email:hover { color: var(--brand); }
.copy-msg { font-family: var(--f-hand); font-size: 1.05rem; color: var(--aside); }

.outlinks { max-width: none; }
.outlinks a { color: var(--brand); }

.cv-note {
  font-family: var(--f-hand); font-size: 1.1rem; color: var(--aside);
  border-left: 2px solid var(--aside); padding-left: 0.9rem;
  max-width: var(--measure);
}


/* -------------------------------------------------------------------------
   CLOSING
   ------------------------------------------------------------------------- */

.closing {
  border-top: 1px solid var(--rule);
  padding: calc(var(--baseline) * 3) 0 calc(var(--baseline) * 4);
  padding-left: clamp(1.25rem, 7vw, 6rem);
}
.closing-line {
  font-family: var(--f-display);
  font-variation-settings: "SOFT" 40, "WONK" 1;
  font-weight: 500;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  line-height: 1.3;
  max-width: 32ch;
  text-wrap: balance;
}
.colophon { color: var(--ink-soft); margin: 0; }


/* -------------------------------------------------------------------------
   OVERLAYS
   ------------------------------------------------------------------------- */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--ink) 55%, transparent);
  overflow-y: auto;
}
.overlay[hidden] { display: none; }

.overlay-panel {
  position: relative;
  background: var(--paper);
  border-radius: 4px 12px 6px 10px;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  max-width: 42rem; width: 100%;
  max-height: 100%; overflow-y: auto;
}

.overlay-close {
  position: absolute; top: 0.5rem; right: 0.75rem;
  font-size: 1.75rem; line-height: 1;
  color: var(--ink-soft); background: transparent; border: 0;
  cursor: pointer; padding: 0.25rem 0.5rem;
}
.overlay-close:hover { color: var(--brand); }

.short { margin: var(--baseline) 0 0; }
.short dt { color: var(--ink-soft); margin-top: var(--baseline); }
.short dt:first-child { margin-top: 0; }
.short dd { margin: 0.3rem 0 0; }
.short-foot {
  color: var(--ink-soft); font-size: 0.9375rem;
  border-top: 1px solid var(--rule); padding-top: 0.8rem;
  margin: var(--baseline) 0 0;
}

.lightbox .overlay-close {
  position: fixed; top: 1rem; right: 1.25rem;
  color: var(--paper); font-size: 2.25rem; z-index: 2;
}
.lightbox-fig { margin: 0; max-width: 60rem; }
.lightbox-fig img {
  width: 100%; border-radius: 3px;
  background: var(--paper);
}
.lightbox-fig figcaption { color: var(--paper); margin-top: 0.75rem; }


/* -------------------------------------------------------------------------
   MOTION
   Margin notes arrive after their paragraph, and corrections arrive last,
   because that is the order she wrote them in.
   ------------------------------------------------------------------------- */

.js .reveal { opacity: 0; transform: translateY(6px); }
.js .reveal.in {
  opacity: 1; transform: none;
  transition: opacity 320ms var(--ease), transform 320ms var(--ease);
}
.js .margin-note.reveal.in { transition-delay: 200ms; }
.js .correction.reveal.in { transition-delay: 380ms; }

/* Page turn on entry change. */
.js .entry { transform-origin: left center; }
.js .entry.turning {
  animation: turn 400ms var(--ease);
}
@keyframes turn {
  0%   { opacity: 0.35; transform: perspective(1400px) rotateY(-3.5deg); }
  100% { opacity: 1;    transform: none; }
}


/* -------------------------------------------------------------------------
   RESPONSIVE
   The right channel loses its position, so it gains a name. See .channel.
   ------------------------------------------------------------------------- */

@media (max-width: 60rem) {
  .entry { grid-template-columns: minmax(0, 1fr); gap: var(--baseline); }
  .channel { top: 0; margin-left: var(--margin-x); }
  .phase-wrap { grid-template-columns: minmax(0, 1fr); }
  .titration { grid-template-columns: minmax(0, 1fr); }
  .titration-canvas { margin: 0 auto; }
}

@media (max-width: 34rem) {
  :root { --measure: 100%; }
  .sheet { --margin-x: 1.6rem; padding: 0 0.9rem; }
  .two-panel { grid-template-columns: minmax(0, 1fr); }
  .cover { min-height: auto; padding-top: calc(var(--baseline) * 4); }
  .display { font-size: clamp(1.85rem, 9vw, 2.6rem); }
  .topbar-nav a { display: none; }
  .channel { margin-left: 0; }
  .entry-main, .cover { padding-left: var(--margin-x); }
  .walk > li { padding-left: 1rem; }
  .walk > li::before { left: -1rem; width: 2rem; font-size: 0.6875rem; }
  .closing { padding-left: 1.6rem; }
}


/* -------------------------------------------------------------------------
   REDUCED MOTION
   Interactives hold their final state and say what they would have shown.
   ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

.rm-note {
  font-family: var(--f-hand); font-size: 1.05rem; color: var(--aside);
  margin: 0.7rem 0 0;
}


@media print {
  .topbar, .controls, .overlay, .scan-zoom { display: none !important; }
  body { background: #fff; }
  .entry-main, .cover { background-image: none; }
}


/* =========================================================================
   THE LABS

   Every interactive on this site is one of these. The engine in sim.js drives
   them, one at a time, and drops their backing resolution before it drops
   their frame rate. Nothing here changes the CSS size of a canvas, so a
   device stepping down a quality tier never moves the layout.
   ========================================================================= */

/* A figure should be wider than the column of prose it sits in, because it
   is a figure. It should not be nearly twice as wide, which is what it was:
   the prose is capped at 66ch and the lab was taking the whole sheet, so at
   1280 the readout rows ran for eleven hundred pixels with the label at one
   end and the value at the other. */
.lab { margin: var(--baseline) 0; max-width: 52rem; }

.lab-views {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: calc(var(--baseline) * 0.6);
}
.lab-view { min-width: 0; }
.lab-view canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 4;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 3px 7px 4px 6px;   /* taped in, never quite square */
  touch-action: none;               /* dragging a field is not scrolling */
}
.view-tag {
  color: var(--ink-soft);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  margin: 0 0 0.3rem;
}

/* ---- controls ---------------------------------------------------------- */

.lab-controls {
  margin-top: var(--baseline);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
}
.lab-controls label { color: var(--ink-soft); letter-spacing: 0.06em; }
.lab-controls label b { color: var(--ink); font-style: normal; }
.lab-controls > .mono.quiet { flex-basis: 100%; margin: 0; font-size: 0.6875rem; }

.slider-row { display: inline-flex; align-items: center; gap: 0.4rem; }
.slider-row input[type="range"] {
  width: min(15rem, 52vw);
  accent-color: var(--brand);
  height: 2.75rem;                  /* 44px, a thumb sized target */
}

/* A slider alone cannot be set exactly, and on a phone it cannot be set
   precisely at all, so every one of them gets these. */
.stepper { display: inline-flex; gap: 0.25rem; }
.stepper button {
  min-width: 2.75rem;    /* 44px, the size a thumb actually needs */
  min-height: 2.75rem;
  font-family: var(--f-mono);
  font-size: 1rem;
  line-height: 1;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
}
.stepper button:hover { border-color: var(--brand); }

.lab-readout { margin-top: var(--baseline); }
.verdict {
  color: var(--correction);
  border-left: 2px solid var(--correction);
  padding-left: 0.9rem;
  margin: calc(var(--baseline) * 0.6) 0 0;
  max-width: 46ch;
}
.verdict.is-diffusive { color: var(--brand); border-left-color: var(--brand); }

/* ---- depth ------------------------------------------------------------- */

.lab-chrome {
  margin-top: calc(var(--baseline) * 0.75);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}
/* The three depths. On paper this stays a segmented control rather than the
   panel the instrument frame gives it, because on the notebook it sits
   inside a figure caption and a panel there would be a box inside a box.
   What it gains is the label saying what it is asking and the line saying
   what the current setting means, both of which it never had. */
.depth { display: block; margin-bottom: 0.4rem; }
.depth-q {
  margin: 0 0 0.35rem;
  font-family: var(--f-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.depth-set {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
}
.depth-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.07em;
  padding: 0.5rem 0.8rem;
  min-height: 2.75rem;   /* 44px */
  background: none;
  border: 0;
  border-right: 1px solid var(--rule);
  color: var(--ink-soft);
  cursor: pointer;
}
.depth-mark {
  width: 8px; height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.depth-btn:last-child { border-right: 0; }
.depth-btn[aria-pressed="true"] { background: var(--brand); color: var(--paper); }
.depth-btn[aria-pressed="true"] .depth-mark { background: currentColor; }
.depth-say {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* Picture hides the quantities. Maths adds the ones only it needs. */
html[data-depth="picture"] .depth-not-picture { display: none; }
html:not([data-depth="maths"]) .depth-only-maths { display: none; }

/* ---- show the code ----------------------------------------------------- */

.showcode > summary {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.07em;
  color: var(--brand);
  cursor: pointer;
  padding: 0.5rem 0;
}
.assumptions-title { color: var(--ink-soft); font-size: 0.6875rem; margin: 0.5rem 0 0.3rem; }
.assumptions { margin: 0 0 var(--baseline); padding-left: 1.1rem; color: var(--ink-soft); font-size: 0.9375rem; }
.assumptions li { margin-bottom: 0.3rem; }
.code {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  line-height: 1.55;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.8rem 0.9rem;
  overflow-x: auto;                 /* long lines scroll here, not the page */
  max-width: 100%;
}

/* Said in her handwriting when a device gives up on animating something. */
.sim-note { color: var(--aside); font-family: var(--f-hand); margin-top: 0.6rem; }

@media (prefers-reduced-motion: reduce) {
  .lab-view canvas { transition: none; }
}


/* Anything in a lab that a thumb has to hit clears 44px. The older labs
   rebuilt in later steps still carry 21 to 28px buttons and are noted. */
.lab-controls button,
.lab [data-act] {
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
}
.lab-controls button:hover, .lab [data-act]:hover { border-color: var(--brand); }

/* The diffraction row carries a label, a slider and a stepper, which does not
   fit on one line at 320. Let the row wrap and let the slider give way first,
   so the stepper stays reachable rather than being pushed off the edge. */
.slider-row { flex-wrap: wrap; max-width: 100%; }
.slider-row input[type="range"] { flex: 1 1 8rem; min-width: 0; }
@media (max-width: 26rem) {
  .slider-row input[type="range"] { width: 100%; flex-basis: 100%; }
  .lab-controls { gap: 0.5rem 0.6rem; }
}


/* =====================================================================
   SOUND
   The control is always visible and always says which state it is in,
   in words, because a speaker glyph alone tells a screen reader nothing
   and tells a stranger very little.
   ===================================================================== */
.sound-toggle {
  position: fixed; right: 0.85rem; bottom: 0.85rem; z-index: 40;
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0.5rem 0.9rem;
  font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.05em;
  background: var(--paper); color: var(--brand);
  border: 1px solid var(--rule); border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(51,46,92,0.10);
}
.sound-toggle:hover { border-color: var(--brand); }
/* The state is carried by the word and by the mark being filled or not,
   never by colour alone. */
.sound-mark {
  width: 0.7rem; height: 0.7rem; border: 1px solid currentColor; border-radius: 50%;
}
.sound-toggle[aria-pressed="true"] .sound-mark { background: currentColor; }

/* In the flow, not over it. A fixed panel here landed on top of a
   paragraph somebody was reading, which is the one thing the brief says an
   invitation must never do. */
.sound-invite {
  max-width: 34rem;
  margin: 0 auto calc(var(--baseline) * 2);
  padding: 0.75rem 0.95rem;
  background: var(--paper-deep);
  border-left: 3px solid var(--aside);
}
.sound-invite p { font-size: 0.9rem; line-height: 1.45; margin: 0 0 0.55rem; }
.sound-invite-do { display: flex; gap: 0.6rem; margin: 0; flex-wrap: wrap; }
.sound-invite .btn-quiet {
  min-height: 2.75rem; padding: 0.5rem 0.9rem;
  font-family: var(--f-mono); font-size: 0.72rem;
  background: none; border: 1px solid var(--rule); border-radius: 4px;
  color: var(--brand); cursor: pointer;
}
.sound-invite .btn-quiet:hover { border-color: var(--brand); }


/* the per simulation listening controls */
.listen-btn {
  min-height: 2.75rem; padding: 0.5rem 0.9rem;
  font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.05em;
  background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 4px;
  color: var(--ink); cursor: pointer;
}
.listen-btn:hover { border-color: var(--brand); }
.listen-btn[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); }
.listen-what {
  flex-basis: 100%; margin: 0.5rem 0 0;
  font-size: 0.9rem; line-height: 1.55; color: var(--ink-soft);
  max-width: 62ch;
}

@media print {
  .sound-toggle, .sound-invite, .listen-btn { display: none; }
}


/* =====================================================================
   TOUCH TARGETS, the sweep

   Measured at 320 rather than guessed. Everything a thumb is meant to
   press clears 44px in its short direction.

   Links sitting inside a sentence are deliberately left alone. You cannot
   make a word in a paragraph 44px tall without wrecking the paragraph, and
   the target size rule exempts them for exactly that reason. Every control
   below is a block that had no such excuse.
   ===================================================================== */
.skip { padding: 0.9em 1em; }

.cover-links .ulink,
.closing-links .ulink,
.cover-foot a.mono,
.outlinks a {
  display: inline-flex; align-items: center;
  min-height: 2.75rem;
}

.showcode > summary,
.transcript > summary,
details.assumptions > summary {
  min-height: 2.75rem;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.controls button,
.choices button,
.signup-row button,
.signup-row .btn,
.hurry-open {
  min-height: 2.75rem;
}


/* =====================================================================
   THE INSTRUMENT HOUSING

   The paper palette stays calm everywhere and that is not negotiable.
   The one place luminous colour belongs is inside a dark panel, and on
   this site there is exactly one simulation whose subject IS colour. A
   soap film's reflected colour sitting on cream paper is a colour being
   argued with by its own background.

   So the thin film lab goes dark, the way the spectroscopy bench on the
   mission planner does, and for the same stated reason: you cannot show
   a wavelength on white paper.
   ===================================================================== */
/* The one panel on the site that is dark in both themes. Its subject is
   colour, and a spectrum argued with by a cream background is not the
   spectrum. It declares the six the drawing code reads rather than that
   file hard coding light values for its own housing. See palette.js. */
.lab.is-instrument {
  --panel: #1B1A24;
  --panel-soft: #B9B4C4;

  --lab-paper:  27,  26,  36;
  --lab-ink:   241, 239, 245;
  --lab-sage:  169, 149, 232;
  --lab-corr:  217, 139, 203;
  --lab-rule:   74,  71,  87;
  --lab-soft:  185, 180, 196;

  background: var(--panel);
  border: 1px solid #2E2C3A;
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  color: var(--panel-soft);
}
.lab.is-instrument .view-tag,
.lab.is-instrument .mono,
.lab.is-instrument .readout-line span { color: var(--panel-soft); }
.lab.is-instrument .readout-line b { color: #F1EFF5; }
.lab.is-instrument .readout-line { border-bottom-color: #33303F; }
.lab.is-instrument .lab-controls button {
  background: none; border-color: #4A4757; color: #E4E1EC;
}
.lab.is-instrument .lab-controls button:hover,
.lab.is-instrument .lab-controls button[aria-pressed="true"] {
  border-color: var(--butter); color: var(--butter);
}
.lab.is-instrument .stepper button {
  background: none; border-color: #4A4757; color: #E4E1EC;
}
.lab.is-instrument .verdict {
  color: #E4E1EC; border-left-color: var(--butter);
}
.lab.is-instrument .verdict.is-diffusive { color: var(--butter); border-left-color: var(--butter); }
.lab.is-instrument :focus-visible { outline-color: var(--butter); }

/* The canvas is transparent, so without this the paper shows through and
   a near black trace disappears into a cream rectangle. */
.lab.is-instrument .lab-view canvas {
  background: #100F16;
  border-color: #33303F;
}
.lab.is-instrument label,
.lab.is-instrument label b { color: #E4E1EC; }

/* Printed, a dark panel is a solid block of toner. It inverts. */
@media print {
  .lab.is-instrument {
    background: #fff; color: #000; border-color: #999;
  }
  .lab.is-instrument .readout-line b,
  .lab.is-instrument .readout-line span,
  .lab.is-instrument .mono,
  .lab.is-instrument .view-tag { color: #000; }
}


/* =====================================================================
   THE OPEN QUESTION LEDGER

   A prediction on the left, and a column on the right that is empty and
   is meant to look empty. Publishing your own disconfirmed prediction is
   one of the most credible things a young researcher can do, and it only
   works if the slot was built before the answer arrived.
   ===================================================================== */
.ledger {
  display: grid; gap: 1rem;
  margin: 0 0 var(--baseline);
  max-width: var(--measure);
}
@media (min-width: 46rem) { .ledger { grid-template-columns: 1fr 1fr; } }

.ledger-col { padding: 0.9rem 1rem; border-radius: 3px 8px 4px 7px; }
.ledger-said { background: var(--paper-deep); border-left: 2px solid var(--ink); }
/* Dashed, because a dashed edge reads as unfinished on its own, without
   needing a colour to say so. */
.ledger-found { border: 1px dashed var(--rule); }
.ledger-head { color: var(--ink-soft); margin: 0 0 0.5rem; }
.ledger-col p { max-width: none; }
.ledger-col p:last-child { margin-bottom: 0; }
.answer-pending { color: var(--ink-soft); font-style: italic; }

.answer-do {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  max-width: var(--measure);
}
.btn-answer {
  display: inline-flex; align-items: center;
  min-height: 2.75rem; padding: 0.5rem 1rem;
  font-family: var(--f-mono); font-size: 0.78rem; letter-spacing: 0.04em;
  background: var(--brand); color: var(--paper);
  border-radius: 4px; text-decoration: none;
}
.btn-answer:hover { text-decoration: underline; }
.answer-do .mono { flex: 1 1 16rem; }


/* ---------- reading time and per entry links ---------- */
.reading-time {
  margin: 0 0 var(--baseline);
  max-width: var(--measure);
}

.entry-no { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.entry-link { display: inline-flex; align-items: center; gap: 0.5rem; }
.entry-link-btn {
  font-family: var(--f-mono); font-size: 0.6875rem; letter-spacing: 0.05em;
  background: none; border: 1px solid var(--rule); border-radius: 3px;
  color: var(--brand); cursor: pointer; text-decoration: none;
  min-height: 2.75rem; padding: 0 0.7rem;
  display: inline-flex; align-items: center;
}
.entry-link-btn:hover { border-color: var(--brand); }
.entry-link-msg { color: var(--aside); font-size: 1rem; }

@media print {
  .entry-link { display: none; }
  .reading-time { display: none; }
}


/* =====================================================================
   THE CONTENTS AND SIMULATIONS PAGES
   Same paper, same pens, no page turning. They are lists, not chapters.
   ===================================================================== */
.page-plain .sheet { padding-bottom: calc(var(--baseline) * 3); }

.toc { list-style: none; margin: 0; padding: 0; }
.toc-row {
  display: grid; gap: 0.15rem 1rem;
  grid-template-columns: 2.5rem 1fr;
  padding: calc(var(--baseline) * 0.7) 0;
  border-bottom: 1px solid var(--rule);
  max-width: var(--measure);
}
.toc-no { grid-row: 1 / span 3; color: var(--ink-soft); margin: 0; }
.toc-title { margin: 0; font-family: var(--f-display); font-size: 1.15rem; }
.toc-title a { text-decoration: none; border-bottom: 1.5px solid var(--brand); }
.toc-note { margin: 0; color: var(--aside); font-size: 1.05rem; }
.toc-what { margin: 0.2rem 0 0; font-size: 0.98rem; max-width: none; }

.simlist { list-style: none; margin: 0; padding: 0; counter-reset: sim; }
.simlist > li {
  padding: calc(var(--baseline) * 0.8) 0;
  border-bottom: 1px solid var(--rule);
  max-width: var(--measure);
}
.sim-name { margin: 0 0 0.25rem; font-family: var(--f-display); font-size: 1.12rem; }
.sim-name a { text-decoration: none; border-bottom: 1.5px solid var(--brand); }
.sim-line { margin: 0 0 0.4rem; max-width: none; }
.sim-tag { color: var(--ink-soft); font-size: 0.6875rem; letter-spacing: 0.08em; margin: 0; }

.plain-list { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.plain-list > li { padding: calc(var(--baseline) * 0.6) 0; border-bottom: 1px solid var(--rule); }
.plain-list .quiet { display: block; font-size: 0.95rem; margin-top: 0.2rem; }


/* =====================================================================
   PRINT

   Professors print. What comes out has to be readable on paper without
   the reader having any of the things a screen gives them: no animation,
   no hover, no clicking a link to find out where it goes.
   ===================================================================== */
@media print {
  /* Paper is already paper. Drop the ruling, it costs toner and gains
     nothing once the page is physically ruled by nothing. */
  .entry-main, .cover {
    background-image: none;
    padding-left: 0;
  }
  .entry-main::before, .cover::before { display: none; }

  body {
    background: #fff; color: #000;
    font-size: 10.5pt; line-height: 1.45;
  }
  .sheet { max-width: none; padding: 0; }

  /* Everything you cannot press on paper */
  .topbar, .skip, .hurry, .hurry-open, .sound-toggle, .sound-invite,
  .pages-toggle, .page-edges, .listen-btn, .listen-what, .entry-link,
  .reading-time, .depth, .lab-controls, .controls, .stepper,
  .signup, .signup-row, .scan-zoom, .predict-opts {
    display: none !important;
  }

  /* An interactive becomes its static fallback and its caption, which is
     exactly what the reduced motion reader and the noscript reader get,
     so there is one fallback and it cannot rot unnoticed. */
  .lab canvas, .two-panel canvas, .fig canvas { display: none; }
  .nojs-note {
    display: block !important;
    border-left: 2px solid #999; padding-left: 0.8rem;
    font-size: 10pt;
  }
  figcaption { font-size: 9pt; color: #333; }

  /* Dark panels invert rather than printing as a slab of toner. */
  .lab.is-instrument, .spectral-panel, .tele-dark {
    background: #fff !important; color: #000 !important; border-color: #999 !important;
  }
  .lab.is-instrument *, .tele-dark * { color: #000 !important; }

  /* Scans are the most credible thing here, so they print large enough to
     actually read, and the transcription prints alongside. */
  .scan-figure img { max-width: 100%; width: 100%; }
  .transcript { display: block !important; }
  .transcript > summary { display: none; }
  .transcript-body { display: block !important; }
  details { display: block; }
  details > summary { display: none; }
  details > *:not(summary) { display: block !important; }

  /* A link on paper is a dead end unless it says where it goes. */
  a[href^="http"]::after,
  a[href^="mailto"]::after {
    content: " (" attr(href) ")";
    font-family: "IBM Plex Mono", monospace;
    font-size: 8.5pt;
    word-break: break-all;
  }
  /* Internal anchors have nowhere to go on paper, so they say nothing. */
  a[href^="#"]::after { content: ""; }

  .entry { page-break-inside: auto; break-inside: auto; }
  h2 { page-break-after: avoid; break-after: avoid; }
  figure { page-break-inside: avoid; break-inside: avoid; }

  .ledger { display: block; }
  .ledger-col { border: 1px solid #999; margin-bottom: 0.5rem; }
}


/* =====================================================================
   THE GUIDE
   ===================================================================== */
.ways { display: grid; gap: var(--baseline); max-width: var(--measure); }
.way {
  padding: 1rem 1.15rem;
  background: var(--paper-deep);
  border-radius: 3px 9px 4px 8px;
}
.way-tag { color: var(--ink-soft); margin: 0 0 0.4rem; }
.way-head {
  font-family: var(--f-display); font-size: 1.15rem; line-height: 1.3;
  margin: 0 0 0.6rem; max-width: none;
}
.way p { max-width: none; }
.way p:last-child { margin-bottom: 0; }
.way-list { margin: 0 0 var(--baseline); padding-left: 1.2rem; }
.way-list li { margin-bottom: 0.5rem; }

/* A crop of a real scan, so the three pens are shown rather than described.
   The percentages come from the crop rectangle: 292 by 142 source pixels
   starting 8 in from the top left of a 520 by 724 image. */
.pen-crop {
  position: relative; overflow: hidden;
  width: 100%; max-width: 34rem;
  aspect-ratio: 292 / 142;
  border: 1px solid var(--rule);
  border-radius: 3px 8px 4px 7px;
  background: var(--paper-deep);
}
.pen-crop img {
  position: absolute;
  width: 178.1%; max-width: none; height: auto;
  left: -2.74%; top: -5.63%;
}
.figcap-line { color: var(--ink-soft); margin: 0.4rem 0 var(--baseline); }

.pens { margin: 0 0 var(--baseline); max-width: var(--measure); }
.pens dt {
  font-family: var(--f-display); font-size: 1.08rem;
  margin-top: calc(var(--baseline) * 0.6);
  padding-left: 0.85rem;
}
.pens dd { margin: 0.2rem 0 0 0.85rem; }
/* Each pen is named in words as well as being shown in its colour, and each
   carries its own left rule, so the three are told apart by position and by
   the sentence even if the colour is not available. */
.pen-ink  { border-left: 3px solid var(--ink); color: var(--ink); }
.pen-corr { border-left: 3px solid var(--correction); color: var(--correction); }
.pen-aside { border-left: 3px solid var(--aside); color: var(--aside); }

.what-list { margin: 0; max-width: var(--measure); }
.what-list dt {
  font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-soft);
  margin-top: var(--baseline);
}
.what-list dd { margin: 0.25rem 0 0; }

.closing-links { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: var(--baseline) 0 0; }

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


/* =====================================================================
   PREDICTIONS
   The question comes before the simulation. The simulation runs anyway.
   ===================================================================== */
.predict {
  max-width: var(--measure);
  margin: 0 0 var(--baseline);
  padding: 0.9rem 1.1rem;
  background: var(--paper-deep);
  border-left: 2px solid var(--ink);
  border-radius: 3px 9px 4px 8px;
}
.predict-q {
  font-family: var(--f-hand);
  font-size: 1.2rem; line-height: 1.4;
  color: var(--ink); margin: 0 0 0.7rem; max-width: none;
}
.predict-opts { display: flex; flex-direction: column; gap: 0.4rem; }
.predict-opts button {
  min-height: 2.75rem; padding: 0.55rem 0.85rem;
  text-align: left;
  font-family: var(--f-body); font-size: 0.97rem;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 3px;
  cursor: pointer;
}
.predict-opts button:hover { border-color: var(--brand); }
/* The chosen one is marked by a rule down its edge and by aria-pressed,
   not by colour on its own. */
.predict-opts button.is-chosen { border-left: 4px solid var(--ink); font-weight: 600; }

.predict-result {
  margin: 0.8rem 0 0; max-width: none;
  padding-left: 0.9rem;
  font-size: 0.98rem;
}
/* Right and wrong differ by which pen marks them, and by the word the
   sentence opens with, never by colour alone. */
.predict-result.is-right { border-left: 2px solid var(--brand); color: var(--ink); }
.predict-result.is-wrong { border-left: 2px solid var(--correction); color: var(--correction); }

@media print {
  .predict-opts { display: none; }
  .predict-result { display: block !important; }
}

/* Why a simulation has no depth control, said rather than left blank. */
.no-depth {
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0.6rem 0 0;
  line-height: 1.55;
}


/* ---------- the guide's three levels, side by side ---------- */
.three-levels {
  display: grid; gap: 0.9rem;
  margin: 0 0 0.6rem;
  max-width: var(--measure);
}
@media (min-width: 46rem) { .three-levels { grid-template-columns: repeat(3, 1fr); } }
.level {
  background: var(--paper-deep);
  border-top: 2px solid var(--ink);
  padding: 0.7rem 0.8rem;
}
.level-tag { color: var(--ink-soft); margin: 0 0 0.5rem; }
.level .readout-line { display: flex; justify-content: space-between; gap: 0.6rem; }
.level-say {
  font-size: 0.88rem; line-height: 1.5; color: var(--ink-soft);
  margin: 0.6rem 0 0; max-width: none;
}
.level-none { color: var(--ink-soft); font-style: italic; margin: 0; }

/* The guide's job is to show the depth control immediately, so its cover
   does not get to fill the screen the way the notebook's does. Measured:
   this brings the demonstration from 956px down to inside the first screen. */
.page-guide .cover { min-height: 0; padding-bottom: calc(var(--baseline) * 0.5); }
.page-guide .cover .display { font-size: clamp(1.9rem, 4.2vw, 3rem); max-width: 24ch; }
.page-guide .cover .lede { font-size: 1.05rem; }
.page-guide #depth .entry-no { margin-top: 0; }
.updated-age { color: var(--correction); }


/* =========================================================================
   THE NOTEBOOK INDEX

   Added in the redesign. The notebook used to open at the cover and go
   straight into entry 01, so the only way to find out what was in the other
   thirteen was to read through them. These are the fourteen laid out as
   page cards on the cover, and they are the notebook's own front matter
   rather than a menu bolted to the top of it: paper, ruled, and the numbers
   in her handwriting because that is how a page number is written.
   ========================================================================= */

.nbx {
  max-width: 78rem;
  padding: 0 0 var(--gap);
}

.nbx-head { margin-bottom: calc(var(--baseline) * 0.9); }

.nbx-h {
  margin: 0 0 0.3rem;
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
}

.nbx-say {
  margin: 0;
  max-width: 56ch;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.nbx-grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}
.nbx-cell { margin: 0; }

.nbx-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.75rem 0.85rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  border-top: 2px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
}
.nbx-card:hover {
  border-color: var(--brand);
  border-top-color: var(--brand);
  background: var(--brand-wash);
}

.nbx-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.nbx-no {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-soft);
}

.nbx-kind {
  font-size: 8.5px;
  letter-spacing: 0.14em;
  color: var(--ink-far);
}

/* The seven artefact labels, coloured by what kind of claim each one is.
   A question and a hypothesis are open; an observation, a calculation and
   a result are findings; a reflection is personal; a reference is neither. */
.nbx-card[data-kind="question"]    { border-top-color: var(--brand); }
.nbx-card[data-kind="question"]    .nbx-kind { color: var(--brand); }
.nbx-card[data-kind="hypothesis"]  { border-top-color: var(--correction); }
.nbx-card[data-kind="hypothesis"]  .nbx-kind { color: var(--correction); }
.nbx-card[data-kind="calculation"] { border-top-color: var(--lavender); }
.nbx-card[data-kind="calculation"] .nbx-kind { color: var(--lavender-ink); }
.nbx-card[data-kind="observation"] { border-top-color: var(--lavender); }
.nbx-card[data-kind="observation"] .nbx-kind { color: var(--lavender-ink); }
.nbx-card[data-kind="result"]      { border-top-color: var(--gold); }
.nbx-card[data-kind="result"]      .nbx-kind { color: var(--gold-ink); }
.nbx-card[data-kind="reflection"]  { border-top-color: var(--orchid); }
.nbx-card[data-kind="reflection"]  .nbx-kind { color: var(--orchid-ink); }

.nbx-name {
  display: block;
  margin: 0.35rem 0 0;
  font-family: var(--f-display);
  font-variation-settings: "SOFT" 40, "WONK" 1;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.2;
  color: var(--ink);
}

.nbx-card .nbx-say {
  margin: 0.3rem 0 0;
  flex: 1 1 auto;
  font-size: 0.85rem;
  line-height: 1.4;
}

.nbx-runs {
  display: block;
  margin: 0.55rem 0 0;
  padding-top: 0.4rem;
  border-top: 1px solid var(--rule-soft);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--brand);
}


/* =========================================================================
   THE TURN AT THE END OF AN ENTRY

   The page turning engine has the keyboard, the drag, the edges and the
   ribbon. It never had the plainest control of the five: at the bottom of
   an entry, having finished it, something that says what is next by name.
   ========================================================================= */

.nb-turn {
  display: grid;
  gap: 0.5rem;
  margin: var(--gap) 0 0;
  padding-top: calc(var(--baseline) * 0.7);
  border-top: 1px solid var(--rule);
  max-width: var(--measure);
}
@media (min-width: 640px) {
  .nb-turn { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.nb-turn-a {
  display: block;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  background: var(--surface);
}
.nb-turn-a:hover { border-color: var(--brand); background: var(--brand-wash); }
.nb-turn-next { text-align: right; }
/* on its own, the next control still sits on the right */
.nb-turn-next:only-child { grid-column: 2; }

.nb-turn-dir {
  display: block;
  font-size: 0.625rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-far);
}
.nb-turn-name {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.95rem;
  line-height: 1.25;
  color: var(--brand);
}


/* =========================================================================
   ELSEWHERE ON THIS SITE

   An entry that has a simulation in it should say where that simulation can
   be opened on its own, and an entry belonging to a research area should
   say which. Both were already true and neither was written down.
   ========================================================================= */

.nb-also {
  margin: var(--gap) 0 0;
  padding: 0.7rem 0.9rem;
  background: var(--brand-wash);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius) var(--radius) 0;
  max-width: var(--measure);
}
.nb-also-h {
  margin: 0 0 0.45rem;
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-far);
}
.nb-also-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
}
.nb-also-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem;
}
.nb-also-kind {
  flex: none;
  min-width: 8.5rem;
  font-size: 0.5625rem;
  letter-spacing: 0.13em;
  color: var(--ink-far);
}
.nb-also-list a { font-size: 0.95rem; }

@media print {
  .nbx, .nb-turn, .nb-also { display: none; }
}

/* The cover's second row: the two ways out of the notebook, set quieter
   than the two ways in, so the row reads as a hierarchy rather than as
   five links of equal weight that happened to wrap. */
.cover-links-quiet { margin-top: 0; gap: 1.4rem; }
.cover-links-quiet .ulink {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-decoration-color: var(--rule);
}
.cover-links-quiet .ulink:hover { text-decoration-color: var(--brand); }
