/* amrosallam.com — design system. Tokens and rules are specified in /DESIGN_SPEC.md; keep the two in step.
   White ground, near-black type, one sans family, hairlines, sharp corners. No accent colour, no radii, no shadows.
   Motion is progressive: every `html.motion …` rule only applies when JS is running, the visitor allows motion,
   and site.js has loaded. Without it every page is static and complete. */

/* ---------- 1. Font (self-hosted, SIL OFL 1.1) ---------- */
@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/inter-tight-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- 2. Tokens ---------- */
:root {
  /* colour */
  --bg: #ffffff;
  --ink: #111111;
  --muted: #6a6a6a;      /* 5.4:1 on white */
  --rule: #dcdcdc;       /* hairlines that belong to content (rows, header, pager) */
  --line: #ececec;       /* structural grid lines behind the page */

  /* type */
  --sans: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --fs-meta: 0.8125rem;                          /* 13 */
  --fs-body: 1rem;                               /* 16 */
  --fs-read: clamp(1.0625rem, 0.6rem + 0.9vw, 1.25rem);   /* 17 → 20 long-form text */
  --fs-lead: clamp(1.25rem, 0.8rem + 1.2vw, 1.5625rem);   /* 20 → 25 */
  --fs-h3: clamp(1.25rem, 1rem + 0.8vw, 1.5625rem);       /* 20 → 25 */
  --fs-h2: clamp(1.5625rem, 1rem + 1.9vw, 2.4375rem);     /* 25 → 39 */
  --fs-h1: clamp(2.75rem, 1rem + 6.4vw, 7.5rem);          /* 44 → 120 project titles */
  --fs-display: clamp(3.25rem, 0.5rem + 11.5vw, 13rem);   /* 52 → 208 section titles */
  --track-display: -0.045em;
  --track-head: -0.025em;
  --track-text: -0.003em;

  /* space: 8px system */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s6: 48px; --s8: 64px; --s12: 96px; --s16: 128px; --s20: 160px;
  --m: 20px;             /* outer margin */
  --g: 16px;             /* gutter */
  --header-h: 56px;

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --t-hover: 240ms;
  --t-reveal: 900ms;
  --t-wipe: 1100ms;
  --t-page: 420ms;
  --stagger: 70ms;

  /* structural lines: 1px verticals drawn in the gutter centres of the page's own grid */
  --ln: linear-gradient(var(--line), var(--line));
  --lines-edge: var(--ln) 0 0 / 1px 100% no-repeat, var(--ln) 100% 0 / 1px 100% no-repeat;
  --lines-2: var(--lines-edge), var(--ln) 50% 0 / 1px 100% no-repeat;
  --lines-3: var(--lines-edge), var(--ln) 33.333% 0 / 1px 100% no-repeat, var(--ln) 66.667% 0 / 1px 100% no-repeat;
  --lines-4: var(--lines-2), var(--ln) 25% 0 / 1px 100% no-repeat, var(--ln) 75% 0 / 1px 100% no-repeat;
  --lines-side: var(--lines-edge), var(--ln) 25% 0 / 1px 100% no-repeat;                       /* 1 + 3 split */
  --lines-list: var(--lines-side), var(--ln) 75% 0 / 1px 100% no-repeat;                       /* 1 + 2 + 1 */
  --lines: var(--lines-edge);
}
@media (min-width: 768px)  { :root { --m: 32px; --g: 24px; --header-h: 60px; } }
@media (min-width: 1200px) { :root { --m: 48px; --g: 32px; } }
@media (min-width: 1600px) { :root { --m: 64px; } }
@media (min-width: 2000px) { :root { --m: 7vw; } }

