/* Engineering computation paper on a drafting desk; unfolds into a cyanotype. */

:root {
  --desk: #c6cec3;
  --sheet: #eef2ea;
  --grid-minor: rgba(84, 132, 96, 0.09);
  --grid-major: rgba(84, 132, 96, 0.2);
  --ink: #1f231e;
  --ink-2: #545c51;
  --rule: #9db097;
  --cobalt: #2a55a0;
  --madder: #b03b3b;
  --olive: #587620;
  --ochre: #a8761c;
  --blueprint: #0e2b4a;
  --chalk: #dce7f3;
  --redline: #ff9a86;
  --serif: 'CMU Serif', 'Latin Modern Roman', 'Times New Roman', serif;
  --draft: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--desk); }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.62;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

i, em { font-style: italic; }

/* ---------- the sheet ---------- */

.desk { padding: 56px 24px 220px; }

.sheet {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 96px 72px 140px 132px;
  background-color: var(--sheet);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 50px 50px, 50px 50px, 10px 10px, 10px 10px;
  background-position: -1px -1px;
  border: 1px solid #93a68d;
  box-shadow: 0 30px 60px -36px rgba(25, 40, 25, 0.5);
}

.sheet::before {
  content: '';
  position: absolute;
  inset: 24px;
  border: 1.5px solid var(--ink);
  pointer-events: none;
}

.zones {
  position: absolute;
  left: 24px;
  top: 24px;
  bottom: 24px;
  width: 36px;
  border-right: 1px solid var(--ink);
  font: 500 15px/1 var(--draft);
  color: var(--ink-2);
}

.zones span {
  position: absolute;
  left: 0;
  width: 36px;
  text-align: center;
  transform: translateY(-50%);
}

.zones i {
  position: absolute;
  left: 26px;
  width: 10px;
  border-top: 1px solid var(--ink);
}

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

.opening { max-width: 920px; margin-bottom: 120px; }

h1 {
  font: 500 clamp(72px, 10vw, 148px)/0.86 var(--draft);
  letter-spacing: -0.015em;
  margin: 0 0 40px;
  max-width: 8.5em;
}

h2 {
  font: 500 clamp(52px, 6vw, 84px)/0.95 var(--draft);
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

h2 .no {
  display: inline-block;
  min-width: 0.9em;
  margin-right: 0.22em;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--ink);
}

h3 {
  font: 600 26px/1.2 var(--draft);
  letter-spacing: 0.01em;
  margin: 56px 0 10px;
  max-width: 640px;
}

p { max-width: 640px; margin: 0 0 1em; hyphens: auto; }

.lede {
  font-size: 24px;
  line-height: 1.45;
  font-style: italic;
  color: var(--ink-2);
  margin-bottom: 1.4em;
}

.opening .lede { font-style: normal; color: var(--ink); max-width: 700px; }

.chapter { padding-top: 40px; margin-bottom: 140px; clear: both; }

.chapter.closing h2 { font-size: clamp(40px, 4.4vw, 60px); }

.chapter { counter-reset: eq; }

.eq {
  counter-increment: eq;
  position: relative;
  max-width: 640px;
  margin: 0.4em 0 1.6em;
  padding: 0.3em 3.2em 0.3em 0;
  text-align: center;
  font-size: 20px;
  font-style: italic;
  line-height: 1.7;
}

.eq::after {
  content: '(' attr(data-ch) counter(eq) ')';
  position: absolute;
  right: 0;
  top: 0.3em;
  font-style: normal;
  font-size: 17px;
  color: var(--ink-2);
}

sub, sup { font-size: 0.68em; line-height: 0; }

.note {
  float: right;
  clear: right;
  width: 230px;
  margin: 0.25em -290px 1em 0;
  padding-left: 12px;
  border-left: 1.5px solid var(--ochre);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-2);
}

/* ---------- figures ---------- */

.fig { margin: 2.2em 0 0.6em; max-width: 720px; }
.fig.wide { max-width: 940px; }

.fig-art svg { display: block; width: 100%; height: auto; overflow: visible; }

figcaption {
  max-width: 640px;
  margin-top: 0.8em;
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink-2);
}

.fig-no {
  font: 600 16px var(--draft);
  letter-spacing: 0.02em;
  color: var(--ink);
  margin-right: 0.6em;
}

