/* ------------------------------------------------------------------
   Portfolio — one typeface, one ground, photographs first.
   ------------------------------------------------------------------ */

@font-face {
  font-family: "Archivo";
  src: url("archivo-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #eeeeec;
  --fg: #151515;
  --mute: #8b8a86;
  --line: #d6d5d1;

  --gutter: clamp(16px, 2vw, 28px);
  --head: 56px;
  --strip: 0px;                 /* mobile caption strip height */
  --safe-top: env(safe-area-inset-top, 0px);
  --aside: 15.5rem;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --fg: #e9e8e4;
    --mute: #7a7975;
    --line: #262625;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 14px/1.4 "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }
::selection { background: var(--fg); color: var(--bg); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Photographs can't be dragged out, long-pressed to save, or right-clicked as images:
   a transparent layer sits over each one. */
img { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }
.shot, .tile { position: relative; -webkit-touch-callout: none; user-select: none; }
.shot::after, .tile::after { content: ""; position: absolute; inset: 0; }

/* Images fade in over their own dominant colour. */
.js img[onload] { opacity: 0; transition: opacity .7s var(--ease); }
.js img.is-loaded { opacity: 1; }

/* ---------- masthead ---------- */

.masthead {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: calc(var(--head) + var(--safe-top));
  padding: var(--safe-top) var(--gutter) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
}

.masthead__name { font-weight: 500; letter-spacing: -.005em; }

.masthead__nav { display: flex; gap: clamp(1.25rem, 2.5vw, 2.25rem); }
.masthead__nav a { color: var(--mute); transition: color .2s; }
.masthead__nav a:hover,
.masthead__nav a.is-on,
.masthead__nav a[aria-current] { color: var(--fg); }

/* ---------- home: a wall of photographs ---------- */

.masthead__now {
  position: absolute;
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  color: var(--mute);
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.masthead__now.is-on { opacity: 1; }
.masthead__now b { font-weight: 400; color: var(--fg); margin: 0 .5em; }

.home {
  padding: calc(var(--head) + var(--safe-top) + 2px) var(--gutter) 0;
}

.home__intro {
  max-width: 34ch;
  margin: clamp(12px, 3vh, 32px) 0 clamp(20px, 4vh, 40px);
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.2;
  letter-spacing: -.02em;
}

/* series names live at the end of the wall, quietly */
.series-index {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  gap: var(--gutter);
  margin-top: clamp(72px, 14vh, 160px);
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.series-index__label { margin: 0; font-size: inherit; font-weight: 400; color: var(--mute); }
.series-index__list {
  columns: 3;
  column-gap: var(--gutter);
  font-size: clamp(1rem, 1.25vw, 1.2rem);
  line-height: 1.5;
  letter-spacing: -.01em;
}
.series-index__list a { display: block; break-inside: avoid; transition: color .25s var(--ease); }
.series-index__num {
  display: inline-block;
  width: 2.2em;
  font-size: 11px;
  letter-spacing: 0;
  color: var(--mute);
}

.wall-wrap { container-type: inline-size; }

.wall {
  --cols: 6;
  --gap: clamp(6px, .65vw, 12px);
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols) * 1.5);
  grid-auto-flow: row dense;
  gap: var(--gap);
}

.tile {
  display: block;
  overflow: hidden;
  background: var(--c);
  transition: opacity .4s var(--ease);
}
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile--big { grid-row: span 2; }
.tile--left { grid-column: 1 / span 2; }
.tile--right { grid-column: -3 / span 2; }

@media (hover: hover) {
  .wall.is-focus .tile.is-dim { opacity: .22; }
  .series-index.is-focus a:not(.is-on) { color: var(--mute); }
}

@media (min-width: 1600px) { .wall { --cols: 7; } }
@media (max-width: 1199px) { .wall { --cols: 5; } }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(40px, 10vh, 120px) 0 var(--gutter);
  color: var(--mute);
  font-size: 13px;
}

@media (max-width: 899px) {
  :root { --head: 48px; }
  .masthead__now { display: none; }
  .wall { --cols: 4; }

  .series-index { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .series-index__list { columns: 2; }
  .foot { flex-direction: column; padding-top: 48px; }
}

@media (max-width: 599px) {
  .wall { --cols: 2; --gap: 4px; }
  .wall-wrap { margin-inline: calc(var(--gutter) * -1 + 4px); }
  .tile--extra { display: none; }
  .series-index__list { columns: 1; font-size: 1.1rem; line-height: 1.6; }
}

/* ---------- series: one photograph per screen ---------- */

.is-gallery { scroll-snap-type: y mandatory; }
.is-gallery.is-grid { scroll-snap-type: none; }

.caption {
  position: fixed;
  z-index: 10;
  top: var(--head);
  left: var(--gutter);
  bottom: var(--gutter);
  width: var(--aside);
  display: flex;
  flex-direction: column;
  padding-top: clamp(20px, 5vh, 64px);
}

.caption p { margin: 0; }
.caption__num { color: var(--mute); }

.caption__title {
  margin: .4rem 0 0;
  font-size: clamp(1.75rem, 2.4vw, 2.5rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -.03em;
}

.caption__count { margin-top: 1.5rem !important; }
.caption__of { color: var(--mute); }

.frames {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px 0;
  max-width: 13rem;
  font-size: 11px;
  line-height: 1.6;
}
.frames a { color: var(--mute); opacity: .7; transition: color .2s, opacity .2s; }
.frames a:hover { color: var(--fg); opacity: 1; }
.frames a[aria-current] { color: var(--fg); opacity: 1; }

.caption__toggle {
  align-self: flex-start;
  margin-top: 1.25rem;
  color: var(--mute);
  transition: color .2s;
}
.caption__toggle:hover,
.caption__toggle[aria-pressed="true"] { color: var(--fg); }

.caption__series {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  color: var(--mute);
}
.caption__series a { transition: color .2s; }
.caption__series a:hover { color: var(--fg); }

.reel { margin-left: calc(var(--aside) + var(--gutter)); }

.frame {
  --pad-top: calc(var(--head) + var(--safe-top) + var(--strip) + 6px);
  --pad-bottom: var(--gutter);
  height: 100vh;
  height: 100svh;
  margin: 0;
  padding: var(--pad-top) var(--gutter) var(--pad-bottom);
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
}

.shot {
  width: min(100%, calc((100vh - var(--pad-top) - var(--pad-bottom)) * var(--r)));
  width: min(100%, calc((100svh - var(--pad-top) - var(--pad-bottom)) * var(--r)));
  aspect-ratio: var(--r);
  background: var(--c);
}
.shot img { width: 100%; height: 100%; object-fit: cover; }

/* end of a series → the next one */
.frame--end { flex-direction: column; gap: 1.5rem; }

.next {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
.next__label { color: var(--mute); }
.next__shot {
  width: calc(42vh * var(--r));
  width: calc(42svh * var(--r));
  transition: opacity .3s var(--ease);
}
.next:hover .next__shot { opacity: .85; }
.next__title {
  display: flex;
  gap: .9rem;
  align-items: baseline;
  font-size: clamp(1.75rem, 3.6vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -.03em;
}
.next__num { font-size: 13px; letter-spacing: 0; color: var(--mute); }
.next__back { color: var(--mute); transition: color .2s; }
.next__back:hover { color: var(--fg); }

/* overview: the whole series as a contact sheet */
.is-grid .reel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(92px, 11vw, 170px), 1fr));
  gap: 10px;
  align-content: start;
  min-height: 100vh;
  padding: calc(var(--head) + var(--safe-top) + var(--strip) + clamp(20px, 5vh, 64px)) var(--gutter) var(--gutter);
}
.is-grid .frame { height: auto; padding: 0; display: block; scroll-snap-align: none; }
.is-grid .frame--end { display: none; }
.is-grid .shot { width: 100%; aspect-ratio: 2 / 3; cursor: pointer; transition: opacity .25s; }
.is-grid .shot:hover { opacity: .8; }

@media (max-width: 899px) {
  :root { --strip: 40px; }

  .caption {
    top: calc(var(--head) + var(--safe-top));
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: var(--strip);
    padding: 0 var(--gutter);
    flex-direction: row;
    align-items: center;
    gap: .75rem;
    background: var(--bg);
  }
  .caption__num { color: var(--mute); }
  .caption__title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .caption__count { margin: 0 !important; }
  .caption__toggle { margin: 0 0 0 .5rem; align-self: auto; }
  .frames, .caption__series { display: none; }

  .reel { margin-left: 0; }
  .frame { padding-left: 0; padding-right: 0; --pad-bottom: 0px; }
  .frame--end { padding-left: var(--gutter); padding-right: var(--gutter); }
  .is-grid .reel { gap: 4px; padding-left: 4px; padding-right: 4px; }
}

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