/* Authentic Sans (free, WTFPL; files and license in assets/fonts/) */
@font-face { font-family: "Authentic Sans Condensed"; src: url("../assets/fonts/authentic-sans-condensed-60.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Authentic Sans"; src: url("../assets/fonts/authentic-sans-130.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  /* the site grid: columns and gutter shared by every grid layout */
  --cols: 4;
  --gutter: clamp(16px, 2.2vw, 36px);
  --hover: #c3291c;       /* my red: subhead (Instrument Serif) links turn red on hover / when selected */
  --bg: #fff;             /* page background (all pages) */
  --ink: #111;
  --muted: var(--ink);    /* no gray text, ever: what used to be gray is black */
  --panel: #f2f2f2;
  --brand: #b3262d;       /* logo red */
  --select: #2a62d8;      /* finder selection blue */
  --sans: "Authentic Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; /* body copy: Authentic Sans 130 */
  --heading: "Instrument Serif", Georgia, "Times New Roman", serif; /* subheads: Instrument Serif, sentence case */
  --script: "Authentic Sans Condensed", "Arial Narrow", "Helvetica Neue", sans-serif; /* headers: Authentic Sans Condensed 60, all caps */
  --script-weight: 400;
  /* type settings (the type editor, ?edit on localhost, writes overrides at the end of this file) */
  --h-case: uppercase; --h-track: .02em; --h-scale: 1; --h-style: normal;          /* headers */
  --sub-case: none; --sub-first: uppercase; --sub-track: 0em; --sub-scale: 1; --sub-style: normal; /* subheads */
  --body-size: 16px; --body-leading: 1.65; --body-track: 0em; --body-weight: 400; /* body copy */
}

* { box-sizing: border-box; }
@media (max-width: 699px)  { :root { --cols: 2; } }
html, body { margin: 0; }
body { font-family: var(--sans); font-weight: var(--body-weight); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--heading); font-weight: 400; letter-spacing: -.005em; }
h1 { font-family: var(--script); font-weight: var(--script-weight); text-transform: var(--h-case); letter-spacing: var(--h-track); font-style: var(--h-style); }
img { display: block; max-width: 100%; }
a { color: inherit; }

/* =========================================================
   DESKTOP (home)
   ========================================================= */

.desktop-page { background: var(--bg); min-height: 100vh; min-height: 100dvh; overflow: hidden; }

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

.desk {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px 16px;
}
/* my name and role, top left, on the same left edge as the inner pages' titles */
.home-id { position: absolute; z-index: 30; top: clamp(16px, 2.6vw, 34px); left: 0; right: 0; pointer-events: none; }
.home-id__name { margin: 0; line-height: 0; }
/* my lace "MA" logo, where my name used to be */
.home-id__mark { display: block; width: auto; height: clamp(64px, 7.4vw, 108px); }
.home-id__role { margin: 10px 0 0; font-family: var(--sans); font-size: clamp(11px, .9vw, 13px); letter-spacing: .02em; color: var(--ink); }
/* a red square the size of one of the logo's pixels (the logo is 9 pixels tall) */
.home-id__pixel {
  display: inline-block; vertical-align: -.08em;
  width: var(--logo-px, clamp(7px, .82vw, 12px)); height: var(--logo-px, clamp(7px, .82vw, 12px));
  margin: 0 .55em; background: #c3291c;
}
/* (the tray stays in the very center of the screen; the name and role just sit in the corner) */

/* images on the tray and the projects table stay hidden until they've fully
   loaded, so slow connections never show empty (shadowed) boxes */
.stage img:not(.is-loaded), .table img:not(.is-loaded) { visibility: hidden; }

/* the desk area: every x / y / w in content.js is a % of this box */
.stage {
  position: relative;
  width: min(100%, calc((100dvh - 48px) * 1850 / 1010));
  aspect-ratio: 1850 / 1010;
  user-select: none; -webkit-user-select: none;
}
.tray {
  position: absolute; height: auto; pointer-events: none;
  /* the tray's own shadow on the page (light from the top left) */
  filter: drop-shadow(calc(var(--sw, 1200px) * .01) calc(var(--sw, 1200px) * .022) calc(var(--sw, 1200px) * .022) rgba(20, 12, 4, .24));
}

.icon {
  --tilt: 0deg;
  position: absolute;
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform: rotate(var(--tilt));
  transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.icon__art { width: 100%; height: auto; pointer-events: none; }

/* Realistic shadow: a tight dark contact shadow plus a soft ambient one.
   Offsets scale with the desk width (--sw), the object's --depth, and --lift
   (raised on hover / drag so the shadow spreads as the object comes up). */
.icon__body {
  --depth: 1; --lift: 1; --sx: .45; --sy: 1; --blur: 0px;
  --u: calc(var(--sw, 1200px) * var(--depth) * var(--lift));
  position: relative; display: block; width: 100%;
  /* shadows only: iPhone Safari paints images with a blur() in their filter
     as solid white boxes, so blur is only ever added on desktop hover */
  --shadows:
    drop-shadow(calc(var(--u) * .0035 * var(--sx)) calc(var(--u) * .0035 * var(--sy)) calc(var(--sw, 1200px) * .003 * var(--lift)) rgba(20, 12, 4, .42))
    drop-shadow(calc(var(--u) * .013 * var(--sx)) calc(var(--u) * .013 * var(--sy)) calc(var(--u) * .017) rgba(20, 12, 4, .26));
  filter: var(--shadows);
  transition: filter .3s ease, opacity .3s ease;
}
@media (hover: hover) and (pointer: fine) {
  .icon__backing { filter: blur(calc(var(--sw, 1200px) * .003)); }
  .icon:hover .icon__body, .icon:focus-visible .icon__body { filter: var(--shadows) blur(var(--blur)); }
  .icon.is-clicked .icon__body { filter: var(--shadows); }
}
/* hover: lift, then blur + fade the object so its word reads on top */
.icon:hover .icon__body, .icon:focus-visible .icon__body {
  --lift: 2.2;
  --blur: calc(var(--sw, 1200px) * .008);
  opacity: .35;
}
.icon.is-clicked .icon__body { --blur: 0px; opacity: 1; } /* sharp again for the click effect */
.icon__backing {
  position: absolute; inset: 0;
  background: #fff;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  transform: scale(1.06); /* a touch bigger so the blurred edges stay on white */
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.icon:hover .icon__backing, .icon:focus-visible .icon__backing { opacity: 1; }
.icon.is-clicked .icon__backing { opacity: 0; }
.icon.is-dragging .icon__body { --lift: 2.8; }
.icon:hover { transform: rotate(var(--tilt)) translateY(-6px) scale(1.03); }
.icon:focus-visible { outline: 2px solid #2a62d8; outline-offset: 4px; border-radius: 6px; }
.icon.is-dragging { cursor: grabbing; transition: none; transform: rotate(calc(var(--tilt) - 3deg)) scale(1.05); }
/* hover word (Neue Haas Script), centered on the object and kept level */
.icon__hover {
  position: absolute; top: 50%; left: 50%; z-index: 5;
  transform: translate(-50%, -40%) rotate(calc(var(--tilt) * -1));
  font-family: var(--script); font-weight: var(--script-weight); text-transform: var(--h-case); letter-spacing: var(--h-track); font-style: var(--h-style);
  font-size: calc(var(--sw, 1200px) * .046 * var(--h-scale));
  line-height: 1.3;
  white-space: nowrap;
  color: var(--ink);
  /* no halo: the objects sit so every word lands on the tray's white middle,
     and the object behind it blurs and fades enough for the word to read */
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease, transform .35s cubic-bezier(.2, .8, .2, 1);
}
.icon:hover { z-index: 40; }
.icon:hover .icon__hover, .icon:focus-visible .icon__hover {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(calc(var(--tilt) * -1));
}
.icon.is-clicked .icon__hover { opacity: 0; }
/* touch screens (no hover): a tap lifts, blurs and names the object, just like
   hovering does, for a moment before its click effect plays */
.icon.is-named { z-index: 40; transform: rotate(var(--tilt)) translateY(-6px) scale(1.03); }
.icon.is-named .icon__body { --lift: 2.2; opacity: .2; } /* faded, no blur (see .icon__body) */
.icon.is-named .icon__backing { opacity: 1; filter: none; }
.icon.is-named .icon__hover { opacity: 1; transform: translate(-50%, -50%) rotate(calc(var(--tilt) * -1)); }

/* loading screen: the apple, keys, polaroid and phone take turns showing
   in the middle of a white screen; then the white fades away and each one
   is "put down" in its spot on the tray (js/desktop.js runs the timing) */
.intro {
  position: fixed; inset: 0; z-index: 5000;
  display: grid; place-items: center;
  background: var(--bg);
  cursor: pointer;
  transition: background-color .5s ease;
}
.intro-seen .intro { display: none; }
.intro.is-placing { background-color: transparent; pointer-events: none; }
.intro__cycle { position: relative; width: min(40vmin, 340px); aspect-ratio: 1; }
.intro__obj {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain;
  opacity: 0;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .16));
}
.intro__obj.is-on { opacity: 1; } /* a straight swap, no animation */
/* objects wait off the tray until it's their turn to be put down */
.is-intro .stage { pointer-events: none; }
.is-intro .icon { opacity: 0; }
.is-intro .icon.is-landing {
  opacity: 1;
  transition: translate .8s cubic-bezier(.55, 0, .2, 1), scale .8s cubic-bezier(.55, 0, .2, 1), rotate .8s cubic-bezier(.55, 0, .2, 1);
}

/* apple bite */
.icon__art { -webkit-mask-size: 100% 100%; mask-size: 100% 100%; }
.bite__flesh {
  position: absolute; top: 0; left: 0; width: 100%;
  pointer-events: none;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
.bite__flesh svg { display: block; width: 100%; height: auto; }
.icon.is-bitten { animation: chomp .32s ease-out; }
@keyframes chomp {
  0% { transform: rotate(var(--tilt)) scale(1); }
  35% { transform: rotate(calc(var(--tilt) - 4deg)) scale(.94); }
  70% { transform: rotate(calc(var(--tilt) + 2deg)) scale(1.03); }
  100% { transform: rotate(var(--tilt)) scale(1); }
}
.bite__crumb {
  position: absolute; width: 1.6%; aspect-ratio: 1; min-width: 4px;
  border-radius: 40% 60% 50% 45%;
  pointer-events: none;
  animation: crumb .55s cubic-bezier(.2, .7, .4, 1) forwards;
}
@keyframes crumb {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 40px)) scale(.6) rotate(160deg); opacity: 0; }
}

