/* The frame is rigid; the art is free.
   Global decisions live here, once. Nothing is styled per page. */

:root {
  --ground: #ffffff;       /* around the pages */
  /* Pages: currently the same white as the ground, so no page squares show.
     To bring the off-white pages back, change --paper to #f3f0e8 and --page-edge to transparent. */
  --paper: #ffffff;        /* the pages */
  --page-edge: rgba(0, 0, 0, .09); /* hairline around panel thumbnails, so white pages still read */
  --plate: var(--paper);   /* behind full-bleed images (shows only where the image doesn't fill) */
  --ink: #1e1b17;
  --mark: #d0312d;         /* the red of every underline: current section, links, "you left off here" */
  --ink-soft: #6d675d;
  /* on top of pictures and video (the same in light and dark) */
  --on-media: #fff;
  --on-media-soft: rgba(255, 255, 255, .8);
  --media-bg: #111;                  /* behind video that hasn't loaded */
  --media-scrim: rgba(0, 0, 0, .62); /* the fade under gallery captions */
  --media-text: #eee;
  --media-text-soft: #aaa;
  /* depth-scene weather and light */
  --fx-rain: #dfe6ea;
  --fx-light: #fff;
  --fx-eye: #f2d04a;
  --serif: "EB Garamond", Garamond, "Iowan Old Style", Georgia, serif;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
}
/* Dark (a site setting, switched in the editor): near-black ground and pages, warm off-white ink */
:root[data-theme="dark"] {
  --ground: #191917;
  --paper: #191917;
  --page-edge: rgba(235, 233, 228, .14);
  --ink: #ebe9e4;
  --ink-soft: #a6a39c;
  --mark: #e0524c;          /* the red, a touch brighter so it holds on the dark */
}

* { box-sizing: border-box; }

html, body {
  transition: background-color var(--look-fade, .3s), color var(--look-fade, .3s);   /* a section's own colours fade in */
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}
body { touch-action: auto; }

/* ---------- the header ---------- */

#top {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 5;
  display: flex;
  align-items: center;
  height: clamp(64px, 5.8vw, 92px);
  padding: 0 clamp(20px, 3vw, 48px);
  background: var(--ground);
  border-bottom: var(--rule, 1.5px) solid var(--ink);
}
#brand {
  flex: none;
  font-size: clamp(22px, 2.05vw, 34px);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
#nav {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: clamp(18px, 2.9vw, 46px);
  padding-right: clamp(0px, 7vw, 120px);   /* centers the row a little right of middle, as in the mockup */
}
#nav a {
  font-size: clamp(14px, 1.15vw, 19px);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: var(--nav-ls, 0);
  text-transform: var(--nav-tt, none);
}
#nav a:hover, #nav a.on {
  text-decoration: underline;
  text-decoration-color: var(--mark);
  text-decoration-thickness: var(--ul, 1px);
  text-underline-offset: .42em;       /* low enough to clear descenders (p, g, y) */
}
#top a:focus { outline: none; }
#top a:focus-visible { outline: 1px dotted var(--ink); outline-offset: 4px; }  /* keyboard users only */
#menubtn { display: none; }

/* ---------- grid view ---------- */

#grid {
  position: fixed;
  inset: 0;
  top: var(--hh, 92px);
  z-index: 4;
  overflow-y: auto;
  background: var(--ground);
  padding: clamp(20px, 3vw, 48px);
}
.grid-intro { margin: 0 0 clamp(30px, 5vh, 60px); }
/* a pinned header stays at the top of the grid while the images scroll under it */
.grid-intro.pinned { position: sticky; top: calc(clamp(20px, 3vw, 48px) * -1); z-index: 2; background: var(--ground); margin-top: calc(clamp(20px, 3vw, 48px) * -1); padding: clamp(20px, 3vw, 48px) 0 calc(var(--fs-title) * .5); margin-bottom: clamp(14px, 2vh, 24px); }
.grid-canvas { margin: 0 0 clamp(30px, 5vh, 60px); }
/* a header with a picture at the top of a grid: only a thin gap below it, so its text can sit close to the first row
   (the free layout decides how far down the text goes; the page adds almost nothing under it) */
