/* nickzamsa.com
   One typeface (ABC Diatype Medium), two sizes: --s for details, --l for reading.
   Solid colours only: no transparency anywhere. */

@font-face {
  font-family: "Diatype";
  src: url("/assets/fonts/Diatype-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* sizes scale smoothly with the window: phone → large screen */
  --s: clamp(20px, 17.4px + .53vw, 24px);  /* text: 24px on a large screen, 20px on a phone */
  --p: 16px;                               /* the small size (filters, pills, Info lists): 16px; 14px on phones (below) */
  --p-track: .01em;                        /* the small size is spaced a little more openly, for easier reading */
  --l: var(--s);                           /* no large size any more: titles and texts use the text size */
  --lh-s: 1.2;
  --lh-l: var(--lh-s);
  --m: clamp(14px, 8.2px + 1.48vw, 35px);  /* outer margin: 14px on a phone, 30px on a laptop (1470), 35px on a large screen */
  --g: clamp(10px, 1vw, 16px);            /* gutter */
  --bar: calc(var(--s) * var(--lh-s) + 2 * var(--m));
  /* tallest an image may be. vh, not svh: Safari on iPhone (iOS 26) changes svh while you scroll, as its toolbar
     shrinks, which made the first card jump wider; vh is the screen with the toolbar tucked away and never changes */
  --fit: calc(100vh - var(--bar) - 2 * var(--m));
  --column: 76rem;                                  /* centred content column */
  --measure: calc(var(--s) * 30);                   /* reading width (about 60–65 characters), centred */
  --ink: #000;
  --paper: #fff;
  --rule: #000;
  --tint: #f1f1f0;                        /* image placeholder */
  --track: #e3e3e3;                       /* grey of the pill buttons */
  --soft: #5c5c5c;                        /* dark grey text on unselected pills */
  --menu-grey: #b5b5b5;                   /* the other menu items: a soft mid grey */
  --rim: 3px;                             /* grey rim around a white (selected) pill */
  --ease: cubic-bezier(.22, .9, .25, 1);   /* gentle, soft landing */
  --ease-io: cubic-bezier(.6, 0, .3, 1);
  --fast: 310ms;
  --slow: 1260ms;
  --in: .5s;                              /* every hover effect arrives within half a second… */
  --out: 1s;                              /* …and fades back over one second when you leave */
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar) + var(--m));
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Diatype", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 500;
  font-size: var(--s);
  line-height: var(--lh-s);
  letter-spacing: 0;                       /* the large size is never tracked; only the small size is (--p-track) */
  font-feature-settings: "ss07", "ss05";  /* Diatype's straight-leg R (ss07) and curly y (ss05), everywhere */
  font-kerning: normal;
  font-variant-ligatures: common-ligatures contextual;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* a phone turned sideways: the page reaches under the camera cut-out and the rounded corners (viewport-fit=cover),
   so the side margins grow to keep clear of them; held upright the insets are 0 and nothing changes */
:root { --ml: max(var(--m), env(safe-area-inset-left, 0px)); --mr: max(var(--m), env(safe-area-inset-right, 0px)); }
main { flex: 1; padding: var(--bar) var(--mr) 0 var(--ml); }
main > * { max-width: var(--column); margin-inline: auto; }
main > .index, main > .entry { max-width: none; }
/* a project: title, text and details sit in one centred reading column; images centre in the full width */
.entry-head, .entry > .prose, .entry > .watch, .entry > .details, main > .subscribe, main > .next { width: min(100%, var(--measure)); margin-inline: auto; }
img, picture { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; padding: 0; font-weight: inherit; font-size: inherit; }
ul, ol { list-style: none; }
em { font-style: normal; }                 /* one style only; italics read as upright */
sup { font-size: inherit; line-height: 0; vertical-align: baseline; font-variant-position: super; position: relative; top: 0; }
::selection { background: var(--ink); color: var(--paper); }

