/* Inter Medium, self-hosted (no requests to Google) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* =========================================================
   Christian Ressör — Portfolio 2026
   Values mirror the Figma "Portfolio/…" text styles and the
   desktop (1440) and mobile (390) frames.
   ========================================================= */

:root {
  --black: #000;
  --grey: #808080;
  --body-grey: #666;
  --line: #d4d4d4;
  --placeholder: #f0f0f0;
  --placeholder-hi: #e2e2e2;   /* the placeholder's lighter step */
  --shimmer: rgba(255, 255, 255, 0.6);       /* loading: the light that sweeps across */
  --image-veil: rgba(240, 240, 240, 0.35);   /* loading: over the blurred preview */
  --top-fade: 15, 15, 15;                    /* the top bar's fade, as r, g, b */
  --bg: #fff;
  /* Buttons (Read more pills, Selected work, the 40px round arrows and
     close): solid grey with text and icons in the text colour, a shade
     further on hover. Disabled (an arrow at the end of the row): paler,
     out of play. Dark values in html.theme-dark. */
  --button-bg: var(--placeholder);
  --button-fg: var(--black);
  --button-hover: #e2e2e2;
  --button-off-bg: #f8f8f8;
  --button-off-fg: #d2d2d2;

  /* Desktop — Figma 1440 frames */
  --gutter: 40px;
  --page-max: 1440px;     /* the Figma desktop frame; wider screens centre the page */
  --landing-max: 1000px;  /* landing stops growing taller than this and stays at the top */
  --display: 64px;        /* Portfolio/Display */
  --heading-l: 30px;      /* Portfolio/Heading L */
  --heading-s: 20px;      /* Portfolio/Heading S */
  --body-l: 16px;         /* Portfolio/Body L */
  --body: 14px;           /* Portfolio/Body */
  --row-height: 80px;
  --row-padding: 20px;
  --spacer-min: 120px;

  /* Project page — Figma "Template / Project page – Desktop · Gallery" */
  --section-gap: 40px;
  --text-gap: 32px;       /* equal space above and below each divider in the text column */
  --text-column: 440px;
}

/* Mobile — Figma 390 frames */
@media (max-width: 640px) {
  :root {
    --gutter: 20px;
    --display: 40px;      /* Portfolio/Mobile/Display */
    --heading-l: 20px;    /* Portfolio/Mobile/Heading L */
    --row-height: 64px;
    --row-padding: 16px;
    --spacer-min: 80px;
  }
  /* Landing v2: a little more room at the sides on phones */
  :root:has(:is(.landing--v2, .project-page)) { --gutter: 24px; }
}


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

html { -webkit-text-size-adjust: 100%; }
/* Dark pages colour the page itself (html; they also do it inline in
   <head>, so the first frame is dark), not the body: a body background
   would then be painted over the dot grid, which sits behind it. */
html.theme-dark { background: var(--bg); }
html.theme-dark body { background: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--black);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, p, figure { margin: 0; font-weight: 500; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 4px;
}

/* On screens wider than the design frame, the page keeps its width and sits centred */
.landing,
.project-page {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
}

/* =========================================================
   Landing page
   ========================================================= */
/* Fills the screen up to --landing-max tall. On taller screens it stops
   growing and stays at the top, so title and list stay together. */
.landing {
  min-height: min(100vh, var(--landing-max));
  min-height: min(100svh, var(--landing-max));
  display: flex;
  flex-direction: column;
  padding: var(--gutter);
}

.intro {
  font-size: var(--display);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.intro span { display: block; }
.intro .subtitle { color: var(--grey); margin-top: 8px; }

/* Round portrait right beside the name, both from the left edge.
   The portrait is as tall as the name's two lines (2 × 56 × 1.05 + 8). */
.landing-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 24px;
  align-items: center;
}
.portrait {
  width: 126px;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
}
/* Without the portrait the name spans the full width */
.portrait[hidden] + .intro { grid-column: 1 / -1; }
/* Phone: no room beside the name, so it sits above */
@media (max-width: 640px) {
  .landing-header { grid-template-columns: minmax(0, 1fr); row-gap: 20px; }
  .portrait { width: 80px; }
}

/* Landing type scale: four steps, each clearly apart from the next.
     name 56 / 36 · section heading 28 / 24 · body 20 / 18 · secondary 16
   (desktop / phone). Project pages keep the Figma tokens. */
.landing .intro { font-size: 56px; }
.landing .section-row-label { font-size: 28px; }
@media (max-width: 640px) {
  .landing .intro { font-size: 36px; }
  .landing .section-row-label { font-size: 24px; }
}

/* Space between the name and the section rows on the landing page */
.landing .section-rows {
  margin-top: var(--spacer-min);
  /* The page ends with the same space as between sections (gutter included) */
  padding-bottom: calc(var(--spacer-min) - var(--gutter));
}
/* Header hidden: the rows start at the top */
.landing-header[hidden] { display: none; }
.landing-header[hidden] + .section-rows { margin-top: 0; }

/* =========================================================
   Section row: a heading on the left, content on the right.
   Each row has one hairline across its top, spanning both columns.
     <div class="section-rows">          (optional: a stack of rows)
       <section class="section-row">
         <h2 class="section-row-label">About me</h2>
         <div class="section-row-content"><p>…</p></div>
       </section>
     </div>
   ========================================================= */