.grid-intro:has(> .sv-head) { margin-bottom: clamp(6px, 1vh, 12px); }
.grid-intro:has(> .sv-head) > .sv-head { margin-bottom: 0; }
.grid-intro.pinned:has(> .sv-head) { padding-bottom: 4px; margin-bottom: clamp(6px, 1vh, 12px); }
.grid-intro .t-title { font-size: var(--fs-title); margin: 0 0 .45em; }
.grid-intro .t-body { font-size: var(--fs-body); line-height: 1.45; margin: 0 0 .7em; max-width: none; }
.grid-intro .t-cap { font-size: var(--fs-cap); margin: 0 0 .6em; }
.grid-in {
  display: grid;
  grid-template-columns: repeat(5, 1fr);   /* five across */
  gap: clamp(18px, 2vw, 32px) clamp(14px, 1.6vw, 26px);
  align-items: end;
}
.cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.cell img { display: block; width: 100%; aspect-ratio: var(--ar); object-fit: contain; }
.cell:hover img { opacity: .85; }
.cell.here::after {                     /* where you left off */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -9px;
  height: 1px;
  background: var(--mark);
}
#closebook {
  position: fixed;
  z-index: 4;
  top: calc(var(--hh, 92px) + 10px);
  right: clamp(14px, 2vw, 34px);
  font: inherit;
  font-size: 34px;
  line-height: 1;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
}
#closebook:hover { opacity: .6; }
#closebook[hidden], #grid[hidden], #backtop[hidden] { display: none; }
#backtop {                                          /* back to the top of a long page */
  position: fixed; right: 18px; bottom: 18px; z-index: 6;
  font: 12px/1 var(--ui, sans-serif); letter-spacing: .06em; padding: 9px 12px; cursor: pointer;
  color: var(--ink-soft); background: color-mix(in srgb, var(--paper) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); border-radius: 999px;
}
#backtop:hover { color: var(--ink); }
body.scroll-open #closebook { z-index: 6; }

/* ---------- scrolling sections ---------- */

#scrollview {
  position: fixed;
  inset: 0;
  top: var(--hh, 92px);
  z-index: 3;
  overflow-y: auto;
  background: var(--ground);
  outline: none;
}
#scrollview[hidden] { display: none; }
.sv-col { width: var(--sw); margin: 0 auto; padding: clamp(24px, 5vh, 56px) 0; }      /* the same space above and below */
.rw-flow > :last-child { margin-bottom: 0; }
/* The rhythm, from one token: --sgap is the space between one unit of the book and the next (set from the spread's
   height by the script; a share of the window's height in a scrolling section). A break inside a run of scrolling
   pages is that space twice, with the hairline in the middle. */
#scrollview { --sgap: 12vh; }
.sv-page + .sv-page {                              /* the break between one page and the next */
  margin-top: var(--sgap);
  padding-top: var(--sgap);
  border-top: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
}
/* a section header is a page without the space around it: nothing above or below of its own, no line. It sits close
   to what follows it, and the space before it is the same as the break between pages. */
.sv-head { margin: 0 0 calc(var(--fs-title) * .8); }
.sv-head .canvas { margin-inline: var(--mx, 0%); }
body.mobile .sv-head .canvas { margin-inline: 0; }
.sv-page + .sv-head { margin-top: calc(var(--sgap) * 2); }
/* pinned: it stays at the top while the pages scroll under it */
.sv-head.pinned { position: sticky; top: 0; z-index: 2; background: var(--ground); padding-block: clamp(20px, 3vh, 32px) calc(var(--fs-title) * .5); margin-bottom: calc(var(--fs-title) * .3); }
/* (a pinned header that opens the section starts where it will stay: it takes the place of the space above the first
   page, so it doesn't travel when you start to scroll. Its own room under the menu line is a small fixed amount,
   not the spread-centring space, which grows with the window.) */