.plot .ln { fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.plot .ln.thick { stroke-width: 2.7; }
.plot .ln.thin { stroke-width: 1.2; }
.plot .ln.dash { stroke-dasharray: 7 6; }
.plot .ln.guide { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 4; }
.plot .ln.axis { stroke-width: 1.4; }
.plot .ahead { fill: var(--ink); }
.plot .cb { stroke: var(--cobalt); fill: var(--cobalt); }
.plot .md { stroke: var(--madder); fill: var(--madder); }
.plot .ol { stroke: var(--olive); fill: var(--olive); }
.plot .oc { stroke: var(--ochre); fill: var(--ochre); }
.plot .ln.cb, .plot .ln.md, .plot .ln.ol, .plot .ln.oc, .plot .ln.k { fill: none; }
.plot .dot { stroke: none; fill: var(--ink); }
.plot .dot.cb { fill: var(--cobalt); }
.plot .dot.oc { fill: var(--ochre); }
.plot .dot.ol { fill: var(--olive); }
.plot .ring { fill: var(--sheet); stroke-width: 1.7; }
.plot .area { stroke: none; }
.plot .f-cobalt { fill: rgba(42, 85, 160, 0.12); }
.plot .f-madder { fill: rgba(176, 59, 59, 0.12); }
.plot .f-olive { fill: rgba(88, 118, 32, 0.1); }
.plot .f-ochre { fill: rgba(168, 118, 28, 0.16); }

.plot .f-hatch { fill: rgba(31, 35, 30, 0.06); }

.plot .lb { font-family: var(--serif); font-size: 18px; fill: var(--ink); stroke: none; }
.plot .lb.it { font-style: italic; }
.plot .lb.cb { fill: var(--cobalt); }
.plot .lb.md { fill: var(--madder); }
.plot .lb.ol { fill: var(--olive); }
.plot .lb.oc { fill: var(--ochre); }
.plot .lb.note { font-size: 13.5px; fill: var(--ink-2); font-style: italic; }
.plot .lb.note.cb { fill: var(--cobalt); }
.plot .lb.note.md { fill: var(--madder); }
.plot .lb.note.oc { fill: var(--ochre); }
.plot .lb.step { font: 600 21px var(--draft); }

/* ---------- parts list ---------- */

.partslist { max-width: 920px; margin: 2em 0; }

.partslist table {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px solid var(--ink);
  background: var(--sheet);
  font-size: 15.5px;
  line-height: 1.4;
}

.partslist caption {
  caption-side: top;
  text-align: left;
  font: 600 18px var(--draft);
  padding-bottom: 6px;
}

.partslist th {
  font: 600 15px var(--draft);
  letter-spacing: 0.02em;
  text-align: left;
  padding: 7px 10px;
  border: 1px solid var(--ink);
}

.partslist td {
  padding: 7px 10px;
  border: 1px solid var(--ink);
  vertical-align: top;
}

.partslist td:first-child { font: 500 16px var(--draft); text-align: center; width: 3em; }
.partslist td:nth-child(2) { font-weight: 700; }
.partslist td:last-child { font-style: italic; }

/* ---------- title block ---------- */

.titleblock {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  width: 330px;
  background: var(--sheet);
  border: 1.5px solid var(--ink);
  font-family: var(--draft);
  color: var(--ink);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.45);
  transition: background 0.6s, color 0.6s, border-color 0.6s;
}

.tb-row { padding: 6px 12px; border-bottom: 1px solid currentColor; }
.tb-title { display: flex; justify-content: space-between; align-items: baseline; }
.tb-name { font-weight: 600; font-size: 23px; letter-spacing: 0.01em; }
.tb-sheet { font-size: 15px; font-variant-numeric: tabular-nums; }
.tb-sub { font-size: 17px; line-height: 1.25; min-height: 2.6em; }

.tb-counts { display: grid; grid-template-columns: repeat(3, 1fr); padding: 0; }
.tb-counts > div { padding: 5px 12px 6px; border-right: 1px solid currentColor; }
.tb-counts > div:last-child { border-right: 0; }
.tb-k { display: block; font-size: 13px; opacity: 0.75; }
.tb-v { font-size: 30px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }

.tb-unfold {
  display: block;
  width: 100%;
  border: 0;
  padding: 11px 12px;
  background: var(--ink);
  color: var(--sheet);
  font: 600 19px var(--draft);
  letter-spacing: 0.03em;
  text-align: left;
  cursor: pointer;
}

.tb-unfold:hover { background: #333a31; }
.tb-unfold:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }
.tb-unfold:disabled { cursor: not-allowed; opacity: 0.55; }

.tb-status { margin: 0; padding: 0 12px; font-size: 14px; line-height: 1.3; max-width: none; }
.tb-status:not(:empty) { padding: 7px 12px; }
.tb-perf { margin: 0; padding: 6px 12px; font: 500 13px/1.3 var(--draft); max-width: 360px; border-top: 1px solid currentColor; }
.tb-perf:empty { display: none; }

body.unfolded .titleblock {
  background: rgba(10, 34, 60, 0.82);
  color: var(--chalk);
  border-color: var(--chalk);
  backdrop-filter: blur(6px);
}

body.unfolded .tb-unfold { background: var(--chalk); color: var(--blueprint); }

/* ---------- unfolded: the stage takes over ---------- */

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 20;
  display: block;
  pointer-events: none;
}

body.unfolded #sheet { visibility: hidden; }

#expo-labels {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}

body:not(.unfolded) #expo-labels { display: none; }

.xl {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  will-change: transform, opacity;
  color: var(--redline);
  font: italic 18px/1.2 var(--serif);
  text-shadow: 0 0 10px rgba(8, 24, 44, 0.9);
  transform-origin: 0 0;
}

.xl.xeq, .xl.tag {
  padding: 3px 9px 4px;
  background: rgba(8, 26, 46, 0.82);
  border-left: 2px solid currentColor;
  text-shadow: none;
}