/* key jingle: swing from the keyring (about 68% across, 10% down the image) */
.icon.is-jingling .icon__art { transform-origin: 68% 10%; animation: jingle .75s cubic-bezier(.3, .6, .4, 1); }
@keyframes jingle {
  0% { transform: rotate(0); }
  12% { transform: rotate(9deg) translateY(-2%); }
  28% { transform: rotate(-7deg); }
  44% { transform: rotate(5deg); }
  60% { transform: rotate(-3deg); }
  78% { transform: rotate(1.5deg); }
  100% { transform: rotate(0); }
}

/* sharpie note on the polaroid's bottom strip (photo ends ~80% down) */
.icon { container-type: inline-size; }
.sharpie {
  position: absolute; left: 7%; right: 7%; top: 80%; height: 20%;
  display: grid; place-items: center;
  font-family: "Permanent Marker", "Marker Felt", "Comic Sans MS", cursive;
  font-size: 13cqw; line-height: 1;
  color: #161616; opacity: .9;
  transform: rotate(-3deg);
  white-space: nowrap;
  pointer-events: none;
  clip-path: inset(0 0 0 0);
  animation: sharpie .75s cubic-bezier(.45, .1, .55, .9) both;
}
@keyframes sharpie {
  from { clip-path: inset(-20% 100% -20% 0); }
  to { clip-path: inset(-20% 0 -20% 0); }
}

/* flip phone
   Layers, all positioned as % of the closed phone (189 x 363 px):
   - base: the open phone's bottom half, hidden under the closed phone
   - closed: closed phone + live outer screen; lifts away on click
   - lid: the open phone's top half; unfolds upward from the hinge */
.phone .icon__body { perspective: 700px; }
.phone__closed { position: relative; display: block; transform-origin: 50% 3%; z-index: 2; }
.phone__closed .icon__art { display: block; }
.phone__base, .phone__lid {
  position: absolute; left: 1.85%; width: 96.3%;
  pointer-events: none; opacity: 0;
}
.phone__base { top: 3.3%; z-index: 1; }
.phone__lid { bottom: 96.7%; transform-origin: 50% 100%; transform: rotateX(90deg); z-index: 3; }