#track > :first-child > .sv-col > .sv-head.pinned:first-child,
#track > .unit-head:first-child > .sv-head.pinned:first-child { margin-top: calc(var(--pady, 24px) * -1); }

/* a section that opens with scrolling pages starts close under the menu line (the same small room a pinned header
   has), not at the spread-centring space, which only suits a spread that sits centred in the window */
#track > .unit-run:first-child:not(:has(> .sv-col > .sv-head.pinned:first-child)) { margin-top: min(0px, calc(var(--pady, 24px) * -1 + clamp(20px, 3vh, 32px))); }
/* matching: as wide as the reading column of the text page below, so their edges line up */
.sv-head.match .canvas { width: min(calc(var(--fs-body) * 34), calc(100% - 2 * var(--mx, 0%))); margin-inline: auto; }
/* a header at the side: a column to the left of the pages after it, staying in view while they scroll */
.sv-aside { display: grid; grid-template-columns: var(--aw) minmax(0, 1fr); column-gap: clamp(24px, 4vw, 64px); align-items: start; margin-inline: var(--mx, 0%); }
.sv-aside.read { grid-template-columns: var(--aw) minmax(0, calc(var(--fs-body) * 34)); justify-content: center; }
.sv-aside .canvas, .sv-aside .sv-page .canvas { margin-inline: 0; }
.sv-aside .md { margin-left: 0; }
.sv-main { min-width: 0; }
.sv-head.side { position: sticky; top: clamp(20px, 3vh, 32px); margin: 0; max-height: calc(100vh - var(--hh, 92px) - 2 * clamp(20px, 3vh, 32px)); overflow-y: auto; scrollbar-width: none; overflow-wrap: break-word; }
.sv-head.side::-webkit-scrollbar { display: none; }
.sv-page + .sv-aside, .sv-aside + .sv-aside, .sv-aside + .sv-head { margin-top: calc(var(--sgap) * 2); }
body.mobile .sv-aside { display: block; margin-inline: 0; }
body.mobile .sv-head.side { position: static; max-height: none; overflow: visible; margin: 0 4px var(--sgap); }
body.mobile .sv-head.side .rw-img { width: min(60%, 14em); }                    /* (the photo smaller, so the page starts soon after it) */
body.mobile .sv-head.match .canvas { width: calc(100% - 8px); }
.unit-head { margin-bottom: var(--sgap); }
.unit-head > .spread { margin-bottom: 0; }
.canvas { position: relative; container-type: inline-size; min-height: 40px; }
.sv-page .canvas, .run-top .canvas { margin-inline: var(--mx, 0%); }          /* the site-wide side margin */
/* The type scale: one set of sizes for every kind of page, following the usual guidance for
   reading on screen — body about 19px on a typical laptop (never under 16 or over 22), captions
   about 14px (12–16), titles about twice the body (30–52). Between those limits the sizes grow
   with the spread (--sw, set by site.js; the editor sets its own to match), so layouts keep their
   proportions; the custom properties are worked out on each element, so a page in the editor can
   carry its own --sw. */
