@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Layout and type follow zegzulka.com: one size for everything (14px on a 21px line, a touch
   smaller than the reference's 16/24), 8px edges and gaps, tiles with 10px corners in three columns.
   The menu is fixed and drawn in white with "difference" blending, so it shows black on the white
   page and inverts over photos.
   --inset is how far text sits inside a column, so the menu lines up with the tiles below it.
   --head is the menu's height (12px, one line, 12px): content starts right under it. */
:root {
  --bg: #ffffff;
  --text: #000000;
  --tile: #f4f4f4;
  --fs: 14px;
  --lh: 21px;
  --gap: 8px;
  --inset: 0px; /* text sits flush with the tile edges */
  --radius: 0px; /* square tiles */
  /* Columns: 3 on the web, and 3 is the MAXIMUM at every width, however wide the screen (the tiles just
     get bigger). Tablet and phone (under 1024px) may use 1 or 2: today 2 from 600px, 1 below that. */
  --cols: 3;
  --head: calc(var(--lh) + 24px);
  /* Pills (after abcdinamo.com's shape): fully round and drawn as a 1px stroke, no fill. The shape is the
     box: its edge sits on the column line and the text sits one pad inside. */
  --pill-pad: 8px;
  --pill-gap: 4px;
  --pill-stroke: 1px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* Where scrollbars take space (Windows, or "always show scrollbars" on a Mac), reserve it on every
     page, so Work (which scrolls) and Info (which doesn't) keep the same width and the grid never
     shifts when you move between them. No effect with overlay scrollbars. */
  scrollbar-gutter: stable;
  scroll-padding-top: var(--head);
}

::selection {
  background: var(--text);
  color: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--fs);
  line-height: var(--lh);
  font-weight: 400;
  letter-spacing: 0;
  /* Typographic finish: kerning on, and opening punctuation hung outside the text edge where
     supported, keeping the left edge true. (Fixed-width numerals are only on the footer's year:
     in Inter they also widen hyphens, which spaced out "self-taught".) */
  font-feature-settings: "cv11", "ss01", "kern";
  font-kerning: normal;
  font-synthesis: none; /* never fake a bold or italic the font doesn't have */
  text-rendering: optimizeLegibility;
  hanging-punctuation: first;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1 0 auto;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Keyboard focus: a 2px line (WCAG 2.2), 2px off the text so neighbouring words don't touch. */
a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Touch targets: the menu and footer links are one line of 14px type, too small to hit reliably on
   a phone. An invisible area around each link makes it comfortably tappable without moving or
   resizing anything. (4px sideways so "Work" and "Info", 9px apart, never overlap.) */
.site-header a,
.site-footer a {
  position: relative;
}

.site-header a::after,
.site-footer a::after {
  content: "";
  position: absolute;
  inset: -12px -4px;
}

img,
video {
  display: block;
  max-width: 100%;
}

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

.skip-link {
  position: fixed;
  left: var(--gap);
  top: -100px;
  z-index: 20;
  padding: 4px 8px;
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus {
  top: var(--gap);
}

/* Shared column grid: the menu, the footer and the Info text sit on the same three columns as the
   tiles, so their left edges line up. */
.site-header,
.site-footer,
.info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--gap);
}

.site-header,
.site-footer {
  padding: 12px var(--gap);
}

.site-header nav {
  display: contents;
}

.site-header ul,
.site-footer ul {
  display: flex;
  gap: var(--pill-gap);
  margin: 0;
  padding: 0 var(--inset);
  list-style: none;
}

/* Menu: fixed to the top, white with difference blending (black on white, inverted over images). */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  color: #ffffff;
  mix-blend-mode: difference;
  pointer-events: none;
}

.site-header a {
  pointer-events: auto;
}

.site-name,
.site-header .nav-main,
.site-footer > * {
  padding: 0 var(--inset);
}

.site-name {
  justify-self: start;
}

/* Swiss grid: every item starts on a column line. "Work Info" starts the second column, over the
   second column of tiles. */
.site-header .nav-main {
  justify-self: start;
}

/* ---------- Pills ---------- */

/* Every piece of text in the menu and the footer sits in a pill drawn as a stroke in the text's own
   color (no fill). Pills are for the menu and footer only: captions and project text are plain. The outline never changes size (Chi: don't enlarge the
   pills). Height = the line, so nothing moves vertically. The page you're on in the menu is grayed, stroke and text. */
.site-name,
.site-header .nav-main a,
.site-footer a,
.footer-copy {
  position: relative;
  display: block;
  isolation: isolate;
  width: fit-content;
  padding: 0 var(--pill-pad);
  border-radius: 999px;
  white-space: nowrap;
}

.site-name::before,
.site-header .nav-main a::before,
.site-footer a::before,
.footer-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: var(--pill-stroke) solid currentColor;
  border-radius: inherit;
  transition: transform 0.3s cubic-bezier(0.55, 0.08, 0, 1), border-color 0.2s ease;
}