.phone__screen {
  position: absolute; left: 27%; top: 39.7%; width: 46%; height: 26.2%;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 3cqw 2.5cqw 3.5cqw;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #fff; line-height: 1; white-space: nowrap;
  overflow: hidden;
}
.phone__screen::after { /* glass glare */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, rgba(255,255,255,.22) 0 30%, rgba(255,255,255,0) 30.5%);
  pointer-events: none;
}
.phone__status { align-self: stretch; display: flex; align-items: flex-end; justify-content: space-between; height: 4.5cqw; }
.phone__signal { display: flex; align-items: flex-end; gap: .6cqw; height: 100%; }
.phone__signal i { width: 1cqw; background: #fff; }
.phone__signal i:nth-child(1) { height: 35%; }
.phone__signal i:nth-child(2) { height: 55%; }
.phone__signal i:nth-child(3) { height: 78%; }
.phone__signal i:nth-child(4) { height: 100%; }
.phone__zone { font-size: 3.2cqw; opacity: .75; letter-spacing: .03em; }
.phone__battery {
  position: relative; display: flex; gap: .5cqw;
  height: 3.6cqw; padding: .5cqw; border: .35cqw solid #ddd; border-radius: .6cqw;
}
.phone__battery::before { content: ""; position: absolute; left: -1.2cqw; top: 25%; width: .8cqw; height: 50%; background: #ddd; border-radius: .3cqw 0 0 .3cqw; }
.phone__battery i { width: 1.7cqw; background: #7bd66a; border-radius: .2cqw; }
.phone__time { display: flex; align-items: flex-start; }
.phone__hm { font-size: 12.5cqw; font-weight: 300; letter-spacing: -.02em; }
.phone__ampm { font-size: 3.4cqw; margin: .6cqw 0 0 .5cqw; }
.phone__date { font-size: 5.4cqw; font-weight: 500; }
.phone__day { font-size: 5.4cqw; font-weight: 500; }

.phone.is-ringing .phone__closed { animation: phone-buzz .09s linear infinite; }
@keyframes phone-buzz {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(-1.2%, .3%) rotate(-1.5deg); }
  75% { transform: translate(1.2%, -.3%) rotate(1.5deg); }
}
.phone.is-open .phone__base { opacity: 1; }
.phone.is-open .phone__closed { animation: phone-lift .22s ease-in forwards; }
.phone.is-open .phone__lid { opacity: 1; animation: phone-unfold .38s .2s cubic-bezier(.2, .9, .3, 1.15) both; }
@keyframes phone-lift {
  from { transform: rotateX(0); }
  to { transform: rotateX(-90deg); visibility: hidden; }
}
@keyframes phone-unfold {
  from { transform: rotateX(90deg); }
  to { transform: rotateX(0); }
}

/* open animation */
.zoom {
  position: fixed; z-index: 2000;
  background: var(--bg);
  border-radius: 12px;
  opacity: .4;
  transition: all .38s cubic-bezier(.2, .8, .2, 1);
}
.zoom.is-open { left: 0 !important; top: 0 !important; width: 100vw !important; height: 100vh !important; border-radius: 0; opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .icon, .icon.is-dragging { transition: none; }
  .icon.is-bitten, .icon.is-jingling .icon__art, .sharpie { animation: none; }
  .phone.is-open .phone__closed { animation: none; visibility: hidden; }
  .phone.is-ringing .phone__closed { animation: none; }
  .phone.is-open .phone__lid { animation: none; transform: none; }
}

/* =========================================================
   SUB PAGES (folders, projects, about, contact)
   ========================================================= */

.sub-page { background: var(--bg); min-height: 100vh; overflow-x: clip; } /* full-bleed pieces never cause sideways scroll */
.wrap { width: min(1550px, 100% - 32px); margin-inline: auto; }
@media (min-width: 900px) { .wrap { width: min(1550px, 100% - 160px); } }

/* Top left of every inner page: a mini copy of the home page tray as navigation.
   Same composition as the home page (every x / y / w is a % of this box). */
.site-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 18px 0 32px; }
.page-title {
  flex: 1; min-width: 0; margin: 0;
  font-size: calc(clamp(40px, 5.2vw, 78px) * var(--h-scale)); line-height: 1;
  padding-top: .1em;
}
.mini-tray {
  position: relative; display: block;
  width: clamp(220px, 22vw, 340px);
  aspect-ratio: 1850 / 1010;
}
.mini-tray__home img { position: absolute; display: block; height: auto; filter: drop-shadow(1px 3px 3px rgba(20, 12, 4, .18)); }
.mini-tray__obj {
  --tilt: 0deg;
  position: absolute; display: block;
  transform: rotate(var(--tilt));
  filter: drop-shadow(1px 2px 1.5px rgba(20, 12, 4, .3));
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), filter .2s ease;
}
.mini-tray__obj img { display: block; width: 100%; height: auto; }
.mini-tray__obj:hover, .mini-tray__obj.is-current {
  transform: rotate(var(--tilt)) translateY(-3px) scale(1.12);
  filter: drop-shadow(2px 5px 3px rgba(20, 12, 4, .3));
  z-index: 2;
}
.mini-tray a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }


.folder-count { font-size: 14px; color: var(--muted); margin: 0 0 24px; }

/* project rows — same layout as the existing portfolio */
.rows { display: grid; gap: 28px; padding-bottom: 120px; }
.row { display: grid; grid-template-columns: 72.5fr 27.5fr; text-decoration: none; background: var(--panel); }
.row--flip { grid-template-columns: 27.5fr 72.5fr; }
.row--flip .row__media { order: 2; }
.row__media { aspect-ratio: 1123 / 605; overflow: hidden; }
.row__media > * { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.row:hover .row__media > img { transform: scale(1.03); }
.row__media--contain { background: #fff; }
.row__media--contain > img { object-fit: contain; }
.row__info { display: grid; place-content: center; text-align: center; padding: 24px; }
.row__info h2 { font-size: 34px; line-height: 1.1; margin: 0 0 6px; }
.row__info p { margin: 0; color: var(--muted); font-size: 17px; }
@media (max-width: 700px) {
  .row, .row--flip { grid-template-columns: 1fr; }
  .row--flip .row__media { order: 0; }
  .row__info { padding: 18px; }
}

/* gallery / grid switch on the projects page */
.view-switch {
  display: flex; align-items: baseline; gap: .45em;
  font-family: var(--heading); font-size: calc(clamp(20px, 1.8vw, 26px) * var(--sub-scale)); line-height: 1;
  color: var(--muted);
}
.view-switch a { color: var(--ink); text-decoration: none; transition: color .2s ease; }
.view-switch a[aria-current] { color: var(--hover); } /* the view you're on is red */
.view-switch a:hover, .view-switch a:focus-visible { color: var(--hover); outline: none; }
.table-page .view-switch {
  position: fixed; z-index: 10; top: 22px; left: 50%; transform: translateX(-50%); /* top middle */
  padding: 6px 12px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .88);   /* stays readable as objects slide underneath */
}
.grid-page .view-switch { margin: -6px 0 clamp(24px, 3vw, 40px); }

/* projects grid: a static page on the site grid */
.pgrid {
  /* each cut-out is exactly its size in the gallery: there the table is
     max(1500px, 125vw) wide, 4 cells across, and an object fits 62% of a cell */
  --obj: max(232.5px, 19.375vw);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, calc(var(--obj) * 1.3)), 1fr));
  column-gap: var(--gutter); row-gap: calc(var(--gutter) * 1.6);
  margin: 0; padding: 0 0 140px; list-style: none;
}
.pgrid__link { display: block; text-decoration: none; color: var(--ink); }
/* every object gets the same square */
.pgrid__box {
  display: flex; align-items: center; justify-content: center;
  width: var(--obj); max-width: 100%; aspect-ratio: 1; margin-inline: auto;
}
.pgrid__box .tobj__img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  transform: rotate(var(--tilt, 0deg));
  filter: drop-shadow(4px 8px 7px rgba(20, 12, 4, .28)) drop-shadow(1px 2px 1.5px rgba(20, 12, 4, .25));
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.pgrid__box .tobj__book { width: 100%; max-width: 100%; }
.pgrid__link:hover .tobj__img, .pgrid__link:focus-visible .tobj__img { transform: rotate(var(--tilt, 0deg)) translateY(-8px) scale(1.04); }
.pgrid__link:focus-visible { outline: none; }
/* caption: exactly the gallery's hover label (name in Neue Haas, kind of
   project under it in the subheader font in the project's colour, centred), at
   exactly the gallery's size: a tenth of a table cell, and the table is
   max(1500px, 125vw) wide with 4 cells, so max(37.5px, 3.125vw) */
