/* doodleshnookie.net: engineer's computation pad */

@font-face {
  font-family: "Osifont";
  src: url("/fonts/osifont.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Charis";
  src: url("/fonts/charis-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Charis";
  src: url("/fonts/charis-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Charis";
  src: url("/fonts/charis-semibold.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Charis";
  src: url("/fonts/charis-semibolditalic.woff2") format("woff2");
  font-weight: 600 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* paper and printing */
  --paper: #dde8cf;
  --paper-deep: #d2dfc1;
  --grid: rgb(45 100 70 / 0.13);
  --rule: rgb(45 100 70 / 0.42);
  --print: #2d6446;
  /* inks */
  --ink: #1b2620;
  --graphite: #435148;
  --check: #983519;
  --blue: #1f3a6b;

  --u: 1.5rem;
  --measure: 68ch;
  /* An odd number of grid squares, so a centred page starts on a grid line. */
  --page: calc(var(--u) * 57);
  --gutter: calc(var(--u) * 2);

  --f-letter: "Osifont", "Arial Narrow", sans-serif;
  --f-text: "Charis", "Charis SIL", "Bitstream Charter", Charter, Georgia, serif;
  --f-code: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --ease-ink: cubic-bezier(0.16, 1, 0.3, 1);

  --pen: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M1 5.2C18 3.6 34 5.9 52 4.4S84 3 99 4.6' fill='none' stroke='%231b2620' stroke-width='1.9' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}

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

html {
  color-scheme: light;
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: var(--u) var(--u);
  /* Centred grid: with an odd-width page, the page edge lands on a line. */
  background-position: 50% 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--print) var(--paper-deep);
  scroll-padding-top: var(--u);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--f-text);
  font-size: 1.125rem;
  line-height: 1.6;
  font-variant-numeric: lining-nums proportional-nums;
  text-rendering: optimizeLegibility;
  caret-color: var(--check);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Below the page width the page starts at x = 0, so the grid does too. */
@media (max-width: 85.5rem) {
  html {
    background-position: 0 0;
  }
}
@media (max-width: 40rem) {
  :root {
    --gutter: var(--u);
  }
}

/* The printed grid is the layout grid: blocks whose height follows their
   text are rounded up to whole squares, so every rule lands on a line. */
@supports (height: calc-size(auto, size)) {
  .strip,
  .lede,
  .index__item,
  .cover,
  .sheet,
  .logbook,
  .log__row,
  .entry__head,
  .entry,
  .logbook__h,
  .logbook__fast {
    height: calc-size(auto, round(up, size, var(--u)));
  }
}

::selection {
  background: var(--check);
  color: var(--paper);
}

img,
svg {
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
}

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

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

.defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-letter);
  text-decoration: none;
}
.skip:focus {
  top: 0.75rem;
}

/* Links: printed underline at rest, a pen stroke drawn over it on intent.
   Titles that are links by position (.pen) get the stroke without the rest line. */

.ink,
.prose a {
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.2em;
}
.ink,
.prose a,
.pen {
  background-image: var(--pen);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 0.42em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding-bottom: 0.08em;
  transition:
    background-size 320ms var(--ease-ink),
    text-decoration-color 160ms linear;
}
.pen {
  text-decoration: none;
}
.ink:hover,
.ink:focus-visible,
.prose a:hover,
.prose a:focus-visible,
.pen:hover,
.pen:focus-visible {
  background-size: 100% 0.42em;
  text-decoration-color: transparent;
}
.ink--quiet {
  color: var(--graphite);
}

/* Marks: the closed state vocabulary, in checker's ink */

.mark {
  width: 1.05em;
  height: 1.05em;
  flex: none;
  color: var(--check);
  vertical-align: -0.16em;
}

/* Header strip: the printed title block of every sheet */

.strip {
  width: calc(100% - 2 * var(--gutter));
  max-width: calc(var(--page) - 2 * var(--gutter));
  margin: var(--u) auto 0;
  display: grid;
  grid-template-columns:
    minmax(max-content, 1.1fr) minmax(max-content, 1.3fr) minmax(0, 2.4fr)
    minmax(max-content, 0.6fr) minmax(max-content, 0.9fr) minmax(max-content, 1fr);
  grid-auto-rows: 1fr;
  border: 2px solid var(--print);
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3px var(--print);
  font-family: var(--f-letter);
}

.strip__cell {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.3rem 0.75rem 0.35rem;
  border-left: 1px solid var(--print);
}
.strip__cell:first-child {
  border-left: 0;
}

.strip__label {
  font-size: 0.7rem;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--print);
}

.strip__fill {
  font-size: 1.05rem;
  line-height: 1.25;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.strip__home {
  font-size: 1.15rem;
}

.strip__cell--nav .strip__fill {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
}

.strip__cell--subject .strip__fill {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.strip__by {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.strip__avatar {
  width: 2rem;
  height: 2rem;
  margin-block: -0.15rem -0.2rem;
  border-radius: 50%;
  background: var(--paper-deep);
  box-shadow: 0 0 0 1px var(--print);
}

@media (max-width: 64rem) {
  .strip {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .strip__cell {
    border-top: 1px solid var(--print);
  }
  .strip__cell--project {
    order: 1;
    grid-column: span 4;
    border-top: 0;
  }
  .strip__cell--by {
    order: 2;
    grid-column: span 2;
    border-top: 0;
  }
  .strip__cell--subject {
    order: 3;
    grid-column: span 6;
    border-left: 0;
  }
  .strip__cell--sheet {
    order: 4;
    grid-column: span 2;
    border-left: 0;
  }
  .strip__cell--date {
    order: 5;
    grid-column: span 4;
  }
  .strip__cell--nav {
    order: 6;
    grid-column: span 6;
    border-left: 0;
  }
  .strip__by {
    white-space: nowrap;
  }
}

@media (max-width: 40rem) {
  .strip__cell {
    padding: 0.3rem 0.55rem 0.35rem;
  }
  .strip__fill {
    font-size: 0.95rem;
  }
  .strip__home {
    font-size: 1rem;
  }
  .strip__avatar {
    width: 1.9rem;
    height: 1.9rem;
  }
  .strip__cell--subject {
    grid-column: span 4;
  }
  .strip__cell--sheet {
    grid-column: span 2;
    border-left: 1px solid var(--print);
  }
  .strip__cell--date {
    grid-column: span 3;
    border-left: 0;
  }
  .strip__cell--nav {
    grid-column: span 3;
    border-left: 1px solid var(--print);
  }
}

/* Balloons: circled sheet references, as on a drawing */

.balloon {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font-family: var(--f-letter);
  font-size: 1.15rem;
  line-height: 1;
  font-variant-numeric: lining-nums;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
  transition: background-color 200ms var(--ease-ink), color 200ms var(--ease-ink);
}
a.balloon:hover {
  background: var(--ink);
  color: var(--paper);
}

/* Cover sheet */

.cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
  grid-template-areas:
    "index entry"
    "index legend";
  grid-template-rows: auto 1fr;
  gap: calc(var(--u) * 1) calc(var(--u) * 3);
  padding-block: calc(var(--u) * 2);
}
.cover__index {
  grid-area: index;
}
.cover__entry {
  grid-area: entry;
}
.legend {
  grid-area: legend;
  align-self: start;
}

.cover__index {
  position: relative;
  min-width: 0;
}

.lede {
  margin: 0 0 var(--u);
  max-width: 40ch;
  font-family: var(--f-letter);
  font-weight: 400;
  font-size: clamp(1.75rem, 1.15rem + 1.9vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: 0;
  text-wrap: balance;
}

.index {
  list-style: none;
  margin: 0;
  padding: 0 0 0 calc(var(--u) * 3);
}

.index__item {
  --name: clamp(2.1rem, 1.3rem + 2.4vw, 3.25rem);
  --pad-top: calc(var(--u) * 0.5);
  position: relative;
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  column-gap: calc(var(--u) * 0.75);
  padding-block: var(--pad-top) calc(var(--u) * 0.75);
  border-top: 1px solid var(--rule);
}
.index__item:last-child::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--rule);
}

.index__no {
  align-self: start;
  margin-top: calc(var(--name) * 0.5 - 1.125rem);
}

.index__name {
  margin: 0;
  font-family: var(--f-letter);
  font-weight: 400;
  font-size: var(--name);
  line-height: 1;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
}
.index__name a {
  text-decoration: none;
}

.index__fast {
  margin: 0.2rem 0 0;
  font-size: 1.2rem;
  line-height: 1.45;
  max-width: 44ch;
}

.index__relations {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  font-size: 1rem;
  color: var(--graphite);
}
.index__relations li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  width: max-content;
  max-width: 100%;
}
.index__relations .mark {
  align-self: center;
}

.index__links {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  grid-template-areas: "site source . tally";
  align-items: center;
  gap: 0.35rem 1.25rem;
  margin: 0.55rem 0 0;
  font-size: 1.05rem;
}

.index__site {
  grid-area: site;
  font-family: var(--f-letter);
  font-size: 1.15rem;
}
.index__source {
  grid-area: source;
}

.index__tally {
  grid-area: tally;
  display: inline-flex;
  gap: 0.2rem;
}

/* The checker's tick: drawn once when an index line is taken up */

.index__tick {
  position: absolute;
  right: 0;
  top: calc(var(--pad-top) + var(--name) * 0.5 - 0.9rem);
  width: 2.2rem;
  height: 1.8rem;
  color: var(--check);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition:
    stroke-dashoffset 420ms var(--ease-ink),
    opacity 60ms linear;
  pointer-events: none;
}
.index__item:hover .index__tick,
.index__item:focus-within .index__tick {
  stroke-dashoffset: 0;
  opacity: 1;
}

/* Leader rails between balloons and the relations they explain.
   Drawn only where anchor positioning exists; the text carries the fact. */

.rails {
  display: none;
}

@supports (anchor-name: --a) {
  .rails {
    display: block;
  }
  .rail {
    position: absolute;
    pointer-events: none;
    border-color: var(--graphite);
    border-width: 0;
  }
  .rail--pending {
    --lane: calc(var(--u) * 1);
    border-style: dashed;
  }
  .rail--built {
    --lane: calc(var(--u) * 2);
    border-style: solid;
  }
  .rail--run {
    left: var(--lane);
    top: anchor(var(--from) center);
    bottom: anchor(var(--to) center);
    right: anchor(var(--from) left);
    border-top-width: 1.5px;
    border-left-width: 1.5px;
  }
  .rail--foot {
    left: var(--lane);
    top: anchor(var(--to) center);
    right: calc(anchor(var(--to) left) + 0.35rem);
    height: 0;
    border-top-width: 1.5px;
  }
}

/* Newest entry, beside the index */

.cover__entry {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 1.5);
  padding-top: calc(var(--u) * 0.25);
}

.entry-card {
  padding: calc(var(--u) * 0.75) 0 calc(var(--u) * 1);
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}

.entry-card__title {
  margin: 0;
  font-family: var(--f-letter);
  font-weight: 400;
  font-size: 1.9rem;
  line-height: 1.1;
}

.entry-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  margin: 0.5rem 0 0;
  font-family: var(--f-letter);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--print);
  font-variant-numeric: lining-nums tabular-nums;
}

