.knm-gallery-wall {
  display: grid;
  gap: 28px;
  color: #171514;
}

.knm-gallery-wall__head {
  display: grid;
  gap: 10px;
  max-width: 760px;
}

.knm-gallery-wall__title,
.knm-gallery-wall__intro {
  margin: 0;
}

.knm-gallery-wall__title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 5vw, 72px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: 0;
}

.knm-gallery-wall__intro,
.knm-gallery-wall__empty {
  color: #706a63;
  font-size: 18px;
  line-height: 1.55;
}

.knm-gallery-wall__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 10px;
  grid-auto-flow: dense;
  gap: clamp(8px, 1.4vw, 16px);
}

.knm-gallery-wall__item {
  position: relative;
  grid-column: span 3;
  grid-row: span 22;
  min-width: 0;
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f0ebe3;
}

.knm-gallery-wall__item.is-feature {
  grid-column: span 6;
  grid-row: span 36;
}

.knm-gallery-wall__item.is-wide {
  grid-column: span 6;
  grid-row: span 24;
}

.knm-gallery-wall__item.is-tall,
.knm-gallery-wall__item.is-portrait:not(.is-feature) {
  grid-column: span 3;
  grid-row: span 34;
}

.knm-gallery-wall__trigger {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.knm-gallery-wall__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease, filter 220ms ease;
}

.knm-gallery-wall__trigger:hover .knm-gallery-wall__image,
.knm-gallery-wall__trigger:focus .knm-gallery-wall__image {
  transform: scale(1.035);
  filter: saturate(1.04) contrast(1.02);
}

.knm-gallery-wall__trigger:focus {
  outline: 3px solid #df6b54;
  outline-offset: -3px;
}

.knm-gallery-wall__caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 16px;
  background: linear-gradient(0deg, rgba(23, 21, 20, 0.78), transparent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.knm-gallery-wall__item:hover .knm-gallery-wall__caption,
.knm-gallery-wall__item:focus-within .knm-gallery-wall__caption {
  opacity: 1;
  transform: translateY(0);
}

.knm-gallery-wall-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  place-items: center;
  padding: clamp(16px, 4vw, 42px);
  background: rgba(16, 14, 13, 0.92);
  color: #ffffff;
}

.knm-gallery-wall-lightbox.is-open {
  display: grid;
}

.knm-gallery-wall-lightbox__figure {
  display: grid;
  gap: 14px;
  max-width: min(1180px, 100%);
  max-height: 100%;
  margin: 0;
}

.knm-gallery-wall-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: calc(100svh - 150px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: #211d1b;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
}

.knm-gallery-wall-lightbox__caption {
  min-height: 1.4em;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.knm-gallery-wall-lightbox__button {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
}

.knm-gallery-wall-lightbox__button:hover,
.knm-gallery-wall-lightbox__button:focus {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
}

.knm-gallery-wall-lightbox__button--close {
  top: 18px;
  right: 18px;
}

.knm-gallery-wall-lightbox__button--previous {
  top: 50%;
  left: 18px;
  transform: translateY(-50%);
}

.knm-gallery-wall-lightbox__button--next {
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
}

body.knm-gallery-wall-lightbox-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .knm-gallery-wall__item,
  .knm-gallery-wall__item.is-tall,
  .knm-gallery-wall__item.is-portrait:not(.is-feature) {
    grid-column: span 4;
    grid-row: span 24;
  }

  .knm-gallery-wall__item.is-feature,
  .knm-gallery-wall__item.is-wide {
    grid-column: span 8;
    grid-row: span 28;
  }
}

@media (max-width: 640px) {
  .knm-gallery-wall__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
  }

  .knm-gallery-wall__item,
  .knm-gallery-wall__item.is-feature,
  .knm-gallery-wall__item.is-wide,
  .knm-gallery-wall__item.is-tall,
  .knm-gallery-wall__item.is-portrait:not(.is-feature) {
    grid-column: span 1;
    grid-row: auto;
    aspect-ratio: 1 / 1.22;
  }

  .knm-gallery-wall__item.is-feature {
    grid-column: 1 / -1;
    aspect-ratio: 4 / 3;
  }

  .knm-gallery-wall__caption {
    display: none;
  }

  .knm-gallery-wall-lightbox__button--previous,
  .knm-gallery-wall-lightbox__button--next {
    top: auto;
    bottom: 18px;
    transform: none;
  }

  .knm-gallery-wall-lightbox__image {
    max-height: calc(100svh - 170px);
  }
}