* { --fs-title: calc(clamp(30px, calc(var(--sw, 1152px) * .0347), 52px) * var(--fs-k, 1)); --fs-body: calc(clamp(16px, calc(var(--sw, 1152px) * .0165), 22px) * var(--fs-k, 1)); --fs-cap: calc(clamp(14px, calc(var(--sw, 1152px) * .0145), 18px) * var(--fs-k, 1)); }
.cv-item { position: absolute; margin: 0; }
.cv-img img { display: block; width: 100%; height: auto; }
.free-crop, .cv-crop { overflow: hidden; }                   /* a cropped image: the frame shows part of its picture */
.free-crop img, .cv-crop img { position: absolute; max-width: none; height: auto; }
/* rows: a page laid out as justified rows (see rowsHTML in site.js) */
.rw-flow { width: 100%; }
.rw-row { display: flex; gap: var(--g); margin-bottom: var(--g); }
.rw-img { position: relative; margin: 0; overflow: hidden; min-width: 0; }
.rw-img img { position: absolute; display: block; max-width: none; height: auto; }
.rw-img.zoomable img { cursor: zoom-in; }
.rw-img.linked img { cursor: pointer; }
.rw-block { margin: 0 0 calc(var(--g) * 1.5); }
/* text beside a picture: a column in the row, as tall as the row */
.rw-row.has-side { align-items: flex-start; }
.rw-side { display: flex; flex-direction: column; align-self: stretch; min-width: 0; overflow-wrap: break-word; }
.rw-side.rw-va-middle { justify-content: center; }
.rw-side.rw-va-bottom { justify-content: flex-end; }
.rw-side > .rw-block:last-child { margin-bottom: 0; }
.rw-block.cv-text > p { margin: 0 0 var(--ps, .6em); max-width: none; }
.rw-block.cv-text > p:last-child { margin-bottom: 0; }
@media (max-width: 700px) {
  .rw-row { flex-direction: column; width: auto !important; }
  .rw-img { flex: none !important; width: 100%; }
  .rw-side { flex: none !important; }                 /* on a phone the words go above or below their picture */
}
/* depth scenes: the window is 3:2; the scene behind it is 11 × 8 inches to 9 × 6, so the layers have room to move */
.depth { position: relative; overflow: hidden; width: 100%; aspect-ratio: 3 / 2; }
.depth-scene { position: absolute; left: calc(-1 / 9 * 100%); top: calc(-1 / 6 * 100%); width: calc(11 / 9 * 100%); height: calc(8 / 6 * 100%); }
.depth-layer { position: absolute; inset: 0; will-change: transform; }
.depth-layer img { position: absolute; display: block; height: auto; max-width: none; user-select: none; }
.spread.is-depth { align-items: center; justify-content: center; }
.depth-box { width: min(100%, calc(var(--H) * 1.5)); }
/* gallery pages: a grid of project thumbnails, each opening a slideshow */
.gal { display: grid; gap: calc(var(--g) * 2) var(--g); width: 100%; }
.gal-item { display: flex; flex-direction: column; gap: .35em; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.gal-th { display: block; position: relative; aspect-ratio: var(--ar, 1.5); overflow: hidden; background: var(--plate); }
.gal-over { position: absolute; left: 0; right: 0; bottom: 0; padding: 2.2em .8em .7em; display: flex; flex-direction: column; gap: .15em; color: var(--on-media); background: linear-gradient(transparent, var(--media-scrim)); }
.gal-over .gal-n { color: var(--on-media-soft); }
.gal-th img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease, opacity .2s; }
.gal-item:hover .gal-th img { transform: scale(1.03); opacity: .92; }
.gal-title { font-size: var(--fs-body); line-height: 1.25; }
.gal-n { font-size: var(--fs-cap); color: var(--ink-soft); }
@media (max-width: 700px) { .gal { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
.mz-item { position: absolute; margin: 0; overflow: hidden; }
.mz-item img { position: absolute; display: block; height: auto; max-width: none; }
/* phones: the wall becomes one column, in reading order, each image keeping its crop */
@media (max-width: 700px) {
  .canvas.mosaic { height: auto !important; display: flex; flex-direction: column; gap: 14px; }
  .canvas.mosaic .mz-item { position: relative; left: auto !important; top: auto !important; width: 100% !important; height: auto !important; aspect-ratio: var(--ar); }
}
.mz-item.zoomable img { cursor: zoom-in; }
.cv-img.linked img { cursor: pointer; }
.cv-img.linked:hover img { opacity: .88; }
/* a video file's own player: the same 16:9 frame as a link video; other shapes sit inside it with black bars */
.cv-file { object-fit: contain; background: #000; }
.cv-vid { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: var(--media-bg); }
.cv-text .t-title { font-size: var(--fs-title); }
.cv-text .t-body { font-size: var(--fs-body); }
.cv-text .t-cap { font-size: var(--fs-cap); }
.cv-text > p { margin: 0 0 var(--ps, .6em); max-width: none; }
.cv-text > p:last-child { margin-bottom: 0; }

/* ---------- the spread, below the header ---------- */

#book {                                             /* the section's flow: one continuous scroll under the header */
  position: fixed;
  left: 0;
  right: 0;
  top: var(--hh, 92px);
  bottom: 0;
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
  outline: none;
}
#viewport {
  width: var(--sw);
  margin: 0 auto;
  padding: var(--pady, 24px) 0;
}
.unit-run { margin-bottom: var(--sgap); }
body.mobile .spread.is-bleed, body.mobile .spread.is-depth { height: auto; }              /* on a phone these take the height of their picture */
body.mobile .is-bleed .plate { position: static; }
body.mobile .is-bleed .plate img { position: static; width: 100%; height: auto; object-fit: initial; }
body.mobile .unit-stack .sv-page .canvas { margin-inline: 0; }
.unit-run .sv-col { padding: 0; }
#track > :last-child { margin-bottom: 0; }

/* ---------- spreads and pages ---------- */

.spread {
  width: var(--sw);
  height: var(--H);
  margin-bottom: var(--sgap);
  display: flex;
  gap: var(--gut);
}
.page {
  flex: 1;
  min-width: 0;
  position: relative;
  background: var(--paper);
  container-type: size;
  overflow: hidden;
}
.plate {
  flex: 1;
  position: relative;
  background: var(--plate);
}
.plate img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;   /* never cropped */
}