.entry-card__fast {
  margin: 0.75rem 0 0;
  font-style: italic;
}

.entry-card__more {
  margin: 0.75rem 0 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  margin: 0;
  font-family: var(--f-letter);
  font-size: 0.9rem;
  color: var(--graphite);
}
.legend div {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.legend dt,
.legend dd {
  margin: 0;
  display: flex;
}

/* Project sheets: fixed stations, same order on every sheet */

.sheets {
  counter-reset: sheet;
}

.sheet {
  padding-block: calc(var(--u) * 2 - 2px) calc(var(--u) * 3);
  border-top: 2px solid var(--print);
  box-shadow: 0 -5px 0 -3px var(--print);
}

.sheet__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: calc(var(--u) * 0.75);
  margin-bottom: calc(var(--u) * 1.5);
}

.sheet__no {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font-family: var(--f-letter);
  font-size: 1.5rem;
  line-height: 1;
}

.sheet__name {
  margin: 0;
  font-family: var(--f-letter);
  font-weight: 400;
  font-size: clamp(2.2rem, 1.3rem + 3vw, 4rem);
  line-height: 1;
  overflow-wrap: break-word;
}

.sheet__fast {
  grid-column: 2;
  margin: 0.4rem 0 0;
  font-size: 1.25rem;
  font-style: italic;
  color: var(--graphite);
}

