/* How the hand's marks look: pencil, ink, coloured pencil and lettering. Every sketch on every
   page wears these; an entry adds nothing of its own unless its subject needs a new mark. */

.sk {
  --sk-ink: var(--fn-ink);
  --sk-graphite: var(--fn-graphite);
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.sk path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Line work */
.sk .ink {
  stroke: var(--sk-ink);
  stroke-width: 1.7;
}
.sk .ink.fine {
  stroke-width: 1.1;
}
.sk .over {
  stroke-width: 0.9;
  opacity: 0.5;
}
.sk .pencil {
  stroke: var(--sk-graphite);
  stroke-width: 1.3;
}
.sk .pencil.fine {
  stroke-width: 1;
  opacity: 0.8;
}
.sk .dashed {
  stroke-dasharray: 6 5.5;
}
.sk .hatch {
  stroke: var(--sk-ink);
  stroke-width: 0.85;
  opacity: 0.5;
}
.sk .hatch.bark {
  stroke: var(--fn-bark);
  opacity: 0.75;
}
.sk .dots {
  stroke: var(--fn-bark);
  stroke-width: 1.5;
  opacity: 0.5;
}
.sk .dots.silt {
  stroke-width: 2.1;
  opacity: 0.95;
}
.sk .rutline {
  stroke: var(--fn-bark);
  stroke-width: 1.7;
}
.sk .lead {
  stroke: var(--sk-graphite);
  stroke-width: 1.15;
}
.sk .lead.red {
  stroke: var(--fn-blaze);
  stroke-width: 1.5;
}

/* Colour: coloured pencil laid in lightly, and the paper showing through a shape */
.sk .wash {
  stroke: none;
}
.sk .wash.moss {
  fill: var(--fn-moss);
  opacity: 0.2;
}
.sk .wash.bark {
  fill: var(--fn-bark);
  opacity: 0.14;
}
.sk .wash.tread {
  fill: var(--fn-bark);
  opacity: 0.07;
}
.sk .wash.stone {
  fill: #7d7b68;
  opacity: 0.2;
}
.sk .wash.silt {
  fill: var(--fn-bark);
  fill-opacity: 0.34;
}
.sk .paper {
  fill: var(--fn-page);
  stroke: none;
}

/* Water: blue pencil. The dashes march along the line; the march is set on the `.flow` group
   and inherited, so redrawing the lines inside it never restarts it. */
.sk .water {
  stroke: var(--fn-water);
  stroke-width: 2.1;
  stroke-dasharray: 13 8;
}
.sk .water.still {
  stroke-dasharray: none;
}
.sk .waterdot {
  fill: var(--fn-water);
}
.sk .flow {
  animation: fn-flow 1.15s linear infinite;
}
@keyframes fn-flow {
  to {
    stroke-dashoffset: -21px;
  }
}
.is-held .sk .flow {
  animation-play-state: paused;
}

/* Lettering */
.sk text.note {
  font-family: var(--fn-hand);
  font-size: 25px;
  fill: var(--sk-ink);
  /* a rubbed-out halo, so a note stays readable where it crosses a line */
  stroke: var(--fn-page);
  stroke-width: 5px;
  stroke-linejoin: round;
  paint-order: stroke;
}
.sk text.note.small {
  font-size: 20px;
  fill: var(--sk-graphite);
}
.sk text.note.big {
  font-size: 33px;
}
.sk text.note.red {
  fill: var(--fn-blaze);
}

/* The highlighter: a swipe of ochre under whatever the notes are talking about */
.sk .hl {
  fill: var(--fn-ochre);
  stroke: none;
  opacity: 0;
  transition: opacity 260ms var(--fn-ease);
}
.sk [data-on] > .hl {
  opacity: 0.32;
}
.sk [data-name] {
  transition: opacity 260ms var(--fn-ease);
}
.sk[data-focus] [data-name]:not([data-on], [data-name='notes'], [data-name='silt']) {
  opacity: 0.55;
}

@media (prefers-reduced-motion: reduce) {
  .sk .flow {
    animation: none;
  }
  .sk .hl,
  .sk [data-name] {
    transition: none;
  }
}

/* Tread & True Field Notes: the notebook.
   A pine cover, cream leaves. The sketch leaf stays put; the ruled leaf of notes scrolls past it.
   Brand colours and the extended palette are the site's (../brand, site/src/styles/global.css).
   Printed matter (form labels, buttons) is National Park; everything written is Mynerve.

   The ruled leaf is a baseline grid. --rule is the pitch of the lines, and every block on that
   leaf is a whole number of rules tall, so the writing sits on the lines all the way down. */

@font-face {
  font-family: 'National Park';
  src: url('/field-notes/fonts/national-park-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Mynerve';
  src: url('/field-notes/fonts/mynerve-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand */
  --fn-pine: #1f3b2d;
  --fn-cream: #f3e8cf;
  --fn-bark: #6e4527;
  --fn-ochre: #d49a2a;
  /* Extended (site design brief, 3.2) */
  --fn-paper-shade: #e9dcbd;
  --fn-blaze: #a63d24;
  --fn-water: #2f6577;
  --fn-moss: #4e6b45;
  --fn-contour: #b89f78;

  /* The notebook */
  --fn-page: var(--fn-cream);
  --fn-ink: var(--fn-pine);
  --fn-graphite: #56605a;
  --fn-printed: #45594c;
  --fn-hand: 'Mynerve', 'Bradley Hand', 'Segoe Print', 'Comic Sans MS', cursive;
  --fn-print: 'National Park', ui-rounded, 'Avenir Next', system-ui, sans-serif;

  --rule: 2rem;
  --hand: 1.3125rem;
  --margin: 4.25rem;
  --fn-head: 4.5rem; /* the header's height: it stays at the top, so whatever else sticks, sticks below it */
  --fn-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fn-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .43 0 0 0 0 .27 0 0 0 0 .15 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");

  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--fn-pine) var(--fn-grain);
  color: var(--fn-ink);
  font-family: var(--fn-print);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--fn-water);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}
a:hover {
  text-decoration-thickness: 2px;
}

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

.fn-skip {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 50;
  padding: 0.6rem 1rem;
  background: var(--fn-cream);
  color: var(--fn-pine);
  font-weight: 600;
}
.fn-skip:focus {
  top: 0.75rem;
}

/* Printed matter: what the notebook came with, before anyone wrote in it */
.fn-printed {
  font-family: var(--fn-print);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fn-printed);
}

