:root {
  --bg: #F4F1EC;
  --fg: #1C1B19;
  --muted: #6B6861;
  --rule: #C9C3B8;
  --tile: #E6E1D8;
  --gutter: 20px;
  --max: 1200px;
  /* Type system. Neuzeit Grotesk and Alternate Gothic ATF come from the Adobe
     Fonts kit (oug6fwr). Bebas Neue Pro is named first so it takes over once
     added to that kit; until then Google's Bebas Neue is used. */
  --display: "Instrument Serif", Georgia, serif; /* name, headings: editorial serif */
  --body: "neuzeit-grotesk", "Helvetica Neue", Arial, sans-serif; /* body, contact (Adobe kit, Regular) */
  --accent: var(--body); /* small labels, nav: Neuzeit */
  --accent-thin: var(--body); /* opening line: Neuzeit */
  --mono: "IBM Plex Mono", ui-monospace, monospace; /* captions and details */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-weight: 400;
  font-size: 17px;
  /* Google's Bebas Neue ships one (already heavy) weight; don't fake-bold it. */
  font-synthesis-weight: none;
  line-height: 1.6;
}

a { color: inherit; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: 0.01em; }
strong, b { font-weight: 700; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 88px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--rule);
}

.site-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.site-nav { display: flex; gap: 28px; }

.site-nav a {
  font-family: var(--accent);
  font-weight: 400;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--fg); }

.nav-toggle {
  display: none;
  font-family: var(--accent);
  font-weight: 400;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--rule);
  padding: 6px 14px;
  color: var(--fg);
  cursor: pointer;
}

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    right: var(--gutter);
    flex-direction: column;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg);
    border: 1px solid var(--rule);
  }
  .site-nav.open { display: flex; }
}

/* Layout */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--gutter);
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

/* Home */
/* Home: the three photos use the full width and fill the height of the screen */
body[data-page="home"] .wrap { max-width: none; }

.opening {
  font-family: var(--accent-thin);
  font-weight: 100;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.2;
  margin: 0;
  max-width: 28ch;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-top: 32px;
  padding-bottom: 64px;
}

.tile { display: block; text-decoration: none; }

.tile-img {
  aspect-ratio: 4 / 5;
  background: var(--tile);
  overflow: hidden;
}

/* Wide screens: each photo fills the height of the screen beneath the menu */
@media (min-width: 801px) {
  body[data-page="home"] .tile-img {
    aspect-ratio: auto;
    height: calc(100svh - 230px);
    min-height: 260px;
  }

  body[data-page="home"] .tiles {
    padding-bottom: 24px;
  }
}

.tile-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Greyed out until hovered or focused. Only on devices that can hover, so
   phones and tablets always show the photos in color. */
@media (hover: hover) {
  .tile-img img {
    filter: grayscale(1) opacity(0.6);
    transition: filter 0.4s ease;
  }
  .tile:hover .tile-img img,
  .tile:focus-visible .tile-img img {
    filter: none;
  }
}

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

.tile-label {
  font-family: var(--accent);
  font-weight: 400;
  font-size: 1.9rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-top: 12px;
}

/* Home tiles: title centered over the photo, shown on hover only */
.tile-img { position: relative; }

.tile-img .tile-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 16px;
  text-align: center;
  color: #F4F1EC;
  background: rgba(20, 20, 19, 0.35);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.tile:hover .tile-label,
.tile:focus-visible .tile-label { opacity: 1; }

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

@media (max-width: 800px) {
  .tiles { grid-template-columns: 1fr; gap: 32px; }
}

.section {
  border-top: 1px solid var(--rule);
  padding: 48px 0;
}

.section h2 { font-size: 2.4rem; line-height: 1; margin: 0 0 16px; }
.section p { max-width: 60ch; margin: 0 0 16px; }

.contact-line {
  font-family: var(--body);
  font-weight: 400;
  font-size: 1.5rem;
}

/* Series pages */
.series-head { padding: 32px 0 32px; }

.series-head h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  line-height: 0.95;
  margin: 0 0 12px;
}

.note { color: var(--muted); max-width: 60ch; margin: 0; }

.gallery {
  padding-bottom: 80px;
}

/* Each row of two photos sticks to the top of the screen; the next row slides over it */
.gallery-row {
  position: sticky;
  top: 88px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 0 0 24px;
  background: var(--bg);
}

.piece { margin: 0; }

/* Wide screens: each row fills the window, so the next row only appears as it slides over */
@media (min-width: 640px) {
  .gallery-row {
    grid-template-columns: 1fr 1fr;
    align-items: center;
    height: calc(100vh - 88px);
    padding: 24px 0;
  }

  .piece img {
    height: calc(100vh - 180px);
    width: 100%;
    object-fit: contain;
  }
}