/* ---------- 3. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--s3)); }
body {
  margin: 0;
  font: 400 var(--fs-body)/1.5 var(--sans);
  letter-spacing: var(--track-text);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "calt";
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}
/* the grid, drawn once behind everything */
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0 calc(var(--m) - var(--g) / 2);
  background: var(--lines);
  pointer-events: none;
}
main { flex: 1; display: block; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }   /* width/height attributes cap every image at its intrinsic size */
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 0; }
::selection { background: var(--ink); color: var(--bg); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.skip { position: absolute; left: var(--m); top: -100px; z-index: 100; padding: var(--s1) var(--s2); background: var(--ink); color: var(--bg); font-size: var(--fs-meta); font-weight: 500; }
.skip:focus { top: var(--s1); outline-offset: 2px; }

/* text link with a hairline underline that redraws on hover */
.prose a, .m-button a, .notfound-link a, .crumb a {
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size var(--t-hover) var(--ease-io);
}
.prose a:hover, .m-button a:hover, .notfound-link a:hover, .crumb a:hover { background-size: 0 1px; background-position: 100% 100%; }

/* small label style: metadata, numbers, nav */
.card-date, .card-body::before, .page-count, .project-index, .project-date, .pager-label, figcaption, .site-footer, .statement::before, .notfound-code {
  font-size: var(--fs-meta);
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  font-variant-numeric: tabular-nums lining-nums;
}

/* ---------- 4. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  height: var(--header-h);
  padding-inline: var(--m);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.wordmark { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; white-space: nowrap; padding-block: var(--s2); }
.site-header nav ul { display: flex; gap: clamp(var(--s3), 3vw, var(--s6)); }
.site-header nav a {
  position: relative;
  display: block;
  padding-block: var(--s2);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  color: var(--muted);
  transition: color var(--t-hover) ease;
}
.site-header nav a::after {       /* tick that grows into an underline: current page = ink + rule, never colour alone */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 8px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--t-hover) var(--ease-io);
}
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--ink); }
.site-header nav a:hover::after, .site-header nav a[aria-current]::after { transform: scaleX(1); }
.site-header nav a[aria-current] { font-weight: 600; }
/* scroll progress, drawn on the header's own hairline */
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--ink); transform: scaleX(var(--p, 0)); transform-origin: 0 50%; pointer-events: none; }
html:not(.js) .progress { display: none; }

@media (max-width: 559px) {
  /* phone: two rows. The wordmark row scrolls away; the four section links stay pinned. Nothing hides behind a menu. */
  .site-header { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; height: auto; top: -44px; }
  .wordmark { height: 44px; display: flex; align-items: center; padding: 0; }
  .site-header nav { border-top: 1px solid var(--rule); margin-inline: calc(var(--m) * -1); padding-inline: var(--m); }
  .site-header nav ul { justify-content: space-between; gap: var(--s1); }
  .site-header nav a { padding-block: 15px; }
  :root { --header-h: 45px; }
}

/* ---------- 5. Footer ---------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s16);
  padding: var(--s3) var(--m);
  border-top: 1px solid var(--rule);
  background: var(--bg);
}
.site-footer a { color: var(--ink); padding-block: var(--s1); display: inline-flex; align-items: center; gap: var(--s1); }
.site-footer a::before { content: ""; width: 9px; height: 9px; border-left: 1px solid; border-top: 1px solid; transform: translateY(3px) rotate(45deg); transition: transform var(--t-hover) var(--ease-out); }
.site-footer a:hover::before { transform: translateY(0) rotate(45deg); }

/* ---------- 6. Intro ---------- */
.page-intro { --lines: var(--lines-edge); }
.intro-layout { padding-inline: var(--m); }
.intro { padding-top: var(--s8); }
.intro-name {
  font-size: clamp(3.5rem, 1rem + 12vw, 6.5rem);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: var(--track-display);
  margin-left: -0.04em;
  text-wrap: balance;
}
.intro-bio { margin-top: var(--s6); max-width: 34em; }
.intro-bio .prose { max-width: none; background: none; }
.intro-bio p { font-size: var(--fs-lead); line-height: 1.32; letter-spacing: -0.015em; }
.intro-art { margin-top: var(--s6); }
.intro-art img { width: 100%; }
.intro-enter { margin-top: var(--s6); }
.intro-enter a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--s3);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-size: var(--fs-h3);
  font-weight: 500;
  letter-spacing: var(--track-head);
  line-height: 1;
}
/* arrow: a hairline and a chevron, inline SVG so nothing is fetched */
.intro-enter a::after, .pager .next::after, .pager .prev::before {
  content: "";
  flex: none;
  width: 44px;
  height: 11px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 11' fill='none' stroke='%23111' stroke-width='1'%3E%3Cpath d='M0 5.5h43M38 .5l5 5-5 5'/%3E%3C/svg%3E") 100% 50% / 44px 11px no-repeat;
  transition: transform var(--t-hover) var(--ease-out);
}
.pager .prev::before { transform: scaleX(-1); }
.intro-enter a:hover::after { transform: translateX(8px); }

