/* 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;
}

*, *::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: calc(-0.6 * var(--u));
  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: calc(-0.3 * var(--u));
  font-weight: 500;
}
.about__text, .project__text, .contacts__links {
  font-size: calc(13 * var(--u));
  line-height: calc(15 * var(--u));
  letter-spacing: calc(-0.2 * var(--u));
  font-weight: 500;
}
.about__text { width: calc(531 * var(--u)); text-align: center; }

/* ---------- 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: #272727;
}
.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;
}
.cell img, .cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cell[data-full] { cursor: zoom-in; }
.cell img { transition: opacity .5s; }
.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));
  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__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(339 * var(--u));
  height: calc(187 * var(--u));
  margin: calc(30 * var(--u)) auto 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: calc(51 * var(--u));
  letter-spacing: calc(-3 * var(--u));
  transition: transform .45s cubic-bezier(.45, 0, .2, 1);
}
.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.3px; }
  .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.2px; }
  .about__text { width: auto; text-align: left; }
  .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; 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; }
  .cv { width: 100%; height: 120px; margin-top: 24px; font-size: 34px; letter-spacing: -1.6px; }
}

/* ---------- 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; }
}