/* Hover on the menu and footer links (after abcdinamo.com): the text slides out of the pill sideways while
   a copy of it slides in from the other side; the outline stays put. The pill's own padding
   moves to the text's window (.roll), so the text is clipped at the pill's edge. */
.site-name,
.site-header .nav-main a,
.site-footer a {
  padding: 0;
}

.roll {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 0 var(--pill-pad);
  /* Clip the sliding text to the inside of the outline, round ends included: a plain rectangle let the
     moving letters show past the curved ends and over the stroke. */
  border-radius: 999px;
  clip-path: inset(var(--pill-stroke) calc(var(--pill-stroke) + 2px) round 999px); /* letters fade out 2px before the stroke */
}

.roll > span {
  display: block;
}

.roll::after {
  content: attr(data-title);
  content: attr(data-title) / ""; /* the copy is decoration: screen readers skip it */
  position: absolute;
  inset: 0;
  padding: 0 var(--pill-pad);
  transform: translateX(calc(-100% - var(--pill-pad)));
}

@media (hover: hover) {
  .roll > span,
  .roll::after {
    transition: transform 0.45s cubic-bezier(0.55, 0.08, 0, 1);
  }

  a:hover > .roll > span,
  a:focus-visible > .roll > span {
    transform: translateX(calc(100% + var(--pill-pad)));
  }

  a:hover > .roll::after,
  a:focus-visible > .roll::after {
    transform: none;
  }
}

.site-header a[aria-current] {
  color: #8c8c8c; /* mid gray stays gray under the blend: #737373 on white */
}

/* Footer: at the bottom of every page, plain black. */
.site-footer {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  /* Space above the footer: eight lines of type, so it sits on the same rhythm as the text. */
  margin-top: calc(var(--lh) * 8);
}

/* © starts the second column, under "Work", on every screen size. */
.site-footer .footer-copy {
  grid-column: 2;
  font-variant-numeric: tabular-nums;
}

/* ---------- Info ---------- */

/* The layout from before the redesign: the bio in the second column, under "Work Info" in the menu,
   a line below the menu; the magnolia (home-art.js) turning behind everything in light gray and
   hanging from the bio's last line. One screen, with the footer at the bottom. */
.page-info .site-footer {
  margin-top: 0;
}

.info {
  position: relative;
  z-index: 2;
  align-items: start;
  padding: calc(var(--head) + var(--lh)) var(--gap) 0;
}

.info-text {
  grid-column: 2;
  max-width: 40em;
  padding: 0 var(--inset);
  /* Avoids a single word alone on a paragraph's last line. Only the breaks change, never the word
     spacing, so the spacing stays the same at every window size. */
  text-wrap: pretty;
}

.info-text p + p {
  margin-top: var(--lh);
}

/* The magnolia drawn in text characters, light gray, fixed behind the page, centred and free to be
   wider than the window (the edges are clipped). home-art.js sizes it and hangs it from the bio. */
.home-art {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.home-art pre {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.12;
  letter-spacing: 0;
  white-space: pre;
  /* A drawing in characters: no ligatures, no kerning, so every character keeps its cell. */
  font-variant-ligatures: none;
  font-kerning: none;
  color: #d4d4d7;
}

/* ---------- Work: the tiles ---------- */

/* Tiles stack into --cols columns, each going into the shortest column so the grid stays even
   (main.js). Without script they fall back to CSS columns. */
.tiles {
  padding: var(--head) var(--gap) 0;
  columns: var(--cols);
  column-gap: var(--gap);
}

.tiles.is-masonry {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
  columns: auto;
}

.tiles-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* An item is a tile with its name under it. */
.item {
  display: flex;
  flex-direction: column;
  margin: 0 0 var(--gap);
  break-inside: avoid;
}

.tiles.is-masonry .item {
  margin-bottom: 0;
}

.tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--tile);
  aspect-ratio: var(--ratio, 4 / 3);
  /* Keeps the corners round in Safari while an image or video inside is scaled. */
  isolation: isolate;
}

/* The project's name and year: smaller than the page type (12px on an 18px line, the same 1.5
   ratio). The name is flush with the tile's left edge, the year with its right edge, both close
   under the tile, with room before the next one. The year is the site's one gray (#737373 is what
   the menu's gray shows as on white; 4.7:1 contrast). */
.caption {
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  margin: 6px 0 var(--gap);
  font-size: 12px;
  line-height: 18px;
}

.caption time {
  flex-shrink: 0;
  color: #737373; /* the year is the quiet one (4.7:1 on white) */
  font-variant-numeric: tabular-nums;
}

.tile img,
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* An image fades in once it has loaded, over the tile's gray, rather than popping in (main.js). */
.js .tile img,
.js .project-images img {
  opacity: 0;
  transition: opacity 0.5s var(--ease-out);
}