.statement { padding-top: var(--s12); }
.statement::before { content: attr(aria-label); display: block; padding-top: var(--s2); border-top: 1px solid var(--rule); margin-bottom: var(--s6); }
.statement .m-image { margin-bottom: var(--s4); }
.statement .m-image img { filter: grayscale(1); }
.statement .prose { max-width: 36em; }

.intro-social { margin-top: var(--s12); padding-inline: var(--m); }
.social { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); }
.social li { border-bottom: 1px solid var(--rule); }
.social a { display: flex; align-items: center; gap: var(--s2); padding-block: var(--s3); font-size: 0.9375rem; font-weight: 500; }
.social a::after { content: attr(aria-label); background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; padding-bottom: 2px; transition: background-size var(--t-hover) var(--ease-io); }
.social a:hover::after { background-size: 100% 1px; }
.social svg { width: 18px; height: 18px; flex: none; fill: currentColor; }
.social svg[fill="none"] { fill: none; }
.social img { width: auto; height: 20px; flex: none; }

@media (min-width: 900px) {
  .page-intro { --lines: var(--lines-2); }
  .intro-layout { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto 1fr; column-gap: var(--g); }
  .intro {
    grid-column: 1; grid-row: 1;
    display: flex; flex-direction: column; justify-content: space-between;
    min-height: calc(100vh - var(--header-h) - 128px);
    min-height: calc(100svh - var(--header-h) - 128px);
    padding-top: var(--s6);
    padding-right: var(--g);
  }
  .intro-name { font-size: clamp(4rem, 7.6vw, 10rem); }
  /* pinned: the painting holds the right half while name, bio, Enter and the statement travel past it */
  .intro-art { grid-column: 2; grid-row: 1 / span 3; align-self: start; position: sticky; top: calc(var(--header-h) + var(--s6)); margin-top: var(--s6); }
  .intro-art img { width: auto; max-height: calc(100vh - var(--header-h) - 96px); max-height: calc(100svh - var(--header-h) - 96px); }
  .intro-enter { grid-column: 1; grid-row: 2; margin-top: var(--s4); padding-right: var(--g); }
  .statement { grid-column: 1; grid-row: 3; padding-top: var(--s20); padding-right: var(--g); padding-bottom: var(--s8); }
  .social { grid-template-columns: repeat(4, 1fr); column-gap: var(--g); border-top: 0; }
  .social li { border-top: 1px solid var(--rule); }
  .intro-social { margin-top: var(--s8); }
}

/* ---------- 7. Prose ---------- */
.prose { max-width: 33em; font-size: var(--fs-read); line-height: 1.55; }
.prose p + p { margin-top: 1.1em; }
.prose p { text-wrap: pretty; hanging-punctuation: first; }

/* ---------- 8. Section pages: head ---------- */
.page-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  padding: clamp(var(--s8), 9vw, var(--s20)) var(--m) clamp(var(--s6), 5vw, var(--s12));
}
.page-title {
  font-size: var(--fs-display);
  font-weight: 500;
  line-height: 0.86;
  letter-spacing: var(--track-display);
  margin-left: -0.05em;
}
.page-count { padding-top: 0.6em; font-size: clamp(0.8125rem, 0.5rem + 0.8vw, 1.25rem); }
.crumb { font-size: var(--fs-meta); }

/* 8a. Statement under a section title (Art). One reading column on small screens, on a white band so the page's
   grid lines do not run through the text; from 1200px it sits on the page's own four-column grid (label, then one
   paragraph per column) and the lines fall between the paragraphs. */