/* margins */
.frame {
  position: absolute;
  inset: 8% 10%;
  container-type: size;
}

/* running heads: naked text in the top margin, aligned to the margins */
.rh {
  position: absolute;
  top: 3.4%;
  font-size: max(2.9cqw, 12px);
  letter-spacing: .01em;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}
.rh:hover { color: var(--ink); }
.rh-l { left: 10%; }
.rh-r { right: 10%; }

/* a full-width page in the book: the spread's size exactly (WIDE_H in the editor matches this padding) */
.wide-scroll {
  position: absolute;
  inset: 0;
  overflow: hidden;
  padding: 3% 5% 4%;
}
.wide-scroll > .canvas { height: 100%; overflow: hidden; }
/* a run of scrolling pages, as it sits in the book: the top of its first page (it opens as a scroll) */
.run-top { position: absolute; inset: 0; overflow: hidden; padding: 3% 5% 0; }
#endnote {                                          /* "End of …": said when you try to go past the end of a section */
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 6px); z-index: 7;
  font: 12px/1 var(--ui, sans-serif); letter-spacing: .06em; color: var(--ink-soft);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
#endnote.on { opacity: 1; transform: translate(-50%, 0); }

/* one sheet across the whole spread (no gutter); sizes rescaled for the doubled width */
.page.wide .frame { inset: 8% 5%; }
.page.wide .rh { font-size: max(1.45cqw, 12px); }
.page.wide .rh-l { left: 5%; }
.page.wide .rh-r { right: 5%; }
.page.wide .t-cap { font-size: max(1.8cqw, 12px); }
/* …but text on a full-width page keeps the site's type scale, the same as in the editor */
.page.wide .cv-text .t-cap { font-size: var(--fs-cap); }
.page.wide .grid.has-cap { --capH: 6cqh; }

/* ---------- image arrangements ----------
   Every image keeps its proportions and shows as big as its cell allows.
   The group packs together and centers on the page. */

