/* =====================================================================
   Project / Object detail
   ===================================================================== */
.project {
  padding: var(--header-pad) var(--frame) 0;
  max-width: 1148px;
  margin: 0 auto;
}

.project__header {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0 80px;
  padding-bottom: 40px;
  margin-bottom: 24px;
}

.project__title {
  grid-column: 1 / -1;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0.05em;
  color: #000000E0;
  margin: 0 0 40px;
}

.project__lede { grid-column: 1; }
.project__meta { grid-column: 2; }

.project__lede {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  max-width: 60ch;
  color: #000;
}
.project__lede p { margin: 0 0 1em; }

.project__meta {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.project__meta-row {
  display: grid;
  /* Wide enough to keep "Design Team" on a single line at 16px. */
  grid-template-columns: 110px 1fr;
  gap: 32px;
}
.project__meta-row dt,
.project__meta-row dd {
  margin: 0;
  font-weight: inherit;
  color: var(--ink);
}
.project__meta-row dt { white-space: nowrap; }

/* Year is rendered first in the meta list. */
.project__meta-row:first-of-type dt,
.project__meta-row:first-of-type dd { color: #000000E0; }

/* Gallery layout */
.project__gallery {
  display: flex;
  flex-direction: column;
  gap: 96px;
  margin-bottom: 120px;
}

/* WIP — single stacked column of images + captions at the project pages'
   "Narrow" width. Each image is also capped to the viewport so a portrait
   photo and its caption fit on screen together.
   width:100% stops the auto side-margins (margin:0 auto) from shrink-
   wrapping the article inside the flex-column .site-main. */
.project.wip {
  width: 100%;
  /* Tighter than the project pages' 160px — the heading is all there is
     above the column. Mobile's --header-pad is already 100px. */
  padding-top: min(var(--header-pad), 100px);
}
/* Nothing in the WIP header but the heading — no lede, no meta — so
   centre it over the column instead of hanging it off the left edge,
   and drop the spacing that lede/meta would otherwise sit in. */
.project.wip .project__header {
  text-align: center;
  padding-bottom: 0;
  margin-bottom: 48px;
}
.project.wip .project__title { margin-bottom: 0; }
.wip__column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 96px;
  max-width: 50%;
  margin: 0 auto 120px;
}
.wip__column .project__figure { width: fit-content; max-width: 100%; }
.wip__column .project__figure img,
.wip__column .project__figure .project__video {
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
}
/* The photos are all 3:4 portrait, so the height cap above sets their
   width. Size videos to that same width whatever their own aspect. */
.wip__column .project__figure:has(> .project__video) {
  width: min(100%, calc((100vh - 140px) * 3 / 4));
  width: min(100%, calc((100dvh - 140px) * 3 / 4));
}
.wip__column .project__figure > .project__video { width: 100%; max-height: none; }

.project__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

/* Grid/flex items default to min-width:auto, which lets wide media blow
   out the track on narrow screens. Allow columns to shrink. */
.project__col { min-width: 0; }

/* Display widths for a single image/slideshow in a full-width column:
   standard = narrow + centered, wide = full container width, full = 100vw. */
.project__col--1-1 > .project__figure:not(.project__figure--full):not(.project__figure--wide),
.project__col--1-1 > .project__slideshow:not(.project__slideshow--full):not(.project__slideshow--wide) {
  max-width: 50%;
  margin-left: auto;
  margin-right: auto;
}
.project__row:has(.project__col--1-2 + .project__col--1-2) {
  grid-template-columns: 1fr 1fr;
}
.project__row:has(.project__col--1-3 + .project__col--1-3 + .project__col--1-3) {
  grid-template-columns: 1fr 1fr 1fr;
}
.project__row:has(.project__col--2-3 + .project__col--1-3) {
  grid-template-columns: 2fr 1fr;
}
.project__row:has(.project__col--1-3 + .project__col--2-3) {
  grid-template-columns: 1fr 2fr;
}

.project__figure { position: relative; }
.project__figure img,
.project__video { width: 100%; height: auto; display: block; }

/* Slideshow — slides stack via CSS grid so the stage always has a
   measurable height (= the tallest slide). Fade between them. */
.project__slideshow { position: relative; }

/* Edge-to-edge — escape the .project max-width / padding container so
   the image spans the full viewport width. Declared after the base
   rules above so the negative margins win on same-specificity ties. */
.project__figure--full,
.project__slideshow--full {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}
.project__figure--full > img,
.project__figure--full > .project__video,
.project__slideshow--full .project__slide img { width: 100vw; }
.project__slideshow-stage {
  position: relative;
  display: grid;
  grid-template-areas: "slide";
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  cursor: pointer;
  /* Horizontal swipes change slides (main.js); vertical still scrolls. */
  touch-action: pan-y;
}
.project__slide {
  grid-area: slide;
  opacity: 0;
  transition: opacity var(--t-med) var(--ease);
  pointer-events: none;
}
.project__slide.is-current {
  opacity: 1;
  pointer-events: auto;
}
.project__slide img { width: 100%; height: auto; display: block; }

.project__slideshow-nav {
  display: inline-flex;
  gap: 12px;
  margin-left: auto;
}
.project__slideshow-nav button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.01em;
  color: #000;
}
.project__slideshow-nav button:hover { opacity: .65; }

