.gallery-intro {
  margin-bottom: 64px;
  text-align: center;
}

.gallery-heading {
  max-width: 760px;
  margin: 0 auto 30px;
}

.gallery-category-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  width: min(100%, 900px);
  margin: 0 auto;
}

.gallery-category-nav a {
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 12px 16px;
  border: 2px solid var(--gold);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(190, 135, 72, .28), rgba(88, 53, 28, .34));
  box-shadow: 0 8px 20px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .08);
  color: var(--gold-2);
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .1em;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}

.gallery-category-nav a:hover,
.gallery-category-nav a:focus-visible {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 10px 24px rgba(0, 0, 0, .3);
  color: #160e08;
  transform: translateY(-3px);
}

.gallery-category {
  scroll-margin-top: 24px;
  margin-bottom: 76px;
  padding-top: 10px;
}

.gallery-category + .gallery-category {
  border-top: 1px solid var(--line);
  padding-top: 58px;
}

.gallery-category-empty {
  margin-bottom: 24px;
}

.gallery-category-heading {
  max-width: 720px;
  margin: 0 auto 30px;
  text-align: center;
}

.gallery-category-empty .gallery-category-heading {
  margin-bottom: 0;
}

.gallery-category-heading h2 {
  margin: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 220px));
  justify-content: center;
  align-items: stretch;
  gap: 24px;
  max-width: 952px;
  margin: 0 auto;
}

.gallery-grid-single {
  grid-template-columns: minmax(190px, 220px);
}

.gallery-card {
  position: relative;
  width: 100%;
  min-width: 0;
}

.gallery-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #1b130e;
  cursor: zoom-in;
  transition: transform .2s ease, filter .2s ease;
}

.gallery-card img:hover {
  filter: brightness(1.08);
  transform: scale(1.015);
}

.gallery-card img:focus-visible {
  outline: 3px solid var(--gold-2);
  outline-offset: 4px;
}

.gallery-card .gallery-card-copy {
  display: grid;
  place-items: center;
  min-height: 68px;
  padding: 14px 14px 16px;
  text-align: center;
}

.gallery-card-copy h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.deferred-gallery-image {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.deferred-gallery-image.is-loaded {
  opacity: 1;
}

.gallery-card.image-error::after {
  content: "Photo unavailable";
  position: absolute;
  inset: 0 0 auto;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  padding: 20px;
  color: var(--muted);
  background: var(--panel);
  font-family: Arial, sans-serif;
  text-align: center;
}

body.lightbox-open {
  overflow: hidden;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  grid-template-columns: minmax(52px, 1fr) minmax(0, auto) minmax(52px, 1fr);
  align-items: center;
  justify-items: center;
  padding: 72px 24px 28px;
  background: rgba(7, 5, 4, .94);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}

.gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.gallery-lightbox-figure {
  grid-column: 2;
  display: grid;
  gap: 14px;
  max-width: 92vw;
  max-height: calc(100vh - 100px);
  margin: 0;
  text-align: center;
}

.gallery-lightbox-image {
  display: block;
  width: auto;
  max-width: min(86vw, 1400px);
  height: auto;
  max-height: calc(100vh - 150px);
  margin: auto;
  border-radius: 10px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .65);
  object-fit: contain;
}

.gallery-lightbox-caption {
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: clamp(15px, 2vw, 20px);
  font-weight: 700;
  line-height: 1.3;
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(20, 15, 12, .76);
  color: #fff;
  cursor: pointer;
  font-family: Arial, sans-serif;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-close:focus-visible,
.gallery-lightbox-nav:hover,
.gallery-lightbox-nav:focus-visible {
  border-color: var(--gold-2);
  background: rgba(88, 53, 28, .95);
  outline: none;
  transform: scale(1.06);
}

.gallery-lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 34px;
  line-height: 1;
}

.gallery-lightbox-nav {
  width: 52px;
  height: 72px;
  border-radius: 12px;
  font-size: 52px;
  line-height: 1;
}

.gallery-lightbox-prev {
  grid-column: 1;
  justify-self: end;
  margin-right: 18px;
}

.gallery-lightbox-next {
  grid-column: 3;
  justify-self: start;
  margin-left: 18px;
}

@media (max-width: 760px) {
  .gallery-category-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-width: 520px;
  }
}

@media (max-width: 620px) {
  .gallery-intro {
    margin-bottom: 48px;
  }

  .gallery-heading {
    margin-bottom: 22px;
  }

  .gallery-category-nav {
    gap: 8px;
  }

  .gallery-category-nav a {
    min-height: 48px;
    padding: 10px 8px;
    border-width: 1px;
    border-radius: 8px;
    font-size: clamp(10px, 3vw, 12px);
    letter-spacing: .06em;
  }

  .gallery-category {
    margin-bottom: 58px;
  }

  .gallery-category + .gallery-category {
    padding-top: 44px;
  }

  .gallery-category-empty {
    margin-bottom: 18px;
  }

  .gallery-grid,
  .gallery-grid-single {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-width: none;
  }

  .gallery-grid-single .gallery-card {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: 220px;
  }

  .gallery-card .gallery-card-copy {
    min-height: 62px;
    padding: 11px 8px 13px;
  }

  .gallery-card-copy h3 {
    font-size: clamp(13px, 3.8vw, 16px);
    line-height: 1.2;
  }

  .gallery-lightbox {
    grid-template-columns: 1fr 1fr;
    align-content: center;
    padding: 64px 12px 18px;
  }

  .gallery-lightbox-figure {
    grid-column: 1 / -1;
    grid-row: 1;
    max-width: 96vw;
  }

  .gallery-lightbox-image {
    max-width: 94vw;
    max-height: calc(100vh - 180px);
    border-radius: 7px;
  }

  .gallery-lightbox-prev,
  .gallery-lightbox-next {
    grid-row: 2;
    width: 58px;
    height: 48px;
    margin: 12px 0 0;
    font-size: 42px;
  }

  .gallery-lightbox-prev {
    grid-column: 1;
    justify-self: end;
    margin-right: 8px;
  }

  .gallery-lightbox-next {
    grid-column: 2;
    justify-self: start;
    margin-left: 8px;
  }

  .gallery-lightbox-close {
    top: 10px;
    right: 12px;
    width: 44px;
    height: 44px;
    font-size: 30px;
  }
}
