.gallery-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  padding: 0 4vw 80px;
}

.gallery-card {
  background: #e7e2d8;
  min-width: 0;
}

.gallery-open {
  background: #d4d0c7;
  border: 0;
  display: block;
  height: 300px;
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.gallery-open img {
  display: block;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
  width: 100%;
}

.gallery-open:hover img,
.gallery-open:focus-visible img {
  transform: scale(1.025);
}

.gallery-card > div {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 11px 12px;
}

.gallery-card form,
.gallery-card form button {
  margin: 0;
}

.gallery-card form button {
  background: transparent;
  border: 0;
  font-weight: 700;
}

.lightbox {
  background: rgba(10, 15, 12, .97);
  border: 0;
  color: white;
  height: 100dvh;
  inset: 0;
  margin: 0;
  max-height: none;
  max-width: none;
  overflow: hidden;
  padding: 50px 70px;
  position: fixed;
  width: 100vw;
  z-index: 10000;
}

.lightbox::backdrop { background: rgba(10, 15, 12, .94); }
.lightbox[open] { display: grid; grid-template-columns: 50px 1fr 50px; place-items: center; }
.lightbox figure { height: 100%; margin: 0; min-width: 0; text-align: center; width: 100%; }
.lightbox figure img { height: calc(100% - 35px); max-width: 100%; object-fit: contain; width: 100%; }
.lightbox figcaption { font-size: 12px; padding-top: 12px; }
.lightbox button { background: transparent; border: 0; color: white; font-size: 44px; padding: 15px; }
.lightbox-close { position: absolute; right: 18px; top: 8px; }
body.lightbox-open { overflow: hidden; }

@media (max-width: 650px) {
  .gallery-grid { gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 6px 50px; }
  .gallery-open { height: 220px; }
  .lightbox { padding: 48px 8px 20px; }
  .lightbox[open] { grid-template-columns: 36px 1fr 36px; }
  .lightbox button { font-size: 34px; padding: 5px; }
}
