.project-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 1rem;
}
.project-photos a {
  display: block;
  overflow: hidden;
  border-radius: 0.85rem;
  background: #fffaf0;
  border: 1px solid var(--border-soft, #e6ded3);
}
.project-photos a:focus-visible {
  outline: 3px solid #b45309;
  outline-offset: 3px;
}
.project-photos img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.project-photos-preview {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.project-photos > p {
  grid-column: 1 / -1;
}

@media (max-width: 600px) {
  .project-photos {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .project-photos a {
    border-radius: 0.5rem;
  }

  .project-photos img {
    aspect-ratio: 1;
  }
}

.gallery-popup {
  width: max-content;
  max-width: min(94vw, 90rem);
  max-height: 94vh;
  max-height: 94dvh;
  padding: 0;
  border: 0;
  border-radius: 0.75rem;
  background: #201c1a;
  color: #fff;
}

.gallery-popup::backdrop {
  background: rgb(0 0 0 / 82%);
}

.gallery-popup img {
  display: block;
  max-width: min(94vw, 90rem);
  max-height: 94vh;
  max-height: 94dvh;
  object-fit: contain;
}

.gallery-popup button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.4rem 0.75rem;
  border: 1px solid #fff;
  border-radius: 0.5rem;
  background: #201c1a;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.gallery-popup button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.gallery-popup:not([open]) {
  display: none;
}

.gallery-popup-fallback[open] {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 0;
  background: rgb(0 0 0 / 90%);
}