.gallery-intro { margin: 0 var(--m) clamp(var(--s8), 7vw, var(--s16)); padding-top: var(--s2); border-top: 1px solid var(--rule); background: var(--bg); scroll-margin-top: calc(var(--header-h) + var(--s2)); }
.gallery-intro::before { content: attr(aria-label); display: block; margin-bottom: var(--s4); font-size: var(--fs-meta); color: var(--muted); }
.gallery-intro .prose { max-width: 36em; }
@media (min-width: 1200px) {
  .gallery-intro { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--g); background: none; }
  .gallery-intro::before { margin-bottom: 0; }
  .gallery-intro .prose { grid-column: 2 / -1; max-width: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--g); font-size: var(--fs-body); line-height: 1.5; }
  .gallery-intro .prose p + p { margin-top: 0; }
}

/* ---------- 9. Grids ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s8) var(--g); padding-inline: var(--m); counter-reset: item; }
.card { counter-increment: item; min-width: 0; }
.card > a { display: block; }
.card-media { position: relative; overflow: hidden; max-width: calc(var(--w, 9999) * 1px); }
.cover { width: 100%; }
.card-body { display: grid; grid-template-columns: 2.25em minmax(0, 1fr) auto; column-gap: var(--s1); align-items: baseline; padding-top: var(--s2); }
.card-body::before { content: counter(item, decimal-leading-zero); }
.card-title { font-size: 1.0625rem; font-weight: 500; line-height: 1.25; letter-spacing: -0.015em; }
.card-title, .pager-title { text-wrap: balance; }
.card-date { text-align: right; }
/* title underline draws in on hover / focus */
.card-title, .pager-title { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; display: inline; padding-bottom: 1px; transition: background-size 360ms var(--ease-io); }
.card > a:hover .card-title, .card > a:focus-visible .card-title, .pager a:hover .pager-title { background-size: 100% 1px; }

/* 9a. Architecture: one ratio (202:158, the ratio every cover was cut at), 1 → 2 → 3 columns */
.layout-grid .card-media { aspect-ratio: 202 / 158; }
.layout-grid .cover { height: 100%; object-fit: cover; transition: transform 700ms var(--ease-out); }
.layout-grid .card > a:hover .cover { transform: scale(1.02); }
@media (min-width: 640px)  { .layout-grid { --lines: var(--lines-2); } .layout-grid .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .layout-grid { --lines: var(--lines-3); } .layout-grid .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: var(--s12); } }

/* 9b. Art: a gallery wall. Every work is shown whole in a square bay, hung on a common base line. Never cropped. */
.layout-wall { --lines: var(--lines-2); }
.grid-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--s6); }
.grid-wall .card-media { aspect-ratio: 1; display: flex; align-items: flex-end; overflow: visible; max-width: none; }
.grid-wall .cover { width: calc(min(1, var(--ar)) * 100%); height: auto; max-width: calc(var(--w, 9999) * 1px); transition: transform 700ms var(--ease-out); }
.grid-wall .card > a:hover .cover { transform: translateY(-6px); }
.grid-wall .card-body { grid-template-columns: 2.25em minmax(0, 1fr); }
.grid-wall .card-date { grid-column: 2; text-align: left; margin-top: 2px; }
.grid-wall .card-title { font-size: 0.9375rem; }
@media (min-width: 768px)  { .layout-wall { --lines: var(--lines-3); } .grid-wall { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: var(--s8); } }
@media (min-width: 1200px) { .layout-wall { --lines: var(--lines-4); } .grid-wall { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: var(--s12); } .grid-wall .card-title { font-size: 1.0625rem; } }