.grid {
  --gap: 6cqw;
  --capH: 0px;
  --cellW: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols));
  --cellH: calc((100cqh - (var(--rows) - 1) * var(--gap)) / var(--rows) - var(--capH));
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--cols), auto);
  place-content: center;
  place-items: center;
  gap: var(--gap);
}
.grid.has-cap { --capH: 7cqh; }

figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
figure img {
  display: block;
  width: auto;
  height: auto;
  max-width: var(--cellW);
  max-height: var(--cellH);
  user-select: none;
}
figure .vid {
  display: block;
  border: 0;
  aspect-ratio: var(--ar);
  width: min(var(--cellW), var(--cellH) * var(--ar));
}
figcaption {
  contain: inline-size;   /* captions never widen their image */
  height: var(--capH);
  padding-top: 1.4cqh;
}

/* ---------- free pages (made in the editor) ----------
   Items sit in the frame by fractions; text scales with the page so layouts hold at any size. */

.free-item { position: absolute; margin: 0; }
.free-img img { display: block; width: 100%; height: auto; user-select: none; }
.free-text .t-title { font-size: var(--fs-title); }
.free-text .t-body { font-size: var(--fs-body); }
.free-text .t-cap { font-size: var(--fs-cap); }
.free-text > p { margin: 0 0 var(--ps, .6em); max-width: none; }
.free-text > p:last-child { margin-bottom: 0; }

/* ---------- the three text styles ---------- */

.t-title {
  font-weight: var(--title-w, 400);
  font-size: var(--fs-title);
  line-height: 1.05;
  margin: 0 0 .6em;
}
.t-body {
  font-size: var(--fs-body);
  line-height: var(--body-lh, 1.42);
  margin: 0 0 .8em;
  max-width: 30em;
}
.t-cap {
  font-size: var(--fs-cap);
  line-height: 1.3;
  font-style: italic;
  color: var(--ink-soft);
}

.frame.text { padding-top: 18cqh; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .3em;
  text-decoration-color: var(--mark);
}
a:hover { text-decoration-thickness: 1px; }

.toc { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 3.4cqh; }
.toc-tight li { margin-bottom: 1.6cqh; }
.toc-airy li { margin-bottom: 5.6cqh; }
.toc a { display: block; text-decoration: none; }
.toc .toc-name { display: block; margin: 0; line-height: 1.15; }
.toc .toc-desc { display: block; margin-top: .25em; }
.toc-desc-beside a { display: flex; align-items: baseline; gap: .8em; flex-wrap: wrap; }
.toc-desc-beside .toc-desc { margin-top: 0; }
.toc-center { text-align: center; }
.frame.text.toc-page { padding-top: 9cqh; }   /* the contents list needs the room */
.frame.text.toc-large { padding-top: 3cqh; }
.toc-page .t-title { margin-bottom: .45em; }
.toc-center .toc-desc-beside a { justify-content: center; }
.toc a:hover .toc-name { text-decoration: underline; text-decoration-color: var(--mark); text-decoration-thickness: 1px; text-underline-offset: .16em; }

/* ---------- zoom (only where a section turns it on) ---------- */

.zoomable img { cursor: zoom-in; }
#zoom {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--paper) 97%, transparent);
  cursor: zoom-out;
}
#zoom.on { display: flex; z-index: 20; }
#zoom img { max-width: 94vw; max-height: 94vh; }
#zoom .zn {                                          /* page through the section's pictures */
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; padding: 0 0 4px; border: 0; border-radius: 50%; color: var(--ink);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  font: 300 34px/1 var(--serif, Georgia, serif); opacity: .6; cursor: pointer;
}
#zoom .zn:hover:not(:disabled) { opacity: 1; }
#zoom .zn:disabled { opacity: 0; cursor: default; }
#zoom .zprev { left: 8px; } #zoom .znext { right: 8px; }
#zoom .zcount { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font: 12px/1 var(--ui, sans-serif); color: var(--ink-soft); letter-spacing: .06em; pointer-events: none; }