.fn-hand {
  font-family: var(--fn-hand);
  font-weight: 400;
}

/* Pressing harder is how a pencil says "bold" */
.fn-leaf b,
.fn-leaf dt {
  font-weight: 400;
  -webkit-text-stroke: 0.45px currentColor;
}

/* ───────────────────────── the cover */

/* The site's own header bar: cream, so the pine emblem reads on it. Same width, gutter,
   height, grain and map's edge as ../site/src/components/Header.astro, so nothing jumps
   between stops. It stays at the top of the window as the page moves. */
.fn-cover {
  --gutter: clamp(1rem, 0.6rem + 2vw, 2.5rem);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: var(--fn-head);
  padding: 0 max(var(--gutter), calc((100% - 76rem) / 2 + var(--gutter))) 4px;
  background: var(--fn-grain), var(--fn-cream);
  box-shadow: 0 10px 18px -14px rgba(31, 59, 45, 0.6);
  color: var(--fn-pine);
}
/* The map's edge: a fine line over a row of checks, as round the frame of a trail map */
.fn-cover::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  border-top: 1px solid var(--fn-pine);
  background: repeating-linear-gradient(90deg, var(--fn-pine) 0 1.25rem, transparent 1.25rem 2.5rem);
  opacity: 0.7;
}
.fn-foot :focus-visible {
  outline-color: var(--fn-ochre);
}
.fn-cover-brand {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--fn-pine);
  text-decoration: none;
  border-radius: 4px;
}
.fn-cover-brand img {
  display: block;
}
/* The name beside the icon, as on the site's header: the wordmark's ExtraBold capitals */
.fn-cover-name {
  font-family: var(--fn-print);
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}
.fn-cover-name .fn-amp {
  color: var(--fn-bark);
}
/* The site's stops, as on its own header: this notebook is stop 1 */
.fn-stops {
  margin-left: auto;
}
.fn-stops ol {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.fn-stops a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  color: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}
.fn-stop-no {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  background: var(--fn-pine);
  color: var(--fn-cream);
  font-weight: 800;
  letter-spacing: 0;
  clip-path: polygon(25% 0, 75% 0, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0 75%, 0 25%);
  transition: background-color 160ms var(--fn-ease);
}
.fn-stops a:hover .fn-stop-no,
.fn-stops a[aria-current='page'] .fn-stop-no {
  background: var(--fn-blaze);
}
.fn-stops a:hover .fn-stop-name,
.fn-stops a[aria-current='page'] .fn-stop-name {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.fn-btn {
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  background: transparent;
  color: var(--fn-pine);
  font-family: var(--fn-print);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.15;
  cursor: pointer;
  transition:
    background-color 160ms var(--fn-ease),
    color 160ms var(--fn-ease);
}
.fn-btn:hover,
.fn-btn[aria-pressed='true'] {
  background: var(--fn-pine);
  border-color: var(--fn-pine);
  color: var(--fn-cream);
}

/* ───────────────────────── the open notebook */

.fn-spread {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr);
  max-width: 82rem;
  margin: 0 auto;
  background: var(--fn-page);
  border-radius: 5px 9px 9px 5px;
  /* the edges of the pages underneath */
  box-shadow:
    3px 0 0 -1px #e6d9b8,
    4px 0 0 -1px rgba(31, 59, 45, 0.35),
    7px 0 0 -2px #e6d9b8,
    8px 0 0 -2px rgba(31, 59, 45, 0.3),
    0 18px 40px -18px rgba(0, 0, 0, 0.6);
}
.fn-spread--single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 48rem;
}