/* 9c. Software: an index. Thumbnail | title + line | number, ruled rows. */
.grid-list { display: block; }
.grid-list .card { border-top: 1px solid var(--rule); }
.grid-list .card:last-child { border-bottom: 1px solid var(--rule); }
.grid-list .card > a { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3) var(--g); padding-block: var(--s4); }
.grid-list .card-media { aspect-ratio: 202 / 158; }
.grid-list .cover { height: 100%; object-fit: cover; transition: transform 700ms var(--ease-out); }
.grid-list .card > a:hover img.cover { transform: scale(1.02); }
.grid-list .card-body { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr; padding-top: 0; row-gap: var(--s2); align-content: start; }
.grid-list .card-body::before { grid-column: 2; grid-row: 1; text-align: right; }
.grid-list .card-title { grid-column: 1; grid-row: 1; font-size: var(--fs-h2); line-height: 1.05; letter-spacing: var(--track-head); display: block; background: none; }
.grid-list .card-desc { grid-column: 1 / -1; grid-row: 2; max-width: 34em; font-size: var(--fs-read); line-height: 1.45; color: var(--muted); transition: color var(--t-hover) ease; }
.grid-list .card > a:hover .card-desc { color: var(--ink); }
.ext { display: inline-block; font-weight: 400; transition: transform var(--t-hover) var(--ease-out); }
.card > a:hover .ext { transform: translate(3px, -3px); }
/* typographic cover for a product with no image yet: a ruled plate, word set like the wordmark */
.cover-type {
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 100%;
  padding: var(--s2);
  border: 1px solid var(--ink);
  background:
    linear-gradient(var(--ink), var(--ink)) 0 0 / 100% 1px no-repeat,
    var(--bg);
  font-size: clamp(1.75rem, 1rem + 2.2vw, 2.75rem);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.04em;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.card > a:hover .cover-type { background-color: var(--ink); color: var(--bg); }
@media (min-width: 768px) {
  .layout-list { --lines: var(--lines-list); }
  .grid-list .card > a { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; padding-block: var(--s4); }
  .grid-list .card-media { grid-column: 1; }
  .grid-list .card-body { grid-column: 2 / 5; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--g); }
  .grid-list .card-title { grid-column: 1 / 3; }
  .grid-list .card-body::before { grid-column: 3; }
  .grid-list .card-desc { grid-column: 1 / 3; }
}

/* ---------- 10. Project pages ---------- */
.project-head { padding: clamp(var(--s8), 8vw, var(--s16)) var(--m) clamp(var(--s6), 5vw, var(--s8)); }
.project-title {
  max-width: 14em;
  font-size: var(--fs-h1);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: var(--track-display);
  margin-left: -0.045em;
  text-wrap: balance;
}
.project-layout { padding-inline: var(--m); }
.project-meta { display: grid; grid-template-columns: auto 1fr; gap: var(--s1) var(--s3); padding-top: var(--s2); border-top: 1px solid var(--ink); margin-bottom: var(--s6); }
.project-index span { color: var(--ink); }
.project-date { color: var(--ink); }
.project-desc { grid-column: 1 / -1; margin-top: var(--s2); max-width: 36em; font-size: var(--fs-read); line-height: 1.45; text-wrap: pretty; }
.project-body > .project-desc { margin-top: 0; font-size: var(--fs-lead); line-height: 1.36; letter-spacing: -0.012em; max-width: 34em; }
.project-body { display: flex; flex-direction: column; gap: var(--g); min-width: 0; }
.project-body > .project-desc, .project-body > .m-text { margin-bottom: var(--s4); }
.project-body > .m-text:not(:first-child) { margin-top: var(--s4); }

