/* ==========================================================================
   DESIGN TOKENS: edit colours, type and spacing here.
   Colours are sampled from the Homepage Wireframe PDF.
   These are the starting colours. The F key swaps them for a random palette (js/colours.js).

   Sizes: the wireframe is 1440px wide, and 1rem = 16px at 1440. A wireframe px value is
   written as px / 16 rem. 1rem stays 16px up to 2560px wide, then the root size grows
   with the window (100vw / 160), so everything in rem grows with it.
   Anything smaller on phones (390px wide) uses a clamp() token:
     clamp(P rem, intercept rem + slope vw, F rem)
     F = size at 1440, P = size at 390, slope = (F - P) / 10.5 vw,
     intercept = (P - (F - P) * 390 / 1050) / 16 rem.
   ========================================================================== */
:root {
  --ink: #1e293b;
  --panel: #bcbcbc;
  --highlight: #ffffff;     /* The lightest tone in the pixel image */
  --star: #f5c542;          /* Shooting stars: gold yellow */
  --dot: #e2e8f0;
  --placeholder: #8a0000;
  --placeholder-dark: #ff9e94; /* The same, on the dark Work page */
  /* --ink + --panel, added channel by channel. See "Sticky controls" below for why. */
  --swap: #dae5f7;

  --font-text: "Work Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-name-zh: "Noto Serif TC Name", "Songti TC", "PMingLiU", serif;

  --text-label: 0.75rem;    /* 12px: nav, name and switches */
  --text-small: 0.875rem;   /* 14px */
  --text-base: 1.0625rem;   /* 17px */
  --text-tagline: 1.125rem; /* 18px: "design is art." */
  --text-lg: clamp(1.25rem, 1.1571rem + 0.381vw, 1.5rem);   /* 20px on phones, 24px at 1440 */
  --text-xl: clamp(2rem, 1.5357rem + 1.9048vw, 3.25rem);    /* 32px on phones, 52px at 1440 */

  --edge: clamp(1rem, 0.675rem + 1.3333vw, 1.875rem);      /* Wireframe's margin: 16px on phones, 30px at 1440 */
  --top: 1.75rem;           /* 28px: logo and name from the top */
  --nav-w: 10.625rem;       /* 170px: space kept for the logo and nav on inner pages */
  --page-w: 62.5rem;        /* 1000px: width of the light panel on inner pages */
  --measure: 62ch;
  --tracking: 0.12em;
  --hairline: 0.0625rem;    /* 1px */

  /* Where the switches sit: 52px above the bottom of the first screen, never above 196px. */
  --switch-top: max(12.25rem, var(--fold-h) - 3.25rem);

  /* js/field.js keeps these in step with the pixel image, which is sized by the window's width. */
  --hero-h: max(102.8vw, 592px);
  --fold-h: max(52.08vw, 300px);
}

/* 16px = 1rem up to 2560px wide (a 1440p screen), so the 12px labels stay 12px there,
   then growing with the window above it (24px at 3840). */
html { font-size: 100%; }
@media (min-width: 2560px) { html { font-size: calc(100vw / 160); } }

/* No visible scroll bar. The page still scrolls with the wheel, trackpad, keys and touch. */
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