.fn-leaf {
  min-width: 0;
}

/* The sketch leaf: unruled, a faint dot grid */
.fn-leaf--sketch {
  --fn-page: var(--fn-cream);
  border-radius: 5px 0 0 5px;
  background:
    linear-gradient(to left, rgba(31, 59, 45, 0.16), transparent 2.2rem),
    var(--fn-grain),
    radial-gradient(circle, rgba(110, 69, 39, 0.3) 0.8px, transparent 1.2px) 0 0 / 1.25rem 1.25rem,
    var(--fn-page);
}

.fn-pin {
  position: sticky;
  top: var(--fn-head);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  height: calc(100vh - var(--fn-head));
  height: calc(100svh - var(--fn-head));
  max-height: 64rem;
  padding: clamp(0.9rem, 3.5vh, 3rem) clamp(1rem, 2.4vw, 2.25rem) 1rem clamp(1rem, 2.4vw, 2rem);
}

.fn-fig {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.fn-fig figcaption {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 1.3rem;
  line-height: 1.3;
}
.fn-stage {
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.fn-stage.is-dragging {
  cursor: grabbing;
}
.fn-stage > .sk {
  aspect-ratio: 760 / 672;
  width: min(100%, calc((100svh - 19rem - var(--fn-head)) * 760 / 672));
  min-width: min(100%, 20rem);
  height: auto;
  margin-inline: auto;
  overflow: hidden;
}
.fn-hint {
  margin: 0;
  text-align: right;
  font-size: 1.05rem;
  line-height: 1.2;
  color: var(--fn-graphite);
}

/* The control: a scale ruled in pencil, with a knob on it */
.fn-control {
  width: 100%;
  max-width: 36rem;
  margin-inline: auto;
}
.fn-control-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 0.7rem;
}
.fn-out {
  min-width: 2.2em;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--fn-blaze);
}
.fn-facts {
  flex-basis: 100%;
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--fn-graphite);
}
.fn-facts b {
  font-weight: 400;
  color: var(--fn-ink);
}
.fn-facts i {
  font-style: normal;
}
.fn-facts [data-tone='good'] b {
  color: var(--fn-moss);
}
.fn-facts [data-tone='bad'] b {
  color: var(--fn-blaze);
}