.m-image { max-width: calc(var(--w, 9999) * 1px); }
.m-image img, .m-gallery img { width: 100%; }          /* fills its figure; the figure is capped at the image's intrinsic width */
figcaption { margin-top: var(--s1); }
.m-gallery { display: flex; flex-wrap: wrap; gap: var(--g); }
.m-gallery figure {
  --row: 270px;   /* low enough that a pair of 1.4:1 drawings still sits side by side at 1280px with a scrollbar */
  flex: var(--ar) 1 calc(var(--ar) * var(--row));
  min-width: 0;
  max-width: min(100%, calc(var(--w, 9999) * 1px), calc(var(--ar) * 64vh));
}
.m-gallery figure:only-child { max-width: min(100%, calc(var(--w, 9999) * 1px)); }
.m-gallery .lb { display: block; overflow: hidden; cursor: zoom-in; }
/* a labelled group inside a project body (e.g. "Detail sketches"): hairline, then a small label, like the other section labels */
.m-label { margin-top: var(--s8); padding-top: var(--s2); border-top: 1px solid var(--rule); font-size: var(--fs-meta); font-weight: 400; color: var(--muted); }
/* hand drawings: line work on white paper, so they sit straight on the page with a larger row height and no hover zoom */
.m-drawings figure { --row: 340px; }
.m-drawings .lb:hover img { transform: none !important; }
.m-gallery .lb img { transition: transform 700ms var(--ease-out); }
.m-gallery .lb:hover img { transform: scale(1.02); }
.m-columns { display: flex; flex-direction: column; gap: var(--g); }
.m-columns .col { min-width: 0; display: flex; flex-direction: column; gap: var(--g); }
@media (min-width: 640px) { .m-columns { flex-direction: row; align-items: flex-start; } }
.m-embed { width: 100%; background: var(--ink); }
.m-embed iframe { display: block; width: 100%; height: 100%; border: 0; }
.m-yt .yt { position: relative; display: block; width: 100%; height: 100%; background: #111; }
.m-yt .yt img { width: 100%; height: 100%; object-fit: cover; }
/* play mark: a white square with an ink triangle, in keeping with the square-cornered system */
.m-yt .yt-play { position: absolute; left: 50%; top: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; background: var(--bg); transition: transform var(--t-hover) var(--ease-out); }
.m-yt .yt-play::after { content: ""; position: absolute; left: 29px; top: 24px; border-left: 20px solid var(--ink); border-top: 12px solid transparent; border-bottom: 12px solid transparent; }
.m-yt .yt:hover .yt-play, .m-yt .yt:focus-visible .yt-play { transform: scale(1.08); }
.m-embed video { display: block; width: 100%; height: 100%; background: #111; object-fit: contain; }
.m-button { margin-top: var(--s3); font-size: var(--fs-read); font-weight: 500; }
.m-button a[target="_blank"]::after { content: " \2197"; font-weight: 400; }

@media (min-width: 1024px) {
  .page-project { --lines: var(--lines-side); }
  .project-layout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--g); align-items: start; }
  /* pinned: number, year and the one-line description hold the first column while the images travel past */
  .project-meta { grid-column: 1; position: sticky; top: calc(var(--header-h) + var(--s4)); display: block; margin-bottom: 0; padding-right: var(--s2); }
  .project-meta > * + * { margin-top: var(--s1); }
  .project-meta .project-desc { margin-top: var(--s3); font-size: var(--fs-body); line-height: 1.5; }
  .project-body { grid-column: 2 / 5; }
}

/* Art: the wall label sits beside the work, and the work is sized to be seen whole in one screen. */
.section-art .m-image img { width: auto; max-height: calc(100vh - var(--header-h) - 40px); max-height: calc(100svh - var(--header-h) - 40px); }
.section-art .project-title { font-size: var(--fs-h2); line-height: 1; letter-spacing: var(--track-head); margin-left: -0.02em; }
.section-art .project-head { padding-block: var(--s6) var(--s3); }
@media (min-width: 1024px) {
  .section-art .project { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: auto auto 1fr; column-gap: var(--g); padding-inline: var(--m); padding-top: var(--s6); }
  .section-art .project-head { grid-column: 1; grid-row: 1; padding: 0 var(--s2) var(--s4) 0; }
  .section-art .project-layout { display: contents; }
  .section-art .project-meta { grid-column: 1; grid-row: 2; position: static; }
  .section-art .project-body { grid-column: 2 / 5; grid-row: 1 / span 3; }
  .section-art .pager { grid-column: 1 / -1; margin-inline: 0; }
}