/* ---------- the cave ---------- */

.cave-art { width: var(--cellW); height: var(--cellH); }
.cave-art svg { display: block; width: 100%; height: 100%; }

@keyframes fx-fall { to { transform: translate(-60px, 860px); } }
@keyframes fx-snow { to { transform: translate(40px, 860px); } }
@keyframes fx-twinkle { 50% { opacity: .25; } }
@keyframes fx-bob { 50% { transform: translateY(-16px); } }
@keyframes fx-shadow { 50% { transform: scaleX(.82); opacity: .08; } }
@keyframes fx-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes fx-drift { to { transform: translateX(70px); } }

.fx-rain { stroke: var(--fx-rain); stroke-width: 2; stroke-linecap: round; opacity: .75; animation: fx-fall linear infinite; }
.fx-snow { fill: var(--fx-light); animation: fx-snow linear infinite; }
.fx-star { fill: var(--fx-light); animation: fx-twinkle 3s ease-in-out infinite; }
.fx-bob { animation: fx-bob 3.2s ease-in-out infinite; }
.fx-shadow { transform-box: fill-box; transform-origin: center; animation: fx-shadow 3.2s ease-in-out infinite; }
.fx-eye { fill: var(--fx-eye); transform-box: fill-box; transform-origin: center; animation: fx-blink 5s infinite; }
.fx-fog { fill: var(--fx-light); opacity: .45; animation: fx-drift 9s ease-in-out infinite alternate; }

/* ---------- phones: one page at a time ---------- */

body.mobile .grid-in { grid-template-columns: repeat(3, 1fr); }   /* three across on phones */

/* the section names fold into a Menu button */
body.mobile #nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  gap: 0;
  padding: 6px 20px 14px;
  background: var(--ground);
  border-bottom: var(--rule, 1.5px) solid var(--ink);
}
body.mobile #top.open #nav { display: flex; }
body.mobile #nav a { font-size: 18px; padding: 8px 0; }
body.mobile #menubtn {
  display: block;
  margin-left: auto;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
}

/* colour effects on text (see fxStyle in site.js): the animation is in the box's own style, so these are the shared keyframes */
@keyframes tfx-slide { from { background-position-x: 0; } to { background-position-x: 200%; } }
@keyframes tfx-shift { from { background-position-x: 0; } to { background-position-x: 100%; } }
@keyframes tfx-hue { 0% { color: hsl(0 90% 55%); } 17% { color: hsl(60 90% 50%); } 33% { color: hsl(120 70% 45%); } 50% { color: hsl(180 80% 45%); } 67% { color: hsl(240 85% 62%); } 83% { color: hsl(300 80% 58%); } 100% { color: hsl(360 90% 55%); } }
@keyframes tfx-ab { 0%, 100% { color: var(--fa); } 50% { color: var(--fb); } }
@keyframes tfx-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .15; } }
@media (prefers-reduced-motion: reduce) {
  [style*="tfx-"] { animation: none !important; background-size: 100% 100% !important; }
}
@media (prefers-reduced-motion: reduce) {
  #track { transition: none; }
  [class^="fx-"], [class*=" fx-"] { animation: none; }
}

/* a gallery project: its pictures as a page of their own, over the book */
#project { position: fixed; left: 0; right: 0; top: var(--hh, 92px); bottom: 0; z-index: 4; overflow-y: auto; overflow-x: hidden; background: var(--ground); outline: none; touch-action: pan-y; }
#project[hidden] { display: none; }
.pj-col { width: var(--sw); margin: 0 auto; padding: clamp(24px, 5vh, 56px) 0 clamp(40px, 8vh, 90px); }
.pj-col .canvas { margin-inline: var(--mx, 0%); }
.pj-back { font: inherit; font-size: var(--fs-cap); color: var(--ink-soft); background: none; border: 0; padding: 0; cursor: pointer; margin-bottom: 1.4em; letter-spacing: .04em; }
.pj-back:hover { color: var(--ink); }
.pj-title { margin: 0 0 .15em; font-weight: normal; }
.pj-n { margin: 0 0 2em; font-size: var(--fs-cap); color: var(--ink-soft); }
body.project-open #closebook, body.project-open #backtop { display: none; }