.fn-scale {
  --knob: 1.7rem;
  position: relative;
  height: 4.2rem;
  margin-top: 0.15rem;
}
.fn-scale-line {
  position: absolute;
  left: calc(var(--knob) / 2);
  top: 1rem;
  width: calc(100% - var(--knob));
  height: 8px;
}
.fn-tick {
  position: absolute;
  top: 1.1rem;
  display: grid;
  justify-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.fn-tick i {
  display: block;
  width: 1.5px;
  height: 0.6rem;
  background: var(--fn-ink);
  border-radius: 1px;
  transform: rotate(4deg);
}
.fn-tick:nth-child(odd) i {
  transform: rotate(-5deg);
}
.fn-tick b {
  white-space: nowrap;
  font-family: var(--fn-hand);
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.1;
  color: var(--fn-graphite);
}
.fn-band {
  position: absolute;
  top: 0.4rem;
  height: 1.5rem;
  border-radius: 3px 9px 4px 8px;
  background: color-mix(in srgb, var(--fn-moss) 30%, transparent);
  pointer-events: none;
}
.fn-band em {
  position: absolute;
  top: 2.5rem;
  right: -0.5rem;
  white-space: nowrap;
  font-family: var(--fn-hand);
  font-style: normal;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--fn-moss);
}
.fn-band em::before {
  content: '↑ ';
}
.fn-range {
  position: absolute;
  inset: 0 0 auto 0;
  width: 100%;
  height: 2.5rem;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: ew-resize;
}
.fn-range:focus-visible {
  outline: none;
}
.fn-range::-webkit-slider-runnable-track {
  height: var(--knob);
  background: transparent;
}
.fn-range::-moz-range-track {
  height: var(--knob);
  background: transparent;
}
.fn-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--knob);
  height: var(--knob);
  border: 2px solid var(--fn-pine);
  border-radius: 50%;
  background: radial-gradient(circle, var(--fn-cream) 0 20%, var(--fn-blaze) 23%);
  box-shadow: 0 2px 3px rgba(31, 59, 45, 0.35);
}
.fn-range::-moz-range-thumb {
  width: var(--knob);
  height: var(--knob);
  border: 2px solid var(--fn-pine);
  border-radius: 50%;
  background: radial-gradient(circle, var(--fn-cream) 0 20%, var(--fn-blaze) 23%);
  box-shadow: 0 2px 3px rgba(31, 59, 45, 0.35);
}
.fn-range:focus-visible::-webkit-slider-thumb {
  outline: 3px solid var(--fn-blaze);
  outline-offset: 3px;
}
.fn-range:focus-visible::-moz-range-thumb {
  outline: 3px solid var(--fn-blaze);
  outline-offset: 3px;
}
.fn-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

/* ───────────────────────── the ruled leaf */

.fn-leaf--notes {
  --shift: -6px; /* where a rule falls under a line of writing */
  position: relative;
  padding: calc(var(--rule) * 2) clamp(1.1rem, 3vw, 2.75rem) calc(var(--rule) * 3) calc(var(--margin) + 1.1rem);
  border-radius: 0 9px 9px 0;
  background:
    linear-gradient(to right, rgba(31, 59, 45, 0.2), transparent 2rem),
    linear-gradient(to right, transparent calc(var(--margin) - 1px), rgba(166, 61, 36, 0.42) calc(var(--margin) - 1px), rgba(166, 61, 36, 0.42) calc(var(--margin) + 0.5px), transparent calc(var(--margin) + 0.5px)),
    var(--fn-grain),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--rule) - 1px), rgba(47, 101, 119, 0.3) calc(var(--rule) - 1px), rgba(47, 101, 119, 0.3) var(--rule)) 0 var(--shift),
    var(--fn-page);
  font-family: var(--fn-hand);
  font-size: var(--hand);
  line-height: var(--rule);
  overflow-wrap: break-word;
}
.fn-spread--single .fn-leaf--notes {
  border-radius: 5px 9px 9px 5px;
}

.fn-leaf--notes p,
.fn-leaf--notes h1,
.fn-leaf--notes h2,
.fn-leaf--notes h3,
.fn-leaf--notes ul,
.fn-leaf--notes ol,
.fn-leaf--notes dl,
.fn-leaf--notes dd,
.fn-leaf--notes figure {
  margin: 0;
}
.fn-leaf--notes p {
  text-wrap: pretty;
}
.fn-leaf--notes .fn-printed {
  line-height: var(--rule);
}