/* ---------- Fonts (self-hosted so they always load) ---------- */
@font-face { font-family: "Work Sans"; src: url("../assets/fonts/work-sans.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
/* Fraunces, for project cover titles: Latin, and the extended set for names such as Lēafer. */
@font-face { font-family: "Fraunces"; src: url("../assets/fonts/fraunces-latin.woff2") format("woff2"); font-weight: 600; font-display: swap;
  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; }
@font-face { font-family: "Fraunces"; src: url("../assets/fonts/fraunces-latin-ext.woff2") format("woff2"); font-weight: 600; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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; }
/* Fraunces as a variable font (weights 100 to 900, Google Fonts' latin set), for the folding box's words. */
@font-face { font-family: "Fraunces Variable"; src: url("../assets/fonts/fraunces-variable-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  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; }
@font-face { font-family: "Noto Serif TC Name"; src: url("../assets/fonts/noto-serif-tc-name.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--ink);
  font: 400 var(--text-base)/1.6 var(--font-text);
  overflow-wrap: break-word;
}
h1, h2, h3, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.2em; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
main:focus { outline: none; }
:focus-visible { outline: 0.125rem solid currentColor; outline-offset: 0.1875rem; }

.skip-link {
  position: absolute; z-index: 20; left: var(--edge); top: -4rem;
  padding: 0.5rem 0.75rem; background: var(--ink); color: var(--dot);
}
.skip-link:focus { top: 0.5rem; }

/* ---------- The two canvases ---------- */
.field, .trail { position: fixed; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.field { z-index: 0; }
.trail { z-index: 10; }
/* Under the sticky controls, so they swap colour as the sweep passes behind them. */
.wipe { position: fixed; z-index: 4; display: none; pointer-events: none; image-rendering: pixelated; }
.wipe.is-on { display: block; }

/* ---------- Loading screen: on page load, and from the logo on the homepage ---------- */
.loader {
  position: fixed; inset: 0; z-index: 30; display: none; place-content: center; justify-items: center; gap: 0.875rem;
  background: var(--ink); color: var(--panel);
  font-size: var(--text-label); line-height: 1rem; letter-spacing: var(--tracking);
}
[data-loading] { overflow: hidden; }
[data-loading] .loader { display: grid; }
[data-loading="sweep"] .loader { background: var(--panel); color: var(--ink); } /* Matches the pixel sweep. */
.loader-bar { width: 10rem; height: 0.625rem; padding: var(--hairline); border: var(--hairline) solid currentColor; }
.loader-fill { height: 100%; width: var(--load, 0%); background: currentColor; transition: width 160ms steps(5, end); }
/* At the bottom centre, level with where the switches sit, like the line at the bottom of the homepage. */
.loader-hint { position: absolute; left: var(--edge); right: var(--edge); top: calc(var(--switch-top) + 0.25rem); text-align: center; }
/* The first-visit music choice. */
.loader-music { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.625rem; }
.loader-music[hidden] { display: none; }
.loader-music button { padding: 0.375rem 0.625rem; border: var(--hairline) solid currentColor; letter-spacing: inherit; }
.loader-music button:hover, .loader-music button:focus-visible { background: var(--panel); color: var(--ink); }
.loader-dots span:nth-child(2) { animation: dot-two 900ms steps(1, end) infinite; }
.loader-dots span:nth-child(3) { animation: dot-three 900ms steps(1, end) infinite; }
@keyframes dot-two { 0% { visibility: hidden; } 33% { visibility: visible; } }
@keyframes dot-three { 0% { visibility: hidden; } 66% { visibility: visible; } }

/* While the pixels rise into place, the logo, nav and switches wait, then appear on the finished image.
   Set by a small script in index.html and cleared by js/field.js. */
.site-header, .switches, .scroll-cue { transition: opacity 200ms linear; }
[data-settling] .site-header, [data-settling] .switches, [data-settling] .scroll-cue { opacity: 0; }

/* ---------- Sticky controls: logo, nav, switches and name stay put while the page scrolls.
   On the homepage they cross both colours. The difference blend, using --swap, turns each
   pixel of them into --panel over --ink and --ink over --panel, even when a word sits across
   the edge. This needs --ink + --panel to stay within 255 on every channel. ---------- */
.site-header, .switches, .home-name, .scroll-cue { position: fixed; color: var(--swap); mix-blend-mode: difference; }
/* Inner pages only ever have the light panel behind them. */
[data-page="inner"] .site-header, [data-page="inner"] .switches { color: var(--ink); mix-blend-mode: normal; }

/* ---------- Logo and nav ---------- */
.site-header { z-index: 5; top: var(--top); left: var(--edge); }
.site-logo { display: block; width: 1.875rem; aspect-ratio: 1; }
.site-logo svg { display: block; width: 100%; height: 100%; }
.site-nav { margin-top: 1.125rem; }
.site-nav a {
  display: block; padding: 0.4375rem 0; width: max-content;
  font-size: var(--text-label); font-weight: 600; line-height: 0.875rem;
  letter-spacing: var(--tracking); text-transform: uppercase; text-decoration: none;
}
[data-scramble] span, [data-scramble-title] span { display: inline-block; }
/* Drawn as a line under the word's box, so it holds still while the letters scramble.
   The page you're on (aria-current, set by markNav in js/main.js) keeps it. */
[data-scramble] span { position: relative; white-space: nowrap; }
.site-nav a:hover span::after, .site-nav a:focus-visible span::after, .site-nav a[aria-current="page"] span::after {
  content: ""; position: absolute; left: 0; right: var(--tracking); bottom: -0.1875rem; border-bottom: 0.125rem solid currentColor;
}
/* The logo lifts with a small bob and stays raised while the cursor is on it. */
[data-motion="on"] .site-logo:hover svg, [data-motion="on"] .site-logo:focus-visible svg { animation: logo-bob 420ms ease-out forwards; }
@keyframes logo-bob {
  0% { transform: translateY(0); }
  45% { transform: translateY(-0.3125rem); }
  75% { transform: translateY(-0.0625rem); }
  100% { transform: translateY(-0.125rem); }
}

/* ---------- Music and motion switches: near the bottom of the first screen ---------- */
.switches {
  z-index: 5; left: var(--edge); top: var(--switch-top);
  display: flex; gap: 0.4375rem;
}
.switch {
  min-height: 1.5rem; padding: 0.125rem 0;
  font-size: var(--text-label); font-weight: 400; line-height: 1.25rem; letter-spacing: var(--tracking);
}
.switch:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.switch [data-value] { display: inline-block; min-width: 2.2em; text-align: left; }

/* ---------- Scroll hint: right margin as the name, level with the switches ---------- */
.scroll-cue { z-index: 5; right: var(--edge); top: calc(var(--switch-top) + 0.3125rem); pointer-events: none; }
.scroll-cue svg { display: block; width: 0.875rem; height: 0.875rem; }
.scroll-cue.is-gone, [data-page="inner"] .scroll-cue { visibility: hidden; }
[data-motion="on"] .scroll-cue svg { animation: cue-bob 900ms steps(3, jump-none) infinite alternate; }
@keyframes cue-bob { from { transform: translateY(-0.125rem); } to { transform: translateY(0.125rem); } }

/* ---------- Home: only the pixel image and the name ----------
   Ten equal columns across the window. The first row ends 725px down the 1480px wireframe,
   where "design is art." sits (80px higher than in the wireframe). */
main { position: relative; } /* No z-index: the name's blend has to reach the canvas behind it. */
.home {
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr));
  /* --tagline-min (js/field.js) keeps the line below the first screen in a tall window, such as full screen. */
  grid-template-rows: max(var(--hero-h) * 725 / 1480, var(--tagline-min, 0px) + 1.5rem) auto;
  /* The second value only counts in a tall window, such as full screen: it makes the page long
     enough for "design is art." to scroll off the top at the bottom of the page. */
  height: max(var(--hero-h) + var(--end-gap, 0px), var(--tagline-min, 0px) * 2 + 7.5rem);
}
/* "design is art.": from the ninth of ten columns, 80% across, a little right of the wireframe. */
.home-tagline {
  grid-column: 9 / -1; grid-row: 2; justify-self: start; align-self: start;
  white-space: nowrap; font-size: var(--text-tagline); font-weight: 300; line-height: 1.5rem;
  color: var(--swap); mix-blend-mode: difference; /* The opposite colour over the image too. */
  scroll-snap-align: center;
}
/* Snap scrolling on the homepage: the top, then "design is art." in the middle of the window,
   then the bottom. js/main.js makes each wheel notch or trackpad swipe go one stop. Off with
   Motion off. js/main.js adds no-snap from when Creative mode is first turned on until the
   drawing is cleared and Creative mode is off again. */
html[data-motion="on"]:has(body[data-page="home"]):not(.no-snap) { scroll-snap-type: y mandatory; }
.home { scroll-snap-align: start; }
.snap-end { position: absolute; left: 0; bottom: 0; width: var(--hairline); height: var(--hairline); scroll-snap-align: end; pointer-events: none; }
.home-name {
  z-index: 5; top: var(--top); right: var(--edge); text-align: right;
  font-size: var(--text-label); font-weight: 300; line-height: 1rem; letter-spacing: var(--tracking);
}
.home-end {
  /* At the bottom of the page, this sits level with the switches. */
  position: absolute; left: var(--edge); right: var(--edge); bottom: calc(var(--end-gap, 0px) + 2rem);
  display: flex; justify-content: center; gap: 1.125rem; pointer-events: none; white-space: nowrap;
  color: var(--panel); font-size: var(--text-label); line-height: 1rem; letter-spacing: var(--tracking);
}
/* A real button. Off: the dark colour with a light border. On: filled with the light colour.
   Hovering fills it, pixel by pixel, with the colour it will turn when pressed. */
.pixel-button {
  --pixel: var(--panel);
  position: relative; isolation: isolate; overflow: hidden; pointer-events: auto;
  min-height: 1.75rem; margin: -0.375rem 0; padding: 0 0.75rem;
  background: var(--ink); border: var(--hairline) solid var(--panel);
}
.pixel-button.is-on { --pixel: var(--ink); background: var(--panel); }
.pixel-button:focus-visible { outline: 0.125rem solid var(--panel); outline-offset: 0.125rem; box-shadow: 0 0 0 0.125rem var(--ink); }
/* The hover pixels. js/main.js draws them, one canvas pixel per cell. */
.pixel-fill { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
/* Blends to the opposite colour, whichever colour each part of the button is. */
.pixel-label { position: relative; color: var(--swap); mix-blend-mode: difference; }
/* While drawing, the buttons stay put in the same spot as the page scrolls. */
.home-end.is-fixed { position: fixed; z-index: 5; bottom: auto; top: calc(var(--switch-top) + 0.25rem); }
/* How to use Creative mode: bottom right, level with the buttons, in the page's other colour. */
.creative-hint {
  position: fixed; z-index: 5; right: var(--edge); top: calc(var(--switch-top) - 1rem); /* Last line level with the buttons */
  display: grid; justify-items: end; gap: 0.25rem; max-width: calc(100% - 2 * var(--edge));
  color: var(--swap); mix-blend-mode: difference; pointer-events: none; text-align: right;
  font-size: var(--text-label); line-height: 1rem; letter-spacing: var(--tracking);
}
.creative-hint[hidden] { display: none; }
/* Too narrow to fit beside the centred buttons: just above them instead. */
@media (max-width: 1279px) { .creative-hint { top: calc(var(--switch-top) - 3.25rem); } }
.is-drawing, .is-drawing body { cursor: crosshair; user-select: none; -webkit-user-select: none; touch-action: none; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.home-name span { display: block; text-transform: uppercase; }
.home-name [lang] { font-family: var(--font-name-zh); font-size: var(--text-small); font-weight: 300; line-height: 1.125rem; letter-spacing: 0.08em; }

/* ---------- Inner pages: the light panel grows to hold the content ----------
   Columns: margin, the nav's space, the content, margin. */
[data-page="inner"] .switches { top: 12.75rem; flex-direction: column; align-items: flex-start; gap: 0; }
.page, [data-page="inner"] .site-footer {
  display: grid; grid-template-columns: var(--edge) var(--nav-w) minmax(0, 1fr) var(--edge); align-content: start;
  width: min(100%, var(--page-w));
  background: var(--panel);
}
.page > *, .site-footer > * { grid-column: 3; }
.page { min-height: 100svh; padding-block: var(--top) 6rem; }
.page-title { font-size: var(--text-xl); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
.back { justify-self: start; margin-bottom: 1.5rem; font-size: var(--text-small); }
.meta { font-size: var(--text-small); }
.lede { margin-top: 1rem; font-size: var(--text-lg); line-height: 1.35; max-width: var(--measure); }
.prose { margin-top: 1.5rem; max-width: var(--measure); }
.prose p + p { margin-top: 1em; }
.ph { background: none; color: var(--placeholder); text-decoration: underline dashed var(--hairline); text-underline-offset: 0.2em; }

.tags { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.5rem; }
.figure { margin-top: 1.5rem; will-change: transform; }
.figure img { width: 100%; }
.figure figcaption { margin-top: 0.5rem; font-size: var(--text-small); }
.placeholder {
  display: grid; place-items: center; width: 100%; aspect-ratio: var(--ratio, 2 / 1); padding: 1rem; text-align: center;
  color: var(--dot); background: var(--ink); font-size: var(--text-small);
}
.gallery { display: grid; gap: 1rem; margin-top: 1.5rem; }

.profile-photo { max-width: 20rem; }
.post-list { margin-top: 2rem; }
.post-list a { display: block; padding: 1.25rem 0; border-top: var(--hairline) solid var(--ink); text-decoration: none; }
.post-list h2 { font-size: var(--text-lg); font-weight: 600; line-height: 1.25; }
.post-list a:hover h2 { text-decoration: underline; text-decoration-thickness: 0.125rem; text-underline-offset: 0.15em; }
.post-notice { padding: 0.75rem 1rem; margin-bottom: 1.5rem; border: var(--hairline) dashed var(--placeholder); font-size: var(--text-small); }
.post-title { font-size: var(--text-xl); font-weight: 600; line-height: 1.1; }
.pull { margin: 1.5em 0; font-size: var(--text-lg); font-weight: 500; line-height: 1.35; }
.refs { margin-top: 2rem; max-width: var(--measure); font-size: var(--text-small); }
.refs h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.next { justify-self: start; margin-top: 2.5rem; font-weight: 600; }

/* ---------- Work: a list of projects and the chosen one's image ----------
   Sized from CDTD Hover.pdf, at 1440 × 740. The image is 500px square there (--art: the smaller of
   34.7% of the window's width and 67.6% of its height), centred top to bottom, 120px in from the right.
   Its frame is 10px outside it and 4px thick: solid, and dashed while you point at the image, when
   the image and frame grow by the same amount. The titles (24px) start 188px in from the left, level
   with the top of the frame; the chosen one sits in a light bar as wide as its title.
   The chosen project's summary sits below, its last line level with the bottom of the image.
   js/main.js (setUpWorks) does the choosing. */
[data-page="work"] .scroll-cue { visibility: hidden; }
/* The switches stay exactly where they are on the homepage, so only their text changes between pages. */
html:has(body[data-page="work"]) { overflow: hidden; }
.works {
  --art: min(34.72vw, 67.57svh);
  --grow: 1.015; /* How much the image and its frame grow on hover. */
  position: relative; height: 100svh; overflow: hidden; color: var(--panel);
}
/* Under the page-change curtain (z-index 4). */
/* From the top of the frame to the bottom of the image, and across to the frame's inner edge. */
.works-menu {
  position: absolute; z-index: 3; left: 13.06vw; top: calc(50% - var(--art) * 0.52);
  width: calc(100vw - 13.06vw - var(--art) * 1.252); height: calc(var(--art) * 1.02 + 0.1875rem);
  display: flex; flex-direction: column;
}
/* The light bar behind the chosen title (js/main.js moves it). With Motion on it slides there, fast. */
.works-mark { position: absolute; top: 0; left: 0; background: var(--panel); }
[data-motion="on"] .works-mark.is-ready { transition: transform 160ms cubic-bezier(0.2, 0.9, 0.1, 1), width 160ms cubic-bezier(0.2, 0.9, 0.1, 1), height 160ms cubic-bezier(0.2, 0.9, 0.1, 1); }
/* The chosen project's summary: 18px, at the bottom, as wide as fits, stopping 24px short of the frame. */
.works-about {
  margin-top: auto; padding-right: 15rem;
  font-size: 1.125rem; line-height: 1.5rem; letter-spacing: 0.01em;
}
.works-about .ph { color: var(--placeholder-dark); }
.works-item {
  position: relative; display: block; width: fit-content; padding: 0 0.25rem;
  font-size: 1.5rem; font-weight: 600; line-height: 2.125rem; letter-spacing: 0.09em;
  text-transform: uppercase; text-decoration: none;
}
.works-item.ph { color: var(--placeholder-dark); }
/* The chosen project: dark on light, 7.6:1. */
.works-item.is-on { color: var(--ink); }
[data-motion="on"] .works-item { transition: color 100ms linear; }
.works-item:focus-visible { outline: 0.125rem solid var(--panel); outline-offset: 0.1875rem; }
.works-art {
  position: absolute; z-index: 3; right: calc(var(--art) * 0.24); top: 50%;
  width: var(--art); height: var(--art); transform: translateY(-50%);
}
/* The chosen image on top; the one before under it while the new one wipes in; the rest hidden. */
.works-image { position: absolute; inset: 0; visibility: hidden; }
.works-image.is-on { z-index: 2; visibility: visible; }
.works-image.is-was { z-index: 1; visibility: visible; }
/* Switching (Motion on): the new image wipes in from below, or from above going up, in 180ms. */
.works-image.is-new { animation: works-in 180ms cubic-bezier(0.2, 0.9, 0.1, 1); }
.works-image.is-new.is-up { animation-name: works-in-up; }
@keyframes works-in { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
@keyframes works-in-up { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
.works-image-art { display: block; width: 100%; height: 100%; }
.works-image-art img { width: 100%; height: 100%; object-fit: cover; }
.works-art .placeholder { display: grid; place-items: center; aspect-ratio: auto; padding: 0.75rem; background: var(--panel); color: var(--ink); font-size: var(--text-small); text-align: center; }
/* The image and its frame together: they grow on hover, and tilt towards the cursor
   (--tilt-x and --tilt-y, set by js/main.js, at most WORKS_TILT degrees). */
.works-piece {
  position: absolute; inset: 0; display: block;
  transform: perspective(75rem) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) scale(var(--scale, 1));
}
[data-motion="on"] .works-piece { transition: transform 200ms ease-out; }
.works-art:hover .works-piece, .works-art:focus-visible .works-piece { --scale: var(--grow); }
/* The solid frame, and the dashed one on hover, in the same place. */
.works-piece::after {
  content: ""; position: absolute; z-index: 3; inset: calc(var(--art) * -0.02);
  border: max(0.125rem, var(--art) * 0.008) solid var(--panel);
}
.works-dashes {
  position: absolute; z-index: 3; inset: calc(var(--art) * -0.02); width: calc(var(--art) * 1.04); height: calc(var(--art) * 1.04);
  overflow: visible; fill: none; stroke: var(--panel); stroke-width: 4; stroke-dasharray: 26 15; stroke-dashoffset: 13;
  visibility: hidden;
}
.works-art:hover .works-dashes, .works-art:focus-visible .works-dashes { visibility: visible; }
.works-art:hover .works-piece::after, .works-art:focus-visible .works-piece::after { visibility: hidden; }
.works-art:focus-visible { outline: none; }
/* Bottom right, level with the switches at the bottom left, in the same type. */
.works-hint {
  position: absolute; z-index: 3; right: var(--edge); top: var(--switch-top); padding: 0.125rem 0; /* Level with the switches */
  font-size: var(--text-label); line-height: 1.25rem; letter-spacing: var(--tracking);
}
@media (max-width: 760px) {
  /* Phones: the image under the nav, the list under it, then the summary. */
  .works { --art: min(100vw - 2 * var(--edge) - 4.5rem, 100svh - 28rem); }
  .works-art { right: auto; left: 50%; top: 12.5rem; transform: translateX(-50%); }
  .works-menu { left: var(--edge); right: var(--edge); top: calc(12.5rem + var(--art) * 1.02 + 1.5rem); width: auto; height: auto; }
  .works-about { margin-top: 1rem; padding-right: 0; font-size: 1rem; line-height: 1.375rem; } /* 18px would crowd the switches. */
  .works-hint { display: none; } /* No arrow keys or wheel on a phone, and the switches fill the bottom. */
  .works-item { padding: 0 0.5rem; letter-spacing: 0.04em; } /* At 24px the longer titles take two lines here. */
}

/* ---------- A project's cover ----------
   Sized from CDTD Cover (4).pdf, drawn on a 2560 × 1271 screen. --u is one of its pixels at this
   window's width, so the whole cover scales with the window.
   The screen is the project's colours (--case-bg and --case-ink, from "case" in its file), with no
   nav, name or switches. The title is Fraunces; everything else is Work Sans, the site's text face.
   The back arrow is a 58px pixel square in the top left corner, with the title centred on it. The
   facts sit in a row along the top of the image. The image is 71.2% of the width, centred, in a
   frame as thick as the Work page's, ending 36px above the bottom of the screen; the image fills
   it, cropped top and bottom. The details line and the credit sit bottom left, level with the
   bottom of the frame; the homepage's bobbing arrow is where it is on the homepage.
   Small sizes stop at the site's 12px label size, and the bottom-left text at 10px. */
[data-page="case"] .site-header, [data-page="case"] .switches, [data-page="case"] .site-footer, [data-page="case"] .scroll-cue { display: none; }
.case {
  --u: calc(100vw / 2560);
  --img-w: calc(var(--u) * 1822);
  --foot: max(1.25rem, var(--u) * 36);
  --small: max(var(--text-label), var(--u) * 21);
  --tiny: max(0.625rem, var(--u) * 12);
  position: relative; min-height: 100svh; padding: 0 0 6rem;
  background: var(--case-bg); color: var(--case-ink); font-family: var(--font-text);
}
.case a { color: inherit; }
.case.case-ends { padding-bottom: 0; } /* The details screen is the last thing on the page */
/* The first screen: one window tall, so the folding box (if any) starts just below it. */
.case-cover { box-sizing: border-box; min-height: 100svh; padding-top: calc(var(--u) * 43); }
.case-head {
  display: flex; align-items: center; gap: max(1rem, var(--u) * 48);
  height: max(1.75rem, var(--u) * 58); padding: 0 calc(var(--u) * 92) 0 max(var(--edge), var(--u) * 43);
}
.case-back { flex: none; display: block; width: max(1.75rem, var(--u) * 58); height: max(1.75rem, var(--u) * 58); }
.case-back svg { display: block; width: 100%; height: 100%; }
.case-back-box { fill: var(--ink); }
/* The arrow is drawn pointing down, and turned to point left. It nudges left on hover. */
.case-back g { fill: var(--panel); transform: rotate(90deg); transform-origin: 16.5px 16.5px; }
[data-motion="on"] .case-back g { transition: transform 160ms ease-out; }
[data-motion="on"] .case-back:hover g, [data-motion="on"] .case-back:focus-visible g { transform: translateX(-3px) rotate(90deg); }
.case-back:focus-visible { outline: 0.125rem solid var(--case-ink); outline-offset: 0.1875rem; }
.case-title { font-family: "Fraunces", Georgia, serif; font-size: max(1.5rem, var(--u) * 50); font-weight: 600; line-height: 1.2; letter-spacing: -0.005em; white-space: nowrap; }
.case-facts {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.375rem 1.5rem;
  width: var(--img-w); margin: calc(var(--u) * 105) auto 0; font-size: var(--small); line-height: max(1.125rem, var(--u) * 32);
}
.case-facts div { display: flex; align-items: center; gap: max(0.5rem, var(--u) * 12); }
.case-facts dd { margin: 0; }
.case-facts dt { padding: 0 max(0.3125rem, var(--u) * 9); background: var(--case-ink); color: var(--case-bg); font-weight: 600; }
/* As tall as the screen allows, but never taller than the whole image or shorter than 40% of its width. */
.case-image {
  width: var(--img-w); margin: calc(max(0.375rem, var(--u) * 14) + 3px) auto 0; /* 3px lower than the PDF, by request */
  height: clamp(var(--img-w) * 0.4, 100svh - var(--u) * 252 - var(--foot), var(--img-w) * 0.6667);
}
.case-image picture { display: block; height: 100%; }
.case-image img { display: block; width: 100%; height: 100%; border: 0.25rem solid var(--case-ink); object-fit: cover; object-position: 50% 47%;
  border-width: max(0.125rem, min(34.72vw, 67.57svh) * 0.008); } /* As thick as the Work page's frame at this window size. */
.case-rest { width: var(--img-w); margin: 3rem auto 0; }
.case-rest .ph { color: var(--case-ink); }
.case-rest .next { display: inline-block; margin-top: 3rem; }
/* Bottom left: the details line (two lines at 2560, more where the margin is narrower, so it never reaches the frame), then the credit, 5px below the bottom of the frame. */
.case-foot {
  position: absolute; left: max(var(--edge), var(--u) * 43); top: calc(100svh - var(--foot)); transform: translateY(calc(-100% + 0.04em + 0.3125rem));
  max-width: min(24em, (100vw - var(--img-w)) / 2 - max(var(--edge), var(--u) * 43) - 1rem); font-size: var(--tiny); line-height: 1;
}
.case-foot { font-weight: 400; }
.case-foot b { font-weight: 600; } /* Work Sans Regular, with the name in SemiBold */
.case-spec { margin-bottom: 1.5em; }
/* The homepage's bobbing arrow, at the same size and in the same place, in the cover's ink. */
.case-cue { position: absolute; right: var(--edge); top: calc(var(--switch-top) + 0.3125rem); color: var(--case-ink); pointer-events: none; }
.case-cue svg { display: block; width: 0.875rem; height: 0.875rem; }
[data-motion="on"] .case-cue svg { animation: cue-bob 900ms steps(3, jump-none) infinite alternate; }
@media (max-width: 1100px) {
  .case-head { flex-wrap: wrap; height: auto; row-gap: 0.75rem; }
  .case-title { white-space: normal; }
}
@media (max-width: 760px) {
  .case { --img-w: calc(100vw - 2 * var(--edge)); display: flex; flex-direction: column; padding: 0 0 3rem; }
  .case-cover { min-height: 0; padding-top: var(--top); }
  .case .fold-scroll { height: 400vh; margin-top: 2rem; }
  .case-head { gap: 0.75rem 1rem; padding: 0 var(--edge); }
  .case-title { flex: 1 1 0; min-width: 0; }
  .case-facts { flex-direction: column; margin-top: 1.5rem; }
  .case-image { height: auto; margin-top: 0.75rem; }
  .case-image img { height: auto; }
  .case-foot { position: static; order: 1; transform: none; max-width: none; margin: 2rem var(--edge) 0; }
}
@media (max-width: 520px) {
  .case-cue { top: calc(100svh - 1.8125rem - 0.875rem); } /* The homepage puts it at the bottom on phones. */
}

/* ---------- The folding box (fold-box.css, from fold-box.zip) ----------
   A line drawing of the deck box folding from the flat sheet to closed, pinned for the length of
   its section (600vh, 400vh on phones) and driven by the scroll; js/fold-box.js draws it. Its
   drawing keeps its own near-black cut lines and teal fold lines, on the project's background.
   Its small text (key and caption) is Work Sans at 12px; the words under the box are Fraunces at
   45px, in the cover's ink. */
.case .fold-scroll {
  --fold-bg: var(--case-bg); --fold-line: #17191b; --fold-crease: #0a8c97;
  --fold-muted: color-mix(in oklab, var(--fold-line) 75%, var(--case-bg));
  --fold-rule: color-mix(in oklab, var(--fold-line) 22%, var(--case-bg));
  --fold-font: var(--font-text); --fold-gutter: max(var(--edge), var(--u) * 43); --fold-key-top: max(var(--edge), var(--u) * 43);
  background: var(--fold-bg);
}
.case .fold-cap, .case .fold-key { font-size: 0.75rem; font-weight: 400; letter-spacing: normal; }
/* The words: one at a time, in one still spot, middle right, centred in the space right of the flat sheet. */
.fold-words {
  position: absolute; top: 50%; left: 80%; right: var(--edge); transform: translateY(-50%); pointer-events: none; text-align: center;
  display: grid;
}
.fold-words p { grid-area: 1 / 1; }
.fold-words p, .fold-end {
  margin: 0; opacity: 0; color: var(--case-ink);
  font-family: "Fraunces Variable", "Fraunces", Georgia, serif; font-size: min(2.8125rem, 3.5vw); font-weight: 600; line-height: 1.2;
}
/* "Designed for travel.": centred under the closed box (its top is set from the box's bottom edge). */
.fold-end { position: absolute; left: 0; right: 0; top: 100%; padding: 0 var(--edge); text-align: center; font-size: 2.8125rem; pointer-events: none; }
@media (max-width: 760px) {
  .fold-words { top: 12%; left: 0; right: 0; transform: none; }
  .fold-words p { font-size: 2rem; }
}
@media (max-width: 520px) { .fold-end { font-size: 2rem; } }
/* defaults sit at zero specificity (:where), so your own  .fold-scroll { --fold-bg: ... }  always wins */
:where(.fold-scroll) {
  --fold-bg: #f3f2ee;
  --fold-line: #17191b;
  --fold-crease: #0a8c97;
  --fold-muted: #666b6f;     /* key text and caption text */
  --fold-rule: #d5d5cf;      /* empty progress ticks */
  --fold-font: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --fold-gutter: max(16px, 5vw);
  --fold-key-top: 20px;      /* raise this if a fixed header sits over the top right */
}
@media (prefers-color-scheme: dark) {
  :where(.fold-scroll:not(:where([data-theme="light"] *))) {
    --fold-bg: #121314; --fold-line: #ecece8; --fold-crease: #55c4cf; --fold-muted: #9a9fa3; --fold-rule: #2c2f32;
  }
}
:where([data-theme="dark"] .fold-scroll) {
  --fold-bg: #121314; --fold-line: #ecece8; --fold-crease: #55c4cf; --fold-muted: #9a9fa3; --fold-rule: #2c2f32;
}

.fold-scroll { position: relative; height: 600vh; /* background: var(--fold-bg);  uncomment if your page behind it is not one flat colour */ }
.fold-scroll, .fold-scroll * { box-sizing: border-box; }
.fold-pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.fold-pin canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.fold-cap {
  position: absolute; left: var(--fold-gutter); bottom: 28px; right: var(--fold-gutter);
  display: flex; align-items: baseline; gap: 14px; pointer-events: none;
  font-family: var(--fold-font); font-size: 12.5px; line-height: 1.5; letter-spacing: 0.05em;
}
.fold-cap .n { color: var(--fold-crease); white-space: nowrap; }
.fold-cap .t { color: var(--fold-muted); min-width: 0; }
.fold-ticks { position: absolute; left: var(--fold-gutter); right: var(--fold-gutter); bottom: 16px; display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; pointer-events: none; }
.fold-ticks i { display: block; height: 2px; background: var(--fold-rule); position: relative; overflow: hidden; }
.fold-ticks i b { display: block; position: absolute; inset: 0; background: var(--fold-line); transform-origin: left; transform: scaleX(0); }
.fold-key { position: absolute; right: var(--fold-gutter); top: var(--fold-key-top); display: flex; gap: 18px; font-family: var(--fold-font); font-size: 11.5px; line-height: 1.5; color: var(--fold-muted); pointer-events: none; }
.fold-key span { display: inline-flex; align-items: center; gap: 7px; }
.fold-key .c::before { content: ""; width: 22px; border-top: 1.5px solid var(--fold-line); }
.fold-key .f::before { content: ""; width: 22px; border-top: 1.5px dashed var(--fold-crease); }
@media (max-width: 520px) { .fold-cap { flex-direction: column; gap: 2px; bottom: 30px; } }

/* ---------- The levels: cards under the folding box (Icons CDTD (1).pdf) ----------
   A light panel slides up from the bottom over the closed box: the box's section is 100vh longer
   and the panel starts 100vh up it, so it rises while the box holds still (js/fold-box.js `tail`).
   Sized from the PDF (2558 wide, so --u is one of its pixels): the title in Fraunces SemiBold at 45,
   three frames 550 × 913 with 9-thick borders in each card's colour, 172 in from each side. On hover
   a card grows and its frame turns dashed. */
.case .fold-scroll:has(+ .case-levels) { height: 700vh; }
.case-levels {
  --card-w: calc(var(--u) * 550);
  /* The bobbing arrow (.case-cue) sits where it does on the cover: the panel is a screen tall too. */
  position: relative; z-index: 1; margin-top: -100vh; min-height: 100svh;
  padding: calc(var(--u) * 96) calc(var(--u) * 172) calc(var(--u) * 160);
  background: #f5f4ef; color: var(--case-ink);
}
.levels-title {
  margin: 0; font-family: "Fraunces Variable", "Fraunces", Georgia, serif; font-weight: 600;
  font-size: max(1.75rem, var(--u) * 45); line-height: 1.2; letter-spacing: normal;
}
.levels-row { display: flex; justify-content: space-between; margin-top: calc(var(--u) * 90); }
.level {
  position: relative; flex: none; width: var(--card-w); aspect-ratio: 549.33 / 904.89; margin: 0; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; cursor: pointer; perspective: calc(var(--card-w) * 4);
}
/* On hover it grows 1% by its real size (0.5% out each side), not a scale, so the art is redrawn sharp rather than stretched. */
[data-motion="on"] .level-turn { transition: inset 200ms ease-out, transform 600ms cubic-bezier(0.45, 0.05, 0.2, 1); }
@media (hover: hover) { .level:hover { z-index: 1; } .level:hover .level-turn { inset: -0.5%; } } /* Mouse only, so a tap on a phone doesn't leave it grown */
.level:focus-visible { outline: 0.125rem solid var(--case-ink); outline-offset: 0.5rem; }
/* Click to turn over (aria-pressed): the two sides back to back, turning about the middle in 600ms (at once with Motion off). */
.level-turn { position: absolute; inset: 0; transform-style: preserve-3d; }
.level[aria-pressed="true"] .level-turn { transform: rotateY(180deg); }
.level-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.level-front { transform: rotateY(180deg); }
/* The card's art is the whole SVG artboard, card and margin, placed so the card (505 wide, as in Group 51.svg)
   sits dead centre in the frame, the same gap all round. */
.level img { position: absolute; left: 1.418%; top: 0.581%; width: 97.154%; height: auto; }
.level-frame { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.level-frame .solid { fill: none; stroke: var(--level); stroke-width: 17.78; }
.level-frame .dashed { fill: var(--level); visibility: hidden; }
@media (hover: hover) {
  .level:hover .level-frame .dashed { visibility: visible; }
  .level:hover .level-frame .solid { visibility: hidden; }
}
.level:focus-visible .level-frame .dashed { visibility: visible; }
.level:focus-visible .level-frame .solid { visibility: hidden; }
@media (max-width: 760px) {
  .case .fold-scroll:has(+ .case-levels) { height: 500vh; }
  .case-levels { --card-w: min(100vw - 2 * var(--edge) - 2rem, 22rem); padding: 3rem var(--edge) 4rem; }
  .levels-row { flex-direction: column; align-items: center; gap: 2.5rem; margin-top: 2rem; }
}

/* ---------- The nine areas, under the levels (Icons page no hover.pdf and hover.pdf) ----------
   A screen of its own on the same light ground, sized from the PDFs (2560 wide, --u one of their pixels):
   the title as on the levels, then nine rows 112 apart, each a 76-tall button 641 wide, with the icon
   (54 square, its art 48) 30 in and the name (Work Sans Medium, 30) at 135 in. The dark bar (the ink) is
   one element that glides to the row under the mouse; the name and icon turn light on it. A click opens
   the note: 19 to the right of the bar, 619 wide, Work Sans Light 21 on the ink, wiping in. */
.case-areas {
  position: relative; min-height: 100svh;
  padding: calc(var(--u) * 96) calc(var(--u) * 172) calc(var(--u) * 120);
  background: #f5f4ef; color: var(--case-ink);
}
.areas-wrap { position: relative; width: calc(var(--u) * 641); margin: calc(var(--u) * 64) 0 0 calc(var(--u) * -3); } /* Higher than the PDF, so the last note fits */
.areas-list { position: relative; z-index: 1; margin: 0; padding: 0; list-style: none; }
.areas-list li + li { margin-top: calc(var(--u) * 22); }
.area {
  display: flex; align-items: center; gap: calc(var(--u) * 34); width: 100%; height: calc(var(--u) * 76);
  padding: 0 0 0 calc(var(--u) * 30); border: 0; background: none; color: inherit; cursor: pointer;
  font: 500 max(1rem, var(--u) * 30) / 1.2 var(--font-text); text-align: left;
}
.area svg { flex: none; width: calc(var(--u) * 54); height: calc(var(--u) * 54); fill: currentColor; }
/* The name's box: the bar fits it (0.55em either side), and only the name turns light on it. */
.area-name { padding: 0.36em 0.55em 0.4em; line-height: 1.2; white-space: nowrap; }
@media (max-width: 760px) { .area-name { white-space: normal; } }
.area.is-on .area-name { color: #f5f4ef; }
[data-motion="on"] .area-name { transition: color 100ms linear; }
.area:focus-visible { outline: 0.125rem solid var(--case-ink); outline-offset: 0.1875rem; }
/* While an area is open the bar stays on it, so another area under the mouse grows 1% instead, from its left edge. */
.area { transform-origin: 0 50%; }
[data-motion="on"] .area { transition: transform 200ms ease-out; }
@media (hover: hover) { .areas-list.has-open .area:not([aria-expanded="true"]):hover { transform: scale(1.01); } }
.areas-list.has-open .area:not([aria-expanded="true"]):focus-visible { transform: scale(1.01); } /* Picked with the arrow keys */
.areas-mark { position: absolute; z-index: 0; left: 0; top: 0; width: 100%; background: var(--case-ink); }
.areas-mark[hidden] { display: none; }
[data-motion="on"] .areas-mark.is-ready { transition: transform 160ms cubic-bezier(0.2, 0.9, 0.1, 1), width 160ms cubic-bezier(0.2, 0.9, 0.1, 1), height 160ms cubic-bezier(0.2, 0.9, 0.1, 1); }
.areas-note {
  position: absolute; z-index: 2; left: 0; width: calc(var(--u) * 619);
  margin: 0; padding: calc(var(--u) * 20) calc(var(--u) * 24) calc(var(--u) * 24);
  background: var(--case-ink); color: #f5f4ef;
  font: 300 max(0.8125rem, var(--u) * 21) / 1.34 var(--font-text);
}
.areas-note[hidden] { display: none; }
/* Opens 140ms after the click, then wipes in over 280ms, gentler than the Work page's 180ms. */
[data-motion="on"] .areas-note.is-new { animation: works-in 280ms cubic-bezier(0.25, 0.8, 0.25, 1) 140ms both; }
[data-motion="on"] .areas-note.is-new.is-up { animation-name: works-in-up; }
@media (max-width: 760px) {
  .case-areas { padding: 3rem var(--edge) 4rem; }
  .areas-wrap { width: 100%; margin: 2rem 0 0; }
  .areas-list li + li { margin-top: 0.5rem; }
  .area { height: auto; min-height: 3rem; gap: 0.5rem; padding: 0.25rem 0.75rem; }
  .area svg { width: 2rem; height: 2rem; }
  .areas-note { left: 0; width: 100%; padding: 0.75rem 1rem 1rem; }
}

/* ---------- The details, the last screen (Details CDTD.pdf) ----------
   It slides up from the bottom over the nine areas, which hold still (sticky) inside .case-stack until
   it covers them. On the cover's colours, sized from the PDF (2560 wide, --u one of its pixels): the back
   arrow as on the cover; seven labels (Work Sans SemiBold 21 on the ink) 138 apart, 182 in, each with
   its bullets (Work Sans 21); the photos 925 square in a 8.5 ink frame at 1453, 164, and the next arrow
   (46 square) 10 right of the frame, halfway down. A new photo wipes in from the right. */
.case-stack { position: relative; }
.case-stack > .case-areas { position: sticky; top: 0; }
.case-details {
  position: relative; z-index: 2; min-height: 100svh; background: var(--case-bg); color: var(--case-ink);
  padding: calc(var(--u) * 165) calc(var(--u) * 172) calc(var(--u) * 100) calc(var(--u) * 182);
}
.details-back { position: absolute; left: max(var(--edge), var(--u) * 43); top: max(var(--edge), var(--u) * 43); }
.details-list { width: calc(var(--u) * 1150); }
.details-group { min-height: calc(var(--u) * 138); }
.details-label {
  display: inline-block; margin: 0; padding: 0 calc(var(--u) * 8);
  background: var(--case-ink); color: #ada790; font: 600 max(0.8125rem, var(--u) * 21) / 1.45 var(--font-text); letter-spacing: normal;
}
.details-group ul { margin: calc(var(--u) * 8) 0 0; padding: 0 0 0 max(1.1em, var(--u) * 30); list-style: disc; font: 400 max(0.8125rem, var(--u) * 21) / 1.2 var(--font-text); }
.deck { position: absolute; left: calc(var(--u) * 1453); top: calc(var(--u) * 164); width: calc(var(--u) * 942); margin: 0; }
/* The photo and its frame are one button, which works like the work page's image: on hover (or focus) it
   grows 1.5% and the solid frame turns dashed (the same dashes, as thick as this frame). Click to enlarge. */
.deck-frame {
  position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: none; color: inherit; cursor: zoom-in;
}
.deck-photos { position: absolute; inset: calc(var(--u) * 8.5); overflow: hidden; background: var(--case-ink); }
.deck-frame::after { content: ""; position: absolute; z-index: 3; inset: 0; border: calc(var(--u) * 8.5) solid var(--case-ink); pointer-events: none; }
.deck-dashes {
  position: absolute; z-index: 3; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none;
  fill: none; stroke: var(--case-ink); stroke-width: 4.7; stroke-dasharray: 26 15; stroke-dashoffset: 13; visibility: hidden;
}
/* Hovering the photo grows the photo and both arrows together, 1.5% from the photo's middle, so the arrows grow in step and move out with its sides. */
.deck { transform: scale(var(--deck-scale, 1)); }
[data-motion="on"] .deck { transition: transform 200ms ease-out; }
.deck:has(.deck-frame:hover, .deck-frame:focus-visible) { --deck-scale: 1.015; }
.deck-frame:hover .deck-dashes, .deck-frame:focus-visible .deck-dashes { visibility: visible; }
.deck-frame:hover::after, .deck-frame:focus-visible::after { visibility: hidden; }
.deck-frame:focus-visible { outline: none; }
/* Enlarged: over a dimmed page, as big as fits in the middle, in a light frame. js/main.js grows it from
   the photo's place (DECK_ZOOM_MS). */
.deck-zoom {
  position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; cursor: zoom-out;
  background: color-mix(in srgb, var(--case-ink) 88%, transparent); opacity: 0;
}
.deck-zoom.is-open { opacity: 1; }
[data-motion="on"] .deck-zoom { transition: opacity 380ms ease-out; }
.deck-zoom-photo {
  --zw: min(80vw, 86svh); --zb: max(0.25rem, var(--u) * 8.5);
  position: relative; width: var(--zw); aspect-ratio: 1; transform-origin: 0 0;
  border: var(--zb) solid var(--case-bg); background: var(--case-ink);
}
.deck-zoom-imgs { position: absolute; inset: 0; overflow: hidden; }
.deck-zoom-imgs img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
[data-motion="on"] .deck-zoom-imgs img.is-new { animation: deck-in 260ms cubic-bezier(0.2, 0.9, 0.1, 1); }
[data-motion="on"] .deck-zoom-imgs img.is-new.is-back { animation-name: deck-in-back; }
/* Its arrows: in the same proportion to it as on the page (46 square, 10 out, for a 942 frame), light pixel
   arrows on no background, like the cross. */
.deck-zoom-prev, .deck-zoom-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: max(1.5rem, var(--zw) * 46 / 942); height: max(1.5rem, var(--zw) * 46 / 942); padding: 0; /* Never under 24px, for phones */ border: 0; background: none; cursor: pointer;
}
.deck-zoom-next { left: calc(100% + var(--zb) + var(--zw) * 10 / 942); }
.deck-zoom-prev { right: calc(100% + var(--zb) + var(--zw) * 10 / 942); }
.deck-zoom-prev svg, .deck-zoom-next svg { display: block; width: 100%; height: 100%; }
.deck-zoom-prev .case-back-box, .deck-zoom-next .case-back-box { fill: transparent; }
.deck-zoom-prev g, .deck-zoom-next g { fill: #f5f4ef; transform-origin: 16.5px 16.5px; }
.deck-zoom-next g { transform: rotate(-90deg); }
.deck-zoom-prev g { transform: rotate(90deg); }
[data-motion="on"] .deck-zoom-prev g, [data-motion="on"] .deck-zoom-next g { transition: transform 160ms ease-out; }
[data-motion="on"] .deck-zoom-next:hover g, [data-motion="on"] .deck-zoom-next:focus-visible g { transform: translateX(3px) rotate(-90deg); }
[data-motion="on"] .deck-zoom-prev:hover g, [data-motion="on"] .deck-zoom-prev:focus-visible g { transform: translateX(-3px) rotate(90deg); }
.deck-zoom-prev:focus-visible, .deck-zoom-next:focus-visible { outline: 0.125rem solid #f5f4ef; outline-offset: 0.125rem; }
/* The close button: a light pixel cross on no background, top right. */
.deck-zoom-close {
  position: absolute; top: max(var(--edge), var(--u) * 43); right: max(var(--edge), var(--u) * 43);
  width: max(1.75rem, var(--u) * 58); height: max(1.75rem, var(--u) * 58); padding: 0; border: 0; background: none; cursor: pointer;
}
.deck-zoom-close svg { display: block; width: 100%; height: 100%; }
.deck-zoom-close .deck-btn-box { fill: transparent; }
.deck-zoom-close g { fill: #f5f4ef; } /* Light on the dimmed (#332836) page */
.deck-zoom-close:focus-visible { outline: 0.125rem solid #f5f4ef; outline-offset: 0.1875rem; }
/* "Work done with Lēafer", bottom left: 12 at 2560 wide, 48 in, its baseline 35 up (Details CDTD (1).pdf). */
.details-credit {
  position: absolute; left: max(var(--edge), var(--u) * 48); bottom: calc(var(--u) * 32); margin: 0;
  font: 400 max(0.6875rem, var(--u) * 12) / 1.2 var(--font-text); letter-spacing: 0.01em;
}
.details-credit strong { font-weight: 700; }
.deck-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; visibility: hidden; }
.deck-frame img.is-on { z-index: 2; visibility: visible; }
.deck-frame img.is-was { z-index: 1; visibility: visible; }
[data-motion="on"] .deck-frame img.is-new { animation: deck-in 260ms cubic-bezier(0.2, 0.9, 0.1, 1); }
[data-motion="on"] .deck-frame img.is-new.is-back { animation-name: deck-in-back; }
@keyframes deck-in { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0); } }
@keyframes deck-in-back { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
/* The two arrows, 46 square, 10 out from each side of the frame, halfway down. Inverted from the back
   arrow: a light square with a #332836 pixel arrow. They grow in step with the photo when it's hovered. */
.deck { --deck-arrow: #332836; }
.deck-prev, .deck-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: max(1.5rem, var(--u) * 46); height: max(1.5rem, var(--u) * 46); padding: 0; border: 0; background: none; cursor: pointer;
}
.deck-next { left: calc(100% + var(--u) * 10); }
.deck-prev { right: calc(100% + var(--u) * 10); }
.deck-prev svg, .deck-next svg { display: block; width: 100%; height: 100%; }
.deck-prev .case-back-box, .deck-next .case-back-box { fill: #ada790; }
.deck-prev g, .deck-next g { fill: var(--deck-arrow); transform-origin: 16.5px 16.5px; }
.deck-next g { transform: rotate(-90deg); }
.deck-prev g { transform: rotate(90deg); }
[data-motion="on"] .deck-prev g, [data-motion="on"] .deck-next g { transition: transform 160ms ease-out; }
[data-motion="on"] .deck-next:hover g, [data-motion="on"] .deck-next:focus-visible g { transform: translateX(3px) rotate(-90deg); }
[data-motion="on"] .deck-prev:hover g, [data-motion="on"] .deck-prev:focus-visible g { transform: translateX(-3px) rotate(90deg); }
.deck-prev:focus-visible, .deck-next:focus-visible { outline: 0.125rem solid var(--case-ink); outline-offset: 0.1875rem; }
@media (max-width: 1100px) {
  .details-list { width: auto; }
  .deck { position: relative; left: auto; top: auto; width: min(100%, 36rem); margin: 2rem 0 0; }
  .deck-prev, .deck-next { top: calc(100% + 0.75rem); transform: none; }
  .deck-next { left: auto; right: 0; }
  .deck-prev { right: auto; left: 0; }
  .details-credit { position: static; margin-top: 4.5rem; } /* Under the photo */
}
@media (max-width: 760px) {
  .case-stack > .case-areas { position: relative; } /* Taller than the screen here, so it scrolls instead of holding still */
  .case-details { padding: 5rem var(--edge) 5rem; }
  .details-group { min-height: 0; margin-bottom: 1.5rem; }
}

/* ---------- Contact: under every inner page ---------- */
.site-footer { position: relative; z-index: 1; display: none; }
[data-page="inner"] .site-footer { padding-block: 1.5rem 4rem; margin-top: -4rem; font-size: var(--text-small); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: center; }
.site-footer[hidden] { display: none !important; }
.copy-email { font-weight: 600; text-decoration: underline; text-underline-offset: 0.2em; min-height: 1.5rem; }
.contact-copy { justify-self: start; margin-top: 0.75rem; }
.contact-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 1.5rem; }

.toast {
  position: fixed; z-index: 15; right: var(--edge); bottom: 1rem; padding: 0.5rem 0.75rem;
  background: var(--dot); color: var(--ink); font-size: var(--text-small); visibility: hidden;
}
.toast.is-on { visibility: visible; }

/* ---------- Phones and tablets ---------- */
@media (max-width: 760px) {
  /* The content takes the nav's column too, and starts below the nav. */
  .page, [data-page="inner"] .site-footer { grid-template-columns: var(--edge) 0 minmax(0, 1fr) var(--edge); }
  .page { padding-top: 18.75rem; }
  /* Here the content runs under the nav, so on inner pages the controls scroll away with it. */
  [data-page="inner"] .site-header, [data-page="inner"] .switches { position: absolute; }
  /* Work: the switches in one row at the bottom. */
  [data-page="work"] .switches { top: auto; bottom: 1.375rem; flex-direction: row; flex-wrap: wrap; gap: 0 1rem; }
}
@media (max-width: 520px) {
  :root { --switch-top: max(12.25rem, var(--fold-h) - 5.5rem); }
  .switches { flex-direction: column; align-items: flex-start; gap: 0; }
  /* The switches are stacked near the top here, so the last line just ends the page. */
  /* Always enough to scroll, and enough for "design is art." to pass above the name at the bottom. */
  .home { height: max(var(--hero-h), 130svh, 100svh + var(--hero-h) * 725 / 1480 + 4rem); }
  .home-end { bottom: 1.75rem; }
  .loader-hint { top: auto; bottom: 1.75rem; }
  /* Too narrow for 80% across: against the right margin instead. */
  .home-tagline { grid-column: 1 / -1; justify-self: end; margin-right: var(--edge); }
  .home-end.is-fixed { top: auto; bottom: 1.75rem; }
  .creative-hint { top: auto; bottom: 4.5rem; } /* Above the buttons */
  .scroll-cue { top: auto; bottom: 1.8125rem; }
}

/* ---------- Print: one clean page for a post ---------- */
@media print {
  .field, .trail, .wipe, .loader, .scroll-cue, .site-header, .switches, .site-footer, .toast, .skip-link, .back { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; line-height: 1.4; }
  .page { display: block; width: 100%; min-height: 0; padding: 0; background: none; }
  .figure { transform: none !important; margin-top: 0.5rem; }
  .post-image img, .post-image .placeholder { max-height: 6cm; object-fit: cover; }
  .post-image .placeholder { aspect-ratio: auto; height: 4cm; background: #eee; color: #000; }
  .ph { color: #000; }
  .post-title { font-size: 20pt; }
  .pull { margin: 0.6em 0; font-size: 12pt; }
  .prose { max-width: none; margin-top: 0.5rem; }
  .prose p + p { margin-top: 0.5em; }
  .refs { margin-top: 0.5rem; font-size: 9pt; }
  .post-notice { display: none; }
  @page { margin: 1.6cm; }
}