.sheet__body {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-areas:
    "what  figure"
    "state figure"
    "links figure";
  grid-template-rows: auto auto 1fr;
  gap: calc(var(--u) * 1.25) calc(var(--u) * 2.5);
  align-items: start;
}

.station--what {
  grid-area: what;
}
.station--state {
  grid-area: state;
}
.station--links {
  grid-area: links;
}
.sheet__figure {
  grid-area: figure;
  position: sticky;
  top: var(--u);
}

.station {
  max-width: 60ch;
}
.station p {
  margin: 0 0 0.75rem;
}
.station p:last-child {
  margin-bottom: 0;
}

.station__label {
  margin: 0 0 0.5rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--f-letter);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--print);
}

.state,
.links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.state__item {
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr);
  gap: 0.6rem;
  padding-block: 0.3rem;
  line-height: 1.45;
}
.state__item .mark {
  margin-top: 0.2rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
}
.links li:first-child {
  font-family: var(--f-letter);
  font-size: 1.15rem;
}

/* Plates: real figures pasted onto the sheet */

.plate {
  margin: 0;
}

.plate__paper {
  display: block;
  line-height: 0;
  background: var(--paper-deep);
  border: 1px solid rgb(27 38 32 / 0.6);
  box-shadow: 0 1px 0 rgb(27 38 32 / 0.12);
}
a.plate__paper {
  cursor: zoom-in;
}

