.gallery-main {
  width: min(var(--max), calc(100% - var(--gutter)));
  margin: 0 auto;
  padding-top: 154px;
}

.gallery-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.gallery-heading h1 {
  margin: 0;
}

.gallery-heading > p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.gallery-page .section-kicker {
  letter-spacing: 0;
}

.photo-gallery {
  columns: 3;
  column-gap: 24px;
}

.gallery-photo {
  min-width: 0;
  margin: 0 0 32px;
  break-inside: avoid;
}

.gallery-image-link {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--line);
  cursor: zoom-in;
}

.gallery-image-link img {
  width: 100%;
  height: auto;
  transition: filter 180ms ease;
}

.gallery-image-link:hover img {
  filter: brightness(1.04);
}

.gallery-expand {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid hsla(0, 0%, 100%, 0.45);
  color: var(--white);
  background: hsla(212, 24%, 10%, 0.75);
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 24px;
}

.gallery-image-link:focus-visible {
  outline: 3px solid var(--wine);
  outline-offset: 4px;
}

.gallery-photo figcaption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.gallery-photo figcaption span:last-child {
  color: var(--brass-2);
  font-variant-numeric: tabular-nums;
}

.gallery-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-top: 72px;
  padding: 48px 0 64px;
  border-top: 1px solid var(--line);
}

.gallery-contact h2 {
  margin-bottom: 12px;
}

.gallery-contact p:last-child {
  max-width: 480px;
  margin-bottom: 0;
  color: var(--muted);
}

.gallery-contact .button {
  flex-shrink: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html.gallery-viewer-open {
  overflow: hidden;
  scrollbar-gutter: stable;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 16px 24px;
  border: 0;
  color: var(--white);
  background: hsl(210, 10%, 7%);
}

.gallery-lightbox[open] {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 48px;
  gap: 16px;
}

.gallery-lightbox::backdrop {
  background: hsl(210, 10%, 7%);
}

.lightbox-toolbar,
.lightbox-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.lightbox-count {
  margin: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.lightbox-control {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid hsl(210, 6%, 44%);
  border-radius: 4px;
  color: var(--white);
  background: transparent;
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 28px;
  cursor: pointer;
  touch-action: manipulation;
}

.lightbox-control:hover {
  background: hsl(210, 8%, 20%);
}

.lightbox-control:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 3px;
}

.lightbox-figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.lightbox-image {
  align-self: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  touch-action: pan-y pinch-zoom;
}

.lightbox-caption {
  color: hsl(210, 5%, 82%);
  font-size: 14px;
  text-align: center;
}

.lightbox-navigation {
  justify-content: center;
}

@media (max-width: 1050px) {
  .photo-gallery {
    columns: 2;
  }
}

@media (max-width: 760px) {
  .gallery-main {
    padding-top: 126px;
  }

  .gallery-heading {
    display: block;
    margin-bottom: 24px;
    padding-bottom: 24px;
  }

  .gallery-heading h1 {
    margin-bottom: 20px;
    font-size: 46px;
  }

  .photo-gallery {
    columns: 1;
  }

  .gallery-photo {
    margin-bottom: 28px;
  }

  .gallery-contact {
    display: block;
    margin-top: 40px;
    padding: 32px 0 48px;
  }

  .gallery-contact .button {
    margin-top: 24px;
  }

  .gallery-lightbox {
    padding: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-image-link img {
    transition: none;
  }
}
