/**
 * Карточки статей [fs_latest_posts]: показываем обложку целиком (без crop как у cover).
 */

.fs-posts-grid {
  display: grid;
  gap: 1rem;
}

.fs-post {
  display: flex;
  flex-direction: column;
  gap: 0;
  /* Не растягивать превью по высоте строки сетки */
  align-items: stretch;
}

/* Контейнер превью: высота строго по картинке.
   На сайте в «Доп. CSS» задано aspect-ratio 4/3 и 16/10 — из‑за этого при object-fit:contain остаётся пустота. */
.fs-post-thumb {
  display: block;
  width: 100%;
  margin: 0 0 0.5rem;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #f3f4f7;
  line-height: 0;
  min-height: 0 !important;
  height: auto !important;
  aspect-ratio: auto !important;
  align-self: flex-start;
}

.fs-post-body {
  margin: 0;
  padding: 0;
}

.fs-post-body .fs-post-meta {
  margin: 0 0 0.25rem;
  line-height: 1.2;
}

.fs-post-body h3 {
  margin: 0 0 0.4rem;
  line-height: 1.25;
}

.fs-post-body p {
  margin: 0 0 0.5rem;
}

/* Перебиваем глобальные правила с object-fit: cover, если они есть */
.fs-site .fs-post-thumb img,
.fs-post .fs-post-thumb img,
.fs-post-thumb img {
  width: 100%;
  height: auto !important;
  max-height: 340px;
  object-fit: contain !important;
  object-position: center;
  display: block;
  vertical-align: middle;
}

/* Вариант сетки .fs-grid--blog / .fs-homeBlogGrid (Доп. CSS задаёт aspect-ratio 16/10 + cover) */
.fs-homeBlogGrid .fs-post__img,
.fs-grid--blog .fs-post__img,
.fs-post__img {
  display: block;
  width: 100%;
  margin: 0 0 0.5rem;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #f3f4f7;
  line-height: 0;
  min-height: 0 !important;
  height: auto !important;
  aspect-ratio: auto !important;
  align-self: flex-start;
}

.fs-homeBlogGrid .fs-post__img img,
.fs-grid--blog .fs-post__img img,
.fs-post__img img {
  width: 100%;
  height: auto !important;
  object-fit: contain !important;
  object-position: center;
  display: block;
}

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

  .fs-site .fs-post-thumb img,
  .fs-post .fs-post-thumb img,
  .fs-post-thumb img {
    max-height: 280px;
  }

  .fs-homeBlogGrid .fs-post__img img,
  .fs-grid--blog .fs-post__img img,
  .fs-post__img img {
    max-height: 280px;
  }
}

/* Мобильный брейкпоинт Доп. CSS: .fs-post-thumb { aspect-ratio: 16/10 } */
@media (max-width: 767px) {
  .fs-post-thumb,
  .fs-homeBlogGrid .fs-post__img,
  .fs-grid--blog .fs-post__img {
    aspect-ratio: auto !important;
  }
}