.plate__paper img {
  width: 100%;
}

.plate__caption {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.75rem;
  margin-top: 0.6rem;
  font-family: var(--f-letter);
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--graphite);
}
.plate__no {
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
/* Opening a figure is announced in ink on its caption; the paper stays put. */
.plate__source {
  background-image: var(--pen);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 0.4em;
  padding-bottom: 0.1em;
  transition: background-size 320ms var(--ease-ink);
}
.plate:has(a.plate__paper:hover) .plate__source,
.plate:has(a.plate__paper:focus-visible) .plate__source {
  background-size: 100% 0.4em;
}

/* Log */

.logbook {
  padding-block: calc(var(--u) * 2 - 2px) calc(var(--u) * 3);
  border-top: 2px solid var(--print);
  box-shadow: 0 -5px 0 -3px var(--print);
}
.logbook--page {
  border-top: 0;
  box-shadow: none;
  padding-top: calc(var(--u) * 2);
}

.logbook__h {
  margin: 0 0 var(--u);
  font-family: var(--f-letter);
  font-weight: 400;
  font-size: clamp(2.2rem, 1.3rem + 3vw, 4rem);
  line-height: 1;
}

.logbook__fast {
  margin: 0 0 var(--u);
  max-width: 60ch;
  font-style: italic;
  color: var(--graphite);
}

.log {
  list-style: none;
  margin: 0;
  padding: 0;
}
.log__row:first-child {
  border-top-color: var(--ink);
}
.log__row:last-child {
  box-shadow: 0 1px 0 var(--rule);
}

.log__row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr) minmax(6rem, 12rem);
  gap: 0.25rem calc(var(--u) * 1);
  padding-block: calc(var(--u) * 0.6);
  border-top: 1px solid var(--rule);
  align-items: baseline;
}

