/* House model galleries. Used with /assets/house-gallery.js. */
.house-gallery {
  margin: 24px 0 30px;
}

.house-gallery h2 {
  margin: 0 0 6px;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.2;
}

.house-gallery__note {
  margin: 0 0 14px;
  color: #5a6b5f;
  font-size: 14px;
  line-height: 1.45;
}

.house-gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: start;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.house-gallery__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
}

.house-gallery__item a {
  display: block;
  overflow: hidden;
  border: 1px solid #d5ded1;
  border-radius: 12px;
  background: #eef2ea;
}

.house-gallery__item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.house-gallery__item--plan img,
.house-gallery__item--scheme img {
  box-sizing: border-box;
  aspect-ratio: 2 / 1;
  padding: 10px;
  object-fit: contain;
}

@media (min-width: 641px) {
  .house-gallery__item--plan,
  .house-gallery__item--scheme {
    grid-column: span 2;
  }
}

.house-gallery__caption {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #3f5547;
  font-size: 13px;
  line-height: 1.3;
}

.house-gallery__kind {
  display: inline-block;
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e3ebdc;
  color: #245b38;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.house-gallery__item--plan .house-gallery__kind,
.house-gallery__item--scheme .house-gallery__kind {
  background: #f3ead2;
  color: #70561e;
}

.house-gallery__item a:hover img {
  transform: scale(1.02);
}

.house-gallery__item img {
  transition: transform 0.25s ease;
}

.house-gallery__item a:focus-visible {
  outline: 3px solid #267c44;
  outline-offset: 2px;
}

.izb-gallery-dialog {
  box-sizing: border-box;
  width: min(1000px, calc(100% - 24px));
  max-height: 94dvh;
  padding: 18px;
  border: 0;
  border-radius: 14px;
  background: #f7f5ea;
  color: #193a28;
}

.izb-gallery-dialog::backdrop {
  background: rgb(13 32 23 / 82%);
}

.izb-gallery-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.izb-gallery-dialog__count {
  color: #516557;
  font-size: 14px;
}

.izb-gallery-dialog__close,
.izb-gallery-dialog__nav button {
  min-height: 44px;
  min-width: 44px;
  border: 1px solid #b9c9b9;
  border-radius: 8px;
  background: #fff;
  color: #193a28;
  font: inherit;
  cursor: pointer;
}

.izb-gallery-dialog__close {
  padding: 8px 14px;
}

.izb-gallery-dialog figure {
  margin: 0;
  text-align: center;
}

.izb-gallery-dialog img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(94dvh - 190px);
  margin: 0 auto;
  object-fit: contain;
  border-radius: 8px;
  background: #e9eee5;
}

.izb-gallery-dialog figcaption {
  margin-top: 10px;
  font-size: 15px;
}

.izb-gallery-dialog__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.izb-gallery-dialog__nav button:disabled {
  opacity: 0.45;
  cursor: default;
}

@media (max-width: 640px) {
  .house-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .house-gallery__caption {
    display: block;
    font-size: 12px;
  }

  .house-gallery__item--plan,
  .house-gallery__item--scheme {
    grid-column: 1 / -1;
  }

  .house-gallery__kind {
    margin-right: 4px;
  }

  .izb-gallery-dialog {
    padding: 12px;
  }

  .izb-gallery-dialog img {
    max-height: calc(94dvh - 210px);
  }
}

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