/* ---------- 11. Pager ---------- */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4) var(--g);
  margin: var(--s16) var(--m) 0;
  padding-top: var(--s3);
  border-top: 1px solid var(--ink);
}
.pager .prev, .pager .next { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--s1); }
.pager .next { grid-column: 2; text-align: right; justify-items: end; }
.pager .prev { grid-column: 1; justify-items: start; }
.pager .back { grid-column: 1 / -1; grid-row: 2; justify-self: start; font-size: 0.9375rem; font-weight: 500; padding-block: var(--s1); background: linear-gradient(currentColor, currentColor) 0 calc(100% - 4px) / 100% 1px no-repeat; transition: background-size var(--t-hover) var(--ease-io); }
.pager a.back:hover { background-size: 0 1px; background-position: 100% calc(100% - 4px); }
.pager-title { font-size: var(--fs-h3); font-weight: 500; line-height: 1.12; letter-spacing: var(--track-head); }
.pager .next::after, .pager .prev::before { grid-row: 3; margin-top: var(--s1); }
.pager a.next:hover::after { transform: translateX(8px); }
.pager a.prev:hover::before { transform: scaleX(-1) translateX(8px); }
.pager span.prev::before, .pager span.next::after { content: none; }
@media (min-width: 768px) {
  .pager { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pager .prev { grid-column: 1 / 3; }
  .pager .next { grid-column: 3 / 5; }
  .pager-title { font-size: var(--fs-h2); line-height: 1.02; }
}
@media (min-width: 1024px) {
  .pager .prev { grid-column: 1 / 2; }
  .pager .back { grid-column: 2 / 3; grid-row: 1; padding-top: 0; align-self: start; }
  .pager .next { grid-column: 3 / 5; }
}

/* ---------- 12. Lightbox ---------- */
.lightbox {
  width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
.lightbox::backdrop { background: var(--bg); }
.lightbox[open] { display: grid; grid-template-rows: var(--header-h) minmax(0, 1fr) auto; animation: lb-in 320ms var(--ease-out) both; }
.lb-bar { display: flex; align-items: center; justify-content: space-between; padding-inline: var(--m); border-bottom: 1px solid var(--rule); font-size: 0.875rem; font-weight: 500; }
.lb-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-count b { color: var(--ink); font-weight: 500; }
.lightbox button { padding: var(--s2) 0; font-size: 0.875rem; font-weight: 500; line-height: 1; }
.lightbox button:hover { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: var(--s3) var(--m); }
.lb-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; transition: opacity 260ms ease; }
.lb-stage img.is-loading { opacity: 0; }
.lb-foot { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s3); padding: 0 var(--m); border-top: 1px solid var(--rule); min-height: var(--header-h); }
.lb-foot figcaption, .lb-caption { margin: 0; text-align: center; font-size: var(--fs-meta); font-weight: 500; color: var(--muted); }
.lightbox [hidden] { display: none; }
.lb-tools { display: flex; gap: var(--s4); }
.lb-stage.can-zoom img { cursor: zoom-in; }
/* full scale: the image at its real pixel size, the stage scrolls and can be dragged */
.lightbox.is-zoomed .lb-stage { display: block; overflow: auto; padding: 0; cursor: grab; overscroll-behavior: contain; touch-action: pan-x pan-y; }
.lightbox.is-zoomed .lb-stage:active { cursor: grabbing; }
.lightbox.is-zoomed .lb-stage img { max-width: none; max-height: none; height: auto; margin: 0 auto; display: block; cursor: zoom-out; user-select: none; -webkit-user-drag: none; }
.lightbox.is-zoomed .lb-foot, .lightbox.is-single .lb-foot { display: none; }
.lightbox.is-zoomed[open], .lightbox.is-single[open] { grid-template-rows: var(--header-h) minmax(0, 1fr); }
.lightbox.is-single:not(.is-zoomed) .lb-stage { padding-block: var(--s2); }
/* single images open the viewer as well */
.m-image .lb { display: block; cursor: zoom-in; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 13. 404 ---------- */
.notfound { padding: clamp(var(--s8), 9vw, var(--s20)) var(--m) 0; }
.notfound .page-title { font-size: var(--fs-h1); line-height: 0.94; margin-top: var(--s2); }
.notfound-link { margin-top: var(--s6); font-size: var(--fs-lead); font-weight: 500; }

/* ---------- 14. Motion (only with html.motion) ---------- */
/* 14a. reveal on scroll: text rises 20px and fades; images are unveiled top to bottom */
html.motion [data-reveal] { opacity: 0; transform: translate3d(0, 20px, 0); transition: opacity var(--t-reveal) var(--ease-out) var(--d, 0ms), transform var(--t-reveal) var(--ease-out) var(--d, 0ms); }
html.motion [data-reveal].in { opacity: 1; transform: none; }
html.motion [data-reveal="wipe"] { opacity: 1; transform: none; }
/* the unveil is a white blind that lifts off the image. The image itself is never clipped or hidden,
   so lazy loading still sees it and it is there for anyone who arrives by a jump. */
html.motion [data-reveal="wipe"] .wt, html.motion [data-reveal="wipe"].wt { position: relative; }
html.motion [data-reveal="wipe"] .wt::after, html.motion [data-reveal="wipe"].wt::after { content: ""; position: absolute; inset: -1px; z-index: 1; background: var(--bg); transform-origin: 50% 100%; transition: transform var(--t-wipe) var(--ease-out) var(--d, 0ms); pointer-events: none; }
html.motion [data-reveal="wipe"].in .wt::after, html.motion [data-reveal="wipe"].in.wt::after { transform: scaleY(0); }
html.motion [data-reveal="wipe"] :is(.card-media, .lb).wt img { transform: scale(1.06); transition: transform 1600ms var(--ease-out) var(--d, 0ms); }
html.motion [data-reveal="wipe"].in .wt img, html.motion .grid-wall [data-reveal="wipe"] .wt img { transform: none; }
html.motion [data-reveal="wipe"] :is(.card-body, figcaption) { opacity: 0; transition: opacity var(--t-reveal) ease calc(var(--d, 0ms) + 200ms); }
html.motion [data-reveal="wipe"].in :is(.card-body, figcaption) { opacity: 1; }
html.motion [data-reveal].done, html.motion [data-reveal].done * { transition-delay: 0ms; }
/* once revealed, hand the transform back to the hover rules */
html.motion [data-reveal="wipe"].done .wt img { transition: transform 700ms var(--ease-out); }
html.motion [data-reveal="wipe"].done .wt::after, html.motion [data-reveal="wipe"].done.wt::after { content: none; }
html.motion .layout-grid .card.done > a:hover .cover, html.motion .grid-list .card.done > a:hover img.cover, html.motion .m-gallery figure.done .lb:hover img { transform: scale(1.02); }
html.motion .grid-wall .card.done > a:hover .cover { transform: translateY(-6px); }

/* 14b. headings: words rise out of their own line */
.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0.08em 0.06em 0.16em; margin: -0.08em -0.06em -0.16em; }
.split .w > span { display: inline-block; transform: translate3d(0, 112%, 0); transition: transform 1100ms var(--ease-out) calc(var(--i) * 80ms + 60ms); will-change: transform; }
.split.in .w > span { transform: none; }