.piece-button:hover img.loaded,
.piece-button:focus-visible img.loaded { opacity: 0.85; }

.piece-button:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; }

.piece img { transition: opacity 0.3s ease; }

.piece-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.piece img {
  display: block;
  width: 100%;
  height: auto;
}

.piece figcaption {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--rule);
}

.empty {
  color: var(--muted);
  padding-bottom: 80px;
}

/* About and Contact */
.prose {
  max-width: 42rem;
  padding: 48px 0 80px;
}

.prose p { margin: 0 0 1.25rem; font-size: 1.05rem; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 25, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 30;
}

.lightbox[hidden] { display: none; }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  line-height: 1;
  color: #fff;
  background: none;
  border: 0;
  padding: 12px 16px;
  cursor: pointer;
}

.lightbox-nav[hidden] { display: none; }
.lightbox-prev { left: 0; }
.lightbox-next { right: 0; }

.lightbox figure { margin: 0; text-align: center; color: #d8d3c8; }

.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 85vh;
  margin: 0 auto;
}

.lightbox figcaption { font-size: 0.875rem; margin-top: 10px; }

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
  background: none;
  border: 0;
  cursor: pointer;
}

/* Series pages: on wide screens the title and note stay pinned on the left while the photos scroll */
/* Series pages: the photos use the full width of the screen */
body[data-series] .wrap { max-width: none; }

/* Series pages: the top menu spans the full width in black, so photos scrolling
   underneath never show at its sides */
body[data-series] .site-header {
  max-width: none;
  background: #000;
}

/* Series title is kept for screen readers but not shown above the gallery */
body[data-series] .series-head h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}