.section-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  column-gap: 24px;
  align-items: start;
  font-size: var(--heading-s);     /* 20px */
  line-height: 1.5;
}
.section-row + .section-row { margin-top: var(--spacer-min); }
/* One unbroken hairline across the top of each section, full width */
.section-row {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.section-row-label {
  font-size: var(--heading-l);     /* Portfolio/Heading L: 30px, 20px on phones */
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.section-row-content > * + * { margin-top: 0.75em; }

/* A list of jobs inside a section row: company left, dates right,
   at the row's text size, hairlines only between items. */
.section-row .project {
  min-height: 0;
  padding: 16px 0;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: 0;
}
.section-row .project .dates { font-size: var(--body-l); color: var(--grey); }   /* Body L, secondary, like the card captions */
.section-row .projects li:first-child .project { padding-top: 0; border-top: 0; }
.section-row .projects li:last-child .project { padding-bottom: 0; border-bottom: 0; }

/* Phone: heading above content */
@media (max-width: 640px) {
  .section-row { grid-template-columns: minmax(0, 1fr); font-size: 18px; }
  .section-row-label { margin-bottom: 16px; }
}

/* =========================================================
   Carousel: project cards in the Experience row.
   The track starts at the content column and runs to the right
   edge of the screen, past the 1440 page cap on large screens.
   Text and the job list run to the right edge of the page; the arrows
   sit under the heading on desktop and under the cards on phones.
   ========================================================= */
.carousel {
  --card-w: 680px;
  --card-ratio: 4 / 3;
  --card-radius: 18px;
  --bleed: calc(var(--gutter) + max(0px, (100vw - var(--page-max)) / 2));
}
.carousel-track {
  display: flex;
  gap: 24px;
  margin: 0 calc(-1 * var(--bleed)) 0 0;
  padding: 0 var(--bleed) 0 0;          /* so the last card can scroll fully in */
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track li { flex: none; scroll-snap-align: start; }

.card { display: block; width: var(--card-w); }
/* Placeholder until the project images are ready: each card gets its own
   two-colour gradient (--c1 deep, --c2 light), set inline in index.html */
.card-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: var(--card-ratio);
  border-radius: var(--card-radius);
  background:
    radial-gradient(120% 90% at 85% 10%, var(--c2) 0%, transparent 65%),
    linear-gradient(135deg, var(--c1) 0%, var(--c1) 35%, var(--c2) 140%);
  background-color: var(--placeholder);
}
/* Project name on the image, at the row's body size */
.card-label {
  position: absolute;
  top: var(--card-radius);         /* same inset as the caption below */
  left: var(--card-radius);
  right: var(--card-radius);
  color: #fff;
}
.card-caption {
  margin-top: 16px;
  padding: 0 var(--card-radius);   /* starts where the rounded corner ends */
  font-size: var(--body-l);
  line-height: 1.5;
  color: var(--grey);
  transition: color 150ms ease-out;
}
.card:hover .card-caption,
.card:focus-visible .card-caption { color: var(--black); }

/* Arrows only work with JavaScript; without it the track still scrolls */
.carousel-controls { display: none; }
.js .carousel-controls {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
/* Desktop: arrows sit in the heading column, right under "Projects".
   The cards span both rows; the first row is only as tall as the heading. */
@media (min-width: 641px) {
  .section-row--carousel { grid-template-rows: auto 1fr; }
  .section-row--carousel .section-row-content { grid-column: 2; grid-row: 1 / span 2; }
  .section-row--carousel .carousel-controls { grid-column: 1; grid-row: 2; align-self: start; }
}
/* Phone: arrows under the cards, on the right */
@media (max-width: 640px) {
  .js .carousel-controls { justify-content: flex-end; }
}
.carousel-button {
  padding: 0;
  background: var(--button-bg);   /* solid, so the dot grid doesn't show through */
  color: var(--button-fg);
  font: inherit;
  cursor: pointer;
}
.carousel-button:hover:not(:disabled) { border-color: var(--black); }
/* Faded, but the white fill stays solid so the dot grid never shows through */
.carousel-button:disabled { color: #999; border-color: #f2f2f2; cursor: default; }


/* The track runs a little past the screen edge when a scrollbar takes space */
body { overflow-x: clip; }

@media (max-width: 640px) {
  .carousel { --card-w: 300px; --card-ratio: 300 / 365; }   /* ~46px of the next card shows */
  /* Secondary text one step down on phones, clearly below the 18px body */
  .card-caption,
  .section-row .project .dates { font-size: var(--body); }
}

/* Pushes the list to the bottom of the screen */
.spacer { flex: 1; min-height: var(--spacer-min); }

.projects {
  list-style: none;
  margin: 0;
  padding: 0;
}
/* The closing line belongs to the last row, so it moves in with it */
.projects li:last-child .project { border-bottom: 1px solid var(--line); }

/* Rows move in one after another when the landing page loads.
   The step is short and stops growing at the 11th row, so a long list
   still settles in about a second. */
.js .projects li {
  animation: row-in 600ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(120ms + var(--row, 0) * 45ms);
}
.projects li:nth-child(2)  { --row: 1; }
.projects li:nth-child(3)  { --row: 2; }
.projects li:nth-child(4)  { --row: 3; }
.projects li:nth-child(5)  { --row: 4; }
.projects li:nth-child(6)  { --row: 5; }
.projects li:nth-child(7)  { --row: 6; }
.projects li:nth-child(8)  { --row: 7; }
.projects li:nth-child(9)  { --row: 8; }
.projects li:nth-child(10) { --row: 9; }
.projects li:nth-child(n+11) { --row: 10; }
@keyframes row-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .js .projects li { animation: none; }
}

.project {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  min-height: var(--row-height);
  padding: var(--row-padding) 0;
  border-top: 1px solid var(--line);
  font-size: var(--heading-l);
  line-height: 1.2;
  letter-spacing: -0.01em;
  transition: color 150ms ease-out;
}
.project .dates { text-align: right; white-space: nowrap; }

a.project:hover,
a.project:focus-visible { color: var(--grey); }
/* Work without a project page yet: same row, but it doesn't react */
.project--static { cursor: default; }

/* =========================================================
   Project page — in the starting page's (v2) language: dark, over the
   dot grid, the same label · content grid as "About me".
     top bar      close (left) · next project (right)
     title        name and dates, the size of the name on the start page
     image        in the content column, rounded like the cards
     text rows    grey label left, text right
   The page scrolls; on phones everything stacks.
   ========================================================= */
.project-page {
  display: flex;
  flex-direction: column;
  gap: var(--project-gap);
  /* Desktop: one screen tall, the page margin all round. Phones scroll,
     so they keep more room at the end. */
  padding: var(--gutter);
  --project-gap: 48px;
}
@media (max-width: 640px) {
  .project-page { padding-bottom: 80px; }
}

/* ---------- Top bar: close (left) · next project (right) ---------- */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
/* It stays at the top while the page scrolls. Once scrolled, a dark fade
   (solid to 40%, then easing out over 80px) and a soft blur sit behind the
   buttons, so the text slides under them. The padding is the fade's room;
   the negative margins keep the layout as it was. */
.project-page > .top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: calc(-1 * var(--gutter)) calc(-1 * var(--gutter)) -80px;
  padding: var(--gutter) var(--gutter) 80px;
  pointer-events: none;            /* the fade never blocks the text under it */
}
.project-page > .top-bar > * { pointer-events: auto; }
.project-page > .top-bar::before,
.project-page > .top-bar::after {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);       /* the full window width, also past 1440 */
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 240ms ease-out;
}
.project-page > .top-bar::before {
  background: linear-gradient(to bottom,
    rgba(var(--top-fade), 1) 0%, rgba(var(--top-fade), 1) 40%,
    rgba(var(--top-fade), 0.952) 47%, rgba(var(--top-fade), 0.828) 53%,
    rgba(var(--top-fade), 0.657) 60%, rgba(var(--top-fade), 0.47) 67%,
    rgba(var(--top-fade), 0.294) 73%, rgba(var(--top-fade), 0.151) 80%,
    rgba(var(--top-fade), 0.055) 87%, rgba(var(--top-fade), 0.009) 93%,
    rgba(var(--top-fade), 0) 100%);
}
.project-page > .top-bar::after {
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  -webkit-mask-image: linear-gradient(to bottom, #000 25%, rgba(0, 0, 0, 0.5) 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 25%, rgba(0, 0, 0, 0.5) 55%, transparent 100%);
}
html.is-scrolled body > .project-page > .top-bar::before,
html.is-scrolled body > .project-page > .top-bar::after { opacity: 1; }

/* 40px round button, 20px icon: solid grey, no outline, like the carousel
   arrows on the starting page; a shade lighter on hover (--button-*) */
.circle {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--button-bg);
  color: var(--button-fg);
  transition: background-color 150ms ease-out;
}
.circle svg { display: block; }
a:hover > .circle, button.circle:hover:not(:disabled) { background: var(--button-hover); }

/* Previous · next project: two arrow circles, side by side on the right */
.home-link,
.prev-project,
.next-project {
  display: flex;
  align-items: center;
}
.project-nav {
  display: flex;
  gap: 12px;
}

/* ---------- Title on top · image left · text right ----------
   At 1440 wide: image 800px, text 512px, 48px apart (the same gap as
   between the title and the image). Narrower screens keep the proportion. */
.project-main {
  display: grid;
  grid-template-columns: minmax(0, 800fr) minmax(0, 512fr);
  column-gap: var(--project-gap);
  row-gap: var(--project-gap);
  align-items: start;
}
/* The image with its numbered steps 16px under it */
.project-media {
  grid-column: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Name and dates, like the name and role on the starting page */
.project-title {
  grid-column: 1 / -1;
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.project-title span { display: block; }
.project-title .dates { color: var(--grey); margin-top: 8px; }

.project-image {
  position: relative;
  overflow: hidden;
  width: 100%;                    /* the full column, even when the height is capped */
  aspect-ratio: 800 / 497;        /* 800 × 497 at 1440 × 900 */
  /* …but never past the bottom of the screen: on a short screen it gets a
     little wider than its shape and the picture crops at the sides. The
     page margin stays below it. 45px is the top bar, 126px the title's
     two lines, 56px the steps and the gap above them. Never less than 360px tall. */
  max-height: max(360px, calc(100vh - 2 * var(--gutter) - 45px - 126px - 2 * var(--project-gap) - 56px));
  max-height: max(360px, calc(100svh - 2 * var(--gutter) - 45px - 126px - 2 * var(--project-gap) - 56px));
  border-radius: 18px;            /* same as the cards */
  background: var(--placeholder);
  min-height: 0;
  isolation: isolate;             /* the blurred preview sits just above the grey */
}
/* The first image sits in a <picture> (3:4 art on phones); the picture
   itself doesn't make a box, so its <img> lays out like the others */
.project-image > picture { display: contents; }
.project-image > :is(img, .project-image-placeholder),
.project-image > picture > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Project images are stacked. Each waits until it has loaded, then fades in
   on top of the previous one — no popping in. (Only when JavaScript runs;
   without it the first image simply shows.) */
.js .project-image > :is(img, .project-image-placeholder),
.js .project-image > picture > img {
  opacity: 0;
  transition: opacity 800ms ease-in-out;
}
.js .project-image > .is-visible,
.js .project-image > picture > .is-visible { opacity: 1; }
.project-image > .is-top,
.project-image > picture > .is-top { z-index: 1; }
/* Loading (canvas "Project page · Loading"): a tiny copy of the first
   image shows blurred under a light veil and a slow shimmer; the full
   image then fades in blurred and sharpens (project.js). */
.js .project-image > .project-image-preview {
  z-index: -1;
  opacity: 1;
  transition: none;
  filter: blur(24px);
  transform: scale(1.08);
}
html:not(.js) .project-image-preview { display: none; }
.js .project-image > img.sharpen,
.js .project-image > picture > img.sharpen {
  transition: opacity 400ms ease-out, filter 700ms ease-out, transform 700ms ease-out;
}
.js .project-image > img.is-blurred,
.js .project-image > picture > img.is-blurred { filter: blur(24px); transform: scale(1.08); }
.js .project-image::before,
.js .project-image::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transition: opacity 500ms ease-out, visibility 0s 500ms;
}
.js .project-image::before { background: var(--image-veil); }
.js .project-image::after {
  background: linear-gradient(90deg, transparent 0%, var(--shimmer) 50%, transparent 100%);
  animation: shimmer 1.6s ease-in-out infinite;
}
.js .project-image.is-loaded::before,
.js .project-image.is-loaded::after { opacity: 0; visibility: hidden; }
/* Without JavaScript only the first image shows */
html:not(.js) .project-image-placeholder { display: none; }
/* A slide whose image isn't there yet: its number, centred in grey */
.project-image-placeholder {
  display: grid;
  place-items: center;
  color: var(--grey);
  font-size: var(--heading-s);
}
/* Cut-out images (transparent background): scale to fit inside the grey
   box without cropping; object-position pins the edge they bleed off */
.project-image img.fit-contain { object-fit: contain; }

.project-image--placeholder {
  display: grid;
  place-items: center;
  color: var(--grey);
  font-size: var(--heading-s);
}

/* ---------- Slide indicator (projects with several images) ----------
   Numbered circles in a row under the image */
.slides {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.slide-step {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--placeholder);
  color: var(--grey);
  font: inherit;
  font-size: var(--body);
  line-height: 1;
  cursor: pointer;
  transition: background-color 200ms ease-out, color 200ms ease-out;
}
html.theme-dark .slide-step { background: #262626; }
html.theme-dark .slide-step:hover { background: #333; }
.slide-step[aria-current="true"],
html.theme-dark .slide-step[aria-current="true"] {
  background: var(--black);
  color: var(--bg);
}
/* Autoplay bar: under the current circle, it fills while that image
   shows (project.js); when full, the next image comes in. Hidden once
   a circle is picked by hand. */
.slides li { position: relative; }
/* Swiping the image changes images (project.js); the page still scrolls up and down */
.project-image { touch-action: pan-y; }
.slide-bar {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  width: 24px;
  height: 2px;
  margin-left: -12px;
  overflow: hidden;
  border-radius: 1px;
  background: var(--placeholder-hi);
  opacity: 0;
  transition: opacity 200ms ease-out;
  pointer-events: none;
}
.slide-bar.is-on { opacity: 1; }
.slide-bar > span { display: block; width: 0; height: 100%; background: var(--black); }

/* ---------- Text, right of the image: grey label on top, then the text ---------- */
.project-text { grid-column: 2; min-width: 0; }
.slide-copy {
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.slide-copy[hidden] { display: none; }

/* Phones: one column. The image is 3:4 portrait, like the cards on the
   starting page, so the screens in it stay big enough to read. */
@media (max-width: 640px) {
  .project-page { gap: 40px; }
  .project-main { grid-template-columns: minmax(0, 1fr); row-gap: 32px; }
  .project-title { font-size: 30px; line-height: 1.2; letter-spacing: -0.01em; }
  .project-title .dates { margin-top: 4px; }
  .project-media, .project-text { grid-column: 1; }
  .project-image { aspect-ratio: 3 / 4; max-height: none; }
  .project-image-placeholder { font-size: 18px; }   /* the phone text size */
}

/* Phones: the images are a swipe row, like the start page cards. Each is
   342 × 456 (3:4), 16px apart, snapping to the page margin; 8px of the
   next and previous ones show at the edges. Autoplay scrolls the row
   (project.js). Only the real page: the skeleton keeps a single box. */
@media (max-width: 640px) {
  body > .project-page .project-image {
    display: flex;
    gap: 16px;
    width: auto;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter);
    aspect-ratio: auto;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-left: var(--gutter);
    scrollbar-width: none;
    border-radius: 0;
    background: none;
    touch-action: auto;
  }
  body > .project-page .project-image::-webkit-scrollbar { display: none; }
  body > .project-page .project-image > :is(img:not(.project-image-preview, .project-image-hold), .project-image-placeholder),
  body > .project-page .project-image > picture > img {
    position: relative;
    inset: auto;
    flex: none;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    border-radius: 18px;
    clip-path: inset(0 round 18px);   /* keeps the loading blur inside the corners */
    background: var(--placeholder);
    scroll-snap-align: start;
    opacity: 1;
  }
  /* The first image starts see-through, so the blurred preview under it shows */
  .js body > .project-page .project-image > img:first-child:not(.is-visible),
  .js body > .project-page .project-image > picture:first-child > img:not(.is-visible) { background: none; opacity: 0; }
  .js body > .project-page .project-image > img.is-blurred,
  .js body > .project-page .project-image > picture > img.is-blurred { transform: none; }
  /* The preview, the card's picture and the loading veil cover the first image */
  body > .project-page .project-image > :is(.project-image-preview, .project-image-hold),
  .js body > .project-page .project-image::before,
  .js body > .project-page .project-image::after {
    left: var(--gutter);
    right: auto;
    width: calc(100% - 2 * var(--gutter));
    aspect-ratio: 3 / 4;
    height: auto;
    bottom: auto;
    border-radius: 18px;
    clip-path: inset(0 round 18px);
  }
  .js body > .project-page .project-image > .project-image-preview { transform: none; background: var(--placeholder); }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  body > .project-page .project-image { scroll-behavior: auto; }
}
@media (max-width: 640px) {
  body > .project-page .project-image > :is(img, .project-image-placeholder),
  body > .project-page .project-image > picture > img { cursor: zoom-in; }
}

/* Fullscreen image viewer (phones; project.js makes it). A tap on a
   project image opens it: one image per screen, swipe sideways between
   them, pinch or double-tap to zoom, X or a swipe down to close.
   --iv-fade dims the backdrop while it is swiped down. */
html.viewer-open { overflow: hidden; }
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 950;                         /* over the page and its top bar, under the wipe */
  color: #ededed;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;   /* set here too, never the browser default */
  font-weight: 500;
  background: rgba(8, 8, 8, calc(0.97 * var(--iv-fade, 1)));
  opacity: 0;
  transition: opacity 240ms ease-out;
  touch-action: none;
  overscroll-behavior: contain;
}
.image-viewer.is-open { opacity: 1; }
.iv-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.iv-strip {
  display: flex;
  height: 100%;
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.iv-slide { flex: none; width: 100%; height: 100%; overflow: hidden; }
.iv-zoom {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.iv-zoom img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.iv-placeholder {
  display: grid;
  place-items: center;
  width: calc(100% - 2 * var(--gutter));
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  background: var(--placeholder);
  color: var(--grey);
  font-size: 18px;
}
.iv-bar {
  position: absolute;
  top: calc(var(--gutter) + env(safe-area-inset-top));
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.iv-count {
  font-size: var(--body);
  line-height: 1;
  color: var(--grey);
  font-variant-numeric: tabular-nums;
}
.iv-close {
  pointer-events: auto;
  padding: 0;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.iv-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(32px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: var(--body);
  line-height: 1.5;
  color: var(--grey);
  pointer-events: none;
  transition: opacity 200ms ease-out;
}
.image-viewer.is-zoomed .iv-hint { opacity: 0; }

/* =========================================================
   Page wipe — a white gradient that travels in the direction you move
     up    landing → project       down  project → landing (close)
     left  next project            right previous project
   Leaving: the white slides in and covers the page.
   Arriving: the page starts white and the white keeps travelling off screen.
   Each overlay is 200% of the screen: a 100% soft edge + 100% solid white.
   ========================================================= */
:root {
  --wipe-out: 220ms;   /* cover the page you're leaving */
  --wipe-in: 280ms;    /* uncover the page you arrive on */
  --wipe-ease: cubic-bezier(0.65, 0, 0.35, 1);
  --wipe-fade: rgba(255, 255, 255, 0);
}

/* ---------- Leaving ---------- */
.wipe-cover {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  pointer-events: none;
  transition: transform var(--wipe-out) var(--wipe-ease);
}
.wipe-cover--up, .wipe-cover--down    { width: 100%; height: 200vh; }
.wipe-cover--left, .wipe-cover--right { width: 200vw; height: 100%; }

.wipe-cover--up    { background: linear-gradient(to top,    var(--bg) 50%, var(--wipe-fade)); transform: translateY(100vh); }
.wipe-cover--down  { background: linear-gradient(to bottom, var(--bg) 50%, var(--wipe-fade)); transform: translateY(-200vh); }
.wipe-cover--left  { background: linear-gradient(to left,   var(--bg) 50%, var(--wipe-fade)); transform: translateX(100vw); }
.wipe-cover--right { background: linear-gradient(to right,  var(--bg) 50%, var(--wipe-fade)); transform: translateX(-200vw); }

.wipe-cover--up.is-covering    { transform: translateY(-100vh); }
.wipe-cover--down.is-covering  { transform: translateY(0); }
.wipe-cover--left.is-covering  { transform: translateX(-100vw); }
.wipe-cover--right.is-covering { transform: translateX(0); }

/* The page drifts a little in the same direction as it's covered */
.landing, .project-page { transition: transform var(--wipe-out) var(--wipe-ease); }
[data-leave="up"]    :is(.landing, .project-page) { transform: translateY(-32px); }
[data-leave="down"]  :is(.landing, .project-page) { transform: translateY(32px); }
/* Between projects only the content moves; the top navigation stays put */
.project-main { transition: transform var(--wipe-out) var(--wipe-ease); }
[data-leave="left"]  .project-main { transform: translateX(-32px); }
[data-leave="right"] .project-main { transform: translateX(32px); }

/* ---------- Arriving ---------- */
[data-wipe-in] body::after {
  content: "";
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  animation: var(--wipe-in) var(--wipe-ease) both;
}
[data-wipe-in="up"] body::after {      /* leaves upwards, revealing from the bottom */
  left: 0; top: 0; width: 100%; height: 200vh;
  background: linear-gradient(to bottom, var(--bg) 50%, var(--wipe-fade));
  animation-name: wipe-up;
}
[data-wipe-in="down"] body::after {    /* leaves downwards, revealing from the top */
  left: 0; top: -100vh; width: 100%; height: 200vh;
  background: linear-gradient(to top, var(--bg) 50%, var(--wipe-fade));
  animation-name: wipe-down;
}
[data-wipe-in="left"] body::after {    /* leaves to the left, revealing from the right */
  left: 0; top: 0; width: 200vw; height: 100%;
  background: linear-gradient(to right, var(--bg) 50%, var(--wipe-fade));
  animation-name: wipe-left;
}
[data-wipe-in="right"] body::after {   /* leaves to the right, revealing from the left */
  left: -100vw; top: 0; width: 200vw; height: 100%;
  background: linear-gradient(to left, var(--bg) 50%, var(--wipe-fade));
  animation-name: wipe-right;
}
@keyframes wipe-up    { from { transform: translateY(0); } to { transform: translateY(-200vh); } }
@keyframes wipe-down  { from { transform: translateY(0); } to { transform: translateY(200vh); } }
@keyframes wipe-left  { from { transform: translateX(0); } to { transform: translateX(-200vw); } }
@keyframes wipe-right { from { transform: translateX(0); } to { transform: translateX(200vw); } }

/* The new page glides in from the side the white is coming from */
[data-wipe-in="up"]    { --enter-x: 0; --enter-y: 48px; }
[data-wipe-in="down"]  { --enter-x: 0; --enter-y: -48px; }
[data-wipe-in="left"]  { --enter-x: 48px; --enter-y: 0; }
[data-wipe-in="right"] { --enter-x: -48px; --enter-y: 0; }
[data-wipe-in="up"] :is(.landing, .project-page),
[data-wipe-in="down"] :is(.landing, .project-page),
[data-wipe-in="left"] .project-main,
[data-wipe-in="right"] .project-main {
  animation: enter 340ms cubic-bezier(0.2, 0.7, 0.2, 1) 30ms both;
}
@keyframes enter {
  from { transform: translate(var(--enter-x), var(--enter-y)); }
  to   { transform: none; }
}

/* No sideways scrollbar while things slide */
[data-wipe-in] body, [data-leave] body { overflow-x: clip; }

/* Between projects the top navigation sits above the white, so it never moves or fades */
:is([data-leave="left"], [data-leave="right"], [data-wipe-in="left"], [data-wipe-in="right"]) .top-bar {
  z-index: 1001;                   /* it is sticky, so already positioned */
}

/* =========================================================
   Shared image — landing ⇄ project (morph.js)
   The card's image grows into the project's image box, and goes back
   into its card when the project closes. Everything else crossfades.
   Browsers without cross-document view transitions use the wipe above.
   ========================================================= */
@view-transition { navigation: auto; }
/* Clicks go through the transition to the page under it, so an arrow
   pressed while a page is still settling in is never lost (by default
   the transition layer covers the page and takes the click) */
::view-transition { pointer-events: none; }

:root {
  --morph: 560ms;          /* the image's flight */
  --morph-fade: 320ms;     /* the rest of the page */
  --morph-radius: 18px;    /* the cards' and the project image's corners */
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--morph-fade);
  animation-timing-function: var(--wipe-ease);
}

::view-transition-group(project-image) {
  animation-duration: var(--morph);
  animation-timing-function: var(--wipe-ease);
}
/* Both pictures fill the moving box, cropped, never stretched */
::view-transition-old(project-image),
::view-transition-new(project-image) {
  height: 100%;
  object-fit: cover;
  mix-blend-mode: normal;
  animation-duration: var(--morph);
  animation-timing-function: var(--wipe-ease);
  animation-fill-mode: both;
}
/* The arriving picture settles in over the leaving one, which holds until
   it's covered, so the box is never see-through on the way */
::view-transition-old(project-image) { animation-name: morph-hold; }
::view-transition-new(project-image) { animation-name: morph-show; }
@keyframes morph-hold { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes morph-show { 0% { opacity: 0; } 60%, 100% { opacity: 1; } }

/* Rounded the whole way: the card and the project image share their corners */
::view-transition-image-pair(project-image) {
  overflow: clip;
  border-radius: var(--morph-radius);
}

/* Project page while the image arrives: show it at once, no grey box behind it */
.morph-in .project-image { background: transparent; }
.js.morph-in .project-image img:first-child,
.js.morph-in .project-image > picture:first-child > img { opacity: 1; transition: none; }
/* …unless it hasn't downloaded yet: keep the grey box, and the card's
   picture stays on top for the whole flight (morph.js) */
.morph-wait .project-image { background: var(--placeholder); }
.js.morph-wait .project-image img:first-child,
.js.morph-wait .project-image > picture:first-child > img { opacity: 0; }
html.morph-wait::view-transition-old(project-image) { animation-name: none; opacity: 1; }
/* …and the top bar, text and slide indicator come in around it */
.morph-in :is(.top-bar, .project-title, .project-text, .slides) {
  animation: morph-around 400ms cubic-bezier(0.2, 0.7, 0.2, 1) 240ms both;
}
@keyframes morph-around {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* Opened through the skeleton (below): the text is already in place,
   so nothing rises in; the real page just crossfades over the skeleton */
.morph-settled :is(.top-bar, .project-title, .project-text, .slides) { animation: none; }

/* The card's picture, held in the image box until the full one has
   faded in over it (morph.js) */
.js .project-image > .project-image-hold { opacity: 1; z-index: 0; transition: none; }

/* ---------- Skeletons (morph.js) ----------
   Shown the moment you click a card, the close button or the project
   arrows: a stand-in for the page you're going to, while it loads.
   The project skeleton uses the project page's own classes, so it lines
   up exactly; the landing skeleton is drawn from where everything was
   when you left it. The page underneath is hidden but its dot grid stays. */
html.skeleton-open { overflow: hidden; }
html.skeleton-open body > :is(.landing, .project-page) { visibility: hidden; }
.skeleton-page {
  position: fixed;
  inset: 0;
  z-index: 900;
  overflow: hidden;
  pointer-events: none;
}
.skeleton-page .project-page { min-height: 100%; }
.skeleton-page :is(.close, .prev-project, .next-project) .circle { cursor: pointer; pointer-events: auto; }
.skeleton-page :is(.close, .prev-project, .next-project) .circle:hover { background: var(--button-hover); }
.skeleton-para { display: flex; flex-direction: column; }
.skeleton-para + .skeleton-para { margin-top: 12px; }   /* like the paragraphs */
.skeleton-line {
  display: block;
  height: 12px;
  margin: 6px 0;            /* 24px a line, like Body L text */
  border-radius: 6px;
  background: var(--placeholder);
}
/* Title and label: a block the size of the words (they're there, but
   transparent), so the skeleton has the real page's measurements */
.sk-bar {
  display: inline-block;
  vertical-align: middle;
  height: 0.82em;           /* 46px on the 56px title */
  line-height: 0.82em;
  border-radius: 8px;
  color: transparent;
  white-space: nowrap;
  background: var(--placeholder);
}
.sk-bar--label { height: 14px; line-height: 14px; border-radius: 7px; }
.project-title span.sk-bar { display: inline-block; }   /* not a block like the title's lines */
.skeleton-page .slide-step.sk-step,
html.theme-dark .skeleton-page .slide-step.sk-step { background: var(--placeholder); }
/* The shimmer: a soft light sweeping across each block */
:is(.skeleton-line, .sk-bar, .sk-step) { position: relative; overflow: hidden; }
:is(.skeleton-line, .sk-bar, .sk-step)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--shimmer) 50%, transparent 100%);
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
/* The skeleton is the page at the top: no scrolled fade over it */
.skeleton-page .top-bar::before,
.skeleton-page .top-bar::after { display: none; }
/* The project's own picture fades in over the card's once it has loaded */
.skeleton-page .project-image > .skeleton-full { z-index: 1; }

/* Landing skeleton: each piece where it was on screen */
.sk-item { position: absolute; display: block; margin: 0; box-sizing: border-box; white-space: nowrap; }
.sk-lines { display: flex; flex-direction: column; }
.sk-lines .skeleton-line { margin: calc((var(--lh) - 12px) / 2) 0; }
.sk-round { border-radius: 50%; object-fit: cover; }
.sk-cards { position: absolute; overflow: hidden; }   /* the row's window, placed by morph.js */
.sk-card { overflow: hidden; background-color: var(--placeholder); }
.sk-card > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sk-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 20px;
  background: var(--button-bg);   /* the Selected work button */
  color: var(--button-fg);
  font-size: var(--body-l);
  line-height: 1.5;
}
.sk-item.sk-off { background: var(--button-off-bg); color: var(--button-off-fg); }   /* the disabled arrow */

/* Next / previous: the content slides out towards where you're going and
   the next project's skeleton slides in from the other side, with the
   same timing as the page wipe it replaces. The top bar stays put. */
::view-transition-group(page-main) { animation: none; }
html.go-left::view-transition-old(page-main)  { animation: main-out-left var(--wipe-out) var(--wipe-ease) both; }
html.go-right::view-transition-old(page-main) { animation: main-out-right var(--wipe-out) var(--wipe-ease) both; }
html.go-left::view-transition-new(page-main)  { animation: main-in-right 340ms cubic-bezier(0.2, 0.7, 0.2, 1) 30ms both; }
html.go-right::view-transition-new(page-main) { animation: main-in-left 340ms cubic-bezier(0.2, 0.7, 0.2, 1) 30ms both; }
@keyframes main-out-left  { to { transform: translateX(-32px); opacity: 0; } }
@keyframes main-out-right { to { transform: translateX(32px); opacity: 0; } }
@keyframes main-in-right  { from { transform: translateX(48px); opacity: 0; } }
@keyframes main-in-left   { from { transform: translateX(-48px); opacity: 0; } }

/* The text fades in as the page arrives: 400ms, a 6px rise
   (over the skeleton, or on a direct visit) */
.text-in body > .project-page :is(.project-title, .slides, .project-text) {
  animation: text-in 400ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes text-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Back on the landing page: the rows are already in place, no rise-in */
[data-return] .projects li { animation: none; }

@media (prefers-reduced-motion: reduce) {
  /* No movement: morph.js names nothing, the pages just swap with a quick fade */
  ::view-transition-old(root),
  ::view-transition-new(root) { animation-duration: 150ms; }
  .morph-in :is(.top-bar, .project-title, .project-text, .slides) { animation: none; }
  .js .project-image::after, :is(.skeleton-line, .sk-bar, .sk-step)::after { animation: none; display: none; }
  .text-in body > .project-page :is(.project-title, .slides, .project-text) { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  [data-wipe-in] body::after { display: none; }
  [data-wipe-in] :is(.landing, .project-page, .project-main) { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}


/* =========================================================
   Landing v2 (v2.html): a full-height first screen with name,
   role and About over a dot grid that lights up around the
   mouse, and a button down to Selected work. index.html is unchanged.
   ========================================================= */
html:has(.landing--v2) { scroll-behavior: smooth; }
.landing--v2 #selected-work {
  scroll-margin-top: var(--gutter);   /* lands with the page margin above */
  /* The gallery below makes the page long enough for it to reach the top */
}
@media (prefers-reduced-motion: reduce) { html:has(.landing--v2) { scroll-behavior: auto; } }

.intro-screen {
  position: relative;
  isolation: isolate;                       /* keeps the gradient behind, inside this screen */
  min-height: calc(100vh - 2 * var(--gutter));
  min-height: calc(100svh - 2 * var(--gutter));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}

/* Dot grid behind the whole page. dot-grid.js draws the dots, the slowly
   moving warm glow (three soft blobs in --c1..3: a dot is never brighter
   than its own colour --ink), the fade around text and the scattering
   rings as one layer on one canvas (.dot-canvas). The button rings below
   (.dot-hover) are CSS masks lined up with the same 12px grid. */
@property --grow { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --in { syntax: "<length>"; inherits: false; initial-value: 40px; }
@property --out { syntax: "<length>"; inherits: false; initial-value: 28px; }
body:has(> .dot-grid) { position: relative; }
.dot-grid {
  --dot-gap: 12px;
  /* Palette: "warm". A dot shows the brighter of its own colour (--ink)
     and the moving blob over it (--c1..3, softened by the blob's opacity
     over white), so the dots stay mid grey and the blobs carry the colour.
     The pulses use the same family (--pulse, --pulse-deep, --pulse-light).
     Previous palette, "grey", for the record:
       --ink, --c1, --c2, --c3: 196, 196, 196 (#c4c4c4)
       blob opacity (--a): .8, .55, .7
       portrait ring: sampled from the photo (fallback #8a8a8a)
       button ring: #6e6e6e; click ripple: #a8a8a8 */
  --ink: 130, 130, 130;
  --c1: 190, 150, 110;
  --c2: 200, 170, 130;
  --c3: 170, 135, 100;
  --pulse: 148, 136, 124;       /* portrait ring, was #8a8a8a */
  --pulse-deep: 120, 110, 100;  /* button ring, was #6e6e6e */
  --pulse-light: 172, 162, 152; /* click ripple, was #a8a8a8 */
  /* Around the portrait the tones are stronger, so it glows a little */
  --glow-1: 212, 140, 78;
  --glow-2: 190, 118, 64;
  --glow-3: 226, 166, 104;
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg);  /* the mesh blends against white */
}
.dot-pulse {
  position: absolute;
  background-size: var(--dot-gap) var(--dot-gap);
  background-position: 0 0;
}
/* The dots, their warm glow, the fade around text and the scattering
   rings are all drawn by dot-grid.js on this one canvas. It sits in the
   page (so it scrolls with the text) and starts hidden, fading in once
   the script has everything in place. */
.dot-canvas {
  position: absolute;
  z-index: 1;
  left: 0;
  top: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .8s ease;
}
.dot-grid.is-ready .dot-canvas { opacity: 1; }
/* Arriving from another page of the site: the dots are there at once */
.dot-grid.no-fade .dot-canvas { transition: none; }
/* Portrait pulse: a ring of dots that grows out from the round portrait,
   thins out and fades. The ring is painted in the palette's warm tones
   (--ring: a soft conic gradient through them), and three masks cut it down to: the ring, random gaps
   along it, and the dots of the grid (the white fade on top keeps it off
   text). Each ring is also slightly squashed (--k) and off-centre
   (--dx, --dy), so no two look alike. --r is the ring's
   radius; the box stays put so the dots line up with the grid. */
.dot-pulse {
  --m: 150px;          /* room around the portrait for the ring to grow into */
  --r: calc(var(--d) / 2 + var(--grow));
  position: absolute;
  left: calc(var(--l) - var(--m));
  top: calc(var(--t) - var(--m));
  width: calc(var(--d) + 2 * var(--m));
  height: calc(var(--d) + 2 * var(--m));
  --ring: conic-gradient(rgb(var(--glow-1)), rgb(var(--glow-2)) 30%, rgb(var(--glow-3)) 60%, rgb(var(--glow-1)) 80%, rgb(var(--glow-1)));
  background: var(--ring);
  -webkit-mask-image:
    radial-gradient(calc(var(--r) + 200px) calc((var(--r) + 200px) * var(--k, 1)) at calc(50% + var(--dx, 0px)) calc(50% + var(--dy, 0px)), transparent calc(var(--r) - var(--in)), #000 var(--r), transparent calc(var(--r) + var(--out))),
    var(--gaps, linear-gradient(#000, #000)),
    var(--dots, radial-gradient(circle, #000 1.25px, transparent 1.75px));
  mask-image:
    radial-gradient(calc(var(--r) + 200px) calc((var(--r) + 200px) * var(--k, 1)) at calc(50% + var(--dx, 0px)) calc(50% + var(--dy, 0px)), transparent calc(var(--r) - var(--in)), #000 var(--r), transparent calc(var(--r) + var(--out))),
    var(--gaps, linear-gradient(#000, #000)),
    var(--dots, radial-gradient(circle, #000 1.25px, transparent 1.75px));
  -webkit-mask-size: 100% 100%, 100% 100%, var(--dots-size, var(--dot-gap) var(--dot-gap));
  mask-size: 100% 100%, 100% 100%, var(--dots-size, var(--dot-gap) var(--dot-gap));
  -webkit-mask-position: 0 0, 0 0, calc(var(--m) - var(--l)) calc(var(--m) - var(--t));
  mask-position: 0 0, 0 0, calc(var(--m) - var(--l)) calc(var(--m) - var(--t));
  -webkit-mask-repeat: no-repeat, no-repeat, repeat;
  mask-repeat: no-repeat, no-repeat, repeat;
  -webkit-mask-composite: source-in, source-in, source-over;
  mask-composite: intersect, intersect, add;
  animation: pulse var(--dur, 4.5s) cubic-bezier(0.37, 0, 0.3, 1) forwards;   /* slow, sine-like breath */
}
/* Eases in rather than popping on, then drifts out wide and slow, thinning,
   lightening and fading. dot-grid.js gives each ring its own --dur, --reach
   and --peak, so no two breaths are quite the same. --in / --out are the
   soft fades inside and outside the ring. */
@keyframes pulse {
  0% { --grow: 0px; --in: 48px; --out: 34px; filter: brightness(0.85); opacity: 0; }
  18% { opacity: var(--peak, 0.9); }
  55% { opacity: calc(var(--peak, 0.9) * 0.5); }
  100% { --grow: var(--reach, 120px); --in: 12px; --out: 10px; filter: brightness(1.15); opacity: 0; }
}
/* Hover pulse: while the pointer is over a button, the grid around it
   pulses out in rings that follow the button's shape (an ellipse that
   grows from its edge). Stops are in % of the ellipse, so the ring sits on
   --rx / --ry and softens on both sides. Like the portrait rings, each one
   is a little squashed and off-centre, with random soft gaps (--k, --dx,
   --dy, --gaps from dot-grid.js). */
.dot-hover {
  --m: 100px;
  --rx: calc(var(--w) / 2 + var(--grow));
  --ry: calc(var(--h) / 2 + var(--grow));
  position: absolute;
  left: calc(var(--l) - var(--m));
  top: calc(var(--t) - var(--m));
  width: calc(var(--w) + 2 * var(--m));
  height: calc(var(--h) + 2 * var(--m));
  z-index: 2;   /* above the white around text, like the other rings */
  /* the same warm glow as the portrait and random rings */
  background: conic-gradient(rgb(var(--glow-1)), rgb(var(--glow-2)) 30%, rgb(var(--glow-3)) 60%, rgb(var(--glow-1)) 80%, rgb(var(--glow-1)));
  -webkit-mask-image:
    radial-gradient(var(--rx) calc(var(--ry) * var(--k, 1)) at calc(50% + var(--dx, 0px)) calc(50% + var(--dy, 0px)), transparent 70%, #000 100%, transparent 118%),
    var(--gaps, linear-gradient(#000, #000)),
    radial-gradient(circle, #000 1.25px, transparent 1.75px);
  mask-image:
    radial-gradient(var(--rx) calc(var(--ry) * var(--k, 1)) at calc(50% + var(--dx, 0px)) calc(50% + var(--dy, 0px)), transparent 70%, #000 100%, transparent 118%),
    var(--gaps, linear-gradient(#000, #000)),
    radial-gradient(circle, #000 1.25px, transparent 1.75px);
  -webkit-mask-size: 100% 100%, 100% 100%, var(--dot-gap) var(--dot-gap);
  mask-size: 100% 100%, 100% 100%, var(--dot-gap) var(--dot-gap);
  -webkit-mask-position: 0 0, 0 0, calc(var(--m) - var(--l)) calc(var(--m) - var(--t));
  mask-position: 0 0, 0 0, calc(var(--m) - var(--l)) calc(var(--m) - var(--t));
  -webkit-mask-repeat: no-repeat, no-repeat, repeat;
  mask-repeat: no-repeat, no-repeat, repeat;
  -webkit-mask-composite: source-in, source-in, source-over;
  mask-composite: intersect, intersect, add;
  animation: hover-pulse 2.8s cubic-bezier(0.37, 0, 0.3, 1) forwards;
}
/* Project cards: the same hover pulse, but as a rounded rectangle that
   follows the card (two bands for the straight sides, a ring at each
   corner), painted in the project's own colours by dot-grid.js.
   --rad is the card's corner radius; the ring sits --grow outside it. */
.dot-hover--card {
  --in: 30px;
  --out: 18px;
  --R: calc(var(--rad) + var(--grow));
  --x0: var(--m);
  --y0: var(--m);
  --x1: calc(var(--m) + var(--w));
  --y1: calc(var(--m) + var(--h));
  --W: calc(var(--w) + 2 * var(--m));
  --H: calc(var(--h) + 2 * var(--m));
  -webkit-mask-image:
    var(--gaps, linear-gradient(#000, #000)),
    radial-gradient(circle, #000 1.25px, transparent 1.75px),
    linear-gradient(transparent calc(var(--y0) - var(--grow) - var(--out)), #000 calc(var(--y0) - var(--grow)), transparent calc(var(--y0) - var(--grow) + var(--in)), transparent calc(var(--y1) + var(--grow) - var(--in)), #000 calc(var(--y1) + var(--grow)), transparent calc(var(--y1) + var(--grow) + var(--out))),
    linear-gradient(to right, transparent calc(var(--x0) - var(--grow) - var(--out)), #000 calc(var(--x0) - var(--grow)), transparent calc(var(--x0) - var(--grow) + var(--in)), transparent calc(var(--x1) + var(--grow) - var(--in)), #000 calc(var(--x1) + var(--grow)), transparent calc(var(--x1) + var(--grow) + var(--out))),
    radial-gradient(circle at 100% 100%, transparent calc(var(--R) - var(--in)), #000 var(--R), transparent calc(var(--R) + var(--out))),
    radial-gradient(circle at 0 100%, transparent calc(var(--R) - var(--in)), #000 var(--R), transparent calc(var(--R) + var(--out))),
    radial-gradient(circle at 100% 0, transparent calc(var(--R) - var(--in)), #000 var(--R), transparent calc(var(--R) + var(--out))),
    radial-gradient(circle at 0 0, transparent calc(var(--R) - var(--in)), #000 var(--R), transparent calc(var(--R) + var(--out)));
  mask-image:
    var(--gaps, linear-gradient(#000, #000)),
    radial-gradient(circle, #000 1.25px, transparent 1.75px),
    linear-gradient(transparent calc(var(--y0) - var(--grow) - var(--out)), #000 calc(var(--y0) - var(--grow)), transparent calc(var(--y0) - var(--grow) + var(--in)), transparent calc(var(--y1) + var(--grow) - var(--in)), #000 calc(var(--y1) + var(--grow)), transparent calc(var(--y1) + var(--grow) + var(--out))),
    linear-gradient(to right, transparent calc(var(--x0) - var(--grow) - var(--out)), #000 calc(var(--x0) - var(--grow)), transparent calc(var(--x0) - var(--grow) + var(--in)), transparent calc(var(--x1) + var(--grow) - var(--in)), #000 calc(var(--x1) + var(--grow)), transparent calc(var(--x1) + var(--grow) + var(--out))),
    radial-gradient(circle at 100% 100%, transparent calc(var(--R) - var(--in)), #000 var(--R), transparent calc(var(--R) + var(--out))),
    radial-gradient(circle at 0 100%, transparent calc(var(--R) - var(--in)), #000 var(--R), transparent calc(var(--R) + var(--out))),
    radial-gradient(circle at 100% 0, transparent calc(var(--R) - var(--in)), #000 var(--R), transparent calc(var(--R) + var(--out))),
    radial-gradient(circle at 0 0, transparent calc(var(--R) - var(--in)), #000 var(--R), transparent calc(var(--R) + var(--out)));
  /* gaps · dots · top+bottom · left+right · four corners */
  -webkit-mask-size: 100% 100%, var(--dot-gap) var(--dot-gap),
    calc(var(--w) - 2 * var(--rad)) 100%, 100% calc(var(--h) - 2 * var(--rad)),
    calc(var(--x0) + var(--rad)) calc(var(--y0) + var(--rad)), calc(var(--W) - var(--x1) + var(--rad)) calc(var(--y0) + var(--rad)),
    calc(var(--x0) + var(--rad)) calc(var(--H) - var(--y1) + var(--rad)), calc(var(--W) - var(--x1) + var(--rad)) calc(var(--H) - var(--y1) + var(--rad));
  mask-size: 100% 100%, var(--dot-gap) var(--dot-gap),
    calc(var(--w) - 2 * var(--rad)) 100%, 100% calc(var(--h) - 2 * var(--rad)),
    calc(var(--x0) + var(--rad)) calc(var(--y0) + var(--rad)), calc(var(--W) - var(--x1) + var(--rad)) calc(var(--y0) + var(--rad)),
    calc(var(--x0) + var(--rad)) calc(var(--H) - var(--y1) + var(--rad)), calc(var(--W) - var(--x1) + var(--rad)) calc(var(--H) - var(--y1) + var(--rad));
  -webkit-mask-position: 0 0, calc(var(--m) - var(--l)) calc(var(--m) - var(--t)),
    calc(var(--x0) + var(--rad)) 0, 0 calc(var(--y0) + var(--rad)),
    0 0, calc(var(--x1) - var(--rad)) 0,
    0 calc(var(--y1) - var(--rad)), calc(var(--x1) - var(--rad)) calc(var(--y1) - var(--rad));
  mask-position: 0 0, calc(var(--m) - var(--l)) calc(var(--m) - var(--t)),
    calc(var(--x0) + var(--rad)) 0, 0 calc(var(--y0) + var(--rad)),
    0 0, calc(var(--x1) - var(--rad)) 0,
    0 calc(var(--y1) - var(--rad)), calc(var(--x1) - var(--rad)) calc(var(--y1) - var(--rad));
  -webkit-mask-repeat: no-repeat, repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  mask-repeat: no-repeat, repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  -webkit-mask-composite: source-in, source-in, source-over, source-over, source-over, source-over, source-over, source-over;
  mask-composite: intersect, intersect, add, add, add, add, add, add;
}
/* Darkest as it leaves the button, lightening as it spreads */
@keyframes hover-pulse {
  0% { --grow: 0px; filter: brightness(0.85); opacity: 0; }
  12% { opacity: 1; }
  100% { --grow: 64px; filter: brightness(1.15); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dot-pulse,
  .dot-hover { display: none; }
}

/* About: grey label over the text on phones, in the heading column on desktop */
.intro-about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  column-gap: 24px;
  font-size: var(--heading-s);
  line-height: 1.5;
}
.intro-about-label { font-size: inherit; color: var(--grey); }
.intro-about-body > p + p { margin-top: 0.75em; }   /* like the paragraphs on the project pages */

/* Button down to Selected work: white pill with a hairline, like the round buttons */
.next-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;                         /* the Read more size: 40px, 18/20px sides */
  box-sizing: border-box;
  margin-top: 32px;
  padding: 0 18px 0 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--button-bg);
  color: var(--button-fg);
  transition: border-color 150ms ease-out;
}
/* Same as the round buttons: the outline turns black */
.next-button:hover { border-color: var(--black); }

@media (max-width: 640px) {
  .intro-screen { gap: 24px; }
  .landing--v2 .portrait { width: 120px; }
  /* The name's line height adds ~7px above the capitals, so 16px reads
     as ~23px: a calmer step below the 120px photo, still one group */
  .landing--v2 .landing-header { row-gap: 16px; }
  .landing--v2 .intro { font-size: 30px; line-height: 1.2; letter-spacing: -0.01em; }
  .landing--v2 .intro .subtitle { margin-top: 4px; }
  .intro-about { display: block; font-size: 18px; }
  .intro-about-label { margin-bottom: 8px; }
  .next-button { display: flex; width: 100%; }
}
/* Short phones (iPhone SE): one size down so the button stays on screen */
@media (max-width: 640px) and (max-height: 700px) {
  .intro-about { font-size: var(--body-l); }
}

/* Sections on v2 (Selected work, Gallery) and on the project pages are
   styled like About me: no hairline, and the heading is a grey label at
   body size instead of a black section heading. */
:is(.landing--v2, .project-page) .section-row {
  border-top: 0;
  padding-top: 0;
}
:is(.landing--v2, .project-page) .section-row-label {
  font-size: var(--heading-s);
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--grey);
}
@media (max-width: 640px) {
  :is(.landing--v2, .project-page) .section-row-label { font-size: 18px; margin-bottom: 16px; }
}

/* Buttons on v2: solid grey, no outline; a shade lighter on hover */
.landing--v2 :is(.next-button, .carousel-button) {
  border-color: transparent;
  background: var(--button-bg);
  color: var(--button-fg);
  transition: background-color 150ms ease-out;
}
.landing--v2 :is(.next-button, .carousel-button):hover:not(:disabled) {
  border-color: transparent;
  background: var(--button-hover);
}
/* Disabled: a dim button and a faint arrow, clearly out of play */
.landing--v2 .carousel-button:disabled {
  border-color: transparent;
  background: var(--button-off-bg);
  color: var(--button-off-fg);
}
.landing--v2 .next-button { font-size: var(--body-l); }   /* 16px, a step below the About text */

/* The first screen (photo, name, About me) fills the whole screen, all
   the way down behind the phone's browser bar; Selected work starts just
   below the bottom edge and shows when you scroll.
   Full screen height (100lvh) − top margin − space to the next section. */
.landing--v2 .intro-screen {
  min-height: calc(100vh - var(--gutter) - var(--spacer-min));
  min-height: calc(100lvh - var(--gutter) - var(--spacer-min));
}

/* Selected work on v2 (version B): each card is the name and dates, the
   image (a link to the project), a caption and a "Read more" pill. No text
   sits on the image.
   Desktop: the arrows step the row one card at a time (carousel.js moves
   the track with a transform). The current card sits in the card column;
   the one before it peeks in on the left, dimmed and fading out, and the
   row runs off the right edge of the screen.
   Phones: the row swipes, every card snapping to the page margin. */
.landing--v2 .carousel {
  /* 680 × 510 pictures, smaller on screens under ~842px tall, so the
     row (title, picture, caption, Read more: picture + 188px) plus 24px
     above, the 48px gap and 72px of the Gallery fit in one screen:
     picture height = 100svh − 332px */
  --card-w: clamp(440px, calc((100vh - 332px) * 4 / 3), 680px);
  --card-w: clamp(440px, calc((100svh - 332px) * 4 / 3), 680px);
  --card-gap: 48px;
  --card-ratio: 4 / 3;
  --peek: 88px;                          /* the window starts this far left of the card: 40px of the card before shows, then the 48px gap */
  --card-ease: 560ms cubic-bezier(0.65, 0, 0.35, 1);
}
.landing--v2 .carousel-track li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: var(--card-w);
}
.card-head {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  font-size: var(--heading-s);
  line-height: 1.4;
}
.landing--v2 .card-label { position: static; color: inherit; }   /* above the image now, not on it */
.card-date { color: var(--grey); }
.landing--v2 .card { width: 100%; }
.landing--v2 .card-media { overflow: hidden; background: var(--placeholder); }
/* The caption grows to fill the card, so every Read more lines up with
   the one under the longest caption in the row (the cards stretch to the
   tallest, the flex default) */
.landing--v2 .card-caption {
  flex: 1 0 auto;
  margin-top: 16px;
  padding: 0 var(--card-radius);
  font-size: var(--body-l);
  line-height: 1.5;
}
.card-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  margin: 16px 0 0 var(--card-radius);
  padding: 0 18px 0 20px;
  box-sizing: border-box;
  border-radius: 20px;
  background: var(--button-bg);
  color: var(--button-fg);
  font-size: var(--body-l);
  line-height: 1.5;
  transition: background-color 150ms ease-out;
}
.card-more svg { flex: none; }
.card-more:hover { background: var(--button-hover); }   /* like the round buttons */
/* Cards before the current one (the faded peek on desktop, the sliver
   on phones; carousel.js makes them inert): the picture turns grey so it
   doesn't take focus, and back to colour as the row moves to it */
.landing--v2 .card-media { transition: filter var(--card-ease, 560ms cubic-bezier(0.65, 0, 0.35, 1)); }
.landing--v2 .carousel-track li[inert] .card-media { filter: grayscale(1); }
@media (prefers-reduced-motion: reduce) { .landing--v2 .card-media { transition: none; } }
/* Hover (mouse and trackpad only): the picture zooms in a touch, inside
   its rounded box. morph.js adds .no-zoom before the card turns into the
   project's image, so the picture that flies is the unzoomed one. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .landing--v2 .card-media { isolation: isolate; }   /* keeps the corners clipped in Safari */
  .landing--v2 .card-img { transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1); }
  .landing--v2 .carousel-track li:not([inert]):hover .card-img { transform: scale(1.025); }
  .landing--v2 .card-media.no-zoom .card-img { transform: none; transition: none; }
}
.card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (min-width: 641px) {
  /* The window: from --peek left of the card column to the screen's right
     edge. It clips only sideways (focus rings above and below stay). */
  .landing--v2 .carousel {
    margin: 0 calc(-1 * var(--bleed)) 0 calc(-1 * var(--peek));
    overflow-x: clip;
    -webkit-mask-image: linear-gradient(to right, transparent 0, rgba(0, 0, 0, 0.08) 12px, rgba(0, 0, 0, 0.3) 25px, rgba(0, 0, 0, 0.7) 34px, #000 40px);
    mask-image: linear-gradient(to right, transparent 0, rgba(0, 0, 0, 0.08) 12px, rgba(0, 0, 0, 0.3) 25px, rgba(0, 0, 0, 0.7) 34px, #000 40px);
  }
  /* The row scrolls sideways (trackpad, arrows, keys) and snaps each card
     to the card column; the padding on the left is where the card before
     peeks in, the padding on the right lets the last card snap too. The
     8px above and below keeps focus rings from being cut off. */
  .landing--v2 .carousel-track {
    gap: var(--card-gap);
    margin: -8px 0;
    padding: 8px calc(100% - var(--peek) - var(--card-w)) 8px var(--peek);
    scroll-padding-left: var(--peek);
  }
  /* Cards scrolling past the card column fade to 0.6 and turn grey, in
     step with the scroll (--past from carousel.js: 0 here, 1 one card on) */
  .landing--v2 .carousel-track li { opacity: calc(1 - 0.4 * var(--past, 0)); }
  .landing--v2 .carousel-track li .card-media,
  .landing--v2 .carousel-track li[inert] .card-media { filter: grayscale(var(--past, 0)); transition: none; }
}
@media (max-width: 640px) {
  /* 314 × 419 (3:4) on a 390 screen, 16px apart: 36px of the next card
     shows, and an 8px sliver of the one before */
  .landing--v2 .carousel { --card-w: calc(100vw - var(--gutter) - 52px); --card-gap: 16px; --card-ratio: 3 / 4; }
  /* Swipe is enough on phones; no arrow buttons */
  .landing--v2 .carousel-controls { display: none; }
  .landing--v2 .carousel-track {
    gap: var(--card-gap);
    /* Run edge to edge, so a card scrolling out slides off the screen;
       snapping still lines each card up with the margin. The 52px after
       the last card lets it snap to the margin too. */
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 52px 0 var(--gutter);
    scroll-padding-left: var(--gutter);
  }
  .landing--v2 .section-row--carousel .section-row-label { margin-bottom: 20px; }
  .card-head { margin-bottom: 10px; font-size: 18px; }
  .landing--v2 .card-caption { margin-top: 14px; padding: 0 4px; font-size: var(--body); }
  .card-more { margin: 14px 0 0 4px; }   /* the same size as on desktop */
}
@media (prefers-reduced-motion: reduce) {
  .landing--v2 .carousel-track,
  .landing--v2 .carousel-track li { transition: none; }
}

/* The first screen fills the screen, so Selected work starts just below
   the fold; the Selected work button takes you there. */
/* Phones: the same button, 24px under About me */
@media (max-width: 640px) {
  .landing--v2 .next-button {
    display: inline-flex;
    width: auto;
    margin-top: 24px;
  }
}
/* Desktop: 60px above the photo and name. About (and the button) sit at
   the bottom of the screen, the page margin (40px) above the fold. */
@media (min-width: 641px) {
  .landing--v2 { --top-space: 60px; padding-top: var(--top-space); }
  .landing--v2 .intro-screen {
    min-height: calc(100vh - var(--top-space) - var(--gutter));
    min-height: calc(100lvh - var(--top-space) - var(--gutter));
  }
}

/* Phones: the first screen is exactly the visible screen (svh, with the
   browser bar showing): photo and name at the top, About aligned to the
   bottom, 36px above and the page margin below. Selected work starts
   below the fold. */
@media (max-width: 640px) {
  .landing--v2 { --top-space: 36px; padding-top: var(--top-space); }
  .landing--v2 .intro-screen {
    min-height: calc(100vh - var(--top-space) - var(--gutter));
    min-height: calc(100svh - var(--top-space) - var(--gutter));
  }
}

/* =========================================================
   v2 dark mode
   Follows the device's setting; ?theme=dark or ?theme=light in the
   address forces one (remembered in this browser), ?theme=auto resets.
   The class is set by a small script in v2.html's <head>, before the
   page draws, so there's no white flash.
   ========================================================= */
html.theme-dark {
  color-scheme: dark;
  --bg: #0f0f0f;
  --black: #ededed;          /* main text */
  --grey: #8a8a8a;           /* labels, captions, role */
  --body-grey: #9a9a9a;
  --line: #2a2a2a;
  --placeholder: #1c1c1c;    /* image boxes, buttons */
  --placeholder-hi: #262626; /* same as the round buttons */
  --shimmer: rgba(237, 237, 237, 0.06);
  --image-veil: rgba(28, 28, 28, 0.35);
  --top-fade: 15, 15, 15;     /* the page colour */
  --wipe-fade: rgba(15, 15, 15, 0);
  --button-bg: #262626;        /* buttons: grey with light text and icons */
  --button-fg: #ededed;
  --button-hover: #333;
  --button-off-bg: #151515;    /* disabled button: dim on the dark page */
  --button-off-fg: #444;
}
/* Dot grid on dark: the same trick turned around. The mesh is dark and
   blends with "darken", so a dot shows the darker of its own colour and
   the blob over it: dots only appear where a (light, warm) blob passes. */
html.theme-dark .dot-grid {
  /* As subtle as in light mode: there a dot sits ~60 steps from white,
     here ~60 steps above the near-black page */
  --ink: 120, 120, 120;
  --c1: 80, 70, 60;
  --c2: 86, 76, 66;
  --c3: 74, 64, 55;
  --pulse: 92, 86, 80;
  --pulse-deep: 112, 104, 96;   /* button ring: the strongest on dark */
  --pulse-light: 76, 72, 68;
  --glow-1: 200, 146, 96;
  --glow-2: 176, 124, 80;
  --glow-3: 218, 172, 124;
}
/* Project pages: the same dot grid, quieter, so it stays behind the work */
body:has(.project-page) .dot-grid.is-ready .dot-canvas { opacity: 0.55; }   /* a step brighter than the image boxes */

/* Project pages: the text column beside the image. "Project overview" in
   grey on top, the text under it, both at Body L (16px), 12px apart. */
.project-page .section-row {
  display: block;
  font-size: var(--body-l);
  line-height: 1.5;
}
.project-page .section-row-label {
  font-size: var(--body-l);
  margin-bottom: 12px;
}
@media (max-width: 640px) {
  .project-page .section-row-label { font-size: var(--body-l); margin-bottom: 12px; }
}

/* =========================================================
   Gallery (v2, under Selected work): square pictures, three in a
   row 8px apart (one per row on phones, also 8px apart), no hover zoom
   and no lightbox. Square corners, except the grid's four outer ones.
   120px below Selected work on desktop, 80px on phones (the
   --spacer-min between rows).
   ========================================================= */
.gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.section-row-content > .gallery { margin-top: 0; }
.gallery > li { aspect-ratio: 1; min-width: 0; }
@media (max-width: 640px) {
  .gallery { grid-template-columns: minmax(0, 1fr); }
}
/* Only the grid's four outer corners are round (18px, 10px on phones).
   Desktop: top left = the first picture, top right = the end of the
   first row, bottom left = the start of the last row, bottom right =
   the last picture, and the end of the row above when the last row
   isn't full. Phones (one column): the first picture's top corners and
   the last one's bottom corners. Works for any number of pictures. */
.gallery { --gallery-r: 18px; }
.gallery > li:first-child .gallery-tile { border-top-left-radius: var(--gallery-r); }
.gallery > li:last-child .gallery-tile { border-bottom-right-radius: var(--gallery-r); }
@media (min-width: 641px) {
  .gallery > li:nth-child(3) .gallery-tile { border-top-right-radius: var(--gallery-r); }
  .gallery > li:nth-child(3n+1):nth-last-child(-n+3) .gallery-tile { border-bottom-left-radius: var(--gallery-r); }
  .gallery > li:nth-child(3n):nth-last-child(-n+3) .gallery-tile { border-bottom-right-radius: var(--gallery-r); }
}
@media (max-width: 640px) {
  .gallery { --gallery-r: 10px; }
  .gallery > li:first-child .gallery-tile { border-top-right-radius: var(--gallery-r); }
  .gallery > li:last-child .gallery-tile { border-bottom-left-radius: var(--gallery-r); }
}
.gallery-tile {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--placeholder);   /* #1c1c1c until the picture is in */
}
.gallery-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 640px) {
  .landing--v2 .section-row--gallery .section-row-label { margin-bottom: 20px; }
}
/* On shorter screens the Gallery comes closer to Selected work (120px
   down to 48px), so the whole card row and 72px of the Gallery fit in
   one screen, with 24px above the row (and the Selected work button
   lands there, carousel.js). 794px = 24px above + the full-size row
   (698px) + the 72px peek. */
@media (min-width: 641px) {
  .landing--v2 .section-row--carousel + .section-row--gallery {
    margin-top: clamp(48px, calc(100vh - 794px), var(--spacer-min));
    margin-top: clamp(48px, calc(100svh - 794px), var(--spacer-min));
  }
}

/* =========================================================
   404 page (404.html): canvas frame NotFoundC.
   The small header top left and the message centred on the screen, over
   the site's dot grid with its pulses (dot-grid.js, as on the start page).
   ========================================================= */
.not-found {
  min-height: 100vh;
  min-height: 100svh;
}
.nf-page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  box-sizing: border-box;
  padding: 40px;
}
.nf-page::after { content: ""; flex: none; height: 56px; }   /* as tall as the header, so the message sits in the middle */
.nf-header { display: flex; align-items: center; gap: 16px; width: fit-content; font-size: var(--body-l); line-height: 1.3; }
.nf-header img { display: block; flex: none; width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.nf-header .tx > span { display: block; }
.nf-role { color: var(--grey); }
.nf-message { display: flex; flex-direction: column; align-items: center; margin: auto 0; text-align: center; }
.nf-message h1 { font-size: 56px; line-height: 1.05; letter-spacing: -0.02em; }
.nf-message p { margin-top: 12px; font-size: var(--heading-s); line-height: 1.5; color: var(--grey); }
/* The button: the Read more size and colours (--button-*) */
.nf-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  margin-top: 32px;
  padding: 0 18px 0 20px;
  box-sizing: border-box;
  border-radius: 20px;
  background: var(--button-bg);
  color: var(--button-fg);
  font-size: var(--body-l);
  line-height: 1.5;
  transition: background-color 150ms ease-out;
}
.nf-button:hover { background: var(--button-hover); }
.nf-button svg { flex: none; }
@media (max-width: 640px) {
  .nf-page { padding: 24px; }
  .nf-page::after { height: 48px; }
  .nf-header { gap: 12px; font-size: var(--body); }
  .nf-header img { width: 48px; height: 48px; }
  .nf-message h1 { font-size: 40px; }
  .nf-message p { font-size: 18px; }
  .nf-button { margin-top: 24px; }
}

/* Selected work reached by its address (the 404 button): a little room above */
.landing--v2 #selected-work { scroll-margin-top: 24px; }
@media (max-width: 640px) { .landing--v2 #selected-work { scroll-margin-top: var(--gutter); } }