/* 14c. page-to-page: cross-document view transitions (Chromium, Safari 18.2+; others simply navigate) */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .site-header { view-transition-name: site-header; }
  .vt-hero { view-transition-name: hero; }
  ::view-transition-old(root) { animation: vt-out 220ms ease both; }
  ::view-transition-new(root) { animation: vt-in var(--t-page) var(--ease-out) 120ms both; }
  ::view-transition-group(hero) { animation-duration: 560ms; animation-timing-function: var(--ease-io); }
  ::view-transition-old(hero), ::view-transition-new(hero) { height: 100%; object-fit: cover; }
}
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }

/* 14d. smooth scrolling (Lenis) housekeeping */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
}
@media print {
  body::before, .site-header nav, .progress, .pager, .to-top { display: none; }
  .site-header { position: static; }
  html.motion [data-reveal], html.motion [data-reveal] * { opacity: 1 !important; transform: none !important; }
  html.motion .wt::after { content: none !important; }
  .split .w > span { transform: none !important; }
}

/* ---------- 15. Small-screen adjustments ---------- */
@media (max-width: 767px) {
  .m-gallery figure { max-width: min(100%, calc(var(--w, 9999) * 1px)); }
  .project-body > .project-desc { font-size: var(--fs-read); line-height: 1.5; letter-spacing: var(--track-text); }
}

/* ---------- 16. Low-resolution originals (img[data-lowres], flagged by the content loader) ----------
   They are laid out exactly like every other image: at natural size or smaller, on the grid, never stretched.
   The only difference is that they are never enlarged, not even by the 2% hover or the unveil scale. */
html img[data-lowres], html.motion [data-reveal] .wt img[data-lowres], html.motion .done a:hover img[data-lowres], html.motion figure.done .lb:hover img[data-lowres], a:hover img[data-lowres] { transform: none !important; }