/* Phones: each row shows two photos stacked, filling the screen; the next pair slides over */
@media (max-width: 639px) {
  .gallery-row {
    position: sticky;
    top: 88px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    align-items: center;
    gap: 12px;
    height: calc(100vh - 88px);
    height: calc(100dvh - 88px);
    padding: 12px 0;
  }

  /* Each photo takes exactly half of the row; the photo scales to fit that half */
  .gallery-row .piece {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .gallery-row .piece-button {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .gallery-row .piece img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: contain;
  }

  .gallery-row .piece figcaption {
    flex: none;
  }

  .lightbox img {
    max-height: 72vh;
  }

  /* Larger previous and next controls along the bottom of the full view */
  .lightbox-nav {
    top: auto;
    bottom: 16px;
    transform: none;
    min-width: 56px;
    min-height: 48px;
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 4px;
  }

  .lightbox-prev { left: 16px; }
  .lightbox-next { right: 16px; }
}


/* Pause after each pinned row before the next one moves in (desktop only) */
@media (min-width: 640px) {
  .gallery-pause { height: 60vh; }
}


/* Phones: two photos per screen, each in a fixed half of the pinned row, with a pause after the row */
@media (max-width: 639px) {
  .gallery-row {
    --row-h: calc(100dvh - 88px - 24px);
    height: calc(100dvh - 88px);
    padding: 12px 0;
    grid-template-rows: none;
    grid-template-columns: 1fr;
    align-content: center;
    gap: 12px;
    overflow: hidden;
  }

  .gallery-row .piece {
    height: calc((var(--row-h) - 12px) / 2);
    overflow: hidden;
  }

  .gallery-row .piece-button {
    flex: none;
    height: calc((var(--row-h) - 12px) / 2 - 40px);
  }

  .gallery-row .piece img {
    height: 100%;
    width: 100%;
    object-fit: contain;
  }

  .gallery-pause { height: 60dvh; }
}


/* Series index: the three series in a row, just under the main menu */
.series-index {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 32px;
  position: sticky;
  top: 88px;
  z-index: 15;
  background: var(--bg);
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}

/* Stays frozen under the top menu on wide screens, where the header is taller */
@media (min-width: 641px) {
  .series-index { top: 110px; }
}

.series-index a {
  font-family: var(--accent);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.series-index a:hover { color: var(--fg); }

.series-index a[aria-current="page"] {
  color: var(--fg);
  font-weight: 700;
}

/* Palette: series pages go dark so the photos stand out; the home page stays light */
:root {
  --accent-color: #B8794A; /* single restrained accent: current series and hover states */
}

body[data-series] {
  --bg: #141413;
  --fg: #F4F1EC;
  --muted: #9C978C;
  --rule: #3A3834;
  --tile: #222220;
  color-scheme: dark;
}

.series-index a:hover,
.series-index a[aria-current="page"] { color: var(--accent-color); }


/* Loading: photos fade in over their blurred preview; each pair fades in as it scrolls into view */
.piece-button img { opacity: 0; transition: opacity 0.6s ease; }
.piece-button img.loaded { opacity: 1; }

.piece {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.piece.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .piece,
  .piece-button img {
    opacity: 1;
    transform: none;
    transition: none;
  }
}


/* Type: Archivo for headings and the name, Neuzeit for text, IBM Plex Mono for captions */
h1, h2 { font-stretch: 80%; font-weight: 700; letter-spacing: 0; }
.site-name { font-size: 1.8rem; font-stretch: 80%; letter-spacing: 0; }
.site-nav a,
.nav-toggle { font-size: 1rem; letter-spacing: 0; text-transform: none; }
.opening { font-weight: 400; }
.tile-label {
  font-family: var(--display);
  font-weight: 600;
  font-stretch: 80%;
  font-size: 1.4rem;
  letter-spacing: 0;
  text-transform: none;
}
.series-index a { font-size: 1.1rem; letter-spacing: 0; text-transform: none; }
.piece figcaption,
.lightbox figcaption { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0; }


/* Classy: serif headings and name, tracked mono labels, quieter details */
h1, h2,
.site-name,
.tile-label {
  font-family: var(--display);
  font-weight: 400;
  font-stretch: normal;
  letter-spacing: 0;
}

.site-name { font-size: 2rem; }

.tile-label { font-size: 1.7rem; text-transform: none; }

.series-index a {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-nav a { letter-spacing: 0.02em; }


/* Series galleries: a flowing masonry of photos, each keeping its own shape; no pinned pairs */
.gallery {
  columns: 1;
  column-gap: 24px;
  padding-bottom: 96px;
}

@media (min-width: 640px) {
  .gallery { columns: 5; column-gap: 16px; }
  .gallery .piece { margin: 0 0 16px; }
}

.gallery .piece {
  break-inside: avoid;
  margin: 0 0 40px;
}

.gallery .piece-button,
.gallery .piece-button img {
  height: auto;
  max-height: none;
}

.gallery .piece img {
  width: 100%;
  object-fit: contain;
}


/* Denser masonry, closer to the reference: more columns and tighter gutters on wide screens */
@media (min-width: 900px) {
  .gallery { columns: 5; column-gap: 16px; }
  .gallery .piece { margin: 0 0 16px; }
}

@media (min-width: 1400px) {
  .gallery { columns: 5; column-gap: 16px; }
}


/* Minimal header on wide screens: centered, tracked wordmark over a small uppercase menu */
@media (min-width: 641px) {
  .site-header {
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    height: 120px;
    padding: 0 var(--gutter);
  }

  .site-name {
    font-size: 1.5rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
  }

  .site-nav { gap: 32px; }

  .site-nav a {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .site-nav a[aria-current="page"] {
    color: var(--fg);
    text-decoration: underline;
    text-underline-offset: 6px;
  }
}


/* Home opening line: quieter, smaller and lighter */
.opening {
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  line-height: 1.5;
  color: var(--muted);
  max-width: 44ch;
}

/* Gallery: title centered over the photo on hover */
.piece-button { position: relative; }

.piece-title {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-family: var(--display);
  font-size: 1.6rem;
  color: #F4F1EC;
  background: rgba(20, 20, 19, 0.35);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.piece-button:hover .piece-title,
.piece-button:focus-visible .piece-title { opacity: 1; }

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


/* Logo: stacked condensed wordmark at the top left, as on the old portfolio */
.site-name {
  font-family: "Bebas Neue", "Arial Narrow", sans-serif;
  font-weight: 400;
  font-size: 2.4rem;
  line-height: 0.86;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
}

@media (min-width: 641px) {
  .site-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    height: 110px;
    padding-top: 22px;
    padding-bottom: 12px;
  }

  .site-name {
    font-size: 3rem;
    line-height: 0.6;
    letter-spacing: 0.01em;
  }

  .site-nav { margin-top: 10px; }
}


/* Mouse pointer: a small camera everywhere on the site */
*,
*::before,
*::after {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24'%3E%3Cpath d='M3 7h4l2-2h6l2 2h4v12H3z' fill='%23fff' stroke='%23000' stroke-width='1.3' stroke-linejoin='round'/%3E%3Ccircle cx='12' cy='13' r='3.6' fill='%23000' stroke='%23fff' stroke-width='1'/%3E%3C/svg%3E") 14 14, auto;
}