.xl sub, .xl sup { font-size: 0.7em; }
.xl.tag { font: 500 15px/1.2 var(--draft); color: var(--chalk); letter-spacing: 0.01em; }
.xl.tag.cobalt { color: #8fb6ff; }
.xl.tag.madder { color: #ff9c9c; }
.xl.tag.olive { color: #bfe07a; }
.xl.tag.ochre { color: #ffd27a; }
/* a model's state of the wheel (ontology.js): the value a held cell is held
   at, and what the wheel produces, measured, beside the hub */
.xl.tag.held { font: italic 16px/1.2 var(--serif); border-left-style: dashed; background: rgba(8, 26, 46, 0.7); }
.xl.tag.held i { font: 500 12px/1 var(--draft); font-style: normal; letter-spacing: 0.04em; opacity: 0.75; margin-right: 0.35em; }
.xl.tag.measured { font: 500 15px/1.35 var(--draft); color: #ffd27a; text-align: left; }
.xl.tag.measured b { font-weight: 600; font-size: 1.25em; color: #fff; }
.xl.tag.measured i { font: italic 13px var(--serif); color: var(--chalk); opacity: 0.8; }
.xl.agent {
  font: 600 17px/1 var(--draft);
  color: #fff;
  letter-spacing: 0.02em;
  padding: 5px 8px 4px;
  border: 1px solid rgba(220, 231, 243, 0.7);
  background: rgba(10, 34, 60, 0.6);
}
.xl.chapter { font: 500 40px/1 var(--draft); color: var(--chalk); letter-spacing: -0.01em; text-align: right; padding-right: 14px; border-right: 2px solid var(--chalk); text-shadow: 0 0 24px rgba(8, 24, 44, 0.95); }
.xl.chapter span { color: transparent; -webkit-text-stroke: 1.2px var(--chalk); margin-right: 0.2em; }
.xl.rect { font: 600 14px/1 var(--draft); color: var(--chalk); opacity: 0.9; }

/* the world (docs/world.md): room signs, margin callouts, dimension lines,
   the reading-time ruler and the stage titles raised as type */
body.unfolded { cursor: grab; user-select: none; }
body.unfolded.turning { cursor: grabbing; }
.xl.room { font: 600 22px/1.05 var(--draft); color: var(--chalk); letter-spacing: 0.01em; text-align: right; padding-right: 9px; border-right: 2px solid currentColor; }
.xl.room span { display: block; font: 500 14px/1.2 var(--draft); letter-spacing: 0.03em; opacity: 0.75; }
.xl.room.left { text-align: left; padding: 0 0 0 9px; border-right: 0; border-left: 2px solid currentColor; }
.xl.callout {
  width: 250px;
  white-space: normal;
  padding: 7px 11px 8px;
  font: 15px/1.35 var(--serif);
  color: var(--chalk);
  background: rgba(8, 26, 46, 0.84);
  border-left: 2px solid var(--chalk);
  text-shadow: none;
}
.xl.callout b { display: block; font: 600 16px/1.2 var(--draft); color: #fff; letter-spacing: 0.01em; }
.xl.callout i { font: 600 13px var(--draft); font-style: normal; color: var(--redline); }
.xl.dim { padding: 3px 7px 4px; font: 600 14px/1 var(--draft); color: var(--chalk); letter-spacing: 0.01em; background: rgba(8, 26, 46, 0.82); text-shadow: none; }
.xl.ruler { font: 600 14px/1 var(--draft); color: var(--chalk); padding-right: 6px; }
.xl.ruler i { font-style: normal; opacity: 0.7; }
.xl.title { color: #48514a; text-shadow: none; line-height: 0.95; box-sizing: border-box; }
.xl.title .no { -webkit-text-stroke-color: #48514a; }
.xl.title.base { text-shadow: 0 2px 12px rgba(4, 12, 24, 0.45); }
.xl.title.top { color: var(--ink); }
.xl.title.top .no { -webkit-text-stroke-color: var(--ink); }
#expo-labels .leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#expo-labels .leaders line { stroke: var(--chalk); stroke-width: 1; }
/* a figure's controls, inside its callout, work while the page is folded */
.xl.callout.live { width: 290px; cursor: default; }
.xl.callout .fig-ctl { max-width: none; margin-top: 8px; gap: 8px; font: 500 14px var(--draft); color: var(--chalk); }
.xl.callout .fig-ctl.grid { grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.xl.callout .fig-ctl label { gap: 6px; }
.xl.callout .fig-ctl input { min-width: 0; accent-color: var(--redline); }
.xl.callout .fig-ctl input:focus-visible { outline: 2px solid var(--redline); outline-offset: 2px; }

/* ---------- small screens ---------- */

@media (max-width: 1180px) {
  .sheet { padding: 72px 40px 120px 96px; }
  .note { float: none; width: auto; max-width: 640px; margin: 0 0 1em; }
}

@media (max-width: 760px) {
  body { font-size: 17px; }
  .desk { padding: 0 0 200px; }
  .sheet { padding: 56px 20px 100px 56px; border: 0; }
  .sheet::before { inset: 10px; }
  .zones { left: 10px; top: 10px; bottom: 10px; width: 30px; }
  .titleblock { left: 10px; right: 10px; bottom: 10px; width: auto; }
  .tb-sub { min-height: 0; }
}

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

/* ---------- links ---------- */

.links { font-size: 16.5px; color: var(--ink-2); }
.links b { font: 600 17px var(--draft); color: var(--ink); letter-spacing: 0.01em; }

/* ---------- week ladders ---------- */

.weeks {
  list-style: none;
  margin: 1.6em 0 2em;
  padding: 0;
  max-width: 700px;
  border-left: 1.5px solid var(--ink);
}

.week {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  margin: 0 0 10px;
  background: var(--sheet);
  border: 1px solid var(--ink);
  border-left: 0;
  scroll-margin-top: 40vh;
}

.wk-no {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 9px;
  border-right: 1px solid var(--rule);
  font: 500 22px/1 var(--draft);
  color: var(--ink-2);
}

.wk-body { padding: 8px 14px 10px; }

.week h4 {
  font: 600 19px/1.2 var(--draft);
  letter-spacing: 0.01em;
  margin: 0 0 4px;
}

.wk-q, .wk-a, .wk-eq, .wk-links { margin: 0 0 4px; max-width: none; font-size: 15.5px; line-height: 1.5; }
.wk-q { font-style: italic; color: var(--ink-2); }
.wk-eq { font-style: italic; font-size: 17px; color: var(--ink); padding: 2px 0 2px 12px; border-left: 2px solid var(--madder); }
.wk-links { font-size: 14px; color: var(--ink-2); }
.wk-links b { font: 600 14px var(--draft); color: var(--ink); letter-spacing: 0.02em; margin-right: 0.3em; }
.wk-links .sep { display: inline-block; width: 1.2em; }
.wk-links a, .jx-links a { color: var(--cobalt); text-decoration: none; border-bottom: 1px solid rgba(42, 85, 160, 0.35); white-space: nowrap; }
.week:target { outline: 2px solid var(--ochre); }

/* ---------- junctions and proof chains ---------- */

.junction {
  max-width: 760px;
  margin: 2.4em 0;
  padding: 14px 18px 12px;
  border: 1.5px solid var(--ochre);
  background: linear-gradient(var(--sheet), var(--sheet)) padding-box, repeating-linear-gradient(45deg, var(--ochre) 0 6px, transparent 6px 12px) border-box;
  border: 6px solid transparent;
  outline: 1.5px solid var(--ochre);
  outline-offset: -6px;
}

.jx-title { font: 600 22px/1.15 var(--draft); margin: 0 0 6px; letter-spacing: 0.01em; max-width: none; }
.jx-text { font-size: 16.5px; line-height: 1.6; margin: 0 0 10px; max-width: none; }
.jx-links { font-size: 14.5px; color: var(--ink-2); margin: 10px 0 0; max-width: none; }
.jx-links b { font: 600 14.5px var(--draft); color: var(--ink); margin-right: 0.3em; }

.chain { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.chain li {
  counter-increment: step;
  position: relative;
  margin: 0 0 6px;
  padding: 6px 10px 6px 42px;
  border: 1px solid var(--ink);
  background: var(--sheet);
  font-size: 15.5px;
  line-height: 1.45;
}
.chain li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 30px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--ink);
  font: 600 15px var(--draft);
}
.chain li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 14px;
  bottom: -7px;
  border: 4px solid transparent;
  border-top: 5px solid var(--ink);
}

/* ---------- field sections ---------- */

.field { margin: 3.6em 0 0; }
.field h3 { font-size: 30px; margin-top: 0; }
.field-q, .field-from, .field-adds { font-size: 16.5px; margin: 0 0 6px; }
.field-q b, .field-from b, .field-adds b { font: 600 16px var(--draft); letter-spacing: 0.01em; margin-right: 0.35em; }
.field-src { font-size: 13.5px; color: var(--ink-2); margin: 0 0 4px; }

/* ---------- charts of real data ---------- */

.plot .dot.md { fill: var(--madder); }
.plot.chart .ln.faint { opacity: 0.22; stroke-width: 1.4; }
.plot.chart .ln.thick { stroke-width: 2.2; }

.plot.chart .lb.tick { font-size: 12.5px; fill: var(--ink-2); }
.plot.chart .lb.ptitle { font: 600 14px var(--draft); fill: var(--ink); letter-spacing: 0.01em; }

.plot.chart .lb.now { font: 600 14px var(--draft); fill: var(--madder); }
.plot.chart .lb.now.big { font-size: 40px; fill: var(--ink); opacity: 0.85; }

.plot.chart .lb.note { font-size: 12.5px; }

/* ---------- the site: three parts and the textbooks ---------- */
nav.site {
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font: 500 15px/1 var(--draft);
}
nav.site a {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px 5px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(238, 242, 234, 0.92);
  border: 1px solid var(--ink-2);
}
nav.site a span { font-weight: 600; color: var(--madder); }
nav.site a.site-home { font-weight: 600; background: var(--ink); color: var(--sheet); border-color: var(--ink); }
nav.site a[aria-current='page'] { border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--madder); }
nav.site a:hover { background: #fff; }
nav.site a:focus-visible { outline: 2px solid var(--madder); outline-offset: 2px; }
body.unfolded nav.site { display: none; }

/* in an exhibit the panel lists the parts in play */

#expo-labels a.xl { color: #ffd27a; text-decoration: none; border-bottom: 1px solid rgba(255, 210, 122, 0.5); cursor: pointer; }
#expo-labels a.xl:hover { color: #fff; }
#expo-labels a.xl i { font-style: normal; font: 600 11px var(--draft); color: var(--redline); margin-right: 4px; }

.desk { padding-top: 72px; }
body.site-page .desk { padding-bottom: 96px; }
.sheet.landing { padding-bottom: 96px; }

.parts-index { list-style: none; margin: 2.4em 0 3em; padding: 0; display: grid; gap: 14px; }
.parts-index a {
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-rows: auto auto;
  column-gap: 18px;
  padding: 18px 22px 20px;
  color: var(--ink);
  text-decoration: none;
  border: 1.5px solid var(--ink);
  border-left-width: 5px;
  background: rgba(238, 242, 234, 0.85);
}
.parts-index a:hover { background: #fff; }
.parts-index a:focus-visible { outline: 2px solid var(--madder); outline-offset: 3px; }
.pi-no { grid-row: 1 / 3; font: 600 54px/0.9 var(--draft); color: var(--madder); }
.pi-title { font: 600 26px/1.2 var(--draft); }
.pi-text { margin-top: 6px; max-width: 64ch; line-height: 1.55; }

.textbooks h3 { margin-top: 1.4em; }
.course-grid { list-style: none; padding: 0; margin: 0.6em 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.course-grid a { display: grid; gap: 2px; padding: 10px 12px; color: var(--ink); text-decoration: none; border: 1px solid var(--ink-2); background: var(--sheet); }
.course-grid a:hover { border-color: var(--ink); background: #fff; }
.course-grid a:focus-visible { outline: 2px solid var(--madder); outline-offset: 2px; }
.course-grid b { font: 600 18px/1.1 var(--draft); }
.course-grid span { font-size: 0.92em; }
.course-grid i { font-size: 0.8em; color: var(--ink-2); }
@media (max-width: 720px) {
  nav.site { position: static; margin: 10px 12px 0; }
  .desk { padding: 16px 12px 120px; }
  .parts-index a { grid-template-columns: 44px 1fr; }
  .pi-no { font-size: 40px; }
}

/* ---------- part 2: the project list ---------- */

.projects { list-style: none; padding: 0; margin: 1em 0 1.6em; display: grid; gap: 10px; }
.projects a { display: grid; gap: 3px; padding: 12px 16px; color: var(--ink); text-decoration: none; border: 1px solid var(--ink-2); border-left: 4px solid var(--blueprint); background: var(--sheet); }
.projects a:hover { background: #fff; border-color: var(--ink); }
.projects a:focus-visible { outline: 2px solid var(--madder); outline-offset: 2px; }
.projects b { font: 600 19px var(--draft); }
.projects span { font-style: italic; color: var(--ink-2); }
.projects i { font-style: normal; line-height: 1.5; }

/* ---------- part 3 and the course pages ---------- */

.paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.paths section { padding: 12px 16px; border: 1px solid var(--ink-2); background: var(--sheet); }
.paths h3 { margin: 0 0 0.4em; font-size: 1.05em; }
.paths ol { margin: 0; padding-left: 1.3em; }
.paths li { margin: 0.3em 0; line-height: 1.45; }
.kicker { margin: 0 0 0.2em; font: 600 15px var(--draft); color: var(--madder); }
.course-links { list-style: none; padding: 0; display: grid; gap: 8px; }
.course-links li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.course-links a { color: var(--ink); }
.course-links a b { font: 600 17px var(--draft); }
.course-links a span { margin-left: 8px; font-style: italic; color: var(--ink-2); }

.course-page .weeks { margin-top: 0.8em; }
/* a course's path of units (course.js) */
.units-path { max-width: 760px; margin: 1.2em 0 0; padding-left: 1.8em; }
.units-path li { margin: 0 0 0.7em; line-height: 1.45; }
.units-path li::marker { font: 600 17px var(--draft); color: var(--ochre); }
.units-path a { color: var(--ink); }
.units-path a b { font: 600 17px var(--draft); margin-right: 0.3em; }
.units-path span { display: block; color: var(--ink-2); font-size: 0.95em; }
.units-path span i { font-style: normal; font: 600 14px var(--draft); color: var(--ink); margin-right: 0.2em; }
.plot .lb.stop { font: 600 15px var(--draft); fill: var(--ink); }

/* ================================================================
   Part 1, flat (classical.html): eight stages, each a revision of one drawing.
   ================================================================ */

.p1 .opening ul { max-width: 640px; margin: 0 0 1em; padding-left: 1.2em; }
.p1 .opening li { margin: 0.15em 0; }

.contents {
  list-style: none;
  margin: 2.4em 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 320px));
  gap: 2px 40px;
  font: 500 23px/1.35 var(--draft);
}
.contents a { color: var(--ink); text-decoration: none; display: flex; gap: 0.5em; padding: 3px 0; border-bottom: 1px solid var(--rule); }
.contents a:hover, .contents a:focus-visible { color: var(--cobalt); }
.contents span { min-width: 1.1em; color: transparent; -webkit-text-stroke: 1px var(--ink); }
/* Part 2's two halves, each under its name */
.contents-half { margin: 2em 0 0; font: 600 18px/1.3 var(--draft); color: var(--ink-2); }
.contents-half + .contents { margin-top: 0.4em; }
.contents-half ~ .contents:last-of-type { margin-top: 1.2em; }

.stage { padding-top: 40px; margin-bottom: 170px; clear: both; counter-reset: eq; }
.stage > ul, .course > ul { max-width: 640px; padding-left: 1.2em; margin: 0 0 1em; }
.stage > ul li, .course > ul li { margin: 0.2em 0; }

/* the revision note: what this stage adds to the drawing */
.adds { max-width: 760px; margin: 6px 0 2.4em; padding: 14px 0 0; border-top: 1.5px solid var(--ink); }
.adds p { display: flex; align-items: flex-start; gap: 14px; max-width: 700px; margin: 0; font-size: 22px; line-height: 1.4; }
.rev {
  flex: none;
  display: grid;
  place-items: end center;
  width: 34px;
  height: 30px;
  padding-bottom: 3px;
  margin-top: 1px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: var(--ink);
  color: var(--sheet);
  font: 600 15px/1 var(--draft);
}
.cast { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0 48px; padding: 0; }
.cast li { font: 500 15px/1.5 var(--draft); padding: 0 8px; border: 1px solid var(--rule); color: var(--ink-2); letter-spacing: 0.01em; }
.cast li.new { border-color: var(--cobalt); color: var(--cobalt); background: rgba(42, 85, 160, 0.06); }

/* what the figure holds fixed: the axis the fold will raise */
.held { max-width: 640px; margin: 0.5em 0 0; padding-left: 10px; border-left: 2px solid var(--cobalt); font-size: 15.5px; line-height: 1.45; color: var(--ink); }
.held span { font: 600 15px var(--draft); color: var(--cobalt); letter-spacing: 0.01em; margin-right: 0.55em; }

.aha {
  max-width: 620px;
  margin: 1.1em 0 1.9em;
  padding-left: 18px;
  border-left: 3px solid var(--madder);
  font-size: 21px;
  line-height: 1.45;
  font-style: italic;
}

.transition { margin-top: 2.6em; padding-top: 0.9em; border-top: 1px solid var(--rule); color: var(--ink-2); font-style: italic; }

.note.later b, .builds b { font: 600 15px var(--draft); color: var(--ink); letter-spacing: 0.01em; margin-right: 0.35em; }
.note.later a, .builds a, .stage p a, .stage li a, .stage td a { color: var(--cobalt); text-decoration: none; border-bottom: 1px solid rgba(42, 85, 160, 0.35); }
.note.later a:hover, .builds a:hover, .stage p a:hover, .stage td a:hover { border-bottom-color: var(--cobalt); }

/* figures with two panels */
.panels.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panels.stack > div + div { margin-top: 10px; }
.fig-error { font-size: 15px; color: var(--madder); }
.plot .ln.faint { opacity: 0.3; }
.plot .ln.ghost { opacity: 0.13; }
.plot .lb.tick { font-size: 12.5px; fill: var(--ink-2); font-style: normal; }
.plot .lb.ptitle { font: 600 14px var(--draft); fill: var(--ink); letter-spacing: 0.01em; }
.plot .ring.cb { stroke: var(--cobalt); }

/* stage 8: groups of field courses */
.group {
  font: 500 clamp(30px, 3.4vw, 40px)/1.05 var(--draft);
  letter-spacing: -0.005em;
  margin: 3.2em 0 0.2em;
  padding-top: 0.5em;
  border-top: 1.5px solid var(--ink);
  max-width: 760px;
}
.course { margin: 2.6em 0 4em; }
.course h4 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; max-width: 760px; margin: 0 0 0.6em; font: 600 25px/1.2 var(--draft); letter-spacing: 0.01em; }
.cno { color: var(--ink-2); font-weight: 500; }
.cpage { margin-left: auto; font: 500 16px var(--draft); color: var(--cobalt); text-decoration: none; border: 1px solid rgba(42, 85, 160, 0.4); padding: 0 8px; }
.cpage:hover, .cpage:focus-visible { background: rgba(42, 85, 160, 0.08); }
.builds { font-size: 16px; color: var(--ink-2); }

.stage.closing h2 { font-size: clamp(40px, 4.4vw, 60px); }

.p1 :target { scroll-margin-top: 40px; }
.p1 figure:target .fig-art { outline: 2px solid var(--ochre); outline-offset: 6px; }

@media (max-width: 760px) {
  .contents { grid-template-columns: 1fr; font-size: 20px; }
  .adds p { font-size: 19px; }
  .cast { margin-left: 0; }
  .aha { font-size: 19px; }
  .panels.two { grid-template-columns: 1fr; }
  .cpage { margin-left: 0; }
}

/* margin notes sit inside the sheet, beside the 640px reading column */
.p1 .stage { max-width: 980px; }
.p1 .note { margin-right: 0; width: 240px; }
.p1 .fig.wide { clear: right; }
@media (max-width: 1180px) { .p1 .note { width: auto; } }
@media (max-width: 760px) {
  .p1 .titleblock .tb-sub, .p1 .titleblock .tb-counts { display: none; }
  .p1 .titleblock .tb-title { border-bottom: 0; }
}

/* live figures (Part 2): the reader's settings sit under the drawing */
.fig-ctl { display: flex; align-items: center; gap: 12px; max-width: 640px; margin-top: 10px; font: 500 16px var(--draft); }
.fig-ctl label { display: flex; align-items: center; gap: 10px; flex: 1; }
.fig-ctl input { flex: 1; max-width: 380px; accent-color: var(--madder); }
.fig-ctl output { min-width: 3em; font-variant-numeric: tabular-nums; }
.fig-ctl.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 18px; }
.fig-ctl.grid input { width: 100%; }
.p2 .projects { max-width: 760px; }

/* doors: names in the folded archive that open a course */
#expo-labels a.xl.door { font: 500 15px/1.2 var(--draft); padding: 3px 8px 4px; background: rgba(10, 34, 60, 0.82); border: 1px solid rgba(255, 210, 122, 0.6); }
#expo-labels a.xl.door:hover, #expo-labels a.xl.door:focus-visible { background: rgba(255, 210, 122, 0.95); color: var(--blueprint); }

/* Part 3, folded: the rooms' names are doors, reachable from the keyboard */
#expo-doors { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
body:not(.unfolded) #expo-doors { display: none; }
#expo-doors a.xl.room.door { color: var(--chalk); text-decoration: none; padding: 3px 9px 4px 0; background: rgba(10, 34, 60, 0.55); }
#expo-doors a.xl.room.door:hover, #expo-doors a.xl.room.door:focus-visible { color: #ffd27a; border-color: #ffd27a; outline: 2px solid #ffd27a; outline-offset: 3px; }
.xl.route { font: 600 15px/1.2 var(--draft); padding: 3px 8px 4px; color: #fff; background: rgba(8, 26, 46, 0.85); border-left: 3px solid currentColor; text-shadow: none; }
.xl.route.ochre { color: #ffd27a; }
.xl.route.cobalt { color: #8fb6ff; }
.xl.route.olive { color: #bfe07a; }
.xl.route.madder { color: #ff9c9c; }
.xl.route.violet { color: #cfa8ff; }
.xl.route.chalk { color: var(--chalk); }

/* Part 3: the relations, a unit card, the rules, every unit */
.relations td:first-child { font: 600 16px var(--draft); text-align: left; width: 6em; }
.relations td:nth-child(2) { font-weight: 400; }
.relations td:last-child { font-style: normal; }
.unit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; border: 1.5px solid var(--ink); background: var(--sheet); }
.unit > div { padding: 10px 14px 12px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.unit > div:nth-child(3n) { border-right: 0; }
.unit > div:nth-last-child(-n + 3) { border-bottom: 0; }
.unit dt { font: 600 15px var(--draft); color: var(--ink-2); margin-bottom: 4px; }
.unit dd { margin: 0; line-height: 1.45; }
@media (max-width: 760px) {
  .unit { grid-template-columns: 1fr; }
  .unit > div, .unit > div:nth-child(3n) { border-right: 0; border-bottom: 1px solid var(--ink); }
  .unit > div:last-child { border-bottom: 0; }
}
.rules { max-width: 700px; }
.rules li { margin: 0.35em 0; line-height: 1.5; }
details.units { margin: 1.4em 0; max-width: 940px; }
details.units summary { cursor: pointer; font: 600 17px var(--draft); }
details.units .partslist { margin-top: 0.8em; }
details.units td:first-child { font: 400 15px var(--serif); text-align: left; width: auto; }
details.units td:nth-child(2) { font-weight: 400; }
details.units td { font-size: 14.5px; }
.paths-fig .paths { margin-bottom: 0.4em; }

/* Part 2: the methods a model needs, the old arguments, the five tasks */
.methods td:first-child, .debates td:nth-child(3) { font: 400 16px/1.4 var(--serif); text-align: left; width: auto; }
.methods td:nth-child(2) { font-weight: 400; }
.methods td:nth-child(3) { font: 500 15px var(--draft); white-space: nowrap; }
.methods td:last-child { font-style: normal; white-space: nowrap; }
.debates td:first-child { width: 5.5em; }
.debates td:nth-child(2) { font-weight: 600; width: 11em; }
.tasks { max-width: 760px; margin: 0; padding: 16px 20px 16px 2.4em; border: 1.5px solid var(--ink); background: var(--sheet); }
.tasks li { margin: 0.45em 0; line-height: 1.5; }
.tasks li::marker { font: 600 18px var(--draft); }
.tasks b { font: 600 17px var(--draft); margin-right: 0.3em; }
.stage h4.sub { font: 600 20px/1.2 var(--draft); margin: 1.6em 0 0.4em; max-width: 760px; }
/* dense figures (plans and tables of the wheel) keep a legible width on a
   narrow screen and scroll sideways instead */
@media (max-width: 760px) {
  .fig.dense .fig-art { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .fig.dense .fig-art svg { min-width: 720px; }
}

/* Part 3: the plan of the archive */
.plot .lb.room { font: 500 17px var(--draft); fill: var(--ink); }
/* Part 3's plans in a model's state (p3-figs.js) */
.plot .lb.room.out { fill: var(--ink-2); opacity: 0.6; }
.plot .lb.room.small { font-size: 14.5px; }
.plot .lb.note.held { fill: var(--ink); font-size: 13px; }
.plot .lb.note.col { font: 500 13px var(--draft); font-style: normal; fill: var(--ink); }
.plot .ln.faint { opacity: 0.45; }
.plot .ring.k { stroke: var(--ink); }
.plot .lb.note.small { font-size: 11.5px; }
.plot .lb.halo { paint-order: stroke; stroke: var(--sheet); stroke-width: 4px; stroke-linejoin: round; }
.plot .ring.dash { stroke-dasharray: 3 3; }
.p3 .plot .lb.room, .plot .lb.note.held { paint-order: stroke; stroke: var(--sheet); stroke-width: 4px; stroke-linejoin: round; }
.plot a.room-door:hover .lb.room, .plot a.room-door:focus .lb.room { fill: var(--cobalt); text-decoration: underline; }
.p3 .paths { max-width: 760px; }

/* Part 3, Figure 3.12: the eight works, placed by what they wait for, with
   the arrows drawn between them (p3-works.js); each work's number is a
   balloon, as an item is numbered on a drawing */
.works { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 24px; row-gap: 22px; margin: 0 0 0.4em; }
.work { position: relative; z-index: 1; align-self: start; padding: 7px 9px 9px; border: 1.5px solid var(--ink); background: var(--sheet); }
.work.mid { align-self: center; }
.work:target { outline: 2px solid var(--cobalt); outline-offset: 3px; }
.work h3 { margin: 0; font: 600 17px/1.15 var(--draft); }
.work .wno { display: inline-grid; place-items: center; width: 21px; height: 21px; margin-right: 6px; border: 1.5px solid var(--ink); border-radius: 50%; font: 600 13px/1 var(--draft); vertical-align: 1px; }
.work .hands { margin: 4px 0 7px; font: italic 14px/1.3 var(--serif); }
.work .after { display: none; }
.reads { margin: 0; padding: 0; list-style: none; }
#w-7 .reads { column-count: 2; column-gap: 16px; }
.reads li { break-inside: avoid; }
.reads a { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--ink); text-decoration: none; font: 500 14px/1.55 var(--draft); }
.reads a:hover .bk { color: var(--cobalt); text-decoration: underline; }
.reads a:focus-visible { outline: 2px solid var(--madder); outline-offset: 1px; }
.ticks { display: flex; flex: none; gap: 1.6px; }
.ticks i { width: 1.6px; height: 10px; background: var(--ink); }
.ticks i.off { opacity: 0.2; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wires { position: absolute; inset: 0; z-index: 0; overflow: visible; pointer-events: none; }
.wires path { fill: none; stroke: var(--ink); stroke-width: 1.3; }
.wires marker path { fill: var(--ink); stroke: none; }
@media (min-width: 761px) {
  .work { grid-column: var(--c); grid-row: var(--r); }
}
@media (max-width: 760px) {
  .works { grid-template-columns: minmax(0, 1fr); row-gap: 10px; }
  .wires { display: none; }
  .work .after { display: block; margin: 0 0 6px; font: 500 13px var(--draft); color: var(--ink-2); }
}
/* the twenty-two books, and the tests of each work */
.books td:first-child { width: 14em; font: 600 15.5px/1.35 var(--serif); text-align: left; }
.books td:nth-child(2) { font-weight: 400; }
.books td:nth-child(3) { width: 4em; font: 500 15px var(--draft); text-align: center; }
.books td:nth-child(4) { width: 9em; font: 500 15px/1.4 var(--draft); }
.books .bno { margin-right: 0.45em; font: 500 15px var(--draft); color: var(--ink-2); }
.books tr.grp th { background: rgba(31, 35, 30, 0.05); }
.books tr:target td { background: rgba(42, 85, 160, 0.08); }
@media (max-width: 760px) {
  .books { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .books table { min-width: 720px; }
}
details.tests ol { max-width: 760px; margin: 0.8em 0 0; padding-left: 1.6em; }
details.tests li { margin: 0.9em 0; line-height: 1.5; }
details.tests li::marker { font: 600 17px var(--draft); }
details.tests b { font: 600 17px var(--draft); }
details.tests p { margin: 0.15em 0 0.25em; }
details.tests ol.three { margin: 0; padding-left: 1.7em; list-style: none; counter-reset: test; }
details.tests ol.three li { margin: 0.2em 0; counter-increment: test; }
details.tests ol.three li::before { content: '(' counter(test) ')'; display: inline-block; width: 1.7em; margin-left: -1.7em; font: 500 15px var(--draft); }

/* ---------- the caption of a story told in the folded space ---------- */

.story {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 35;
  width: min(600px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 14px 20px 12px;
  background: rgba(10, 34, 60, 0.9);
  border-top: 2px solid #ffd27a;
  color: var(--chalk);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s;
}
body:not(.unfolded) .story { display: none; }
.story.on { opacity: 1; }
.story .say { margin: 0; font: 19px/1.45 var(--serif); }
.story .say.in { animation: say-in 0.5s ease-out; }
.story .say i { font-style: italic; }
.story .beats { display: flex; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.story .beats li { width: 18px; height: 3px; background: rgba(220, 231, 243, 0.25); }
.story .beats li.done { background: rgba(255, 210, 122, 0.55); }
.story .beats li.now { background: #ffd27a; }
@keyframes say-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .story .say.in { animation: none; } }
/* the caption keeps clear of the title block: beside it where the window is
   too narrow to centre it, and at the top once the block spans the bottom */
@media (max-width: 1320px) { .story { left: 20px; transform: none; width: min(600px, calc(100vw - 390px)); } }
@media (max-width: 760px) { .story { top: 12px; bottom: auto; left: 12px; width: calc(100vw - 24px); } }
@media (max-width: 640px) { .story { padding: 12px 14px 10px; } .story .say { font-size: 16px; } }

/* the Korean twin of each page (docs/i18n.md): Hangul set in Noto Serif KR
   beside Computer Modern, and in IBM Plex Sans KR beside Barlow Condensed */
:root:lang(ko) {
  --serif: 'CMU Serif', 'Noto Serif KR', 'Apple SD Gothic Neo', serif;
  --draft: 'Barlow Condensed', 'IBM Plex Sans KR', 'Apple SD Gothic Neo', sans-serif;
}
:lang(ko) body, :lang(ko) .sheet { word-break: keep-all; overflow-wrap: anywhere; }
/* the two languages, side by side; the one being read is filled */
nav.site .langs { display: inline-flex; margin-left: 10px; }
nav.site .langs a + a { border-left: 0; }
nav.site .langs a[aria-current='true'] { background: var(--ink); color: var(--sheet); border-color: var(--ink); cursor: default; }