.pgrid__item { container-type: inline-size; }
.pgrid__cap {
  /* clear room between the cut-out (a tilted object can poke out of its
     square, and its shadow falls below it) and the name's tall swashes */
  display: block; padding-top: max(.8em, 24px);
  /* the gallery's size, but never so big that a name needs a second line:
     the longest name fits in --fit of the column (set from js) */
  font-family: var(--script); font-weight: var(--script-weight); text-transform: var(--h-case); letter-spacing: var(--h-track); font-style: var(--h-style); font-size: min(calc(max(28px, 2.4vw) * var(--h-scale)), var(--fit, 14cqw)); line-height: 1.05;
  text-align: center; white-space: nowrap; color: var(--ink);
}
.pgrid__link:hover .pgrid__type, .pgrid__link:focus-visible .pgrid__type { color: var(--ink); }
.pgrid__title, .pgrid__type { display: block; }
.pgrid__title { width: max-content; margin-inline: auto; } /* its real width, for measuring */
.pgrid__type { font-family: var(--heading); font-size: calc(.8em * var(--sub-scale)); line-height: 1.2; margin-top: .2em; color: var(--c); transition: color .2s ease; }
.pgrid img:not(.is-loaded) { visibility: hidden; }
/* phones: the gallery's phone sizes (its table is 210vw wide, 4 cells: an
   object fits 62% of a cell, a name is max(16% of a cell, 30px)) */
@media (max-width: 699px) {
  .pgrid { --obj: 32.55vw; }
  .pgrid__cap { font-size: min(max(6.4vw, 22px), var(--fit, 14cqw)); }
  .pgrid__type { font-size: .6em; }
}

