.photo-bridge {
  display: none;
}

html.has-photo-bridge .photo-bridge {
  display: block;
}

.photo-bridge__grid {
  pointer-events: none;
}

.photo-bridge__column-wrap,
.photo-bridge__column {
  will-change: transform;
}

.photo-bridge__column {
  display: grid;
}

.photo-bridge__item {
  position: relative;
  margin: 0;
  overflow: hidden;
}

.photo-bridge__item img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
}

/* Costura: photographic traces remain over the film until Matter covers them. */

html.has-photo-bridge .opening-sequence {
  --opening-extent: 300svh;
}

.photo-bridge--costura {
  position: absolute;
  z-index: 3;
  inset: 0;
  overflow: hidden;
}

.photo-bridge--costura .photo-bridge__backdrop {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: #164220;
  opacity: var(--bridge-matte-opacity, 0);
  will-change: opacity;
}

.photo-bridge--costura .photo-bridge__handoff {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: #f9f6f2;
  transform: translate3d(0, var(--bridge-handoff-y, 102%), 0);
  will-change: transform;
}

.photo-bridge--costura .photo-bridge__grid {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 112vw;
  gap: clamp(12px, 1.8vw, 28px);
  opacity: var(--bridge-columns-opacity, 0);
  transform: translate(-50%, -50%);
  will-change: opacity;
}

.photo-bridge--costura .photo-bridge__column {
  gap: clamp(18px, 2vw, 32px);
}

.photo-bridge--costura .photo-bridge__column-wrap:nth-child(2) {
  margin-top: -18vh;
}

.photo-bridge--costura .photo-bridge__item {
  aspect-ratio: 4 / 5;
  border-radius: clamp(14px, 2.2vw, 34px);
  background: rgba(249, 246, 242, 0.12);
}

.photo-bridge--costura .photo-bridge__item:nth-child(3n + 2) {
  aspect-ratio: 1 / 1;
}

.photo-bridge--costura .photo-bridge__item:nth-child(4n) {
  aspect-ratio: 5 / 6;
}

/* VibeCurb: the same motion becomes a strict, numbered atelier index. */

.photo-bridge--vibecurb {
  position: relative;
  height: 190svh;
  overflow: clip;
  background: #164220;
}

.photo-bridge--vibecurb .photo-bridge__sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  background: #164220;
}

.photo-bridge--vibecurb .photo-bridge__surface {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: #f9f6f2;
  transform: translate3d(0, var(--bridge-surface-y, 102%), 0);
  will-change: transform;
}

.photo-bridge--vibecurb .photo-bridge__folio {
  position: absolute;
  z-index: 3;
  top: clamp(18px, 3vw, 42px);
  right: var(--gutter);
  left: var(--gutter);
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 14px;
  border: 1px solid rgba(44, 24, 16, 0.24);
  background: #f9f6f2;
  color: #2c1810;
  font-size: 0.61rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.photo-bridge--vibecurb .photo-bridge__grid {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(calc(100% - (var(--gutter) * 2)), 1600px);
  gap: 1px;
  padding: 1px;
  background: rgba(44, 24, 16, 0.24);
  opacity: var(--bridge-opacity, 0);
  transform: translate(-50%, -50%);
}

.photo-bridge--vibecurb .photo-bridge__column {
  gap: 1px;
}

.photo-bridge--vibecurb .photo-bridge__column-wrap {
  min-width: 0;
  background: rgba(44, 24, 16, 0.24);
}

.photo-bridge--vibecurb .photo-bridge__column-wrap:nth-child(2) {
  margin-top: -14vh;
}

.photo-bridge--vibecurb .photo-bridge__item {
  display: grid;
  grid-template-rows: minmax(210px, 31vh) 42px;
  background: #f9f6f2;
}

.photo-bridge--vibecurb .photo-bridge__item:nth-child(3n + 2) {
  grid-template-rows: minmax(180px, 26vh) 42px;
}

.photo-bridge--vibecurb .photo-bridge__item:nth-child(4n) {
  grid-template-rows: minmax(230px, 36vh) 42px;
}

.photo-bridge--vibecurb .photo-bridge__item figcaption {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 0 12px;
  color: #2c1810;
  font-size: 0.56rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.photo-bridge--vibecurb .photo-bridge__item figcaption span:last-child {
  justify-self: end;
  color: #75645c;
}

html[data-motion="off"].has-photo-bridge .photo-bridge--costura {
  display: none;
}

html[data-motion="off"].has-photo-bridge .opening-sequence {
  --opening-extent: 170svh;
}

@media (max-width: 820px) {
  html.has-photo-bridge .opening-sequence {
    --opening-extent: 240svh;
  }

  html[data-motion="off"].has-photo-bridge .opening-sequence {
    --opening-extent: 140svh;
  }

  .photo-bridge--costura .photo-bridge__grid {
    width: 142vw;
    gap: 12px;
  }

  .photo-bridge--costura .photo-bridge__column {
    gap: 16px;
  }

  .photo-bridge--vibecurb {
    height: 165svh;
  }

  .photo-bridge--vibecurb .photo-bridge__grid {
    width: 118vw;
  }
}

@media (max-width: 620px) {
  .photo-bridge--costura .photo-bridge__grid {
    width: 162vw;
  }

  .photo-bridge--costura .photo-bridge__item {
    border-radius: 16px;
  }

  .photo-bridge--vibecurb {
    height: 150svh;
  }

  .photo-bridge--vibecurb .photo-bridge__folio {
    right: 20px;
    left: 20px;
    font-size: 0.52rem;
  }

  .photo-bridge--vibecurb .photo-bridge__grid {
    width: 138vw;
  }

  .photo-bridge--vibecurb .photo-bridge__item {
    grid-template-rows: minmax(180px, 29vh) 38px;
  }

  .photo-bridge--vibecurb .photo-bridge__item figcaption {
    padding-inline: 8px;
    font-size: 0.48rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.has-photo-bridge .photo-bridge {
    display: none;
  }

  html.has-photo-bridge .opening-sequence {
    --opening-extent: 140svh;
  }
}
