﻿/* ===== 1. Родительская строка ===== */
.row:has(.manafactures) {
  /* display: flex; */
  flex-wrap: wrap;
  align-items: stretch;
  margin: -5px;
  padding: 0;
}

/* ===== 2. Карточка ===== */
.manafactures {
  flex: 0 0 calc(25% - 10px);
  max-width: calc(25% - 10px);
  margin: 5px !important;
  padding: 20px 15px !important;
  align-self: stretch;

  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid #f0f0f0;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;

  min-height: 260px; /* ваше новое значение */
  box-sizing: border-box;

  /* Защита от вылезания содержимого */
  overflow: hidden;
}

.manafactures:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  border-color: #d0d0d0;
}

/* ===== 3. Логотип ===== */
.manafactures img.img-responsive {
  max-width: 140px;
  max-height: 140px;
  width: auto;
  height: auto;
  margin-bottom: 15px;
  object-fit: contain;
  transition: transform 0.2s;
  display: block;
}

.manafactures:hover img.img-responsive {
  transform: scale(1.04);
}

/* Скрываем битые картинки */
.manafactures img.img-responsive[src=""],
.manafactures img.img-responsive[src="#"] {
  display: none;
}

/* ===== 4. Название бренда (вторая ссылка) – уменьшаем шрифт и улучшаем перенос ===== */
.manafactures a:last-child {
  display: block;
  font-size: 14px;          /* было 18px – уменьшили */
  /* font-weight: 600; */
  color: #1a1a1a;
  text-decoration: none;
  text-align: center;
  line-height: 1.3;
  max-width: 100%;
  margin-top: 6px;
  transition: color 0.2s;

  /* Жёсткий контроль переноса */
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.manafactures a:last-child:hover {
  color: #e85a2c;
  text-decoration: underline;
}

/* ===== 5. Заглушка "первая буква" для карточек без логотипа ===== */
/* Будет показана, если у карточки есть класс .no-logo (добавляется JS) */
.manafactures.no-logo::before {
  content: attr(data-initial);  /* берём первую букву из data-атрибута */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background:rgb(0 75 127 / 45%);
  font-size: 85px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 15px;
  flex-shrink: 0;
}

/* Если есть логотип – заглушку не показываем */
.manafactures:not(.no-logo)::before {
  display: none;
}

/* ===== 6. Адаптивность ===== */
@media (max-width: 991px) and (min-width: 768px) {
  .manafactures {
    flex: 0 0 calc(50% - 10px);
    max-width: calc(33% - 10px);
  }
}

@media (max-width: 767px) {
  .manafactures {
    flex: 0 0 100%;
    max-width: 100%;
    margin: 5px !important;
    min-height: 220px;
    padding: 18px 12px !important;
    max-width: calc(50% - 10px);
  }
  .manafactures img.img-responsive {
    max-width: 100px;
    max-height: 100px;
  }
  .manafactures a:last-child {
    font-size: 14px;
  }
  .manafactures.no-logo::before {
    width: 80px;
    height: 80px;
    font-size: 36px;
  }
}

@media (max-width: 480px) {
  .manafactures {
    padding: 15px 10px !important;
    min-height: 180px;
    max-width: calc(100% - 10px);
  }
  .manafactures img.img-responsive {
    max-width: 80px;
    max-height: 80px;
  }
  .manafactures a:last-child {
    font-size: 13px;
  }
  .manafactures.no-logo::before {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }
}