.gallery-page {
  min-width: 0;
}

.gallery-hero {
  padding: 130px 0 44px;
  background:
    radial-gradient(circle at 18% 15%, rgba(249, 115, 22, .2), transparent 360px),
    radial-gradient(circle at 88% 5%, rgba(139, 92, 246, .17), transparent 420px);
}

.gallery-hero h1 {
  max-width: 820px;
  font-size: clamp(34px, 7vw, 64px);
  overflow-wrap: anywhere;
}

.gallery-lead {
  max-width: 720px;
  margin-top: 22px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.gallery-content {
  padding: 30px 0 110px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.photo-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .3);
}

.photo-card__button {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: none;
  cursor: zoom-in;
  overflow: hidden;
}

.photo-card__button picture {
  display: block;
}

.photo-card img {
  width: 100%;
  height: 310px;
  object-fit: cover;
  transition: transform .45s ease;
}

.photo-card figcaption {
  min-height: 76px;
  padding: 15px 16px;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
}

.photo-card__button:hover img,
.photo-card__button:focus-visible img {
  transform: scale(1.055);
}

.photo-card__button:focus-visible,
.gallery-dialog__close:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: -3px;
}

.gallery-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 40px;
  padding: 28px;
  border: 1px solid rgba(249, 115, 22, .26);
  border-radius: 20px;
  background: rgba(249, 115, 22, .06);
}

.gallery-cta p {
  font-family: var(--font-head);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 800;
}

.gallery-dialog {
  width: min(94vw, 1100px);
  max-width: 1100px;
  max-height: 92vh;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

.gallery-dialog[open] {
  display: grid;
  place-items: center;
}

.gallery-dialog::backdrop {
  background: rgba(3, 5, 13, .9);
  backdrop-filter: blur(6px);
}

.gallery-dialog__image {
  display: block;
  max-width: 94vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  border-radius: 16px;
  object-fit: contain;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .72);
}

.gallery-dialog__close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 50%;
  color: #fff;
  background: rgba(7, 11, 26, .84);
  font: 400 32px/1 var(--font-body);
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1000px) {
  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .gallery-hero {
    padding-top: 112px;
  }

  .gallery-content {
    padding-bottom: 76px;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .photo-card {
    border-radius: 11px;
  }

  .photo-card img {
    height: 220px;
  }

  .photo-card figcaption {
    min-height: 68px;
    padding: 11px 10px;
    font-size: .74rem;
  }

  .gallery-cta {
    flex-direction: column;
    align-items: stretch;
    padding: 22px 16px;
    text-align: center;
  }

  .gallery-cta .btn {
    justify-content: center;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo-card img {
    transition: none;
  }
}
