/* PROJECT HEADER */
.project-header {
  padding: var(--block-gap) var(--side) 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap-stacked-titles-lg); /* 0 in untrimmed engines (leading covers it), 18px when trimmed */
}
.project-client { color: var(--muted); transition: color var(--transition); margin: 0; }
.project-title  { color: var(--text);  transition: color var(--transition); margin: 0; }

/* CREDITS ROW */
.project-credits {
  display: flex;
  gap: 3rem; /* 48px — Figma credits gap */
  align-items: flex-start;
  padding: var(--block-gap) var(--side) 0;
  flex-wrap: wrap;
}
.credit-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--muted);
  max-width: 196px; /* Figma spec cap — column sizes to its content so the 48px flex gap = the visible whitespace */
}
.credit-label {
  font-family: var(--base);
  font-size: 0.75rem; /* 12px — Figma label size */
  font-weight: 400;
  line-height: 1.12;
}
.credit-value {
  font-family: var(--display);
  font-size: 0.875rem; /* 14px */
  font-weight: 300;
  font-style: italic;
  line-height: 1.24;
}
.credit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

/* DESCRIPTION */
.project-desc {
  padding: var(--block-gap) var(--side) 0;
}
@media (min-width: 768px) {
  .project-desc {
    max-width: calc(var(--side) + 50vw); /* half the viewport on laptop+; mobile stays full width */
  }
}
.project-desc p {
  font-family: var(--display);
  font-size: 1.5rem;   /* 24px — Size/XL */
  font-weight: 400;
  font-style: normal;
  line-height: 1.24;
  color: var(--text);
  margin-bottom: var(--gap-paragraph); /* 0 if leading is natural, 24px when trimmed */
  transition: color var(--transition);
}
.project-desc p:last-child { margin-bottom: 0; }

/* IMAGE GRID */
.project-images {
  padding: var(--block-gap) var(--side) 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--col-gap);
  row-gap: 0;
  align-items: start;
}

.project-images img   { width: 100%; height: auto; display: block; }
.project-images video { width: 100%; height: auto; display: block; }
.project-images p     { display: contents; }
/* Zero the default figure margins on top/sides only. Don't use the `margin` shorthand
   here — it would set margin-bottom: 0 too, and because `.project-images figure` has
   higher specificity than `.project-images > *`, it'd beat the bottom-gap rule below
   and figures with captions would crowd the next image. */
.project-images figure { margin-top: 0; margin-right: 0; margin-left: 0; }
.project-images figure img,
.project-images figure video { width: 100%; height: auto; display: block; }

/* Desktop stagger */
@media (min-width: 768px) {
  /* Vertical: right column (even items) starts lower */
  .project-images > *:nth-child(even) { margin-top: 2.625rem; }
  /* X: alternating widths per 4-item cycle */
  .project-images > *:nth-child(4n+1) { width: 100%; }
  .project-images > *:nth-child(4n+2) { width: 85%; margin-left: auto; }
  .project-images > *:nth-child(4n+3) { width: 85%; }
  .project-images > *:nth-child(4n)   { width: 100%; }
  /* BTS images: 1/3 the width of regular images, centered in grid cell (#53) */
  .project-images > [data-bts="true"] { width: 33.333%; margin-left: auto; margin-right: auto; }
}
.project-images > * { margin-bottom: var(--col-gap); }

figcaption {
  font-family: var(--display);
  font-size: 0.875rem; /* 14px */
  font-weight: 300;
  font-style: italic;
  color: var(--muted);
  margin-top: 0.5rem;
  line-height: 1.24;
  transition: color var(--transition);
}

.proj-img {
  width: 100%;
  background: rgba(0,0,0,0.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.625rem; color: var(--muted);
}
.proj-img.span2 { grid-column: 1/-1; }
.proj-img.r169  { aspect-ratio: 16/9; }
.proj-img.r43   { aspect-ratio: 4/3; }
.proj-img.r34   { aspect-ratio: 3/4; }
.proj-img.r23   { aspect-ratio: 2/3; }
.proj-img.r11   { aspect-ratio: 1/1; }

/* MOBILE */
@media (max-width: 767px) {
  .project-header { padding-top: 2rem; } /* matches Figma 94px title position on mobile */
  .project-credits {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1.5rem;        /* 24px between the two columns */
    row-gap: 1.125rem;         /* 18px between rows */
    flex-direction: initial;   /* override the desktop flex layout */
  }
  .credit-item { max-width: none; width: auto; } /* fill the grid cell, no desktop cap */
  .credit-value { font-size: 1rem; } /* 16px on mobile */
  .project-desc p { font-size: 1.125rem; } /* 18px on mobile */

  /* Single column with x stagger: odd flush left, even flush right, both 92% wide */
  .project-images { grid-template-columns: 1fr; }
  .project-images > * { margin-bottom: 3rem; } /* 48px between images; figures with captions take their own additional height naturally */
  .project-images > *:nth-child(even) { margin-top: 0; width: 92%; margin-left: auto; }
  .project-images > *:nth-child(odd)  { width: 92%; }
  /* BTS images: half width, centered (#53) */
  .project-images > [data-bts="true"] { width: 50%; margin-left: auto; margin-right: auto; }
}
