/* the typeface is served from the site itself (fonts/inter-400.woff2), not from Google */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/inter-400.woff2) format('woff2');
}

:root {
  --fg: #141414;
  --mute: #8f8f8f;
  --line: #e6e6e6;
  --bg: #fff;
  --pad: clamp(18px, 2.8vw, 44px);
  --gap: clamp(10px, 1.4vw, 20px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 400 12px/1.65 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  letter-spacing: 0.012em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  animation: page-in 0.25s ease both;
}

@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

a { color: inherit; text-decoration: none; }
img, video, iframe { display: block; width: 100%; border: 0; }

.caps {
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.mute { color: var(--mute); }
.lc { text-transform: none; letter-spacing: 0.05em; font-size: 1.1em; }

/* ---------- header / footer ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 22px var(--pad) 18px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}
.site-header nav { display: flex; gap: clamp(18px, 2.4vw, 34px); }
.site-header nav a { color: var(--mute); transition: color 0.25s; }
.site-header nav a:hover,
.site-header nav a.current { color: var(--fg); }

main { flex: 1; padding: clamp(28px, 5vw, 72px) var(--pad) 0; }

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: clamp(60px, 9vw, 130px) var(--pad) 24px;
  color: var(--mute);
}

/* ---------- home ---------- */

/* Rows of covers, all the same height, always filling the full width. */
body[data-page='home'] main { padding-top: clamp(14px, 2vw, 28px); }
.home-grid {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 3.4vw, 52px);
}
.jrow {
  display: flex;
  gap: var(--gap);
  /* height of a 4:3 cover in an even row of --cols */
  --h: calc((100cqw - (var(--cols, 3) - 1) * var(--gap)) / var(--cols, 3) * 0.75);
}
.jrow .card { flex: 1 1 0; }
.card .frame { height: var(--h); }
.card .frame { position: relative; }
.card .frame img { position: absolute; inset: 0; width: 100%; height: 100% !important; aspect-ratio: auto !important; object-fit: cover; }
.jrow .card.whole { flex: 0 0 auto; width: calc(var(--h) * var(--ar)); }
.card { display: block; min-width: 0; transition: opacity 0.45s ease; }
.card .frame { overflow: hidden; background: #f4f4f4; }
.card img { transition: transform 1.2s cubic-bezier(0.2, 0.6, 0.2, 1), opacity 0.3s ease; }
.card:hover img { transform: scale(1.025); }
.card .label {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  height: 18px;
  white-space: nowrap;
  overflow: hidden;
}
.card .label span:last-child { overflow: hidden; text-overflow: ellipsis; }
.card .label .num { color: var(--mute); font-variant-numeric: tabular-nums; }

/* ---------- work page ---------- */

.work { display: flex; flex-direction: column; gap: clamp(56px, 8vw, 120px); }
.sec {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gap);
  align-items: start;
}
.work-info {
  grid-column: 1 / 5;
  position: sticky;
  top: 86px;
  max-width: 340px;
}
.work-info h1 { font-weight: 400; margin-bottom: 4px; }
.work-info .subtitle { margin-bottom: 0; }
.work-info .body { margin-top: 26px; }
.work-info .body.first { margin-top: 0; }
.work-info p { margin-bottom: 1.25em; white-space: pre-line; }
.work-info h2 { font-weight: 400; }
.work-info h2 + .body { margin-top: 12px; }
.work-info .quote { color: var(--mute); margin-top: 26px; }
.caption { color: var(--mute); max-width: 60ch; margin: -4px 0 clamp(14px, 2vw, 28px); }
.work-media { grid-column: 6 / 13; display: flex; flex-direction: column; gap: var(--gap); }

.sec.wide .work-info { grid-column: 1 / 4; max-width: 270px; }
.sec.wide .work-media { grid-column: 4 / 13; }

.row { display: flex; gap: var(--gap); align-items: flex-start; }
.row figure { flex: 1 1 0; min-width: 0; cursor: zoom-in; overflow: hidden; }
.row figure { position: relative; }
.row .cell { flex: 1 1 0; min-width: 0; }
.row .cell .ref-num { display: block; margin-top: 6px; color: var(--mute); font-size: 10.5px; transition: color 0.25s; }
.row .cell figure { outline: 1px solid transparent; outline-offset: 3px; transition: outline-color 0.25s; }
.row .cell.on figure { outline-color: var(--fg); }
.row .cell.on .ref-num { color: var(--fg); }
/* numbered area on an image that points to another image on the page */
.mark { position: absolute; outline: 1px solid transparent; outline-offset: 2px; cursor: pointer; transition: outline-color 0.25s; }
.mark span {
  position: absolute; left: 0; top: calc(100% + 5px);
  font-size: 9.5px; line-height: 1; color: var(--fg); opacity: 0.55; transition: opacity 0.25s;
}
.mark.on { outline-color: var(--fg); }
.mark.on span { opacity: 1; }
.row.even figure img { position: absolute; inset: 0; width: 100%; height: 100% !important; aspect-ratio: auto !important; object-fit: cover; }
.embed { position: relative; background: #000; }
.embed iframe, .embed video { position: absolute; inset: 0; height: 100%; }
/* video poster: the Vimeo player is only loaded when the visitor presses play */
.embed .poster { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: #000 center / cover no-repeat; cursor: pointer; }
.embed .poster::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform: translate(-35%, -50%);
  border-style: solid; border-width: 13px 0 13px 22px; border-color: transparent transparent transparent #fff;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.45)); opacity: 0.92; transition: opacity 0.25s, transform 0.25s;
}
.embed .poster:hover::after { opacity: 1; transform: translate(-35%, -50%) scale(1.12); }
img.lazy { opacity: 0; transition: opacity 0.3s ease; }
img.lazy.loaded { opacity: 1; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: clamp(60px, 9vw, 130px);
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.pager a { color: var(--mute); transition: color 0.25s; max-width: 46%; }
.pager a:hover { color: var(--fg); }
.pager a:last-child { text-align: right; margin-left: auto; }

/* ---------- about / contact ---------- */

.text-page {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gap);
}
.text-page h1 { grid-column: 1 / 5; font-weight: 400; margin-bottom: 20px; }
.text-page .col { grid-column: 5 / 10; max-width: 560px; }
.text-page p { margin-bottom: 1.25em; }
.text-page h2 { font-weight: 400; margin: 34px 0 12px; }
.text-page .pre { white-space: pre-line; }
.text-page .meta { margin-top: 34px; color: var(--mute); }
.text-page .meta a { color: var(--fg); border-bottom: 1px solid var(--line); transition: border-color 0.25s; }
.text-page .meta a:hover { border-color: var(--fg); }

.contact-form { display: grid; gap: 18px; max-width: 380px; }
.contact-form label { display: grid; gap: 4px; color: var(--mute); }
.contact-form input,
.contact-form textarea {
  font: inherit;
  letter-spacing: inherit;
  color: var(--fg);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 6px 0;
  outline: none;
  resize: vertical;
  transition: border-color 0.25s;
}
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--fg); }
.contact-form button {
  justify-self: start;
  font: inherit;
  color: var(--fg);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--fg);
  padding: 2px 0;
  cursor: pointer;
}

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 56px var(--pad);
  cursor: zoom-out;
}
.lightbox.open { display: flex; animation: page-in 0.3s ease both; }
.lightbox img { width: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .bar {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  top: 22px;
  display: flex;
  justify-content: space-between;
  color: var(--mute);
}
.lightbox button {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--mute);
  background: none;
  border: 0;
  cursor: pointer;
}
.lightbox button:hover { color: var(--fg); }
.lightbox .nav { display: flex; gap: 22px; }

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  body { font-size: 13px; }
  .home-grid { gap: 26px; }
  /* phones: two works per row, each shown whole (no crop), every row flush on both edges */
  .jrow .card, .jrow .card.whole { flex: var(--ar, 1.4) 1 0; width: auto; }
  .card .frame { height: auto; aspect-ratio: var(--ar, 1.4); }
  .card .frame img, .card.whole .frame img { width: 100%; max-width: none; }
  .sec, .text-page { display: block; }
  /* phones, photography series: title first, then the images, then the text */
  .sec.wide { display: flex; flex-direction: column; align-items: stretch; }
  .sec.wide .work-media { margin-bottom: 30px; }
  .sec.wide .work-info { display: contents; }
  .sec.wide .work-info h1 { order: 0; }
  .sec.wide .work-info .subtitle { order: 1; margin-bottom: 22px; }
  .sec.wide .work-media { order: 2; }
  .sec.wide .work-info .body { order: 3; }
  .sec.wide .work-info .quote { order: 4; }
  .work { gap: 48px; }
  .work-info { position: static; max-width: none; margin-bottom: 22px; }
  .lightbox { padding: 52px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