.log__date {
  font-family: var(--f-letter);
  font-size: 1rem;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--print);
}

.log__title {
  font-weight: 600;
  font-size: 1.25rem;
}

.log__fast {
  margin: 0.15rem 0 0;
  color: var(--graphite);
  max-width: 70ch;
}

.log__topic {
  font-family: var(--f-letter);
  font-size: 0.95rem;
  text-align: right;
}

.log__empty {
  color: var(--graphite);
}

.topics {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--f-letter);
  font-size: 1.3rem;
}
.topics li {
  padding-block: 0.3rem;
  border-bottom: 1px solid var(--rule);
}
.topics__count {
  color: var(--print);
  font-size: 0.95rem;
  margin-left: 0.5rem;
}

/* Entry */

.entry {
  display: grid;
  grid-template-columns: minmax(9rem, 13rem) minmax(0, var(--measure)) minmax(0, 1fr);
  grid-template-areas:
    ".      head ."
    "margin body ."
    ".      nav  .";
  column-gap: calc(var(--u) * 2);
  padding-block: calc(var(--u) * 2.5) calc(var(--u) * 3);
}

.entry__head {
  grid-area: head;
  margin-bottom: calc(var(--u) * 1.5);
}

.entry__title {
  margin: 0;
  font-family: var(--f-letter);
  font-weight: 400;
  font-size: clamp(2.3rem, 1.4rem + 3vw, 4rem);
  line-height: 1.05;
  text-wrap: balance;
}

.entry__fast {
  margin: 0.9rem 0 0;
  font-size: 1.3rem;
  line-height: 1.45;
  font-style: italic;
  color: var(--graphite);
}

.entry__margin {
  grid-area: margin;
}

.entry__facts {
  position: sticky;
  top: var(--u);
  margin: 0;
  padding-top: 0.35rem;
  border-top: 2px solid var(--ink);
  font-family: var(--f-letter);
  font-size: 0.95rem;
}
.entry__facts div {
  padding-block: 0.35rem;
  border-bottom: 1px solid var(--rule);
}
.entry__facts dt {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--print);
}
.entry__facts dd {
  margin: 0.1rem 0 0;
  font-variant-numeric: lining-nums tabular-nums;
}

.entry__body {
  grid-area: body;
  min-width: 0;
}

.entry__nav {
  grid-area: nav;
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--u) * 1);
  margin-top: calc(var(--u) * 2.5);
  padding-top: calc(var(--u) * 1);
  border-top: 2px solid var(--ink);
}
.entry__nav-link {
  font-weight: 600;
}
.entry__nav-link--all {
  margin-left: auto;
}
.entry__nav-dir {
  font-weight: 400;
  color: var(--graphite);
}

/* Prose */

.prose > * {
  margin-block: 0 1.1rem;
}
.prose > :last-child {
  margin-bottom: 0;
}

.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--f-letter);
  font-weight: 400;
  line-height: 1.15;
  text-wrap: balance;
}
.prose h2 {
  margin-top: calc(var(--u) * 2);
  margin-bottom: 0.6rem;
  font-size: 1.9rem;
}
.prose h3 {
  margin-top: calc(var(--u) * 1.5);
  margin-bottom: 0.5rem;
  font-size: 1.45rem;
}
.prose h4 {
  margin-top: calc(var(--u) * 1.25);
  margin-bottom: 0.4rem;
  font-size: 1.15rem;
}

.prose strong {
  font-weight: 600;
}

.prose ul,
.prose ol {
  padding-left: 1.4rem;
}
.prose li + li {
  margin-top: 0.3rem;
}
.prose li::marker {
  color: var(--print);
}

.prose blockquote {
  margin-inline: 0;
  padding-left: calc(var(--u) * 1);
  border-left: 1px solid var(--ink);
  font-style: italic;
  color: var(--graphite);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin-block: calc(var(--u) * 2);
}