/* lists inside text boxes, and inline emphasis */
.t-list { margin: 0 0 .8em; padding-left: 1.3em; }
.t-list li { margin: 0 0 .25em; }
.cv-text > .t-list, .free-text > .t-list { margin: 0 0 var(--ps, .6em); max-width: none; }
.cv-text > .t-list:last-child, .free-text > .t-list:last-child { margin-bottom: 0; }
strong { font-weight: 600; }

.vid-off { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4em; color: var(--media-text); text-decoration: none; font-size: var(--fs-body); text-align: center; padding: 1em; }
.vid-off small { font-size: var(--fs-cap); color: var(--media-text-soft); }

/* links in the menu can't be picked up and dragged (a pen's wobble used to start that and cancel the click) */
#top a, #grid a, #track a { -webkit-user-drag: none; }
#nav a, #menubtn { touch-action: manipulation; }

/* ---------- text pages (written as Markdown; md.js draws them) ----------
   One readable column in the section's own typeface, sized from the same three sizes as everything else. */
.md { max-width: 34em; margin: 0 auto; font-size: var(--fs-body); line-height: var(--body-lh, 1.45); overflow-wrap: break-word; }
.md.md-wide { max-width: none; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table { margin: 0 0 .8em; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-weight: var(--title-w, 400); line-height: 1.15; margin: 1.4em 0 .5em; }
.md h1 { font-size: var(--fs-title); line-height: 1.05; }
.md h2 { font-size: 1.45em; }
.md h3 { font-size: 1.18em; font-weight: 600; }
.md h4 { font-size: 1em; font-weight: 700; }
.md h5, .md h6 { font-size: .85em; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.md strong { font-weight: 700; }
.md ul, .md ol { padding-left: 1.3em; }
.md li { margin: 0 0 .25em; }
.md li > ul, .md li > ol { margin: .25em 0 0; }
.md li.md-task { list-style: none; position: relative; }
.md li.md-task::before { content: ""; position: absolute; left: -1.15em; top: .32em; width: .7em; height: .7em; border: 1px solid var(--ink-soft); border-radius: 2px; }
.md li.md-task[data-done="true"]::before { background: var(--ink-soft); box-shadow: inset 0 0 0 2px var(--paper); }
.md blockquote { padding: 0 0 0 1em; border-left: 2px solid var(--mark); color: var(--ink-soft); }
.md blockquote > :last-child { margin-bottom: 0; }
.md .md-callout-title { font-weight: 700; color: var(--ink); }
.md hr { border: 0; border-top: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); margin: 1.6em 0; }
.md code { font-family: 'Space Mono', Menlo, monospace; font-size: .85em; background: color-mix(in srgb, var(--ink) 7%, transparent); padding: .05em .25em; border-radius: 3px; }
.md pre { background: color-mix(in srgb, var(--ink) 6%, transparent); padding: .8em 1em; border-radius: 4px; overflow-x: auto; line-height: 1.4; }
.md pre code { background: none; padding: 0; }
.md mark { background: color-mix(in srgb, var(--mark) 22%, transparent); color: inherit; }
.md table { width: 100%; border-collapse: collapse; font-size: .92em; }
.md th, .md td { text-align: left; vertical-align: top; padding: .35em .7em .35em 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); }
.md th { font-weight: 700; }
.md img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.md .md-comment, .md .md-front, .md .md-html, .md .md-embed { display: none; }   /* notes to yourself: not shown on the site */
body.mobile .sv-doc .canvas { margin-inline: 4px; }