/* portfolio table: an endless canvas, on phones too (see renderTable in pages.js) */
.table-page { overflow: hidden; height: 100vh; height: 100dvh; }
.table-page .to-top, .table-page .site-header { display: none; }
.table-page .mini-tray { position: fixed; top: 18px; right: 18px; z-index: 10; }
@media (max-width: 700px) {
  .table-page .mini-tray { width: 150px; top: 12px; right: 12px; }
  .table-page .view-switch { left: calc((100% - 162px) / 2); } /* centred in the space left of the little tray */
  .table .tobj__name { font-size: max(calc(var(--cell) * .13), 22px); } /* names big enough to read on a phone */
  .table .tobj__type { font-size: .6em; }
}
.table {
  --tw: 1600px;                                                     /* one tile's width (set in js) */
  position: fixed; inset: 0; z-index: 1;
  overflow: hidden;
}
.table.is-endless { cursor: grab; touch-action: none; overscroll-behavior: none; }
.table.is-dragging { cursor: grabbing; }
.table.is-dragging .tobj { pointer-events: none; }
.table__plane { position: absolute; left: 0; top: 0; width: var(--tw); height: var(--th); will-change: transform; }
.table__plane.is-easing { transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.table__tile { position: absolute; width: var(--tw); height: var(--th); }
/* every object fits the same square box (62% of its grid cell), keeping its shape */
.tobj {
  --box: calc(var(--cell) * .56 * var(--s, 1)); /* --s: each object's own size (pages.js) */
  position: absolute; display: flex; align-items: center; justify-content: center;
  width: var(--box); height: var(--box);
  transform: translate(-50%, -50%) rotate(var(--tilt, 0deg));
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
  -webkit-tap-highlight-color: transparent;
}
.tobj__img {
  display: block; max-width: 100%; max-height: 100%; width: auto; height: auto;
  /* shadows only at rest (iPhone Safari turns blurred images into white boxes) */
  filter: drop-shadow(4px 8px 7px rgba(20, 12, 4, .28)) drop-shadow(1px 2px 1.5px rgba(20, 12, 4, .25));
  opacity: 1;
  transition: filter .35s ease, opacity .35s ease;
}
.tobj__name {
  position: absolute; left: 50%; top: 50%; z-index: 2;
  width: max-content; white-space: nowrap;
  transform: translate(-50%, -40%) rotate(calc(var(--tilt, 0deg) * -1));
  font-family: var(--script); font-weight: var(--script-weight); text-transform: var(--h-case); letter-spacing: var(--h-track); font-style: var(--h-style);
  font-size: calc(var(--cell) * .078 * var(--h-scale)); line-height: 1.05; text-align: center; /* same size for every project */
  color: var(--ink);
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease, transform .35s cubic-bezier(.2, .8, .2, 1);
}
/* hover: zoom a little, blur + fade the object, name on top */
.tobj:hover, .tobj:focus-visible { transform: translate(-50%, -50%) rotate(var(--tilt, 0deg)) scale(1.2); z-index: 5; outline: none; }
.tobj:hover .tobj__img, .tobj:focus-visible .tobj__img {
  filter: drop-shadow(8px 16px 14px rgba(20, 12, 4, .28)) drop-shadow(2px 4px 3px rgba(20, 12, 4, .2));
  opacity: .45;
}
@media (hover: hover) and (pointer: fine) { /* mouse only: see .tobj__img */
  .tobj:hover .tobj__img, .tobj:focus-visible .tobj__img {
    filter: drop-shadow(8px 16px 14px rgba(20, 12, 4, .28)) drop-shadow(2px 4px 3px rgba(20, 12, 4, .2)) blur(4px);
  }
}
.tobj:hover .tobj__name, .tobj:focus-visible .tobj__name { opacity: 1; transform: translate(-50%, -50%) rotate(calc(var(--tilt, 0deg) * -1)); }
.tobj__title, .tobj__type { display: block; }
/* the kind of project, under the name: the subheader font in the project's color (same as its year) */
.tobj__type { font-family: var(--heading); font-size: calc(.78em * var(--sub-scale)); line-height: 1.2; margin-top: .2em; }
/* touch screens (no hover): a tap shows the name the same way, for a moment, before opening */
.tobj.is-named { transform: translate(-50%, -50%) rotate(var(--tilt, 0deg)) scale(1.2); z-index: 5; }
.tobj.is-named .tobj__img {
  filter: drop-shadow(8px 16px 14px rgba(20, 12, 4, .28)) drop-shadow(2px 4px 3px rgba(20, 12, 4, .2));
  opacity: .3; /* faded, no blur (see .tobj__img) */
}
.tobj.is-named .tobj__name { opacity: 1; transform: translate(-50%, -50%) rotate(calc(var(--tilt, 0deg) * -1)); }


/* placeholder for missing images */
.ph {
  display: grid; place-content: center; gap: 6px; text-align: center;
  min-height: 240px; padding: 20px;
  background: repeating-linear-gradient(-45deg, #ecebdc 0 14px, #e4e3d2 14px 28px);
  color: #6f6d5c; font-size: 14px;
}
.ph code { font-size: 12px; word-break: break-all; }

.empty { padding: 80px 0 160px; text-align: center; color: var(--muted); font-size: 18px; }
.empty a { color: var(--ink); }

/* about: my statement in Instrument Serif, written on the lines of an open
   halftone notebook. Sizes are in cqw (% of the page's width), so the words
   stay on the ruled lines at any size. Rules: first at 12.8%, every 4.53%. */
.notebook { display: flex; justify-content: center; padding: 10px 0 120px; }
.notebook__spread {
  display: flex;
  width: min(100%, 1040px, calc((100vh - 290px) * 1500 / 1302)); /* the whole spread fits under the header */
  min-width: min(100%, 560px);
  transform: rotate(-1deg);   /* set down on the table, a little crooked */
}
.notebook__page { position: relative; flex: 1 1 0; container-type: inline-size; }
.notebook__paper {
  display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none;
  /* same two-layer shadow as the objects on the tray */
  filter: drop-shadow(2px 4px 3px rgba(20, 12, 4, .22)) drop-shadow(12px 24px 24px rgba(20, 12, 4, .2));
}
.notebook__text {
  --rule: 4.53cqw;               /* ruled line spacing */
  --lh: calc(var(--rule) * 2);   /* write on every other line */
  position: absolute; margin: 0;
  top: calc(var(--first) - var(--lh) * .74);   /* puts the first baseline on the 3rd ruled line */
  left: var(--l); right: var(--r);
  font-family: var(--heading); font-weight: 400;
  font-size: 6.6cqw; line-height: var(--lh); /* chosen for an even rag: every line well filled */
  text-wrap: pretty;             /* even lines, no lonely last word */
  color: var(--ink);
}
/* the left page's words start on the first ruled line below the polaroid */
.notebook__page--left .notebook__text { --first: 80.75cqw; --l: 11%; --r: 8%; }
/* the polaroid, taped to the top of the left page */
.notebook__photo {
  position: absolute; z-index: 1; margin: 0;
  left: 27cqw; top: 11cqw; width: 46cqw;
  transform: rotate(-3deg);
}
.notebook__photo img {
  display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none;
  filter: drop-shadow(1px 2px 1.5px rgba(20, 12, 4, .25)) drop-shadow(4px 8px 7px rgba(20, 12, 4, .2));
}
/* pink washi tape over the top corners */
.notebook__tape {
  position: absolute; z-index: 2; width: 36%; height: 11%;
  background: rgba(215, 110, 178, .72);   /* my pink, a little see-through like real tape */
  box-shadow: 0 1px 2px rgba(20, 12, 4, .14);
  /* torn ends */
  clip-path: polygon(0 6%, 4% 0, 9% 8%, 14% 0, 100% 0, 96% 40%, 100% 72%, 95% 100%, 88% 92%, 82% 100%, 0 100%, 4% 60%);
}
.notebook__tape--1 { top: -4%; left: -12%; transform: rotate(-34deg); }
.notebook__tape--2 { top: -4%; right: -12%; transform: rotate(31deg); }
.notebook__page--right .notebook__text { --first: 21.81cqw; --l: 8%; --r: 9%; }
/* phones: one page at a time, big enough to read */
@media (max-width: 700px) {
  .notebook__spread { flex-direction: column; align-items: center; gap: 22px; width: min(100%, 420px); transform: none; }
  .notebook__page { width: 100%; flex: none; }
  .notebook__page--left { transform: rotate(-1.2deg); }
  .notebook__page--right { transform: rotate(.9deg); }
}
.btn { display: inline-block; margin-top: 12px; padding: 12px 22px; border-radius: 999px; background: var(--ink); color: var(--bg); text-decoration: none; }
.btn:hover { background: var(--brand); }

/* contact: the open flip phone, with apps on its screen */
.flip-wrap { display: flex; justify-content: center; padding: 10px 0 120px; overflow: hidden; }
.flipphone {
  --w: min(300px, 74vw);
  position: relative; width: var(--w);
  transform: rotate(-6deg); /* leans the same way as on the tray */
  filter: drop-shadow(6px 14px 14px rgba(20, 12, 4, .22)) drop-shadow(1px 3px 3px rgba(20, 12, 4, .2));
}
.flipphone__img { display: block; width: 100%; height: auto; }
/* the lid's screen in the phone image: 12.5% / 9.5% from the left / top, 73.5% x 28.8% */
.flipphone__screen {
  position: absolute; left: 12.5%; top: 9.5%; width: 73.5%; height: 28.8%;
  overflow: hidden; border-radius: 2%;
  display: flex; flex-direction: column;
  background: #fff;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .35), inset 0 0 14px rgba(0, 0, 0, .18);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
}
.flipphone__dots { position: absolute; inset: 0; z-index: 0; }
.flipphone__dot { position: absolute; aspect-ratio: 1; border-radius: 50%; }
.flipphone__status {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 5% 6% 0; font-size: calc(var(--w) * .045); font-weight: 600;
}
.flipphone__signal { display: flex; align-items: flex-end; gap: 2px; height: calc(var(--w) * .04); }
.flipphone__signal i { width: 3px; background: var(--ink); border-radius: 1px; }
.flipphone__signal i:nth-child(1) { height: 30%; } .flipphone__signal i:nth-child(2) { height: 55%; }
.flipphone__signal i:nth-child(3) { height: 78%; } .flipphone__signal i:nth-child(4) { height: 100%; }
.flipphone__battery { display: flex; gap: 2px; padding: 2px; border: 1.5px solid var(--ink); border-radius: 3px; height: calc(var(--w) * .04); }
.flipphone__battery i { width: calc(var(--w) * .014); background: var(--ink); border-radius: 1px; }
.flipphone__apps { position: absolute; inset: 0; z-index: 1; }
/* each app is dropped at a random spot (set in js), centred on that point, slightly tilted */
.flipphone .app {
  --tilt: 0deg;
  position: absolute; transform: translate(-50%, -50%) rotate(var(--tilt));
  display: flex; flex-direction: column; align-items: center; gap: calc(var(--w) * .02);
  text-decoration: none; color: var(--ink); -webkit-tap-highlight-color: transparent;
}
.flipphone .app__icon {
  display: block; width: calc(var(--w) * .16); aspect-ratio: 1; overflow: hidden; border-radius: 24%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .2); transition: transform .15s ease, filter .15s ease;
}
.flipphone .app__icon svg { display: block; width: 100%; height: 100%; }
.flipphone .app:hover .app__icon { transform: scale(1.08); }
.flipphone .app:active .app__icon { transform: scale(.9); filter: brightness(.85); }
.flipphone .app:focus-visible .app__icon { outline: 2px solid var(--ink); outline-offset: 2px; }
.flipphone .app__label {
  font-size: calc(var(--w) * .036); font-weight: 500;
  padding: 0 .4em; border-radius: 999px; background: rgba(255, 255, 255, .85); /* readable over a dot */
}
.flipphone__toast {
  position: absolute; z-index: 3; left: 50%; bottom: 6%; transform: translate(-50%, 8px); color: #fff;
  padding: .4em .9em; border-radius: 999px; white-space: nowrap;
  background: rgba(0, 0, 0, .55); font-size: calc(var(--w) * .036);
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
}
.flipphone__toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* employment: a messy stack of printed resumes */
.resume-stack { display: flex; flex-direction: column; align-items: center; gap: 44px; padding: 20px 0 140px; }
.stack {
  position: relative; display: block;
  width: min(560px, 82vw, calc((100vh - 280px) * 1700 / 2200));
  aspect-ratio: 1700 / 2200;
}
.stack__sheet {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  background: #fff center / cover no-repeat; /* white paper, like the resume */
  box-shadow: 0 1px 2px rgba(20, 12, 4, .12), 0 10px 24px rgba(20, 12, 4, .12);
  transform: translate(var(--x), var(--y)) rotate(var(--r));
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), box-shadow .45s ease;
  animation: sheet-drop .6s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--i) * 90ms);
}
.stack__top { object-fit: cover; }
/* hover: the stack fans out a little and the top sheet lifts */
.stack:hover .stack__sheet { transform: translate(calc(var(--x) * 1.6), calc(var(--y) * 1.6)) rotate(calc(var(--r) * 1.5)); }
.stack:hover .stack__top { transform: translate(0, -10px) rotate(-.4deg); box-shadow: 0 2px 4px rgba(20, 12, 4, .12), 0 22px 40px rgba(20, 12, 4, .2); }
.stack:focus-visible { outline: 2px solid var(--ink); outline-offset: 12px; }
@keyframes sheet-drop {
  from { opacity: 0; transform: translate(var(--x), calc(var(--y) - 40px)) rotate(calc(var(--r) * 2.5)); }
}
@media (prefers-reduced-motion: reduce) { .stack__sheet { animation: none; transition: none; } }


