/* The Riemann post: a reference book (the dictionary binding, docs/BOOKS.md). A printed page in
   Libre Caslon on the binding's paper, read top to bottom like an article; the laptop's screens
   and the map of the proof are dark plates set into it as figures. --paper is the page's first
   colour and matches <meta name="theme-color">. */
@font-face { font-family: 'Libre Caslon Text'; src: url('/fonts/books/libre-caslon-normal-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Libre Caslon Text'; src: url('/fonts/books/libre-caslon-italic-400.woff2') format('woff2'); font-style: italic; font-weight: 400; font-display: swap; }
@font-face { font-family: 'Libre Caslon Text'; src: url('/fonts/books/libre-caslon-normal-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Caveat Brush'; src: url('/fonts/books/caveat-brush-normal-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/books/plex-mono-normal-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/books/plex-mono-italic-400.woff2') format('woff2'); font-style: italic; font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/books/plex-mono-normal-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --paper: #f6f1df; --ink: #1f1b16; --soft: #6b6253; --rule: rgba(31, 27, 22, 0.17); --tint: #ece4cb;
  --red: #b8322a; --navy: #1d2d4f; --pen: #1d3fb5;
  --plate: #0d141c; --plate-rule: rgba(170, 205, 225, 0.17); --plate-ink: #c5d6e2; --plate-soft: #6f8fa3; --cyan: #7fdcf0; --ok: #93e6ae;
  --serif: 'Libre Caslon Text', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --measure: 660px; --plate-width: 1120px;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 18px/1.62 var(--serif); -webkit-font-smoothing: antialiased; font-variant-numeric: lining-nums; }
h1, h2, p, ul, ol, figure, pre, table { margin: 0; }
main { padding: 0 24px 120px; }
main > * { max-width: var(--measure); margin-left: auto; margin-right: auto; }
main > .wide { max-width: var(--plate-width); }
a { color: inherit; text-decoration-color: var(--red); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red); }
button { font: inherit; color: inherit; }
section p { margin: 0 0 0.9em; }
section p:last-child { margin-bottom: 0; }

/* ---------- The first screen: the laptop at work ---------- */
.hero { position: relative; padding: 74px 0 0; --mid: calc((100% - 236px) / 2); }
/* Guide words over the page, as a dictionary prints the first and last words on it. */
.hero::before, .hero::after { position: absolute; top: 30px; font: 700 13px/1 var(--serif); letter-spacing: 0.08em; text-transform: uppercase; color: var(--red); }
.hero::before { content: 'Riemann'; left: var(--mid); transform: translateX(calc(-100% - 22px)); }
.hero::after { content: 'verify'; left: var(--mid); transform: translateX(22px); }
.hero > .badge::before { content: '✦'; position: absolute; top: 28px; left: var(--mid); transform: translateX(-50%); color: var(--ink); font-size: 12px; }
.hero h1 { margin-top: 10px; padding-top: 14px; border-top: 3px double var(--ink); font: 700 clamp(27px, 3.5vw, 40px) / 1.12 var(--serif); letter-spacing: -0.012em; text-wrap: balance; }
.lede { margin-top: 56px !important; font-size: 20px; line-height: 1.55; }
/* Notes in the margin, by hand, each beside the thing it is about (as on the Turing post). The first
   screen keeps a right-hand margin for them; without room for one, each sits under its thing. */
main > .hero { max-width: 1296px; padding-right: 236px; }
.noted { position: relative; margin-top: 16px; }
.noted > :first-child { margin-top: 0; }
.note { position: absolute; left: calc(100% + 40px); top: 4px; width: 192px; font: 400 19px/1.16 'Caveat Brush', 'Segoe Print', 'Bradley Hand', cursive; color: var(--pen); transform: rotate(-1.4deg); transform-origin: 0 0; }
.note svg { position: absolute; right: calc(100% + 5px); top: 2px; width: 30px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* A proof with few folders has a short list of bars: room for its note all the same. */
@media (min-width: 1291px) { .area-bars { min-height: 76px; } }
@media (max-width: 1290px) {
  main > .hero { max-width: var(--plate-width); padding-right: 0; --mid: 50%; }
  .note { position: relative; left: auto; top: auto; width: auto; max-width: 560px; margin: 7px 0 0 34px; transform: none; }
  .note svg { right: auto; left: -32px; top: -2px; transform: rotate(62deg); }
}
.badge { display: flex; align-items: center; gap: 9px; font: 600 12px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); }
.badge i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge[data-state='live'] { color: var(--red); }
.badge[data-state='live'] i { animation: pulse 1.6s ease-in-out infinite; }
.badge[data-state='replay'], .badge[data-state='done'] { color: var(--navy); }
.badge[data-state='failed'] { color: var(--red); }
@keyframes pulse { 50% { opacity: 0.25; } }

/* The versions of the proof, as a reference book does it: the book's page edges run along the foot of
   the window (red, like the dictionary binding's), and a thumb-index tab stands up from them for each
   version. The open version's tab is red and taller. Each version is its own page; between them the
   red tab slides across (a view transition) instead of the page blinking. The thin line in a tab is
   how far that version's run got. */
@view-transition { navigation: auto; }
::view-transition-group(switch-on) { animation-duration: 0.42s; animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.25s; }
body::after { content: ''; position: fixed; z-index: 19; left: 0; right: 0; bottom: 0; height: 9px; pointer-events: none; background: repeating-linear-gradient(to bottom, #e6dcc0 0 1px, #f3ecd6 1px 3px); border-top: 1px solid rgba(31, 27, 22, 0.25); box-shadow: inset 0 -3px 0 var(--red); }
.switch { position: fixed; z-index: 20; left: 50%; bottom: 9px; transform: translateX(-50%); display: flex; align-items: flex-end; gap: 10px; view-transition-name: switch; }
.switch:empty { display: none; }
.switch-item { position: relative; display: grid; min-width: 200px; padding: 7px 20px 13px; border-radius: 9px 9px 0 0; background: #23365c; color: #f6f1df; text-decoration: none; isolation: isolate; box-shadow: 0 -3px 12px -6px rgba(31, 27, 22, 0.45); transition: padding-top 0.18s ease, background 0.18s ease; }
.switch-item:hover { padding-top: 10px; background: #2b4170; color: #fff; }
.switch-item b { font: 700 15px/1.2 var(--serif); font-variant: small-caps; letter-spacing: 0.05em; }
.switch-item small { font: 10.5px/1.4 var(--mono); color: rgba(246, 241, 223, 0.66); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch-item i { position: absolute; left: 20px; right: 20px; bottom: 6px; height: 2px; background: rgba(246, 241, 223, 0.2); }
.switch-item u { display: block; width: calc(var(--done, 0) * 100%); height: 100%; background: #e7a39d; transition: width 0.6s ease; }
.switch-item[data-state='finished'] u { background: #f6f1df; }
.switch-on { position: absolute; z-index: -1; inset: 0; border-radius: inherit; background: var(--red); view-transition-name: switch-on; }
.switch-item[aria-current], .switch-item[aria-current]:hover { padding-top: 13px; background: none; color: #fff; }
.switch-item[aria-current] small { color: rgba(255, 255, 255, 0.78); }
.switch-item[aria-current] u { background: #fff; }
@media (max-width: 560px) {
  .switch { left: 8px; right: 8px; transform: none; gap: 6px; }
  .switch-item { flex: 1; min-width: 0; padding: 6px 12px 12px; }
  .switch-item[aria-current], .switch-item[aria-current]:hover { padding-top: 10px; }
  .switch-item i { left: 12px; right: 12px; }
}

.tally { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 10px 28px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ink); }
.tally-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.tally-main b { font-size: clamp(36px, 5vw, 52px); line-height: 1; font-weight: 700; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.02em; }
.tally-main > span { font-style: italic; color: var(--soft); }
.tally-rest { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 26px; padding-bottom: 4px; font-size: 15px; color: var(--soft); }
.tally-rest > span { white-space: nowrap; }
.tally-rest b { color: var(--ink); font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }
.bar { grid-column: 1 / -1; height: 6px; background: var(--tint); border: 1px solid var(--rule); }
.bar i { display: block; height: 100%; width: 0; min-width: 2px; background: var(--red); }

/* A bar for each part of the proof. */
.area-bars { columns: 2; column-gap: 56px; margin-top: 16px; }
.area { display: grid; grid-template-columns: 204px minmax(24px, 1fr) auto; align-items: center; column-gap: 12px; height: 24px; break-inside: avoid; font-size: 13.5px; }
.area-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border: 1px solid rgba(31, 27, 22, 0.45); }
.mini { display: block; height: 6px; background: var(--tint); border: 1px solid var(--rule); }
.mini u { display: block; height: 100%; width: 0; background: var(--navy); }
.area-n { min-width: 98px; text-align: right; font: 11.5px var(--mono); color: var(--soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.area-n b { color: var(--ink); font-weight: 600; }

/* ---------- Prof's words ---------- */
.words:empty { display: none; }
.words:not(:empty) { padding-top: 40px; }
.words p { margin: 0 0 1em; }
.words h2 { margin: 1.8em 0 0.5em; font-size: 24px; line-height: 1.25; }
.words blockquote { margin: 1.3em 0; padding-left: 1.1em; border-left: 3px solid var(--red); font-style: italic; }

/* ---------- The text ---------- */
/* Section titles are headwords: red small capitals. The text is set justified, as a reference book's is. */
section > h2 { margin: 64px 0 16px; font-size: 25px; line-height: 1.2; font-weight: 700; font-variant: small-caps; letter-spacing: 0.02em; color: var(--red); }
.sec { margin-right: 10px; color: var(--ink); font-weight: 400; font-variant: normal; }
section p, .lede { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.lede::first-line { font-variant: small-caps; letter-spacing: 0.03em; }
.display { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 0.9em; margin: 20px 0 22px; font-size: 22px; }
.display math { font-family: 'STIX Two Math', 'Cambria Math', 'Latin Modern Math', math; }
.lean { margin: 14px 0 16px; padding: 12px 16px; border-left: 3px solid var(--navy); background: var(--tint); font: 13.5px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.lean .k { color: var(--red); }
.lean .t { color: var(--navy); font-weight: 600; }
.gloss { width: 100%; margin: 0 0 22px; border-collapse: collapse; font-size: 16px; line-height: 1.45; }
.gloss td { padding: 7px 0; border-top: 1px solid var(--rule); vertical-align: top; }
.gloss tr:last-child td { border-bottom: 1px solid var(--rule); }
.gloss td:first-child { width: 46%; padding-right: 18px; }
code { font: 13.5px var(--mono); }
.goal { margin: -4px 0 18px !important; font: 600 12px/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); }
.goal::before { content: '○ '; }
.goal[data-state='done'] { color: var(--navy); }
.goal[data-state='done']::before { content: '● '; }
.goal[data-state='failed'] { color: var(--red); }

/* ---------- Figures ---------- */
figure.wide { margin-top: 26px; margin-bottom: 30px; }
figcaption { max-width: var(--measure); margin: 12px auto 0; font-size: 15px; line-height: 1.5; color: var(--soft); }
figcaption b { color: var(--ink); }
.key { white-space: nowrap; }
.key i { display: inline-block; width: 9px; height: 9px; margin-right: 5px; vertical-align: 0; }
.k-done { background: var(--navy); }
.k-wait { background: #d8d0bb; }
.k-now { background: var(--red); border-radius: 50%; }
#tower { display: block; width: 100%; height: 190px; }

/* The windows: one file each. */
.lanes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.lane { position: relative; height: 137px; border-radius: 5px; background: var(--plate); color: var(--plate-ink); overflow: hidden; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25), 0 8px 22px -14px rgba(13, 20, 28, 0.6); }
.lane-head { display: flex; align-items: baseline; gap: 8px; height: 26px; padding: 0 9px; border-bottom: 1px solid var(--plate-rule); font: 11px/26px var(--mono); white-space: nowrap; }
.lane-core { flex: none; color: var(--plate-soft); }
.lane-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #fff; font-weight: 600; direction: rtl; text-align: left; }
.lane-name bdi { direction: ltr; }
.lane-clock { flex: none; color: var(--cyan); font-variant-numeric: tabular-nums; }
.lane-view { position: absolute; inset: 27px 0 0; overflow: hidden; }
.lane-code { position: absolute; left: 0; right: 0; top: 0; padding: 0 9px; font: 10.5px/15px var(--mono); white-space: pre; will-change: transform; transition: transform 0.9s linear; }
.lane-code div { height: 15px; overflow: hidden; color: #86aebf; }
.lane-code div.read { color: #4d8468; }
.lane-code div.at { color: #fff; background: linear-gradient(90deg, rgba(127, 220, 240, 0.2), transparent 85%); box-shadow: -9px 0 0 rgba(127, 220, 240, 0.2), inset 2px 0 0 var(--cyan); }
.lane-code .c { color: #527886; font-style: italic; }
.lane-code .k { color: var(--cyan); }
.lane-code div.read .k, .lane-code div.read .c { color: inherit; }
.lane-idle { position: absolute; inset: 27px 0 0; display: grid; place-items: center; font: 11px var(--mono); color: var(--plate-soft); opacity: 0.7; }
.lane-done { position: absolute; inset: 27px 0 0; display: grid; place-items: center; font: 600 13px var(--mono); color: var(--ok); background: rgba(13, 20, 28, 0.84); opacity: 0; pointer-events: none; transition: opacity 0.18s ease; }
.lane[data-state='done'] { box-shadow: 0 0 0 1.5px var(--ok); }
.lane[data-state='done'] .lane-done { opacity: 1; }
.lane[data-state='busy'] .lane-idle, .lane[data-state='done'] .lane-idle { display: none; }
.lane[data-state='idle'] .lane-code { display: none; }

/* The files as they pass, newest on top: each new one pushes the rest down. */
.ticker { height: 132px; margin-top: 12px; padding: 0; list-style: none; overflow: hidden; font: 12.5px/22px var(--mono); color: var(--soft); -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.ticker li { display: flex; gap: 10px; height: 22px; white-space: nowrap; overflow: hidden; }
.ticker li.new { animation: pass 0.45s ease-out; }
@keyframes pass { from { height: 0; opacity: 0; } }
.ticker li::before { content: '✓'; color: var(--navy); }
.ticker bdi { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; color: var(--ink); }
.ticker span { flex: none; font-variant-numeric: tabular-nums; }

/* The map. */
.map { position: relative; border-radius: 5px; background: #081014; overflow: hidden; line-height: 0; box-shadow: 0 8px 22px -14px rgba(13, 20, 28, 0.6); }
.map canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; cursor: crosshair; }
.map-labels { position: absolute; inset: 0; pointer-events: none; }
.map-labels span { position: absolute; transform: translate(-50%, -50%); padding: 1px 7px; border-radius: 3px; font: 600 11px/16px var(--mono); white-space: nowrap; color: #fff; background: rgba(8, 16, 20, 0.72); }
.tip { position: absolute; z-index: 2; max-width: min(520px, 92%); padding: 6px 9px; border: 1px solid var(--plate-rule); border-radius: 4px; background: rgba(8, 16, 20, 0.95); color: var(--plate-ink); font: 11px/1.45 var(--mono); pointer-events: none; overflow-wrap: anywhere; }
.tip b { display: block; color: #fff; font-weight: 600; }
.peek { margin-top: 12px; border-radius: 5px; background: var(--plate); color: var(--plate-ink); overflow: hidden; }
.peek-head { display: flex; align-items: baseline; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--plate-rule); font: 12px var(--mono); }
.peek-head b { min-width: 0; color: #fff; font-weight: 600; overflow-wrap: anywhere; }
.peek-head span { flex: 1; color: var(--plate-soft); white-space: nowrap; }
.peek-head button { flex: none; width: 26px; height: 26px; border: 1px solid var(--plate-rule); border-radius: 4px; background: none; cursor: pointer; line-height: 1; }
.peek-head button:hover { border-color: var(--cyan); color: var(--cyan); }
.peek pre { max-height: 340px; overflow: auto; padding: 10px 12px; font: 12px/1.5 var(--mono); tab-size: 2; }

/* The folders. */
.areas { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.35; }
.areas caption { padding-bottom: 8px; text-align: left; font-style: italic; color: var(--soft); }
.areas tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px; }
.areas tr { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: baseline; column-gap: 10px; padding: 7px 0 8px; border-top: 1px solid var(--rule); position: relative; }
.areas td { padding: 0; }
.areas .chip { margin: 0; }
.areas b { font-weight: 700; }
.areas em { display: block; font-size: 13.5px; color: var(--soft); }
.areas .n { font: 12.5px var(--mono); color: var(--soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.areas .n b { color: var(--ink); font-weight: 600; }


/* The clock. */
.time { margin-top: 18px; padding: 4px 0 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.time canvas { display: block; width: 100%; height: 60px; cursor: ew-resize; touch-action: none; }
.time-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; font: 12.5px var(--mono); }
.time-controls button { cursor: pointer; }
.round { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--ink); border-radius: 50%; background: none; }
.round svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.round:hover { background: var(--ink); color: var(--paper); }
/* The speed: one of four, the one in use filled in. Live, it is real time, and the four are dimmed. */
.speeds { display: flex; height: 34px; border: 1px solid var(--ink); border-radius: 17px; overflow: hidden; }
.speeds button { padding: 0 13px; border: 0; border-left: 1px solid var(--rule); background: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.speeds button:first-child { border-left: 0; padding-left: 15px; }
.speeds button:last-child { padding-right: 15px; }
.speeds button:hover { background: var(--tint); }
.speeds button[aria-pressed='true'] { color: var(--paper); background: var(--navy); }
.speeds[data-live='true'] { border-color: var(--rule); color: var(--soft); }
.speeds[data-live='true'] button[aria-pressed='true'] { color: var(--soft); background: var(--tint); }
/* Live: a red lamp, lit while the page follows the laptop. */
.live { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 16px 0 13px; border: 1.5px solid var(--red); border-radius: 17px; background: none; color: var(--red); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.live:hover { background: rgba(184, 50, 42, 0.1); }
.live[aria-pressed='true'] { color: #fff; background: var(--red); }
.live[aria-pressed='true'] i { animation: pulse 1.6s ease-in-out infinite; }
.live[data-over='true'] { border-color: var(--navy); color: var(--navy); }
.live[data-over='true'][aria-pressed='true'] { color: #fff; background: var(--navy); }
.live[data-over='true'] i { display: none; }
#time-at { margin-left: auto; color: var(--soft); font-variant-numeric: tabular-nums; }

/* ---------- Notes ---------- */
.notes { margin-top: 72px; padding-top: 18px; border-top: 3px double var(--ink); font-size: 15px; line-height: 1.55; color: var(--soft); }
.notes h2 { margin-bottom: 8px; font: italic 400 15px var(--serif); color: var(--soft); }
.notes ol { padding-left: 1.3em; }
.notes li { margin-bottom: 4px; }

@media (max-width: 900px) {
  .lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tally { grid-template-columns: minmax(0, 1fr); }
  .area-bars { columns: 1; }
  .tally-rest { justify-content: flex-start; padding: 0; }
  .areas tbody { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  main { padding: 0 18px 88px; }
  .hero { padding-top: 92px; }
  .hero::before, .hero::after, .hero > .badge::before { top: 58px; }
  .lede { font-size: 18px; margin-top: 44px !important; }
  .area-bars { columns: 1; }
  .area { grid-template-columns: 178px minmax(24px, 1fr) auto; column-gap: 8px; font-size: 13px; }
  .area-n { min-width: 88px; font-size: 11px; }
  section > h2 { margin-top: 48px; font-size: 24px; }
  .display { font-size: 18px; }
  .gloss, .gloss tbody, .gloss tr, .gloss td { display: block; width: auto !important; }
  .gloss td { border: 0 !important; padding: 0; }
  .gloss tr { padding: 8px 0; border-top: 1px solid var(--rule); }
  .lane:nth-child(n + 7) { display: none; }
  .lean { font-size: 12.5px; padding: 10px 12px; }
  .map-labels span { font-size: 10px; padding: 0 5px; }
  #tower { height: 150px; }
  .time canvas { height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .badge[data-state='live'] i, .live i { animation: none !important; }
  .ticker li.new { animation: none; }
  .lane-code { transition: none; }
}