.prose code {
  font-family: var(--f-code);
  font-size: 0.86em;
  font-variant-ligatures: none;
}
.prose :not(pre) > code {
  padding: 0.08em 0.3em;
  background: var(--paper-deep);
  border: 1px solid rgb(45 100 70 / 0.28);
  border-radius: 2px;
  overflow-wrap: anywhere;
}
.prose a > code {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.3em;
}
.prose a:hover > code {
  border-color: var(--ink);
}

.prose pre {
  margin-inline: 0;
  padding: calc(var(--u) * 0.75) calc(var(--u) * 1);
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-size: 0.95rem;
  line-height: 1.55;
  tab-size: 4;
}
.prose pre code {
  font-size: inherit;
}
.giallo-l {
  display: inline-block;
  min-height: 1lh;
  width: 100%;
}
.giallo-ln {
  display: inline-block;
  user-select: none;
  margin-right: 0.4em;
  padding: 0 0.4em;
  min-width: 3ch;
  text-align: right;
  color: var(--graphite);
}
.prose pre mark {
  display: block;
  background: rgb(152 53 25 / 0.12);
  color: inherit;
}
.prose pre code[data-name]::before {
  content: attr(data-name);
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--f-letter);
  font-size: 0.8rem;
  color: var(--print);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  font-variant-numeric: lining-nums tabular-nums;
}
.prose th,
.prose td {
  padding: 0.4rem 0.75rem 0.4rem 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.prose th {
  font-family: var(--f-letter);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--print);
  border-bottom-color: var(--ink);
}

.prose img {
  display: block;
  border: 1px solid rgb(27 38 32 / 0.6);
  box-shadow: 0 1px 0 rgb(27 38 32 / 0.12);
}

.prose .footnote-definition,
.prose .footnotes {
  font-size: 0.95rem;
  color: var(--graphite);
}

/* Footer: the foot of the sheet */

.foot {
  width: calc(100% - 2 * var(--gutter));
  max-width: calc(var(--page) - 2 * var(--gutter));
  margin: 0 auto var(--u);
  padding-top: calc(var(--u) * 1);
  border-top: 2px solid var(--print);
  box-shadow: 0 -5px 0 -3px var(--print);
  font-size: 0.95rem;
  color: var(--graphite);
}
.foot p {
  margin: 0 0 0.3rem;
}
.foot__line {
  color: var(--ink);
}
.foot__small {
  font-size: 0.85rem;
}

/* Narrow sheets */

@media (max-width: 60rem) {
  .cover {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "index"
      "legend"
      "entry";
    grid-template-rows: none;
  }
  .sheet__body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "what"
      "figure"
      "state"
      "links";
    grid-template-rows: none;
  }
  .sheet__figure {
    position: static;
  }
  .entry {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "margin"
      "body"
      "nav";
  }
  .entry__facts {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.25rem;
    margin-bottom: calc(var(--u) * 1.25);
  }
  .entry__facts div {
    border-bottom: 0;
  }
}

@media (max-width: 40rem) {
  .index {
    padding-left: calc(var(--u) * 2);
  }
  .index__item {
    grid-template-columns: 2.5rem minmax(0, 1fr);
    column-gap: 0.6rem;
  }
  .balloon {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }
  .index__no {
    margin-top: calc(var(--name) * 0.5 - 1rem);
  }
  .index__tick {
    display: none;
  }
  .index__links {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "site   site site"
      "source .    tally";
  }
  .rail--pending {
    --lane: calc(var(--u) * 0.5);
  }
  .rail--built {
    --lane: calc(var(--u) * 1.5);
  }
  .log__row {
    grid-template-columns: minmax(0, 1fr);
  }
  .log__topic {
    text-align: left;
  }
  .sheet__head {
    column-gap: 0.6rem;
  }
  .sheet__no {
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1.2rem;
  }
  .sheet__fast {
    grid-column: 1 / -1;
  }
}

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

@media print {
  html {
    background: none;
  }
  .strip,
  .foot {
    box-shadow: none;
  }
  .skip,
  .rails,
  .index__tick,
  .entry__nav {
    display: none;
  }
}
