.kf-gallery {
  padding-bottom: 3rem;
  margin-top: 2rem;
}

.kf-gallery__h1 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.75rem, 2.5vw, 2.25rem);
  font-weight: 700;
}

.kf-gallery__lead {
  max-width: 42rem;
  margin: 0 auto 2rem;
  color: #555;
  font-size: 1.05rem;
  line-height: 1.5;
}

.kf-gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .kf-gallery__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 1200px) {
  .kf-gallery__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.kf-gallery__item {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #f3f3f3;
  cursor: pointer;
  overflow: hidden;
  line-height: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.kf-gallery__item:hover,
.kf-gallery__item:focus-visible {
  opacity: 0.92;
  transform: translateY(-1px);
  outline: none;
}

.kf-gallery__item img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  vertical-align: middle;
}

.kf-gallery__empty {
  padding: 2rem 0 3rem;
  color: #666;
}

.kf-gallery__pagination {
  margin-top: 2rem;
}

.kf-gallery__pagination .page-link {
  color: #1a1a1a;
}

.kf-gallery__pagination .page-item.active .page-link {
  background-color: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

.kf-gallery__pagination .page-item.disabled .page-link {
  color: #999;
}

.kf-gallery-modal__content {
  background: #111;
  color: #fff;
}

.kf-gallery-modal__content .btn-close {
  filter: invert(1);
}

.kf-gallery-modal__body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  padding: 0.5rem 3rem 1rem;
}

.kf-gallery-modal__img {
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.kf-gallery-modal__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.kf-gallery-modal__nav:hover,
.kf-gallery-modal__nav:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  outline: none;
}

.kf-gallery-modal__nav--prev {
  left: 0.5rem;
}

.kf-gallery-modal__nav--next {
  right: 0.5rem;
}

.kf-gallery-modal__caption {
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
}

@media (max-width: 575.98px) {
  .kf-gallery-modal__body {
    padding: 0.5rem 2.25rem 1rem;
  }

  .kf-gallery-modal__nav {
    width: 2rem;
    height: 2rem;
    font-size: 1.35rem;
  }
}
