/* Layout is drawn on a 1024-wide canvas (the original Readymag grid) and scales
   with the window, just like Readymag did. 1u = 1px of that canvas.            */

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

:root {
  --ink: #000;
  --muted: #a2a2a2;
  --line: #ededed;
  --paper: #fff;
  --placeholder: #f3f3f3;
  --title: #272727;
  --swap: .5s cubic-bezier(.4, 0, .2, 1); /* speed of the colour inversion */
}

/* Hovering either black button inverts the site: the page turns black, the button white.
   Only colours swap — pictures and videos stay as they are. Mouse only (no hover on touch). */
@media (hover: hover) and (pointer: fine) {
  :root:has(.cv:hover) {
    --ink: #fff;
    --paper: #000;
    --line: #2b2b2b;
    --muted: #6e6e6e;
    --placeholder: #141414;
    --title: #e2e2e2;
  }
  body, .project__title, .contacts__headline, .contacts__headline .ink {
    transition: background-color var(--swap), color var(--swap);
  }
  /* the menu inherits its text colour from body, which is already animating:
     a second colour transition here would run on top of it and lag behind */
  .nav { transition: background-color var(--swap), border-color var(--swap); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.smooth { scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  container-type: inline-size;
  overflow-x: hidden;
}
::selection { background: var(--muted); }
p, h2, ul, figure { margin: 0; }
a { color: inherit; }
img, video { display: block; }

/* the scale: desktop = canvas of 1024u, capped like Readymag at 3600px */
main, .nav { --u: calc(min(100cqw, 3600px) / 1024); }

/* ---------- navigation pill (fixed) ---------- */
.nav {
  position: fixed;
  z-index: 50;
  top: calc(11 * var(--u));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: calc(16 * var(--u));
  align-items: center;
  padding: 0 calc(20 * var(--u));
  height: calc(30 * var(--u));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: calc(11 * var(--u));
  letter-spacing: -0.03em; /* same tracking as the name and body text */
  line-height: 1;
  font-weight: 560;
}
.nav a {
  text-decoration: none;
  transition: opacity .2s;
}
.nav a:hover { opacity: .75; }

/* ---------- about (first screen) ---------- */
.about {
  position: relative;
  display: grid;
  place-items: center;
  min-height: max(100svh, calc(556 * var(--u)));
  padding: calc(60 * var(--u)) 0;
}
.about__top {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(8 * var(--u)) calc(30 * var(--u)) 0 calc(24 * var(--u));
}
.avatars { display: flex; }
.avatars img {
  width: calc(34 * var(--u));
  height: calc(34 * var(--u));
  border-radius: 50%;
  object-fit: cover;
}
.avatars img + img { margin-left: calc(-10 * var(--u)); }
.about__name {
  margin-top: calc(10 * var(--u));
  font-size: calc(13 * var(--u));
  line-height: calc(15 * var(--u));
  letter-spacing: -0.03em;
  font-weight: 500;
}
.about__text, .project__text, .contacts__links {
  font-size: calc(13 * var(--u));
  line-height: calc(15 * var(--u));
  letter-spacing: -0.03em;
  font-weight: 500;
}
.about__text { width: calc(531 * var(--u)); text-align: center; }
.about .about__text { line-height: calc(16.75 * var(--u)); } /* 1.29, as in the layout */

/* ---------- about: interactive words ----------
   Enter = springy overshoot, exit = short and plain (no bounce on the way out).
   Every effect works on hover (mouse), tap (touch) and focus + Enter (keyboard). */
.about {
  --spring: cubic-bezier(.34, 1.5, .64, 1);
  --out: cubic-bezier(.4, 0, 1, 1);
  align-content: center;
  row-gap: calc(22.5 * var(--u));
  /* centred in the space under the nav pill (it ends at 41u), not in the whole window */
  padding-top: calc(101 * var(--u));
}
.about__text { position: relative; isolation: isolate; }
.fx {
  position: relative;
  cursor: pointer;
  border-radius: calc(4 * var(--u));
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}
.fx:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Knock-knock: letters are split by main.js and wave one after another */
.fx--knock .l { display: inline-block; transform-origin: 50% 85%; white-space: pre; }

/* tap: a grey circle (.dot, added by main.js) grows behind the word and stays after a tap.
   It sits at z-index -1 of .about__text, so it never covers the neighbouring words. */
.fx--tap .t { display: inline-block; }
.fx--tap .dot {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: calc(36 * var(--u));
  height: calc(36 * var(--u));
  margin: calc(-18 * var(--u)) 0 0 calc(-18 * var(--u));
  border-radius: 50%;
  background: var(--line);
  pointer-events: none;
  transform: scale(0);
  transition: transform .22s var(--out);
}
.fx--tap.is-on .dot { transform: scale(1); transition: transform .5s var(--spring); }
@media (hover: hover) and (pointer: fine) {
  .fx--tap:hover .dot { transform: scale(1); transition: transform .5s var(--spring); }
}

/* bunny meme + WOOOW bubble: positioned by main.js next to the word */
.about__pops { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.pop {
  position: absolute;
  left: 0;
  top: 0;
  height: auto;
  opacity: 0;
  visibility: hidden;
  transform: rotate(var(--r0)) scale(.35);
  transition: transform .2s var(--out), opacity .16s linear, visibility 0s .2s;
  will-change: transform;
}
.pop.is-on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: transform .55s var(--spring), opacity .12s linear, visibility 0s;
}
.pop--bunny { width: calc(52 * var(--u)); transform-origin: 50% 100%; --r0: 14deg; }
.pop--wow, .pop--kitty { width: calc(60 * var(--u)); transform-origin: 8% 92%; --r0: -18deg; } /* grows out of its tail */
.pop--gplay { width: calc(60 * var(--u)); transform-origin: 80% 92%; --r0: 18deg; }        /* tail on the right */

/* "Ok, ok, go to projects": the same pill as Get CV */
.cv.go { margin: 0; }
.cv:active { transform: scale(.96); transition-duration: .15s; }
.cv:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

/* ---------- project ---------- */
.project { padding: calc(51 * var(--u)) 0 calc(120 * var(--u)); }
.project__title {
  /* right edge stops where the pictures end (x = 836 of 1024) */
  width: calc(812 * var(--u));
  margin: 0 calc(24 * var(--u));
  font-size: calc(45 * var(--u));
  line-height: calc(45 * var(--u));
  letter-spacing: calc(-2 * var(--u));
  font-weight: 500;
  color: var(--title);
}
.project__lead { display: block; padding-left: calc(164 * var(--u)); }

.project__text {
  width: calc(531 * var(--u));
  margin: calc(12 * var(--u)) 0 0 calc(188 * var(--u)); /* left edge of the pictures */
}
.project__text > * + * { margin-top: calc(15 * var(--u)); }
.project__text ul { list-style: none; padding: 0; }
.project__text li::before { content: '•\00a0'; }

/* underline used by the big links (Eda, Simple, Tumblr…) */
.project__title a, .contacts__headline a {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 99% / 100% calc(3 * var(--u)) no-repeat;
  transition: background-size .25s;
}
.project__title a:hover, .contacts__headline a:hover { background-size: 0 calc(3 * var(--u)); background-position: 100% 99%; }

/* ---------- bento / pinterest grid ----------
   A row puts its cells side by side at one common height: every cell grows
   proportionally to its aspect ratio (--r), so 320x322 + 320x322 = two halves,
   238x271 + 402x271 = narrow + wide, etc. A .stack is a column of cells
   inside a row (pinterest-style), sized by its own --r.                       */
.grid {
  --gx: calc(8 * var(--u));
  --gy: calc(10 * var(--u));
  --radius: calc(10 * var(--u));
  width: calc(648 * var(--u));
  margin: calc(38 * var(--u)) auto 0;
  display: flex;
  flex-direction: column;
  gap: var(--gy);
}
.row { display: flex; gap: var(--gx); }
.row > * { flex: var(--r) 1 0; min-width: 0; aspect-ratio: var(--r); }
.stack { display: flex; flex-direction: column; gap: var(--gy); }
.stack > .cell { flex: var(--h) 1 0; min-height: 0; aspect-ratio: auto; }

.cell {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--placeholder);
  isolation: isolate;
}
/* tiny preview (inlined by the build as --lqip), blurred, shown until the picture/poster arrives */
.cell::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--lqip, none) center / cover no-repeat;
  filter: blur(calc(28 * var(--u))) saturate(1.1);
  transform: scale(1.2); /* hides the soft transparent edge the blur leaves */
}
.cell img, .cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
  transform: scale(var(--zoom, 1));
  transform-origin: var(--focus, 50% 50%);
}
.cell[data-full] { cursor: default; -webkit-tap-highlight-color: transparent; }
.cell img { transition: opacity .25s; }
.cell img:not(.is-loaded) { opacity: 0; }
.cell__missing {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- contacts ---------- */
.contacts {
  position: relative;
  min-height: calc(890 * var(--u));
  padding: calc(72 * var(--u)) 0 calc(150 * var(--u));
}
.contacts__headline {
  margin: 0 calc(24 * var(--u));
  padding-right: calc(36 * var(--u));
  text-indent: calc(164 * var(--u)); /* first line starts at the pictures' left edge, like project titles */
  font-size: calc(51 * var(--u));
  line-height: calc(60 * var(--u));
  letter-spacing: calc(-3 * var(--u));
  font-weight: 550;
  color: var(--muted);
}
.contacts__headline .ink { color: var(--ink); }
.contacts__video {
  display: inline-block;
  width: calc(74 * var(--u));
  height: calc(60 * var(--u));
  border-radius: calc(30 * var(--u));
  object-fit: cover;
  vertical-align: top;
}
.contacts__links {
  width: calc(531 * var(--u));
  margin: calc(112 * var(--u)) auto 0;
  text-align: center;
}
.contacts--short { min-height: 0; padding-top: 0; padding-bottom: calc(110 * var(--u)); }
.contacts--short .contacts__links { margin-top: 0; }
.contacts__links a {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% calc(1 * var(--u)) no-repeat;
}
.contacts__links a:hover { background-size: 0 calc(1 * var(--u)); }

.cv {
  display: grid;
  place-items: center;
  width: calc(240 * var(--u));
  height: calc(133 * var(--u));
  margin: calc(30 * var(--u)) auto 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: calc(16 * var(--u));
  letter-spacing: -0.03em;
  font-weight: 500;
  transition: transform .45s cubic-bezier(.45, 0, .2, 1), background-color var(--swap), color var(--swap);
}
.cv:hover { transform: scale(1.1); }

/* ---------- phones: same grid, full width, readable text ---------- */
@container (max-width: 700px) {
  main, .nav { --u: calc((100cqw - 32px) / 648); }
  .nav { top: 12px; width: auto; height: 34px; padding: 0 18px; gap: 26px; font-size: 13px; letter-spacing: -0.03em; }
  .about { min-height: 100svh; padding: 80px 16px; }
  .about__top { padding: 14px 16px 0; }
  .about__top .about__name { display: none; }
  .avatars img { width: 34px; height: 34px; }
  .avatars img + img { margin-left: -10px; }
  .about__text, .project__text, .contacts__links { font-size: 15px; line-height: 1.35; letter-spacing: -0.03em; }
  .about__text { width: auto; text-align: left; }
  .about__text br { display: none; }              /* desktop line breaks… */
  .about__text p > br:first-of-type { display: inline; } /* …except after Knock-knock! */
  .about { row-gap: 28px; }
  .about .about__text { line-height: 1.35; }
  .fx--tap .dot { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .pop--bunny { width: 72px; }
  .pop--wow, .pop--kitty, .pop--gplay { width: 84px; }
  .cv.go { margin: 0; }
  .project { padding: 56px 16px 72px; }
  .project__title { width: auto; margin: 0; font-size: 32px; line-height: 1; letter-spacing: -1.4px; }
  .project__lead { padding-left: 0; }
  .project__title a, .contacts__headline a { background-size: 100% 2px; }
  .project__text { width: auto; margin: 16px 0 0; }
  .project__text > * + * { margin-top: 1.35em; }
  .grid { width: 100%; margin-top: 24px; --gx: 6px; --gy: 6px; --radius: 8px; }
  .contacts { min-height: 0; padding: 56px 16px 64px; }
  .contacts__headline { margin: 0; padding: 0; text-indent: 0; font-size: 34px; line-height: 1.1; letter-spacing: -1.6px; }
  .contacts__video { width: 46px; height: 37px; border-radius: 19px; }
  .contacts__links { width: auto; margin-top: 40px; }
  .contacts--short { padding-top: 8px; }
  .contacts--short .contacts__links { margin-top: 0; }
  .cv { width: 100%; height: 96px; margin-top: 24px; font-size: 20px; letter-spacing: -0.03em; }
}

/* ---------- /play: pictures in the air ----------
   Default (phones, no JS): two loose columns with lots of air.
   .is-canvas (mouse + wide window, set by main.js): a canvas you drag around, pictures
   placed on a loose grid with stable jitter (--j1…--j4 come from the build).            */
.play { --u: calc(min(100cqw, 3600px) / 1024); padding: 96px 16px 80px; }
.play .about__top a { text-decoration: none; }
.play__intro {
  margin: 0 auto 56px;
  max-width: 340px;
  text-align: center;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: -0.03em;
  font-weight: 500;
}
.play__canvas { columns: 2; column-gap: 16px; }
.play__hint { display: none; }
.is-canvas .play__hint { display: block; margin-top: calc(3 * var(--u)); color: var(--muted); }
.play__intro { column-span: all; }
.play__item {
  position: relative;
  break-inside: avoid;
  width: calc(62% + var(--j1) * 38%);
  margin: 0 0 calc(28px + var(--j2) * 44px) calc((100% - (62% + var(--j1) * 38%)) * var(--j3));
  aspect-ratio: var(--r);
  border-radius: 6px;
  overflow: hidden;
  background: var(--placeholder) var(--lqip, none) center / cover no-repeat;
}
.play__item img, .play__item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .4s ease;
}
.play__item .is-loaded { opacity: 1; }

/* canvas mode */
html.is-canvas, html.is-canvas body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.is-canvas .play { position: fixed; inset: 0; padding: 0; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.is-canvas .play.is-dragging { cursor: grabbing; }
.is-canvas .play .about__top { z-index: 20; pointer-events: none; }
.is-canvas .play .about__top > * { pointer-events: auto; }
.is-canvas .play__canvas { columns: auto; position: absolute; inset: 0; }
/* no will-change on the canvas or cards: it would freeze them at 1x and blur the zoom */
.is-canvas .play.is-dragging, .is-canvas .play.is-dragging .play__item { cursor: grabbing; }

.is-canvas .play__intro {
  position: absolute;
  z-index: 5;
  left: 0;
  top: 0;
  margin: 0;
  pointer-events: none;
  width: calc(240 * var(--u));
  transform: translate(-50%, -50%); /* position comes from main.js via `translate` */
  max-width: none;
  font-size: calc(13 * var(--u));
  line-height: calc(16.75 * var(--u));
}
.is-canvas .play__item {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  border-radius: calc(6 * var(--u) * var(--z, 1)); /* grows with the zoom */
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--paper);
  opacity: 0;
  transition: opacity .3s ease;
  touch-action: none;
}
.lightbox.is-open { opacity: 1; }
.lightbox[hidden] { display: none; }
.lightbox__stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 64px);
  cursor: zoom-out;
}
.lightbox__stage > * {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  transform-origin: 0 0;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .8);
  color: var(--ink);
  cursor: pointer;
  transition: background .2s;
}
.lightbox__btn:hover { background: #f2f2f2; }
.lightbox__btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.lightbox__btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.lightbox__close { top: 12px; right: 12px; }
.lightbox__prev, .lightbox__next { top: 50%; margin-top: -22px; }
.lightbox__prev { left: 12px; }
.lightbox__next { right: 12px; }
.lightbox__count {
  position: absolute;
  left: 0; right: 0; bottom: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.lightbox.is-single .lightbox__prev, .lightbox.is-single .lightbox__next, .lightbox.is-single .lightbox__count { display: none; }
@media (hover: none) { .lightbox__prev, .lightbox__next { display: none; } }
html.is-locked { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .cv, .lightbox, .cell img { transition: none; }
  .pop, .pop.is-on, .fx--tap .dot { transform: none !important; transition: opacity .15s linear, visibility 0s !important; }
  .fx--tap .dot { opacity: 0; }
  .fx--tap.is-on .dot, .fx--tap:hover .dot { opacity: 1; }
}