/* The form at the head of the page: printed labels, filled in by hand on the page's own rules */
.fn-form {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1rem;
  padding-right: 5.25rem;
  margin-bottom: var(--rule);
}
.fn-form-no b {
  font-size: 1.9rem;
  color: var(--fn-blaze);
  letter-spacing: 0.04em;
  vertical-align: -0.08em;
}
.fn-fields {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.5rem;
}
.fn-fields div {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  min-width: 0;
}
.fn-fields dt {
  flex: none;
  -webkit-text-stroke: 0;
}
.fn-fields dd {
  min-width: 0;
}
.fn-stamp {
  position: absolute;
  top: -0.9rem;
  right: -0.2rem;
  width: 4.4rem;
  height: auto;
  opacity: 0.82;
  mix-blend-mode: multiply;
  transform: rotate(7deg);
}

.fn-leaf--notes h1,
.fn-leaf--notes h2 {
  position: relative;
  width: fit-content;
  max-width: 100%;
  font-weight: 400;
  text-wrap: balance;
}
.fn-leaf--notes h1 {
  top: 7px;
  font-size: 3.4rem;
  line-height: calc(var(--rule) * 2);
}
.fn-leaf--notes h2 {
  top: -2px;
  margin-top: var(--rule);
  font-size: 1.8rem;
  line-height: var(--rule);
}
.fn-under {
  position: absolute;
  left: -1%;
  bottom: -5px;
  width: 102%;
  height: 12px;
}
h1 .fn-under {
  bottom: 0;
  height: 16px;
}

.fn-tagline {
  color: var(--fn-graphite);
}
.fn-question {
  position: relative;
  margin-top: var(--rule) !important;
  color: var(--fn-bark);
}
.fn-margin {
  position: absolute;
  left: calc(-1 * var(--margin) - 1.1rem);
  width: var(--margin);
  padding-right: 0.7rem;
  text-align: right;
  color: var(--fn-blaze);
  font-size: 1.5rem;
}
.fn-lead {
  margin-top: var(--rule) !important;
}

/* Steps: numbered in the margin; the one being read is gone over with a highlighter */
.fn-steps {
  padding: 0;
  list-style: none;
}
.fn-step {
  position: relative;
  margin-top: var(--rule);
  transition: opacity 260ms var(--fn-ease);
}
.fn-step:first-child {
  margin-top: 0;
}
.fn-step-no {
  position: absolute;
  left: calc(-1 * var(--margin) - 1.1rem + (var(--margin) - 2.75rem) / 2);
  top: -0.45rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--fn-graphite);
}
.fn-step-no b {
  -webkit-text-stroke: 0;
}
.fn-ring {
  position: absolute;
  inset: 0;
  --sk-ink: var(--fn-graphite);
  opacity: 0;
  transition: opacity 200ms var(--fn-ease);
}
.fn-step.is-on .fn-step-no {
  color: var(--fn-blaze);
}
.fn-step.is-on .fn-ring {
  --sk-ink: var(--fn-blaze);
  opacity: 1;
}
.fn-step h3 {
  font-size: 1.5rem;
  font-weight: 400;
  line-height: var(--rule);
}
.fn-step h3 button {
  margin: 0 0 0 -0.35em;
  padding: 0 0.45em 0 0.35em;
  border: 0;
  border-radius: 0.45em 0.2em 0.5em 0.25em;
  background: linear-gradient(100deg, transparent 0.3em, color-mix(in srgb, var(--fn-ochre) 50%, transparent) 0.5em, color-mix(in srgb, var(--fn-ochre) 42%, transparent) calc(100% - 0.6em), transparent calc(100% - 0.3em)) no-repeat 0 62% / 0% 78%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-size 380ms var(--fn-ease);
}
.fn-step h3 button:hover {
  color: var(--fn-bark);
}
.fn-step.is-on h3 button {
  background-size: 100% 78%;
}
.fn-steps.has-on .fn-step:not(.is-on) {
  opacity: 0.66;
}