.l { font-size: var(--l); line-height: var(--lh-l); }
.visually-hidden, .skip:not(:focus) {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip { position: fixed; z-index: 100; top: var(--m); left: var(--m); background: var(--ink); color: var(--paper); padding: .3em .7em; }
:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

/* links everywhere: black, no underline, every word leaning a little like an italic. Pointing at a link stands it
   upright in 0.5 s; it leans back over 1.5 s. (site.js wraps each word of a link in a .sk, so links still break
   across lines.) Your name top left, the section you're in, the pill buttons and the project cards keep their own style. */
:root { --lean: -12deg; --lean-back: 1.5s; }
a { color: #000; }
.keep { display: inline-block; }   /* a short link and the last word after it, kept on one line (site.js) */
.sk { display: inline-block; transform: skewX(var(--lean)); transform-origin: 0 76%; transition: transform var(--lean-back) var(--ease); }
@media (hover: hover) { a:hover .sk { transform: none; transition-duration: var(--in); } }
a:focus-visible .sk, a:active .sk { transform: none; transition-duration: var(--in); }   /* keyboard focus and pressing (also on phones) look like hover */
/* phones and iPads (no hover): a tap registers after 0.1 s, so a finger that is only scrolling never sets anything
   leaning, and then the press shows at once, with no animation. Letting go still eases back over 1.5 s. */
@media (hover: none) {
  a:active .sk { transition-duration: 0s !important; transition-delay: .1s !important; }
}
/* project cards: titles black, years and categories grey, black while you point at the card */
.card a { color: var(--menu-grey); transition: color var(--out) var(--ease); }
@media (hover: hover) { .card a:hover { color: #000; transition-duration: var(--in); } }
.card a:focus-visible { color: #000; }
.name, .card-title, .row-title { color: #000; }

/* ---------------------------------------------------------------- bar */

/* The name and the four sections stay put at the top while the page scrolls underneath.
   No band behind them; the letters stay black. */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr); column-gap: var(--g);
  align-items: center;
  padding: var(--m) var(--mr) var(--m) var(--ml);   /* --ml/--mr: the side margins, clear of a sideways phone's cut-out */
  color: #000;
  pointer-events: none;                 /* only the links themselves catch clicks */
}
.bar a { pointer-events: auto; }
.bar { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 1.4em; }
.name { justify-self: start; }

/* the four sections, side by side at the top right, always on the same line as your name, on every screen: upright,
   the one you're in too; any of them (and your name) leans only while you point at it, or as you tap it */
.nav { grid-column: 3; white-space: nowrap; }
.nav .sk, .name .sk { transform: none; }
@media (hover: hover) { .nav a:hover .sk, .name:hover .sk { transform: skewX(var(--lean)); transition-duration: var(--in); } }
.nav a:focus-visible .sk, .name:focus-visible .sk, .nav a:active .sk, .name:active .sk { transform: skewX(var(--lean)); }
/* phones: your name on the left and the four sections on the right, on one line, as on computers (stacked under
   your name they read like a subtitle). The gap between them is never less than 2.2 of the text size (44px), so the
   two clearly belong apart; the small size is 14px */
@media (max-width: 640px) {
  :root { --p: 14px; }
  .bar { column-gap: 1.1em; }
  /* phones: the tallest a photo may be comes from the screen's width, not its height. The height changes while you
     scroll as the browser's bars slide away (Safari, and the browsers inside Instagram and LinkedIn), which made the
     photos jump wider; the width never does. 190vw is about what the height gives on a current iPhone. */
  :root { --fit: 190vw; }
}
/* the narrowest phones (under 360px): the text size steps down with the width (to about 17.6px at 320px), so your
   name and the menu still fit on one line with the same clear gap. All text shrinks together, so the one-size
   system stays the same; 16.6 = name + menu + gap, in units of the text size, with a little room to spare */
@media (max-width: 359px) {
  :root { --s: min(20px, calc((100vw - 28px) / 16.6)); }
}

/* ---------------------------------------------------------------- intro + filters */

.intro { padding: calc(var(--m) * 2) 0 calc(var(--l) * 2.2); max-width: 24em; text-wrap: pretty; }
.intro p + p { margin-top: calc(var(--l) * var(--lh-l)); }
.is-index main, .is-about main { padding-top: calc(var(--bar) + var(--m)); }
/* 404: centred (on phones aligned left, under your name and the menu), in the text size. Its first line ("404") sits on the line of your name and the menu
   (main starts where the bar's padding ends, with the same line height); on phones it starts under the menu,
   after an empty line. A paragraph's worth of space before the link back. */
.is-404 main { padding-top: var(--m); }
.lost { text-align: center; padding-bottom: calc(2 * var(--s) * var(--lh-s)); }
.lost p { margin-top: calc(var(--s) * var(--lh-s)); }
@media (max-width: 640px) { .is-404 main { padding-top: calc(var(--bar) - var(--m) + var(--s) * var(--lh-s)); } .lost { text-align: left; } }

/* under the filters: one empty line of the big text size, then the projects (or texts) */
.filters {
  display: flex; flex-direction: column; align-items: center; row-gap: 6px;
  max-width: 42em; margin: 0 auto; padding: 0 0 calc(var(--s) * var(--lh-s));
  position: relative; z-index: 1;
}

/* Wide screens: the page starts on the menu's line. The menu's baseline sits .995 of the big size below its top
   (Diatype at line height 1.2); a pill's text baseline sits 1.445 of the small size below the pill's top
   ((2.1 − 1) / 2 + .895). The filters' first row sits in the menu's line from 780px, on iPads and computers
   alike (from there the two rows fit, centred on the page, between your name and the menu; on phones they go
   under the menu); a project's or text's title from 1280px (room for a whole line). */
:root { --menu-baseline: calc(var(--m) + .995 * var(--s)); }
@media (min-width: 780px) {
  .is-index main { padding-top: 0; }
  /* the top of the pills lines up with the top of the menu's letters: the menu's baseline minus Diatype's
     capital height (.70 of the type size) */
  .is-index .filters { margin-top: calc(var(--menu-baseline) - .70 * var(--s)); padding-bottom: calc(1.5 * var(--s) * var(--lh-s)); }   /* a line and a half under the filters */
}
/* a phone turned sideways is wide enough for that, but its side margins grow to clear the camera cut-out, which
   leaves too little room between your name and the menu: there the filters go under the menu, as on a phone held upright */
@media (min-width: 780px) and (hover: none) and (pointer: coarse) and (max-height: 500px) {
  .is-index main { padding-top: calc(var(--bar) + var(--m)); }
  .is-index .filters { margin-top: 0; }
}
@media (min-width: 1280px) {
  .is-entry main { padding-top: 0; }
  .is-entry .entry-head { padding-top: var(--m); }        /* the title's line starts where the menu's does */
  .is-entry .entry-head h1 { text-box: normal; }          /* full line box, so both baselines match */
}

/* pill buttons: separate grey pills, close together but not touching.
   Hover or selected: the pill turns white inside a thin grey rim; the text is always black. */
.pill, .chip {
  appearance: none; cursor: pointer;
  border: var(--rim) solid var(--track); border-radius: 999px;
  background: var(--track); color: #000;
  display: inline-flex; align-items: center; height: calc(var(--p) * 2.1); padding: 0 .85em;
  font-size: var(--p); letter-spacing: var(--p-track);
  white-space: nowrap; line-height: 1; text-decoration: none;
  position: relative;
  transition: background-color var(--out) var(--ease), color var(--out) var(--ease), border-color var(--out) var(--ease), transform 280ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .pill:hover, .chip:hover { background: #fff; color: #000; z-index: 1; transition-duration: var(--in), var(--in), var(--in), 280ms; } }
/* pressing a pill looks like pointing at it; on phones and iPads it shows after the 0.1 s tap wait, at once */
.pill:active, .chip:active { background: #fff; color: #000; z-index: 1; transition-duration: var(--in), var(--in), var(--in), 280ms; }
@media (hover: none) { .pill:active, .chip:active { transition-duration: 0s, 0s, 0s, 280ms; transition-delay: .1s; } }
.chip[aria-pressed="true"] { background: #fff; color: #000; z-index: 1; }
.pill:focus-visible, .chip:focus-visible { outline: 1.5px solid #000; outline-offset: 2px; z-index: 2; }

/* pills sit 4px apart side by side and 6px apart from row to row: the gap between two rounded ends looks
   wider than the same gap between flat edges, so the rows get a little more to look the same */
.pills, .filter-row { column-gap: 4px; row-gap: 6px; }
.filter-row { display: flex; flex-wrap: wrap; justify-content: center; }   /* a row wraps only if a screen is too narrow for it */
.pills > li { display: flex; }
/* phones: the filter pills are a little tighter at the sides, and on the narrowest phones (under about 365px) the
   text shrinks a touch too, down to 12.8px at 320px, so every section's filters fit on two rows */
@media (max-width: 640px) {
  .chip { font-size: min(var(--p), calc((100vw - 64px) / 20)); height: 2.1em; padding: 0 .6em; }
}

/* pill links elsewhere (contact, Subscribe) use the normal text size; only the filters are small */
.pill { font-size: var(--s); height: calc(var(--s) * 1.8); padding: 0 .7em; letter-spacing: 0; }
.watch { margin-top: calc(var(--l) * var(--lh-l)); }   /* the Video link: one empty line under the text */
.pills { display: flex; flex-wrap: wrap; }

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

/* one project per row on phones, at most two side by side on bigger screens */
.grid {
  display: grid; grid-template-columns: minmax(0, 1fr);
  --gc: var(--m);                              /* the gutter down the centre: the same as the outer margin */
  gap: calc(var(--l) * 1.6) var(--gc);
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.card[hidden], .row[hidden] { display: none; }
/* each card is as wide as its photo can be while the whole photo stays in the window;
   the space is reserved before the photo loads, so the page never jumps */
.card { --ar: 1.5; --w: min(100%, calc((var(--fit) - 4em) * var(--ar))); }
@media (min-width: 700px) { .card { --w: min(100%, calc((var(--fit) - 4em) * var(--arw, var(--ar)))); } }
.card a { display: block; width: var(--w); margin-inline: auto; }   /* phones: centred */
/* two per row: each pair hugs the middle of the page (left one to the right of its column, right one to the left),
   counting only the projects the current filter shows */
@media (min-width: 700px) {
  .grid > .card:nth-child(odd of :not([hidden])) a { margin-inline: auto 0; }
  .grid > .card:nth-child(even of :not([hidden])) a { margin-inline: 0 auto; }
}
/* a project on its own (the only one a filter shows, or the last one left over) sits in the middle of the page,
   at the same size as the pairs */
@media (min-width: 700px) {
  .grid > .card:nth-child(odd of :not([hidden])):nth-last-child(1 of :not([hidden])) {
    grid-column: 1 / -1;
    --w: min(calc(50% - var(--gc) / 2), calc((var(--fit) - 4em) * var(--arw, var(--ar))));
  }
  .grid > .card:nth-child(odd of :not([hidden])):nth-last-child(1 of :not([hidden])) a { margin-inline: auto; }
}
/* each thumbnail keeps its own proportions; cards hang from the top of their row */
.card-media { position: relative; }
.card-media picture { display: block; }
.card-media img { display: block; width: 100%; height: auto; aspect-ratio: var(--ar); }
@media (min-width: 700px) { .card-media img { aspect-ratio: var(--arw, var(--ar)); } }
.card-media img { background: var(--tint); }
.card-type { display: flex; align-items: flex-end; padding: var(--g); background: var(--tint); aspect-ratio: 3 / 2; width: min(100%, 40em); }
.card-type .l { text-wrap: balance; transition: transform var(--out) var(--ease); }
.card a:hover .card-type .l { transform: translateY(-6px); transition-duration: var(--in); }
/* the title sits 16px under the photo (to the top of its letters): close, but clear of the blur when you point at the project */
/* the space between a project's photo and its title is the same as between two lines of the title: the line height
   minus the capitals' height (10px on phones, 12px on computers), measured to the top of the capitals */
.card-text { display: block; padding-top: max(2px, calc(var(--s) * (var(--lh-s) - .7) - .25em)); }
/* a block, not an inline block: the trim that lines the title's first capitals up under the photo measures from the
   first line of a block, but from the last line of an inline block, which pushed long (wrapping) titles up under the photo */
.card-title { display: block; text-wrap: balance; }

.card-sub { display: block; color: #000; }   /* Art: what the work is, on the line under its title */
/* the title under a project's photo stands upright and leans while you point at the project, like the list of texts */
.card .sk { transform: none; }
@media (hover: hover) { .card a:hover .sk { transform: skewX(var(--lean)); transition-duration: var(--in); } }
.card a:focus-visible .sk, .card a:active .sk { transform: skewX(var(--lean)); transition-duration: var(--in); }

/* one blur for the photos everywhere: loading, filtering and pointing all use the same 12px, its edges
   feathering into the page. Loading: each photo's space shows a tiny blurred preview of it straight away, which
   comes into focus over a second once the real photo has loaded (like the photos when you filter). */
:root { --soft: blur(12px); }
.js .card-media img, .js .gallery img, .js .about-portrait img, .js .inline-figure img {
  background-image: var(--lqip, none); background-size: 100% 100%; background-repeat: no-repeat;
  filter: var(--soft);
  transition: filter 1s var(--ease);
}
@media (min-width: 700px) { .js .card-media img { background-image: var(--lqipw, var(--lqip, none)); } }
.js img.is-in { filter: none; background: none; }   /* once a photo is in, no placeholder is left behind it to flash through */

/* hover on a project: the name stays put, the photo goes soft, its edges feathering into the page
   (in within half a second, back over one and a half) */
.js .card-media img.is-in { transition: filter 1.5s var(--ease); will-change: filter; }   /* pointing: blurs in .5s; leaving: clears over 1.5s */
.js .card-media img.is-in.is-arriving { transition-duration: 1s; }   /* just loaded: comes into focus over a second */
/* will-change: Safari draws big pictures in tiles and can get one tile wrong while a blur animates, leaving a pale
   rectangle on top. Telling it up front that the photo will be blurred makes it draw the photo in one piece. */
@media (hover: hover) {
  .card a:hover .card-media img.is-in { filter: var(--soft); transition-duration: var(--in); }
}
.card a:focus-visible .card-media img.is-in { filter: var(--soft); transition-duration: var(--in); }
/* phones and iPads (no hover): a tap goes straight to the project, the photo doesn't blur (the title still leans) */

/* ---------------------------------------------------------------- text rows */

/* the list of texts reads like lines of text: entries follow each other at the normal line height.
   It sits in the same centred reading column as the texts themselves, clear of the name on wide screens. */
.rows { display: grid; gap: 0; width: min(100%, var(--measure)); margin-inline: auto; }
.row a {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--g);
  position: relative;
}
.row-title { text-wrap: balance; }
/* the other way round from links: a text in the list (title, type and year) stands upright and leans while you
   point at it, in 0.5 s, and straightens over 1.5 s. All black, no grey. */
.row .sk { transform: none; }
@media (hover: hover) { .row a:hover .sk { transform: skewX(var(--lean)); transition-duration: var(--in); } }
.row a:focus-visible .sk, .row a:active .sk { transform: skewX(var(--lean)); transition-duration: var(--in); }
/* title | type | year, on every screen. The type column is as wide as its longest word ("Reviews");
   a "WO" apart on wide screens, a little closer on phones */
.row a { grid-template-columns: minmax(0, 1fr) 3.75em 2.42em; column-gap: .6em; align-items: start; }
.row-meta { display: contents; }
@media (min-width: 900px) { .row a { grid-template-columns: minmax(0, 1fr) 3.75em 2.42em; column-gap: 1.76em; } }

/* ---------------------------------------------------------------- entry (project / text)
   title, description, details table, images */

/* every page starts at the same height, one margin below the menu: the lists' filters, About, and here the title */
.entry-head { padding: var(--m) 0 calc(var(--l) * var(--lh-l)); }
.entry-head h1, .subtitle { text-wrap: balance; }

.subtitle { font-size: var(--l); line-height: var(--lh-l); }
.prose { max-width: 27em; text-wrap: pretty; hanging-punctuation: first allow-end; }
.entry > .prose { max-width: none; }
.prose p + p, .prose p + h2, .prose h2 + p, .prose h2 + .verse, .prose blockquote, .prose p + .verse, .prose .verse + p { margin-top: calc(var(--l) * var(--lh-l)); }
.prose h2 { margin-top: calc(var(--l) * var(--lh-l) * 2.5); text-wrap: balance; }
.prose h2:first-child { margin-top: 0; }
.prose blockquote { padding-left: 1.2em; }
.prose .verse span { display: block; padding-left: 1.2em; text-indent: -1.2em; }   /* wrapped lines hang */
/* a poem inside a project description (and its title) sits slightly indented, about the width of "WO" */
.prose:not(.is-verse) .verse, .prose:not(.is-verse) h2:has(+ .verse) { margin-left: 1.6em; }

.prose a { overflow-wrap: anywhere; }

/* details: label | value */
/* rows follow each other at the normal line height, like lines of text: no extra space between them */
.details {
  margin-top: calc(var(--l) * var(--lh-l)); margin-bottom: calc(var(--l) * 2.4);   /* one empty line above */
  display: grid; grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 1.76em; row-gap: 0;               /* the width of "WO" after the longest label */
}
.details > div { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; }
.details dt { grid-column: 1; }
.details dd { grid-column: 2; text-wrap: pretty; }
.details dd + dd { margin-top: 0; }


.inline-figure { margin: calc(var(--l) * var(--lh-l) * 1.2) 0; }


/* the space between photos is the same as the margin at the sides of the screen, on phones too */
.gallery { display: grid; gap: var(--m); }
/* photos inside a text stay clear of the menu as they scroll past: they end two word spaces (.6em) before it
   (8.8em wide), on both sides so they stay centred. Project galleries use the full width, two photos side by side. */
@media (min-width: 641px) {
  .is-text .inline-figure { max-width: calc(100vw - 2 * (var(--m) + (8.8 + .6) * var(--s))); }   /* already centred by left/translate */
}
.gallery figure, .inline-figure { display: flex; justify-content: center; align-items: flex-start; }
.gallery picture, .inline-figure picture { display: contents; }   /* the image itself sizes against the figure */
/* a photo inside a text sits centred, with its credit line (if it has one) under its left edge */
.inline-figure { flex-direction: column; align-items: center; }
.credit {
  width: min(100%, calc(var(--fit) * var(--fig, 1) * var(--ar, 1.5)));   /* exactly as wide as the photo above */
  margin-top: .6em; font-size: 12px; line-height: 1.3; letter-spacing: var(--p-track);
  color: #000; text-align: left; text-wrap: pretty;
}
.gallery img, .inline-figure img {
  width: min(100%, calc(var(--fit) * var(--fig, 1) * var(--ar, 1.5))); height: auto; aspect-ratio: var(--ar, auto);
  background: var(--tint);
}
.gallery-tall { gap: var(--m); }
.gallery-both + .gallery-both, .gallery-wide + .gallery-wide { margin-top: var(--m); }   /* the flat pictures' block, under the photos' */
/* the photographer's credit (`photos:`): small, centred on the page just under the last photos */
.gallery-credit { margin-top: 14px; font-size: 12px; line-height: 1.3; letter-spacing: var(--p-track); color: #000; text-align: center; }
.gallery-wide, .gallery-tall, .gallery-side { display: none; }   /* side: a phone turned sideways (below) */
@media (min-width: 700px) and (min-aspect-ratio: 4/5) { .gallery-wide { display: grid; } }
@media (max-width: 699px), (max-aspect-ratio: 4/5) { .gallery-tall { display: grid; } }
/* computers and iPads: photos in pairs, side by side, top-aligned and meeting in the middle of the page like the
   project thumbnails, with the outer margin as the gap (the build mixes wide and tall ones, see desktop_mix) */
@media (min-width: 700px) {
  .gallery-both, .gallery-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: var(--m); }
  .gallery-both figure:nth-child(odd), .gallery-wide figure:nth-child(odd) { justify-content: flex-end; }
  .gallery-both figure:nth-child(even), .gallery-wide figure:nth-child(even) { justify-content: flex-start; }
  /* a last photo on its own sits in the middle, at the same size as the others */
  .gallery-both figure:nth-child(odd):last-child, .gallery-wide figure:nth-child(odd):last-child { grid-column: 1 / -1; justify-content: center; }
  .gallery-both figure:nth-child(odd):last-child:not(:only-child) img,
  .gallery-wide figure:nth-child(odd):last-child:not(:only-child) img { max-width: calc(50% - var(--m) / 2); }
  /* a wide photo on its own is as wide as two tall photos side by side (--pair: the gallery's tall photos' shape) */
  .gallery-both figure.w:nth-child(odd):last-child:not(:only-child) img,
  .gallery-wide figure.w:nth-child(odd):last-child:not(:only-child) img { max-width: min(100%, calc(2 * var(--fit) * var(--pair, 9) + var(--m))); }
}


/* a phone turned sideways (a touch screen under 500 points tall) is wide enough for pairs, but it stays a phone: one
   project per row on the overviews and one photo per row in a project, one below the other, as when it's held upright.
   The screen is short that way, so each photo (and each project's photo) is nearly as tall as the screen: the outer
   margin above and below, nothing kept back for the title under it */
@media (hover: none) and (pointer: coarse) and (max-height: 500px) {
  :root { --fit: calc(100vh - 2 * var(--m)); }
  /* landscape photos when there are any: each project's landscape overview photo (--arl, --lqipl), and in a project
     its own sideways selection (.gallery-side), or the computers' when that's the same (.is-side) */
  .card { --w: min(100%, calc(var(--fit) * var(--arl, var(--arw, var(--ar))))); }
  .card-media img { aspect-ratio: var(--arl, var(--arw, var(--ar))); }
  .js .card-media img { background-image: var(--lqipl, var(--lqipw, var(--lqip, none))); }
  .gallery-wide, .gallery-tall, .gallery-both { display: none; }
  .gallery-side, .gallery.is-side { display: grid; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .grid > .card:nth-child(odd of :not([hidden])) a, .grid > .card:nth-child(even of :not([hidden])) a { margin-inline: auto; }
  .grid > .card:nth-child(odd of :not([hidden])):nth-last-child(1 of :not([hidden])) {
    --w: min(100%, calc(var(--fit) * var(--arl, var(--arw, var(--ar)))));
  }
  .gallery-both, .gallery-wide, .gallery-side { grid-template-columns: minmax(0, 1fr); }
  .gallery-both figure:nth-child(odd), .gallery-wide figure:nth-child(odd),
  .gallery-both figure:nth-child(even), .gallery-wide figure:nth-child(even) { justify-content: center; }
  .gallery-both figure:nth-child(odd):last-child:not(:only-child) img,
  .gallery-wide figure:nth-child(odd):last-child:not(:only-child) img,
  .gallery-both figure.w:nth-child(odd):last-child:not(:only-child) img,
  .gallery-wide figure.w:nth-child(odd):last-child:not(:only-child) img { max-width: none; }
}

.next { margin-top: calc(var(--l) * 3); }
.next a { display: grid; padding: .6em 0 calc(var(--l) * 1.2); gap: .2em; }



/* ---------------------------------------------------------------- text pages
   Everything in the small size, in a comfortable reading column (about 65 characters a line).
   Images inside essays may run wider than the text. */
.is-text .l, .is-text .subtitle { font-size: var(--s); line-height: var(--lh-s); }
.is-text .entry-head, .is-text .entry > .prose, .is-text .entry > .details,
.is-text main > .subscribe, .is-text main > .next { width: min(100%, var(--measure)); }
.is-text .entry-head { padding-bottom: calc(var(--s) * var(--lh-s)); }   /* one empty line between title and text */
.is-text .prose p + p, .is-text .prose p + .verse, .is-text .prose .verse + p, .is-text .prose h2 + p,
.is-text .prose h2 + .verse, .is-text .prose blockquote { margin-top: calc(var(--s) * var(--lh-s)); }
.is-text .prose h2 { margin-top: calc(var(--s) * var(--lh-s) * 3); }
/* a line with only "—" in a content file: no dash, two empty lines before what follows (e.g. a note at the end) */
.prose p.after-gap, .is-text .prose p.after-gap { margin-top: calc(2em * var(--lh-s)); }                 /* essay headings */
.is-text .is-verse h2 { margin-top: calc(var(--s) * var(--lh-s) * 2); }              /* two empty lines between poems */
.is-text .is-verse h2:first-child { margin-top: 0; }   /* one empty line between the page title and the first poem title */
/* `format: reviews` (Text › Reviews): two empty lines between reviews, one under the page title */
.is-text .is-reviews h2 { margin-top: calc(var(--s) * var(--lh-s) * 2); }
.is-text .is-reviews h2:first-child { margin-top: 0; }
.is-text .entry > .end-link { width: min(100%, var(--measure)); margin: calc(var(--s) * var(--lh-s)) auto 0; }   /* `end:` link, one empty line under the year */
.is-text main:has(.end-link) > .next { margin-top: calc(var(--s) * var(--lh-s)); }   /* and one empty line above Next */
/* the end of a text: two empty lines, the details (year, genre…), two empty lines, Next */
.is-text .entry > .details { margin-top: calc(var(--s) * var(--lh-s)); }   /* one empty line above the year */
.is-text .entry > .details:last-child { margin-bottom: 0; }
.is-text main > .next { margin-top: calc(var(--s) * var(--lh-s) * 2); }
.is-text .next a { padding-top: 0; }
.is-text .inline-figure {
  position: relative; left: 50%; translate: -50% 0;
  width: calc(min(calc(100vw - 2 * var(--m)), var(--column)) * var(--fig, 1));   /* `image_scale:` in a text file shrinks them */
  margin-block: calc(var(--s) * var(--lh-s));   /* one empty line above and below, like between paragraphs */
}
/* landscape photos in a text are exactly as wide as the text column (still never taller than the window) */
.is-text .inline-figure.is-wide { left: auto; translate: none; width: 100%; }
.is-text .inline-figure.is-wide img, .is-text .inline-figure.is-wide .credit { width: min(100%, calc(var(--fit) * var(--ar, 1.5))); }
.is-text .subscribe { margin-top: calc(var(--s) * var(--lh-s) * 5); }

/* ---------------------------------------------------------------- subscribe */

.subscribe { margin-top: calc(var(--l) * 3.4); display: grid; gap: .6em var(--g); }
.subscribe p { max-width: 30em; }
.subscribe form { display: flex; gap: var(--g); align-items: stretch; max-width: 34em; margin-top: .6em; }
.subscribe input {
  flex: 1; min-width: 0; height: calc(var(--s) * 1.8); padding: 0 .75em; font-size: var(--s); letter-spacing: 0;
  border: var(--rim) solid var(--track); border-radius: 999px; background: var(--track); color: #000; outline: none;
  transition: background-color var(--out) var(--ease);
}
.subscribe input::placeholder { color: var(--soft); opacity: 1; }
.subscribe input:hover, .subscribe input:focus { background: #fff; transition-duration: var(--in); }
.subscribe form { gap: 0; }
.subscribe form .pill { margin-left: -1px; }

.is-index .subscribe { margin-top: calc(var(--l) * 2.5); }


/* ---------------------------------------------------------------- about */

.about-top { display: grid; gap: calc(var(--l) * 1.2) var(--g); align-items: start; }
.about-portrait { background: var(--tint); aspect-ratio: 3 / 4; overflow: hidden; max-width: 28em; }
.about-portrait picture { display: block; }
.about-portrait picture, .about-portrait img { width: 100%; height: 100%; object-fit: cover; }
/* the lists below the text, in the small size. In each column the years are exactly as wide as that column's
   longest year, then two word spaces (.43em; one is about .217em), then the entries; rows follow at the normal line height.
   Every list, its rows and its columns share one grid per column (subgrid), so the years line up all the way down. */
.cv {
  font-size: var(--p); line-height: var(--lh-s); letter-spacing: var(--p-track);
  display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: .43em;
  padding: calc(var(--l) * 2.4) 0 0;
}
.cv-col, .cv-block, .cv-block ul, .cv-block li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-content: start; }
.cv-block { padding-bottom: calc(1em * var(--lh-s) * 2); }      /* two empty lines under each list… */
.cv-col:last-child > .cv-block:last-child { padding-bottom: 0; }  /* …but not under the very last one */
.cv-block h2, .cv-block p { grid-column: 1 / -1; }
/* every space in the lists is whole lines, so all the lines in both columns sit on one baseline grid and the two
   columns end on it too: an empty line under each heading, two above the next (only each column's first heading is
   trimmed to its capitals, the same in both, so the columns start level) */
.cv-block h2 { padding-bottom: calc(1em * var(--lh-s)); }
.cv-block li:not(:has(.when)) > span { grid-column: 1 / -1; }
/* an entry that runs onto a second line: the following lines are indented by five word spaces (one is about .217em) */
.cv-block li > span:not(.when) { padding-left: 1.08em; text-indent: -1.08em; }
.cv-block p { max-width: 40em; }
.cv-block p + p { margin-top: calc(1em * var(--lh-s)); }        /* the imprint: an empty line after the copyright line */
.when, .row-meta > span:last-child { font-variant-numeric: tabular-nums; }   /* years in figures of equal width, About and Writing */
/* contact, right under the About text: links one above the other, upright, leaning while you point at or press them */
.about-contact .sk { transform: none; }
@media (hover: hover) { .about-contact a:hover .sk { transform: skewX(var(--lean)); transition-duration: var(--in); } }
.about-contact a:focus-visible .sk, .about-contact a:active .sk { transform: skewX(var(--lean)); transition-duration: var(--in); }
.prose .about-contact { margin-top: calc(var(--l) * var(--lh-l)); }
/* wide screens: the portrait and the text sit side by side as one block, centred on the page, and the portrait
   is exactly as tall as the text and contact (from the top of the first letters to the baseline of the last line).
   Below, the lists use the whole width in two big columns, each running top to bottom. */
@media (min-width: 900px) {
  main > .about { max-width: none; }
  .about-top {
    --pw: 13.13em;                                  /* 3 : 4 next to the text as it is now (17.5em tall); adjust if the text grows */
    grid-template-columns: var(--pw) minmax(0, 27em); justify-content: center;
    column-gap: 1.76em; align-items: stretch;
  }
  .about-portrait { position: relative; aspect-ratio: auto; max-width: none; margin-top: 0; }
  .about-portrait picture { position: absolute; inset: 0; }   /* fills the height the text gives it, never adds to it */
  /* two columns, side by side: the right one starts with the list marked "## → Title" in about.txt */
  .cv { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: calc(1.76 * var(--s)); align-items: start; }
  .cv-col { grid-column: auto; grid-template-columns: max-content minmax(0, 1fr); column-gap: .43em; }
  .cv-col > .cv-block:last-child { padding-bottom: 0; }   /* side by side, neither column ends with extra space */
}
/* Info on wide screens: the text's first line sits on the menu's baseline. Portrait and text are centred in the room
   between your name (5.24em wide) and the menu (8.8em), the text column narrowing a little (down to about 23em)
   so its first line never reaches the menu. Re-measure those two widths if the name or the menu words change. */
@media (min-width: 1360px) {
  .is-about main { padding-top: 0; }
  .is-about .about-top {
    margin-inline: calc((5.24 + 1.4) * var(--s)) calc((8.8 + 1.4) * var(--s));
    padding-top: calc(var(--menu-baseline) - .7 * var(--s));   /* .7 = the height of a capital: its baseline lands on the menu's */
  }
}
/* narrower than that: the page starts below your name and the menu, which stay on one line as everywhere */
/* computers: after the last list, two empty lines of the big size, then the links at the bottom */
@media (min-width: 900px) {
  .is-about .foot { padding-top: calc(2 * var(--s) * var(--lh-s)); }
}
/* one column (phones and narrow windows): the text first, then the portrait, then the lists */
@media (max-width: 899px) {
  .about-top .prose { order: -1; max-width: none; }               /* the text runs the full width */
}
/* tablets (an iPad upright): the portrait a little smaller, centred on the page */
@media (min-width: 641px) and (max-width: 899px) {
  .about-portrait { width: min(100%, 20em); justify-self: center; }
}
/* the lists stay in the small size (16px) on phones too, so their entries get longer lines */

/* ---------------------------------------------------------------- full-screen images
   Clicking a photo shows it as large as fits below the top line. The name stays top left,
   a large × takes the menu's place, slim arrows sit on either side; nothing covers the name. */
/* a plus, drawn exactly like the × and the arrows */
.gallery img { cursor: url("plus.svg") 15 15, zoom-in; }
@media (max-width: 640px) { .gallery img { cursor: auto; } }   /* phone widths: photos don't open full screen */
.lightbox { --side: clamp(44px, 6vw, 96px); position: fixed; inset: 0; z-index: 25; background: #fff; display: none; }
.lb-open .lightbox { display: block; }
.lb-open { overflow: hidden; }
.lb-open .nav { visibility: hidden; }
.lb-stage {
  position: absolute; left: var(--side); right: var(--side); top: var(--bar); bottom: var(--m);
  overflow: hidden; touch-action: pan-y;          /* horizontal swipes are ours, vertical ones stay the browser's */
}
/* while a photo glides between the page and the full-screen view, nothing clips it */
.lightbox.is-gliding .lb-stage { overflow: visible; }
.lb-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; cursor: default; user-select: none; -webkit-user-drag: none;
  will-change: transform;                         /* each photo on its own layer: a swipe moves them without redrawing */
}
/* below the top line the cursor is the side arrow pointing the way a click goes: left half back, right half forward */
/* each arrow cursor has one fixed point that keeps its 30px picture inside the window (Safari hides a custom
   cursor that would stick out past the edge): each arrow is held at its outer edge */
.lightbox.aim-back, .lightbox.aim-back .lb-img, .lightbox.aim-back .lb-prev, .lightbox.aim-back .lb-next { cursor: url("arrow-left.svg") 0 15, w-resize; }
.lightbox.aim-next, .lightbox.aim-next .lb-img, .lightbox.aim-next .lb-prev, .lightbox.aim-next .lb-next { cursor: url("arrow-right.svg") 29 15, e-resize; }
.lightbox.aim-close, .lightbox.aim-close .lb-img, .lightbox.aim-close .lb-btn { cursor: pointer; }   /* along the top line (which closes): the normal hand */
.lb-btn {
  position: fixed; z-index: 31; display: grid; place-items: center;
  appearance: none; border: 0; background: none; padding: 0; margin: 0; cursor: pointer;
  color: #000; transition: transform 280ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.lb-btn:focus-visible { color: #000; outline: 1.5px solid #000; outline-offset: 4px; border-radius: 4px; }
.lb-btn:not(.lb-close):active { transform: scale(.94); }
.lb-btn svg { display: block; fill: none; stroke: currentColor; stroke-width: 2.75; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.lb-close { top: calc(var(--m) - 6px); right: calc(var(--m) - 6px); width: 48px; height: 48px; }
.lb-close svg { width: 30px; height: 30px; }
/* the × draws in a little while you point at it or press it: its lines shorten slightly towards the middle,
   keeping their thickness (in half a second, back over one and a half, like the links) */
.lb-close path { transform-box: fill-box; transform-origin: center; vector-effect: non-scaling-stroke; transition: transform 1.5s var(--ease); }
@media (hover: hover) { .lb-close:hover path { transform: scale(.87); transition-duration: var(--in); } }
.lb-close:focus-visible path, .lb-close:active path { transform: scale(.87); transition-duration: var(--in); }
@media (hover: none) { .lb-close:active path { transition-duration: 0s; transition-delay: .1s; } }
.lb-prev, .lb-next { top: var(--bar); bottom: var(--m); width: var(--side); }   /* tall targets down each side */
.lb-prev { left: 0; }
.lb-next { right: 0; }
.lb-prev svg, .lb-next svg { width: 30px; height: 30px; }   /* same square as the × */
.is-single .lb-prev, .is-single .lb-next { display: none; }
/* with a mouse or trackpad the cursor itself shows the way (and the arrow keys work), so the side arrows only appear
   on touch screens, where there is no cursor; the × stays everywhere */
@media (hover: hover) and (pointer: fine) { .lb-prev, .lb-next { display: none; } }
@media (max-width: 640px) {
  .lb-close { top: calc(var(--m) + var(--s) * var(--lh-s) - 12px); left: calc(var(--m) - 12px); right: auto; }   /* on the menu line */
}

/* ---------------------------------------------------------------- footer */

.foot { padding: calc(var(--l) * 3) var(--mr) calc(var(--m) + env(safe-area-inset-bottom, 0px)) var(--ml); }
/* phones: more room under the contact pills, clear of the iPhone's home bar */
@media (max-width: 640px) { .foot { padding-bottom: calc(2.5 * var(--m) + env(safe-area-inset-bottom, 0px)); } }
.foot .pills { justify-content: center; }
.foot .pill { font-size: var(--p); height: calc(var(--p) * 2.1); padding: 0 .85em; letter-spacing: var(--p-track); }   /* small, like the filters */

/* ---------------------------------------------------------------- alignment
   Things side by side align at the top of the letters (cap height), not the top of the line box. */
@supports (text-box: trim-start cap alphabetic) {
  .about-top .prose > :first-child,
  .cv-col > .cv-block:first-child h2, .card-text, .card-text > *, .entry-head h1 { text-box: trim-start cap alphabetic; }
  .about-top .prose > :last-child { text-box: trim-end cap alphabetic; }
  .card-text { padding-top: calc(var(--s) * (var(--lh-s) - .7)); }
}
@supports not (text-box: trim-start cap alphabetic) {
  /* older browsers: nudge the image down to the first line's cap height */
  .about-portrait { margin-top: calc(var(--l) * .2); }
}

/* ---------------------------------------------------------------- entrance */

/* no entrance animation: pages, text and the lists simply appear (photos sharpen as they load, see above) */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0s !important; transition-duration: 1ms !important; transition-delay: 0s !important; }
  .js img { clip-path: none !important; }
}

@media print {
  .bar, .filters, .subscribe, .foot, .next, .skip { display: none !important; }
  main { padding: 0; }
  .js img { clip-path: none !important; }
  .gallery-wide { display: grid !important; } .gallery-tall { display: none !important; }
}