/* project page: like a studio case study (after Mother Design's Keen page) */
.project-page { overflow-x: clip; }
.phero { margin: 0 calc(50% - 50vw) clamp(28px, 3vw, 48px); }   /* the first image, edge to edge */
.phero img { display: block; width: 100%; height: auto; max-height: 100vh; object-fit: cover; }
.phero img:not(.is-loaded) { visibility: hidden; aspect-ratio: 16 / 9; }
.pmeta {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gutter);
  margin-bottom: clamp(56px, 7vw, 120px);
}
.pmeta__overview { grid-column: 2 / -1; } /* label on the left, words on the right */
.pmeta__label { display: block; margin-bottom: 6px; font-family: var(--heading); font-size: calc(17px * var(--sub-scale)); line-height: 1.2; color: var(--hover); }
.pnav {
  display: flex; justify-content: space-between; gap: var(--gutter);
  margin-top: clamp(48px, 6vw, 96px); padding: 0 0 140px;
}
.pnav a { text-decoration: none; font-family: var(--script); font-weight: var(--script-weight); text-transform: var(--h-case); letter-spacing: var(--h-track);
  font-size: calc(clamp(22px, 2.2vw, 34px) * var(--h-scale)); line-height: 1.05; transition: color .2s ease; }
.pnav a:hover, .pnav a:focus-visible { color: var(--hover); outline: none; }
.pnav .pmeta__label { text-transform: none; letter-spacing: 0; }
.pnav__next { text-align: right; }
@media (max-width: 699px) {
}
.project-head { max-width: 760px; margin-bottom: 48px; }
.project-year { font-family: var(--heading); color: var(--accent, var(--muted)); font-size: calc(26px * var(--sub-scale)); font-weight: 400; margin: 6px 0 20px; } /* matches the arrows */

/* every sub page: the mini tray on top, the title on its own line below it */
/* inner pages: the Neue Haas title sits top left, on the same line as the tray
   top right, centred on it (it never wraps: Neue Haas stays on one line) */
.sub-page .site-header { flex-wrap: nowrap; align-items: flex-end; gap: 32px; padding-bottom: 28px; }
/* the title's baseline sits level with the bottom of the tray (offset set in js/pages.js) */
.sub-page .page-title { margin-bottom: var(--tray-drop, 0px) !important; }
.sub-page .page-title { flex: 1 1 auto; min-width: 0; margin: 0; white-space: nowrap; }
.sub-page .site-header .mini-tray { flex: none; margin-left: auto; }
/* phones: no room beside the tray, so the title goes just under it */
@media (max-width: 700px) {
  .sub-page .site-header { flex-wrap: wrap; gap: 0; }
  .sub-page .site-header .mini-tray { order: -1; }
  .sub-page .page-title { flex-basis: 100%; margin-top: 18px; }
}
.project-desc { font-size: var(--body-size); line-height: var(--body-leading); letter-spacing: var(--body-track); }
.project-desc p { margin: 0 0 14px; }
/* each line is set in pages.js (8 words at most, never one word alone, as
   even as possible) and never wraps again inside the column */
.project-desc .line { display: block; white-space: nowrap; }
.project-desc .nobr { white-space: nowrap; }
/* about: my words on the left, the polaroid of me on the right */
.about-page {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gutter);
  align-items: start; padding: 24px 0 140px;
}
.about-text { grid-column: 1 / span 2; }
/* exactly as tall as the text: the photo takes no room of its own, the row
   is the text's height, and the photo fills that height */
.about-page { align-items: stretch; }
.about-text .project-desc p:last-child { margin-bottom: 0; }
.about-photo { grid-column: 3 / span 2; margin: 0; position: relative; }
/* the same shadow the polaroid has on the tray (see .icon__body, at rest) */
.about-photo img { position: absolute; top: 0; left: 0; height: 100%; width: auto;
  filter: drop-shadow(1px 2px 4px rgba(20, 12, 4, .42)) drop-shadow(3px 7px 9px rgba(20, 12, 4, .26)); }
.about-photo img:not(.is-loaded) { visibility: hidden; }
@media (max-width: 699px) { .about-text { grid-column: 1 / -1; } .about-photo { grid-column: 1 / span 1; position: static; } .about-photo img { position: static; width: 100%; height: auto; } }
/* phones and tablets are too narrow for those lines: the text flows, with no lone words */
@media (max-width: 999px) {
  .project-desc p { text-wrap: pretty; }
  .project-desc .line { display: inline; white-space: normal; }
}
.project-desc h2 { font-size: 28px; line-height: 1.15; margin: 34px 0 8px; }
.project-desc ul { margin: 0 0 14px; padding-left: 1.2em; }
.project-desc li { margin-bottom: 8px; }
/* project page: text on the left, the pile of prints on the right */
.project-split { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.35fr); gap: 56px; align-items: start; }
.project-split .project-head { margin-bottom: 0; }
.pile-wrap { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 28px; }
.pile { position: relative; height: min(72vh, 680px); }
.pile__card {
  position: absolute; inset: 0; margin: auto; /* centered, sized to its picture */
  width: fit-content; height: fit-content; max-width: 100%;
  padding: 12px; border: 0;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 12, 4, .12), 0 12px 28px rgba(20, 12, 4, .14);
  cursor: pointer;
  transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), opacity .4s ease, box-shadow .3s ease;
}
.pile__card img { display: block; max-width: 100%; max-height: calc(min(72vh, 680px) - 48px); width: auto; height: auto; }
.pile__card:not(.is-top) { pointer-events: none; }
.pile__card.is-hidden { opacity: 0; }
.pile__card.is-top:hover { box-shadow: 0 2px 4px rgba(20, 12, 4, .12), 0 22px 40px rgba(20, 12, 4, .2); }
.pile__card:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
/* top print flies off to the left, then slides back under the pile */
.pile__card.is-leaving { transform: translate(-115%, -6%) rotate(-14deg); opacity: 0; }
.pile__card.is-tucking, .pile__card.no-anim { transition: none; }
.pile__card.is-tucking { opacity: 0; }
.pile-wrap .pamphlet__controls { justify-content: center; }
@media (max-width: 900px) {
  .project-split { grid-template-columns: 1fr; gap: 28px; }
  .pile-wrap { position: static; order: -1; }
  .project-media { order: -1; }
  .project-media .pile-wrap { order: 0; }
  .pile { height: min(62vh, 520px); }
  .pile__card img { max-height: calc(min(62vh, 520px) - 40px); }
}
@media (prefers-reduced-motion: reduce) { .pile__card { transition: none; } }
/* project page: a plain grid of the images */
.project-page .project-head { max-width: 760px; margin-bottom: clamp(32px, 4vw, 56px); }
.project-read { padding: 0; border: 0; background: none; cursor: pointer; margin-top: 6px;
  font-family: var(--heading); font-size: calc(22px * var(--sub-scale)); color: var(--accent, var(--ink)); transition: color .2s ease; }