.js .tile img.is-loaded,
.js .project-images img.is-loaded {
  opacity: 1;
}

/* Reveal: each item fades up once as it comes into view. */
.js .item {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s var(--ease-out) var(--delay, 0ms), transform 0.7s var(--ease-out) var(--delay, 0ms);
}

.js .item.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  [class]::before {
    transition: none !important;
  }

  .js .item,
  .js .tile img,
  .js .project-images img {
    transition: none;
  }

  .js .item {
    opacity: 1;
    transform: none;
  }
}

/* Every tile pushes in a touch on hover (97%, exactly what zegzulka.com does: its tile measures 0.97 on
   hover) and eases back when the pointer leaves; on a touch screen linked tiles push while pressed.
   No dimming. Only a tile with its own page is a link (pointer cursor). */
.tile {
  transition: scale 0.35s var(--ease-out);
}

a.tile {
  cursor: pointer;
}

@media (hover: hover) {
  .tile:hover {
    scale: 0.97;
  }
}

a.tile:active {
  scale: 0.97;
}

@media (prefers-reduced-motion: reduce) {
  .tile {
    transition: none;
  }
}

/* ---------- Project page ---------- */

/* A project page (after edouardvandycke.com): the menu, the words and the footer stay put; only the
   pictures move, in one row that runs sideways. The words sit at the top on the same three columns as
   the menu (name, description, details), and the pictures sit lower, centred in the space between the
   words and the footer. The page is one screen tall, so the pictures take whatever height is left. */
.page-project {
  height: 100vh;
  height: 100dvh;
  min-height: 640px;
}

.page-project .site-footer {
  margin-top: 0;
}

.page-project main {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--head) + var(--lh)); /* one line below the menu, like the Info text */
}

.project {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.project-text {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: var(--lh);
  align-items: start;
  padding: 0 var(--gap);
  text-wrap: pretty;
}

.project-head {
  grid-column: 1;
}

/* Two levels of text: the name and the description in black, the line under the name and the details in
   the site's one gray. The description keeps a comfortable measure (about 60 characters) however wide
   the column gets, flush left on the column line. */
.project-about {
  grid-column: 2;
  max-width: 36em;
  hyphens: none;
}

.project-facts {
  grid-column: 3;
  color: #737373;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-text h1 {
  margin: 0;
  font-size: inherit;
  font-weight: 400;
}

.project-text .project-meta {
  color: #737373;
  font-variant-numeric: tabular-nums;
}

/* The row of pictures: all the same height (as tall as the space allows, never wider than one screen
   at a time on a phone), each at its own width. It scrolls on its own; the page does not. */
.project-images {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: calc(var(--lh) * 3) var(--gap);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  cursor: grab;
}

.project-images::-webkit-scrollbar {
  display: none;
}

.project-images.is-dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

.project-images:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

.project-images img {
  flex: none;
  max-width: none;
  height: min(100%, 61vw);
  width: auto;
  background: var(--tile);
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Smaller screens ---------- */

@media (max-width: 1023px) {
  :root {
    --cols: 2;
  }

  /* Phone and tablet: the menu, footer and bio use the same two columns as the tiles. Name in the
     left half; Work and Info start the right half. */
  .site-header,
  .site-footer,
  .info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-name {
    grid-area: 1 / 1;
  }

  /* Project page, two columns: the name in the first, the description in the second with the details
     under it. */
  .project-text {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-facts {
    grid-column: 2;
  }

  .project-images {
    padding-block: calc(var(--lh) * 1.5);
  }

  .site-header .nav-main {
    grid-area: 1 / 2;
  }

  /* The bio starts at the left edge, under the name (as on the old site), and runs across both
     columns up to 40em. */
  .info-text {
    grid-column: 1 / -1;
  }

  /* The flower moves with the page: on a portrait screen home-art.js grows its stem down to the
     footer, so the page is one full screen. */
  .page-info {
    position: relative;
  }

  .home-art {
    position: absolute;
  }
}

@media (max-width: 599px) {
  :root {
    --cols: 1;
  }

  /* Phone: the bio runs the full width. */
  .info-text {
    grid-column: 1 / -1;
  }

  /* Project page on a phone: everything in one column. */
  .project-text {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-about,
  .project-facts {
    grid-column: 1;
  }

  /* Phone: the description and details a size down (12px on an 18px line, the caption size), so the
     words take less of the screen; the name and the line under it stay at the page size. */
  .project-about,
  .project-facts {
    font-size: 12px;
    line-height: 18px;
  }

  /* Phone: the pictures sit two lines under the details instead of centred in the leftover space,
     which left them floating low on a tall screen. */
  .project-images {
    align-items: flex-start;
    padding-top: calc(var(--lh) * 2);
  }

  .site-header ul,
  .site-footer ul {
    gap: var(--pill-gap);
  }

  .site-footer .footer-copy {
    white-space: nowrap;
  }
}
