/* Portfolio and project details */
body[data-stage="portfolio"] .portfolio {
  padding-block: 64px 100px;
}
body[data-stage="portfolio"] .portfolio-heading {
  grid-template-columns: minmax(0, 6.5fr) minmax(0, 5.5fr);
  align-items: center;
  gap: 26px 28px;
  margin-bottom: 80px;
}
body[data-stage="portfolio"] .portfolio-heading h1 {
  font-size: clamp(70px, 7.92vw, 120px);
  line-height: 0.95;
  letter-spacing: -0.065em;
}
body[data-stage="portfolio"] .portfolio-heading > p:last-child {
  max-width: 350px;
  padding-bottom: 0;
  hyphens: none;
  word-break: normal;
  overflow-wrap: normal;
}
.portfolio-grid {
  columns: unset;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 5%;
  row-gap: 90px;
  align-items: start;
}
.portfolio-item {
  min-width: 0;
  scroll-margin-top: 110px;
}
.portfolio-item:nth-child(6n + 1) {
  grid-column: 1/6;
}
.portfolio-item:nth-child(6n + 2) {
  grid-column: 7/13;
  margin-top: 140px;
}
.portfolio-item:nth-child(6n + 3) {
  grid-column: 1/8;
}
.portfolio-item:nth-child(6n + 4) {
  grid-column: 9/13;
  margin-top: 180px;
}
.portfolio-item:nth-child(6n + 5) {
  grid-column: 1/6;
}
.portfolio-item:nth-child(6n + 6) {
  grid-column: 7/13;
  margin-top: 120px;
}
.portfolio-grid .project {
  margin: 0;
  display: block;
}
.portfolio-grid .project-media img {
  aspect-ratio: auto;
  height: auto;
  max-height: 670px;
  object-fit: cover;
}
.portfolio-grid figcaption,
.portfolio-grid .project-link figcaption {
  display: grid;
  grid-template-columns: 1fr auto;
  margin-top: 16px;
  padding-top: 13px;
  gap: 2px 20px;
}
.portfolio-grid .project-title {
  grid-column: 1;
  display: block;
}
.portfolio-grid h2 {
  font-size: 25px;
  letter-spacing: -0.035em;
  line-height: 1.3;
}
.portfolio-grid figcaption p {
  grid-column: 1;
  padding: 0;
  margin: 0;
  font-size: 11px;
}
.portfolio-grid .project-open {
  grid-column: 2;
  grid-row: 1/3;
  font-size: 25px;
  align-self: center;
}
.portfolio-item:target {
  outline: 1px solid var(--line);
  outline-offset: 12px;
}
.portfolio-note {
  font-size: 10px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 80px;
  letter-spacing: 0.025em;
}
.portfolio-grid .project:not(a):hover img {
  transform: none;
}
.portfolio-grid .project:not(a):hover figcaption {
  transform: none;
}
.detail-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px 30px;
  padding-block: 32px 48px;
  align-items: end;
}
.detail-back {
  grid-column: 1/-1;
  display: flex;
  gap: 18px;
  align-items: center;
  min-height: 44px;
  width: fit-content;
  font-size: 12px;
  margin-bottom: 26px;
}
.detail-heading .eyebrow {
  grid-column: 1/-1;
}
.detail-heading h1 {
  font-size: clamp(62px, 7.3vw, 112px);
  line-height: 1.05;
  letter-spacing: -0.055em;
}
.detail-type {
  font-size: 11px;
  padding-bottom: 10px;
  color: var(--muted);
}
.gallery-photo {
  width: 100%;
  max-width: var(--photo-max);
  justify-self: center;
}
.gallery-open {
  display: block;
  position: relative;
  overflow: hidden;
  cursor: zoom-in;
}
.gallery-open img {
  width: 100%;
  height: auto;
  transition: transform 850ms cubic-bezier(0.2, 0.65, 0.3, 1);
}
.gallery-expand {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--paper);
  color: var(--ink);
  font-size: 23px;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 300ms,
    transform 400ms;
}
.gallery-open:focus-visible .gallery-expand {
  opacity: 1;
  transform: none;
}
.gallery-photo figcaption {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 12px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--muted);
}
.gallery-photo figcaption > span:first-child {
  max-width: 85%;
}
.detail-cover {
  margin-inline: auto;
}
.detail-intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  margin-block: 56px 72px;
  text-align: left;
}
.detail-intro .eyebrow {
  margin: 0;
}
.detail-intro h2 {
  max-width: 660px;
  margin: 0;
  font-size: clamp(26px, 2.2vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.04em;
}
.detail-intro .detail-description {
  max-width: 660px;
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.85;
}
.editorial-gallery {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 90px 5%;
  align-items: start;
}
.project-neighbors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px 30px;
  border-top: 1px solid var(--line);
  margin-top: 70px;
  padding-block: 70px 90px;
}
.project-neighbors > a {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 44px;
}
.project-neighbors > a:nth-child(2) {
  text-align: right;
}
.neighbor-title {
  font-family: var(--font);
  font-size: clamp(24px, 3vw, 44px);
  letter-spacing: -0.035em;
  line-height: 1.2;
}
.project-neighbors .all-projects {
  grid-column: 1/-1;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 30px;
  font-size: 12px;
  padding-top: 16px;
}
.photo-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  background: #1e2322;
  color: var(--paper);
  padding: 24px 36px;
  overflow: auto;
}
.photo-viewer[open] {
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) 54px;
  gap: 12px;
}
.photo-viewer::backdrop {
  background: #1e2322;
}
.viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.photo-viewer button {
  border: 0;
  background: transparent;
  color: inherit;
  min-width: 48px;
  min-height: 48px;
  cursor: pointer;
}
.viewer-bar button {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 12px;
}
.viewer-bar button span {
  font-size: 30px;
}
.photo-viewer figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
}
.photo-viewer figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  min-height: 0;
}
.photo-viewer figcaption {
  font-size: 11px;
  text-align: center;
  max-width: 700px;
  margin-inline: auto;
}
.viewer-controls {
  display: flex;
  justify-content: center;
  gap: 36px;
}
.viewer-controls button {
  font-size: 26px;
}
html[data-gallery-open="true"] {
  overflow: hidden;
}
@media (hover: hover) and (pointer: fine) {
  .gallery-open:hover img {
    transform: scale(1.015);
  }
  .gallery-open:hover .gallery-expand {
    opacity: 1;
    transform: none;
  }
  .portfolio-grid a:hover .project-media img {
    transform: scale(1.025);
  }
}
@media (max-width: 1000px) {
  .portfolio-grid {
    column-gap: 6%;
    row-gap: 64px;
  }
  .portfolio-grid h2 {
    font-size: 22px;
  }
  .portfolio-item:nth-child(6n + 2) {
    margin-top: 100px;
  }
  .portfolio-item:nth-child(6n + 4) {
    grid-column: 9/13;
    margin-top: 100px;
  }
  .detail-type {
    grid-column: 1;
  }
  .editorial-gallery {
    gap: 60px 5%;
  }
}
@media (max-width: 600px) {
  body[data-stage="portfolio"] .portfolio {
    padding-block: 38px 64px;
  }
  body[data-stage="portfolio"] .portfolio-heading {
    display: block;
    margin-bottom: 42px;
  }
  body[data-stage="portfolio"] .portfolio-heading h1 {
    font-size: 67px;
    margin-block: 24px;
  }
  body[data-stage="portfolio"] .portfolio-heading > p:last-child {
    font-size: 12px;
  }
  .portfolio-grid {
    display: block;
  }
  .portfolio-grid .portfolio-item {
    margin: 0 0 44px;
  }
  .portfolio-grid .project-media img {
    max-height: none;
  }
  .portfolio-grid h2 {
    font-size: 24px;
  }
  .portfolio-grid figcaption p {
    font-size: 11px;
  }
  .portfolio-note {
    margin-top: 44px;
    font-size: 10px;
  }
  .detail-heading {
    display: block;
    padding-block: 20px 30px;
  }
  .detail-back {
    margin-bottom: 32px;
  }
  .detail-heading h1 {
    font-size: 57px;
    margin-block: 18px 16px;
    overflow-wrap: break-word;
  }
  .detail-type {
    display: block;
    padding: 0;
  }
  .gallery-photo figcaption {
    font-size: 10px;
    padding-top: 10px;
  }
  .gallery-expand {
    opacity: 1;
    transform: none;
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }
  .editorial-gallery {
    display: block;
  }
  .project-neighbors {
    margin-top: 44px;
    padding-block: 40px 52px;
    gap: 32px 24px;
  }
  .project-neighbors .eyebrow {
    font-size: 9px;
  }
  .neighbor-title {
    font-size: 26px;
  }
  .photo-viewer {
    padding: 12px 16px;
  }
  .photo-viewer[open] {
    grid-template-rows: 48px minmax(0, 1fr) 52px;
  }
  .photo-viewer figcaption {
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-open img,
  .gallery-expand {
    transition: none !important;
    transform: none !important;
  }
}
html[data-motion="reduce"] .gallery-open img,
html[data-motion="reduce"] .gallery-expand {
  transition: none;
  transform: none;
}
.project-neighbors > a[data-direction="next"] {
  grid-column: 2;
  text-align: right;
}
.project-neighbors > a[data-direction="previous"] {
  grid-column: 1;
  text-align: left;
}
/* Project sequence and metadata */
.detail-heading {
  padding-bottom: 28px;
  gap: 18px 30px;
}
.detail-back {
  margin-bottom: 10px;
}
.detail-metadata {
  display: flex;
  gap: 24px;
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  grid-column: 1/-1;
}
.detail-metadata dt {
  font-size: 10px;
  color: var(--muted);
}
.detail-metadata dd {
  font-size: 12px;
  margin: 3px 0 0;
}
.editorial-gallery {
  row-gap: 44px;
  column-gap: 4%;
}
.gallery-photo figcaption > span:last-child {
  display: none;
}
.project-detail .portfolio-note {
  margin-top: 48px;
}
.project-neighbors {
  margin-top: 48px;
  padding-block: 48px;
}
.index-carousel {
  position: relative;
  overflow: hidden;
}
.index-carousel .project-media {
  display: block;
  width: 100%;
  height: 100%;
}
.portfolio-grid .index-carousel img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
}
.index-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  background: rgb(245 243 239 / 0.94);
  color: var(--ink);
}
.index-controls[hidden] {
  display: none;
}
.index-controls button {
  border: 0;
  background: none;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  font-size: 20px;
}
.index-controls button:disabled {
  opacity: 0.45;
  cursor: progress;
}
.index-count {
  font-size: 9px;
  min-width: 48px;
  text-align: center;
}
.portfolio-grid .index-caption {
  display: grid;
  grid-column: 1/-1;
  grid-template-columns: 1fr auto;
  gap: 2px 20px;
}
.portfolio-grid .index-caption .project-title {
  grid-column: 1;
}
.portfolio-grid .index-caption .project-open {
  grid-column: 2;
  grid-row: 1/3;
}
@media (max-width: 600px) {
  .detail-intro {
    gap: 12px;
    margin-block: 36px 48px;
  }
  .detail-intro h2 {
    font-size: 26px;
  }
  .detail-intro .detail-description {
    font-size: 13px;
  }
  .detail-metadata {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
    margin-top: 24px;
  }
  .detail-metadata > div:last-child {
    grid-column: 1/-1;
  }
  .detail-heading {
    padding-bottom: 24px;
  }
  .index-controls {
    bottom: 8px;
    right: 8px;
  }
  .project-detail .portfolio-note {
    margin-top: 32px;
  }
}
.index-carousel .project-media {
  position: relative;
}
/* Project index and galleries */
body[data-stage="portfolio"] .portfolio {
  max-width: 1640px;
  padding-inline: 28px;
  padding-block: 40px 64px;
}
body[data-stage="portfolio"] .portfolio-heading {
  margin-bottom: 40px;
}
.portfolio-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 40px 24px;
}
.portfolio-grid .portfolio-item:nth-child(n) {
  grid-column: span 6;
  margin: 0;
}
.portfolio-grid .portfolio-item:nth-child(4n + 1) {
  grid-column: span 5;
}
.portfolio-grid .portfolio-item:nth-child(4n + 2) {
  grid-column: span 7;
}
.portfolio-grid .portfolio-item:nth-child(4n + 2) .index-carousel {
  margin-top: 48px;
}
.portfolio-grid .index-caption p:empty {
  display: none;
}
.portfolio-grid .project figcaption {
  margin-top: 12px;
  padding-top: 10px;
}
.gallery-photo figcaption {
  font-size: 12px;
  color: var(--ink);
  line-height: 1.7;
  padding-top: 12px;
}
.gallery-photo figcaption > span:first-child {
  max-width: 100%;
}
.gallery-expand {
  opacity: 1;
  transform: none;
  cursor: zoom-in;
}
.editorial-gallery {
  display: block;
}
.photo-viewer figcaption {
  font-size: 13px;
}
@media (max-width: 600px) {
  body[data-stage="portfolio"] .portfolio {
    padding-inline: 12px;
    padding-top: 30px;
  }
  .portfolio-grid .portfolio-item:nth-child(n) {
    margin: 0 0 32px;
  }
  .portfolio-grid .portfolio-item:nth-child(n) .index-carousel {
    margin: 0;
  }
  .gallery-photo figcaption {
    font-size: 12px;
  }
  .portfolio-grid h2 {
    font-size: 24px;
  }
  .portfolio-grid .index-caption p {
    font-size: 12px;
  }
}
/* Dynamic gallery v1: all geometry computed from intrinsic dimensions, no crops. */
.auto-gallery-cover {
  max-width: var(--cover-max);
  margin-inline: auto;
}
.auto-gallery-cover .detail-cover {
  max-width: 100%;
}
.auto-gallery-row {
  display: grid;
  grid-template-columns: var(--row-columns);
  max-width: var(--row-max);
  gap: 24px;
  margin: 0 auto 44px;
  align-items: start;
}
.auto-gallery-row .gallery-photo {
  width: 100%;
  max-width: var(--photo-max);
  margin: 0;
  min-width: 0;
}
.auto-gallery-row .gallery-open img {
  width: 100%;
  height: auto;
  object-fit: contain;
}
@media (max-width: 600px) {
  .auto-gallery-row {
    display: flex;
    flex-direction: column;
    gap: 28px;
    margin-bottom: 28px;
  }
  .auto-gallery-row .gallery-photo {
    align-self: center;
  }
  .auto-gallery-row .gallery-photo img {
    height: auto;
  }
}