/* A sketch on a scrap, taped in */
.fn-scrap {
  --fn-page: var(--fn-paper-shade);
  position: relative;
  margin-top: var(--rule) !important;
  padding: 0.9rem 0.9rem 0.7rem;
  background: var(--fn-grain), var(--fn-page);
  box-shadow:
    0 1px 2px rgba(31, 59, 45, 0.28),
    0 10px 18px -12px rgba(31, 59, 45, 0.55);
  transform: rotate(-0.6deg);
}
.fn-scrap figcaption {
  margin-top: 0.3rem;
  font-size: 1.125rem;
  line-height: 1.45;
  color: var(--fn-graphite);
}
.fn-scrap figcaption .fn-printed {
  line-height: inherit;
  margin-right: 0.3rem;
}
.fn-scrap figcaption b {
  color: var(--fn-ink);
}
.fn-tape {
  position: absolute;
  top: -0.65rem;
  z-index: 1;
  width: 4.4rem;
  height: 1.35rem;
  background: color-mix(in srgb, var(--fn-ochre) 34%, rgba(243, 232, 207, 0.9));
  opacity: 0.82;
  box-shadow: 0 1px 1px rgba(31, 59, 45, 0.2);
}
.fn-tape--a {
  left: 7%;
  transform: rotate(-5deg);
}
.fn-tape--b {
  right: 8%;
  transform: rotate(4deg);
}

/* Key to the sketch */
.fn-key > div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  column-gap: 0.9rem;
  margin-inline: -0.4rem;
  padding-inline: 0.4rem;
  border-radius: 4px;
  cursor: default;
}
.fn-key dt {
  width: fit-content;
  height: fit-content;
  margin-left: -0.3em;
  padding-inline: 0.3em;
  border-radius: 0.45em 0.2em 0.5em 0.25em;
  background: linear-gradient(100deg, transparent 0.2em, color-mix(in srgb, var(--fn-ochre) 48%, transparent) 0.4em, color-mix(in srgb, var(--fn-ochre) 40%, transparent) calc(100% - 0.4em), transparent calc(100% - 0.2em)) no-repeat 0 62% / 0% 78%;
  transition: background-size 300ms var(--fn-ease);
}
.fn-key > div:hover dt,
.fn-key > div:focus-visible dt,
.fn-key > div.is-on dt {
  background-size: 100% 78%;
}
.fn-key > div:focus-visible {
  outline-offset: 1px;
}

/* By the tape */
.fn-tape-table {
  width: 100%;
  border-collapse: collapse;
}
.fn-tape-table th,
.fn-tape-table td {
  padding: 0;
  text-align: left;
  vertical-align: baseline;
  font-weight: 400;
}
.fn-tape-table th {
  width: 9.5rem;
  padding-right: 0.75rem;
}

/* Second thoughts: boxed in red pencil */
.fn-second {
  position: relative;
  margin-top: var(--rule);
  padding: var(--rule) 1.2rem;
  transform: rotate(0.35deg);
}
.fn-box {
  position: absolute;
  left: -0.3rem;
  top: 0.55rem;
  width: calc(100% + 0.5rem);
  height: calc(100% - 0.85rem);
  pointer-events: none;
}
.fn-leaf--notes .fn-second h2 {
  margin-top: 0;
  color: var(--fn-blaze);
}
.fn-second p + p {
  margin-top: var(--rule);
}

.fn-list {
  padding: 0;
  list-style: none;
}
.fn-list li {
  position: relative;
  padding-left: 1.5rem;
}
.fn-list li::before {
  content: '–';
  position: absolute;
  left: 0.15rem;
  color: var(--fn-graphite);
}
.fn-related .fn-printed {
  margin-right: 0.35rem;
}
.is-pencilled {
  color: var(--fn-graphite);
}
.is-pencilled i {
  font-style: normal;
}

.fn-sources ol {
  padding-left: 1.5rem;
}
.fn-sources li + li {
  margin-top: var(--rule);
}
.fn-src-note {
  color: var(--fn-graphite);
}
.fn-sources .is-chosen {
  list-style: '✎  ';
}

.fn-pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 1.5rem;
  margin-top: calc(var(--rule) * 2);
}

/* ───────────────────────── contents */

