/*
 * GANTSEV LAYOUT FIX V142
 * 1. Центрирование заголовка «Наши направления».
 * 2. Проектная галерея по две фотографии в ряд без растягивания одного кадра.
 */

.gsv142-directions-heading {
  width: min(100%, 980px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 20px !important;
  padding-right: 20px !important;
  box-sizing: border-box !important;
  text-align: center !important;
}

.gsv142-directions-heading > *,
.gsv142-directions-heading h1,
.gsv142-directions-heading h2,
.gsv142-directions-heading h3,
.gsv142-directions-heading p {
  margin-left: auto !important;
  margin-right: auto !important;
  text-align: center !important;
}

.gsv142-directions-heading h1,
.gsv142-directions-heading h2,
.gsv142-directions-heading h3 {
  max-width: 900px !important;
}

.gsv142-directions-heading p {
  max-width: 760px !important;
}

/*
 * Применяем сетку только к найденной JS проектной галерее.
 * DOM и обработчики открытия фото не заменяются.
 */
.gsv142-project-gallery {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: clamp(12px, 1.25vw, 22px) !important;
  width: 100% !important;
  max-width: none !important;
  align-items: stretch !important;
}

.gsv142-project-gallery > * {
  grid-column: auto !important;
  grid-row: auto !important;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

/* Убираем особый первый растянутый кадр. */
.gsv142-project-gallery > :first-child,
.gsv142-project-gallery > [class*="wide"],
.gsv142-project-gallery > [class*="large"],
.gsv142-project-gallery > [class*="featured"],
.gsv142-project-gallery > [class*="hero"] {
  grid-column: auto !important;
  grid-row: auto !important;
}

/* Изображения одинаковой аккуратной пропорции. */
.gsv142-project-gallery img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 4 / 3 !important;
  min-height: 0 !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

/* Если картинка обёрнута ссылкой или кнопкой. */
.gsv142-project-gallery a,
.gsv142-project-gallery button,
.gsv142-project-gallery figure,
.gsv142-project-gallery picture {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.gsv142-project-gallery picture img,
.gsv142-project-gallery a > img,
.gsv142-project-gallery button > img,
.gsv142-project-gallery figure > img {
  height: 100% !important;
}

/* Счётчики и иконки поверх фотографии сохраняются. */
.gsv142-project-gallery [class*="counter"],
.gsv142-project-gallery [class*="zoom"],
.gsv142-project-gallery [data-gallery-counter],
.gsv142-project-gallery [data-zoom] {
  position: absolute;
  z-index: 4;
}

@media (max-width: 760px) {
  .gsv142-directions-heading {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .gsv142-project-gallery {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .gsv142-project-gallery img {
    aspect-ratio: 4 / 3 !important;
  }
}