.project-read:hover, .project-read:focus-visible { color: var(--ink); outline: none; }
/* the images after the overview: a loose grid (after KesselsKramer's work
   page, a size bigger): 4 across, lots of air, every image its own shape,
   sitting on the row's bottom line; the shape class is set in pages.js */
.pgal {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: clamp(24px, 4vw, 72px); row-gap: clamp(56px, 8vw, 140px); align-items: end;
}
.pgal__item { display: flex; justify-content: center; }
.pgal__item img { width: 100%; }
.pgal__item.is-square img { width: 82%; }
.pgal__item.is-tall img { width: 64%; }
.pgal__item { margin: 0; }

.pgal__item img { display: block; height: auto; }
.pgal__item img:not(.is-loaded) { visibility: hidden; aspect-ratio: 4 / 3; }
@media (max-width: 699px) {
  .pgal { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; row-gap: 48px; }
  .pmeta__overview { grid-column: 1 / -1; }
}

/* IKEA-style pamphlet (flip-through booklet) */
.pamphlet { padding: 0 0 20px; }
.pamphlet__stage { display: flex; justify-content: center; perspective: 2400px; padding: 16px 24px 40px; overflow: hidden; }
.book {
  /* one page; --aspect is width ÷ height (default: US letter, portrait) */
  --aspect: .773;
  --pw: min(42vw, calc((100vh - 230px) * var(--aspect)), calc(440px * max(1, var(--aspect) * .9)));
  position: relative;
  width: calc(var(--pw) * 2); height: calc(var(--pw) / var(--aspect));
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.3, .1, .2, 1);
}
.book.is-closed { transform: translateX(-25%); } /* just the cover, centered */
.book.is-end { transform: translateX(25%); }      /* just the back cover */
.leaf {
  position: absolute; top: 0; left: 50%; width: 50%; height: 100%;
  transform-origin: left center; transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.3, .1, .2, 1);
  cursor: pointer;
}
.leaf.is-turned { transform: rotateY(-180deg); }
.leaf__face {
  position: absolute; inset: 0; overflow: hidden;
  background: #fff;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
/* one shadow under the whole book, sized to what's showing (cover, spread, or back cover).
   (Shadows on every sheet would stack up into a dark band.) */
.book::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; right: 0;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 12, 4, .1), 0 14px 32px rgba(20, 12, 4, .13);
  transform: translateZ(-1px);
  transition: left .7s cubic-bezier(.3, .1, .2, 1), right .7s cubic-bezier(.3, .1, .2, 1);
}
.book.is-closed::before { left: 50%; }
.book.is-end::before { right: 50%; }
.leaf__back { transform: rotateY(180deg); }
.leaf__face::after { /* fold shading at the spine */
  content: ""; position: absolute; top: 0; bottom: 0; width: 12%; pointer-events: none;
}
.leaf__front::after { left: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .09), rgba(0, 0, 0, 0)); }
.leaf__back::after { right: 0; background: linear-gradient(270deg, rgba(0, 0, 0, .09), rgba(0, 0, 0, 0)); }