.fn-contents-blurb {
  color: var(--fn-graphite);
}
.fn-contents {
  padding: 0;
  list-style: none;
}
.fn-contents > li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1.25rem;
  align-items: start;
  margin-top: var(--rule);
}
.fn-contents-no {
  position: absolute;
  left: calc(-1 * var(--margin) - 1.1rem);
  width: var(--margin);
  padding-right: 0.55rem;
  text-align: right;
  white-space: nowrap;
  color: var(--fn-blaze);
}
.fn-contents-no .fn-printed {
  display: none;
}
.fn-contents-no b {
  -webkit-text-stroke: 0;
}
.fn-contents h3 {
  font-size: 1.5rem;
  font-weight: 400;
  line-height: var(--rule);
}
.fn-contents h3 a {
  color: inherit;
}
.fn-thumb {
  --fn-page: var(--fn-paper-shade);
  position: relative;
  display: block;
  width: 10.5rem;
  height: calc(var(--rule) * 4);
  margin-top: 0.25rem;
  padding: 0.35rem;
  background: var(--fn-grain), var(--fn-page);
  box-shadow:
    0 1px 2px rgba(31, 59, 45, 0.28),
    0 10px 18px -12px rgba(31, 59, 45, 0.55);
  transform: rotate(1.6deg);
  overflow: hidden;
}
.fn-thumb .sk {
  width: 100%;
  height: 100%;
}
.fn-thumb .sk text,
.fn-thumb .sk .lead,
.fn-thumb .sk .flow {
  animation: none;
}
.fn-thumb .sk [data-name='notes'],
.fn-thumb .sk [data-name='angle'] {
  display: none;
}
.fn-thumb .fn-tape {
  left: 32%;
  width: 3.4rem;
}

/* ───────────────────────── the back cover */

.fn-foot {
  max-width: 82rem;
  margin-inline: auto;
  padding: 2.5rem clamp(1rem, 3vw, 2rem) 3rem;
  color: var(--fn-cream);
  font-size: 0.9375rem;
}
.fn-foot p {
  margin: 0 0 0.4rem;
  max-width: 40rem;
}
.fn-foot a {
  color: inherit;
}
.fn-foot-line {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fn-ochre);
}
.fn-foot-small {
  margin-top: 1rem !important;
  font-size: 0.8125rem;
  opacity: 0.85;
}

/* ───────────────────────── one leaf at a time: the sketch stays at the top */

/* The header on a phone, as on the site: one short row, so a header that stays costs little
   of the screen. Print leaves it (the browser's own Print still makes the sheet). */
@media (max-width: 52rem) {
  :root {
    --fn-head: 3.25rem;
  }
  .fn-cover {
    gap: 0.6rem;
  }
  .fn-cover .fn-btn--cover {
    display: none;
  }
  .fn-cover-brand img {
    width: 30px;
    height: 30px;
  }
  .fn-cover-name {
    display: none; /* the stops need the row */
  }
  .fn-stops {
    flex: 1;
    min-width: 0;
    margin-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .fn-stops ol {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 0.4rem;
  }
  .fn-stops a {
    gap: 0.25rem;
    font-size: 0.625rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
  }
  .fn-stop-no {
    width: 1.2rem;
    height: 1.2rem;
    font-size: 0.6875rem;
  }
}

@media (max-width: 24rem) {
  .fn-cover {
    gap: 0.45rem;
  }
  .fn-cover-brand img {
    width: 28px;
    height: 28px;
  }
  .fn-stops ol {
    gap: 0.25rem;
  }
  .fn-stops a {
    letter-spacing: 0;
  }
}

@media (max-width: 62rem) {
  :root {
    --margin: 2.9rem;
  }
  .fn-spread {
    grid-template-columns: minmax(0, 1fr);
    border-radius: 0;
    box-shadow: none;
  }
  .fn-leaf--sketch {
    position: sticky;
    top: var(--fn-head);
    z-index: 5;
    border-radius: 0;
    border-bottom: 1px solid var(--fn-contour);
    box-shadow: 0 10px 14px -10px rgba(31, 59, 45, 0.55);
    background:
      var(--fn-grain),
      radial-gradient(circle, rgba(110, 69, 39, 0.3) 0.8px, transparent 1.2px) 0 0 / 1.25rem 1.25rem,
      var(--fn-page);
  }
  .fn-pin {
    position: static;
    height: auto;
    max-height: none;
    gap: 0.1rem;
    padding: 0.35rem 0.75rem 0.5rem;
  }
  .fn-fig figcaption,
  .fn-hint,
  .fn-band em {
    display: none;
  }
  .fn-stage > .sk {
    aspect-ratio: 760 / 530;
    width: min(100%, calc((100svh - 11rem - var(--fn-head)) * 0.5 * 760 / 530));
  }
  .fn-control {
    max-width: 30rem;
  }
  .fn-out {
    font-size: 1.6rem;
  }
  .fn-out {
    line-height: 1;
  }
  .fn-facts {
    font-size: 1rem;
  }
  /* room for two facts on a phone: how steep the drain is, and the verdict */
  .fn-facts span:nth-of-type(2),
  .fn-facts i:first-of-type {
    display: none;
  }
  .fn-scale {
    height: 3rem;
  }
  .fn-buttons {
    margin-top: 0;
  }
  .fn-buttons .fn-btn {
    min-height: 2rem;
    padding-block: 0.3rem;
  }
  .fn-leaf--notes,
  .fn-spread--single .fn-leaf--notes {
    border-radius: 0;
    padding-top: var(--rule);
    padding-right: 1rem;
    padding-left: calc(var(--margin) + 0.7rem);
    background:
      linear-gradient(to right, transparent calc(var(--margin) - 1px), rgba(166, 61, 36, 0.42) calc(var(--margin) - 1px), rgba(166, 61, 36, 0.42) calc(var(--margin) + 0.5px), transparent calc(var(--margin) + 0.5px)),
      var(--fn-grain),
      repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--rule) - 1px), rgba(47, 101, 119, 0.3) calc(var(--rule) - 1px), rgba(47, 101, 119, 0.3) var(--rule)) 0 var(--shift),
      var(--fn-page);
  }
  .fn-margin,
  .fn-contents-no {
    left: calc(-1 * var(--margin) - 0.7rem);
  }
  .fn-step-no {
    left: calc(-1 * var(--margin) - 0.7rem + (var(--margin) - 2.75rem) / 2);
  }
  .fn-leaf--notes h1 {
    font-size: 2.9rem;
  }
  .fn-form {
    padding-right: 4.1rem;
  }
  .fn-form-book {
    letter-spacing: 0.08em;
    white-space: nowrap;
  }
  .fn-form-no {
    grid-column: 1;
    grid-row: 2;
  }
  .fn-stamp {
    width: 3.7rem;
    top: -0.3rem;
    right: -0.3rem;
  }
  .fn-fields {
    flex-direction: column;
  }
  .fn-key > div {
    grid-template-columns: minmax(0, 1fr);
  }
  .fn-tape-table th {
    width: 7.6rem;
  }
  .fn-thumb {
    width: 7rem;
  }
}