.project__slideshow [data-slideshow-counter] {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.01em;
  text-align: right;
  color: #000;
}

/* When a slideshow has a caption, push counter + nav to the right. */
.project__slideshow.has-caption .project__caption { flex: 1; }

.project__figcaption {
  margin-top: 12px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #000000E0;
}
/* Edge-to-edge media spans 100vw, so its caption needs the page frame
   put back or it sits flush against the viewport edge. */
.project__figure--full .project__figcaption,
.project__slideshow--full .project__figcaption {
  padding: 0 var(--frame);
}
.project__pageindex { white-space: nowrap; }

.project__text {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: #000;
}

.project__closing {
  padding-top: 48px;
  padding-bottom: 60px;
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: #000;
  max-width: 60ch;
}

/* ---------- Lightbox ---------- */
/* Scoped like initLightbox in main.js: WIP reuses the figure markup but
   has no lightbox. */
.page--project .project__gallery .project__figure > img,
.page--project .project__gallery .project__slideshow-stage { cursor: zoom-in; }

/* Same linen wash + blur as the index overlay, above the header. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 20px 22px;
  background: rgba(244, 241, 234, .65);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1;
  color: var(--ink);
}
/* display:grid above would otherwise override the hidden attribute. */
.lightbox[hidden] { display: none; }
/* Lock the page behind: html too, since body's overflow alone doesn't
   reliably stop the viewport scrolling. */
html:has(body.is-lightbox-open),
body.is-lightbox-open { overflow: hidden; }
.lightbox { overscroll-behavior: contain; }

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 22px;
}
.lightbox button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-transform: uppercase;
  cursor: pointer;
}
.lightbox__bar--bottom button { font-size: 28px; font-weight: 300; }
.lightbox button:hover { opacity: .65; }
.lightbox:focus,
.lightbox button:focus:not(:focus-visible) { outline: none; }

.lightbox__caption {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
}
.lightbox__caption p { margin: 0; }

.lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  touch-action: pan-y;
}
.lightbox__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
}
.lightbox__img.is-loaded { opacity: 1; }

@media (max-width: 720px) {
  .lightbox { padding: 18px var(--frame-sm); }
  .project { padding: var(--header-pad) var(--frame-sm) 0; }
  .project__header {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .project__title,
  .project__lede,
  .project__meta { grid-column: 1; }
  .project__meta { font-size: var(--fs-xs); }

  /* WIP goes full width on mobile, like the project pages' narrow images. */
  .wip__column { max-width: 100%; gap: 64px; }

  .project__row:has(.project__col--1-2 + .project__col--1-2),
  .project__row:has(.project__col--1-3 + .project__col--1-3 + .project__col--1-3),
  .project__row:has(.project__col--2-3 + .project__col--1-3),
  .project__row:has(.project__col--1-3 + .project__col--2-3) {
    grid-template-columns: 1fr;
  }

  /* Narrow + wide both go full width on mobile. Matches the desktop
     narrow rule's specificity so this override wins. */
  .project__col--1-1 > .project__figure:not(.project__figure--full):not(.project__figure--wide),
  .project__col--1-1 > .project__slideshow:not(.project__slideshow--full):not(.project__slideshow--wide) {
    max-width: 100%;
  }
}