.pp { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 8% 9%; color: #111; font-family: var(--sans); }
.pp img { display: block; mix-blend-mode: multiply; } /* off-white photo backgrounds melt into the paper */
.pp__num { position: absolute; bottom: 3.5%; font-family: var(--sans); font-weight: 700; font-size: calc(var(--pw) * .026); }
.pp__num--r { right: 5.5%; }
.pp__num--l { left: 5.5%; }
.leaf:first-child .pp__num--r, .leaf:last-child .pp__num--l { display: none; } /* no numbers on the covers */

.pp__name {
  font-family: var(--sans); font-weight: 800; text-transform: uppercase;
  font-size: calc(var(--pw) * .088); line-height: .95; letter-spacing: -.02em; margin: 0;
}
.pp__sub { font-size: calc(var(--pw) * .028); margin: .7em 0 0; color: #555; }
.pp__hero { flex: 1; min-height: 0; width: 100%; object-fit: contain; margin: 6% 0; }
.pp__byline { font-size: calc(var(--pw) * .026); font-weight: 700; margin: 0; }

.pp--intro { gap: 5%; }
.pp__picto--big svg { display: block; width: 55%; margin: 0 auto; }
.pp__tools { display: flex; justify-content: center; gap: 7%; }
.pp__tools svg { width: 19%; }
.pp__text { font-size: calc(var(--pw) * .025); line-height: 1.55; }
.pp__text p { margin: 0 0 .7em; }

.pp--sheet { padding: 3.5%; }
.pp--sheet img { width: 100%; height: 100%; object-fit: contain; }
.pp--full { padding: 0; }
.pp--photo { justify-content: center; gap: 4%; }
.pp__step { font-weight: 800; font-size: calc(var(--pw) * .1); line-height: 1; }
.pp--photo img { width: 100%; flex: 1; min-height: 0; object-fit: contain; }
.pp--back { justify-content: flex-end; }
.pp__code { font-size: calc(var(--pw) * .024); font-weight: 700; margin: .8em 0 0; letter-spacing: .04em; }

.pamphlet__controls { display: flex; justify-content: center; align-items: center; gap: 20px; }
/* arrows: just the arrow, in the project's color (no circle) */
.pamphlet__btn {
  width: 46px; height: 46px; border: 0; padding: 0; cursor: pointer;
  background: none; color: var(--accent, var(--ink));
  font-size: 32px; font-weight: 600; line-height: 1; font-family: var(--sans);
  transition: transform .2s, opacity .2s;
}
.pamphlet__btn:hover:not(:disabled) { transform: scale(1.18); }
.pamphlet__btn:disabled { opacity: .25; cursor: default; }
.pamphlet__btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 6px; }
.pamphlet__count { min-width: 110px; text-align: center; font-size: 14px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .book, .leaf { transition: none; } }

/* 3D book (sizes in px come from --bw; proportions from the book's inches) */
.book3d-scene { display: block; perspective: 1600px; }
.book3d {
  --bw: 300px;
  --bh: calc(var(--bw) * var(--H) / var(--W));
  --bd: calc(var(--bw) * var(--D) / var(--W));
  position: relative; display: block; margin: 0 auto;
  width: var(--bw); height: var(--bh);
  transform-style: preserve-3d;
}
.book3d__face { position: absolute; display: block; background: center / 100% 100% no-repeat; backface-visibility: hidden; }
.book3d__front, .book3d__back { inset: 0; }
.book3d__front { transform: translateZ(calc(var(--bd) / 2)); }
.book3d__back { transform: rotateY(180deg) translateZ(calc(var(--bd) / 2)); }
.book3d__spine, .book3d__fore { top: 0; height: var(--bh); width: var(--bd); left: calc((var(--bw) - var(--bd)) / 2); }
.book3d__spine { transform: rotateY(-90deg) translateZ(calc(var(--bw) / 2)); }
.book3d__fore { transform: rotateY(90deg) translateZ(calc(var(--bw) / 2 - 1px)); }
.book3d__top, .book3d__bottom { left: 0; width: var(--bw); height: var(--bd); top: calc((var(--bh) - var(--bd)) / 2); }
.book3d__top { transform: rotateX(90deg) translateZ(calc(var(--bh) / 2 - 1px)); }
.book3d__bottom { transform: rotateX(-90deg) translateZ(calc(var(--bh) / 2 - 1px)); }
/* page edges: thin paper lines */
.book3d__fore { background: repeating-linear-gradient(90deg, #f6f3ec 0 1.5px, #dcd7cc 1.5px 2.5px); }
.book3d__top, .book3d__bottom { background: repeating-linear-gradient(0deg, #f6f3ec 0 1.5px, #dcd7cc 1.5px 2.5px); }

/* on the portfolio table: fixed at a 3D angle, sized to the object's width */
.tobj__book { container-type: inline-size; width: 100%; padding: 4% 0; }
.tobj__book .book3d-scene { perspective: 520px; } /* stronger depth at this small size */
/* lying flat on the table: turned a little on the surface (rotateZ), then the
   whole thing tipped back as if seen from slightly above (rotateX) */
.book3d--table { --bw: 80cqw; transform: rotateX(42deg) rotateZ(-14deg); }

/* on the project page: big, and you can spin it */
.project-media { display: flex; flex-direction: column; gap: 40px; }
.project-media.has-book .pile-wrap { position: static; }
/* clickable app prototype: the Figma screens inside an iPhone (see wirePrototype in pages.js) */
.proto { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px 0 20px; }
.proto__phone {
  --pw: min(330px, 70vw);                 /* screen width (leaves room beside it to scroll the page on phones) */
  position: relative;
  padding: calc(var(--pw) * .035);
  border-radius: calc(var(--pw) * .17);
  background: linear-gradient(145deg, #3a3a3c, #121214 40%, #2a2a2c);
  box-shadow: inset 0 0 0 2px #4a4a4d, inset 0 0 0 5px #0b0b0c;
  /* same two-layer shadow as the objects on the tray */
  filter: drop-shadow(2px 4px 3px rgba(20, 12, 4, .3)) drop-shadow(14px 26px 26px rgba(20, 12, 4, .26));
}
.proto__screen {
  position: relative; overflow: hidden;
  width: var(--pw); aspect-ratio: 393 / 852;
  border-radius: calc(var(--pw) * .135);
  background: #fcffb0;
}
.proto__scroll {
  position: absolute; inset: 0;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none;
}
.proto__scroll::-webkit-scrollbar { display: none; }
.proto__page { position: relative; width: 100%; }
.proto__page.is-in { animation: proto-in .28s ease both; }
@keyframes proto-in { from { opacity: 0; transform: translateX(4%); } }
.proto__page img, .proto__nav img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.proto__nav { position: absolute; left: 0; right: 0; bottom: 0; }
.proto__nav[hidden] { display: none; }
.proto__island { /* the Dynamic Island */
  position: absolute; top: calc(var(--pw) * .055); left: 50%; transform: translateX(-50%);
  width: calc(var(--pw) * .3); height: calc(var(--pw) * .085);
  border-radius: 999px; background: #050505; pointer-events: none; z-index: 3;
}
.proto__spot {
  position: absolute; z-index: 2;
  padding: 0; border: 0; border-radius: 10px; background: transparent;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.proto__spot:focus-visible { outline: 2px solid var(--accent, #2d69a6); outline-offset: -2px; }
/* a tap that misses every link flashes the links, like Figma's prototype view */
.proto__screen.is-hinting .proto__spot { animation: proto-hint .9s ease; }
@keyframes proto-hint { 0%, 60% { background: rgba(45, 105, 166, .28); box-shadow: inset 0 0 0 2px rgba(45, 105, 166, .7); } }
.proto__hint { margin: 0; font-size: 13px; color: var(--muted); }
.proto__restart { padding: 0; border: 0; background: none; font: inherit; color: var(--accent, var(--ink)); cursor: pointer; text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .proto__page.is-in, .proto__screen.is-hinting .proto__spot { animation: none; } }
.book-viewer { position: relative; display: flex; flex-direction: column; align-items: center; padding: 30px 0 10px; }
.book-viewer__scene { cursor: grab; touch-action: none; padding: 40px; }
.book-viewer__scene.is-grabbing { cursor: grabbing; }
.book3d--viewer { --bw: min(380px, 62vw); }
.book-viewer__shadow {
  width: min(360px, 58vw); height: 26px; margin-top: -10px;
  border-radius: 50%; background: radial-gradient(closest-side, rgba(20, 12, 4, .22), transparent);
}
.book-viewer__hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* full-screen book reader */
.reader-open { overflow: hidden; }
.reader {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
  background: rgba(255, 255, 255, .97);
  animation: reader-in .3s ease both;
}
@keyframes reader-in { from { opacity: 0; } }
.reader .book { --pw: min(41vw, calc((100vh - 230px) * var(--aspect)), 700px); }
.reader .pamphlet__stage { padding: 36px 24px 48px; }
.reader .pp--full img { object-fit: contain; }
.reader__close {
  position: absolute; top: 18px; right: 22px;
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(200, 200, 180, .55); color: #444; font-size: 26px; line-height: 1;
}
.reader__close:hover { background: rgba(170, 170, 150, .7); }
.book-viewer__scene:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

/* back to top: the same thin black arrow on every page (red on hover), only
   once you've scrolled down (pages.js adds .is-shown) */
.to-top {
  position: fixed; right: 40px; bottom: 36px; z-index: 50;
  width: 44px; height: 56px; display: grid; place-items: center;
  color: var(--ink); text-decoration: none;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s, color .2s ease;
}
.to-top svg { width: 22px; height: 38px; display: block; }
.to-top.is-shown { opacity: 1; visibility: visible; transform: none; transition: opacity .25s ease, transform .25s ease, color .2s ease; }
.to-top.is-shown:hover, .to-top.is-shown:focus-visible { color: var(--hover); transform: translateY(-4px); outline: none; }
@media (max-width: 700px) { .to-top { right: 10px; bottom: 10px; } }

/* =========================================================
   CURSOR: a dot that cycles through the palette (js/cursor.js)
   ========================================================= */
.has-dot-cursor, .has-dot-cursor * { cursor: none !important; }
.cursor-dot {
  position: fixed; left: 0; top: 0; z-index: 10000;
  width: 12px; height: 12px; margin: -6px 0 0 -6px; /* centred on the pointer */
  background: #c3291c;      /* a red square pixel, like my logo */
  pointer-events: none;
  opacity: 0;
  transition: width .2s ease, height .2s ease, margin .2s ease, opacity .2s ease;
}
.cursor-dot.is-on { opacity: 1; }
.cursor-dot.is-hover { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
.cursor-dot.is-down { width: 10px; height: 10px; margin: -5px 0 0 -5px; }
.cursor-trail {
  position: fixed; z-index: 9999;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  animation: cursor-trail 1s cubic-bezier(.2, .8, .3, 1) forwards;
}
@keyframes cursor-trail {
  15% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(.2); opacity: 0; }
}


/* subheads under a caps header must not inherit its caps */
.pgrid__type, .tobj__type, .project-year, .pmeta__label, .view-switch a, .project-read { text-transform: var(--sub-case); letter-spacing: var(--sub-track); font-style: var(--sub-style); }
/* subheads are sentence case: the words are stored lowercase, the first letter is capitalized where they show */
.project-year::first-letter, .pgrid__type::first-letter, .tobj__type::first-letter,
.view-switch a::first-letter, .project-read::first-letter { text-transform: var(--sub-first); }
.view-switch a { display: inline-block; }