/* A phone on its side: too little height to pin anything */
@media (max-width: 62rem) and (max-height: 30rem) {
  .fn-leaf--sketch {
    position: static;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

/* ───────────────────────── on paper */

@media print {
  @page {
    margin: 14mm;
  }
  :root {
    --fn-page: #fff;
  }
  body {
    background: #fff;
  }
  .fn-leaf--sketch,
  .fn-scrap,
  .fn-thumb {
    --fn-page: #fff;
  }
  .fn-form {
    padding-right: 5.25rem;
  }
  .fn-stamp {
    right: 0.25rem;
  }
  .fn-stops,
  .fn-cover .fn-btn,
  .fn-skip,
  .fn-buttons,
  .fn-scale,
  .fn-hint,
  .fn-pager,
  .fn-foot-small {
    display: none !important;
  }
  .fn-cover,
  .fn-foot {
    color: var(--fn-pine);
    padding: 0 0 4mm;
  }
  .fn-cover {
    position: static;
    min-height: 0;
    background: none;
    box-shadow: none;
  }
  .fn-cover::after {
    display: none;
  }
  .fn-foot-line {
    color: var(--fn-bark);
  }
  .fn-spread {
    display: block;
    max-width: none;
    box-shadow: none;
    background: none;
  }
  .fn-leaf--sketch,
  .fn-leaf--notes {
    position: static;
    background: none;
    box-shadow: none;
    border: 0;
  }
  .fn-pin {
    position: static;
    height: auto;
    max-height: none;
    padding: 0;
  }
  .fn-stage > .sk {
    width: 62%;
    aspect-ratio: 760 / 672;
  }
  .fn-leaf--notes {
    padding: 4mm 0 0 calc(var(--margin) + 0.5rem);
  }
  .fn-step,
  .fn-scrap,
  .fn-second,
  .fn-key > div,
  .fn-sources li {
    break-inside: avoid;
  }
  .fn-steps.has-on .fn-step:not(.is-on) {
    opacity: 1;
  }
  .sk .flow {
    animation: none;
  }
}
