.brand-section {
  padding: 40px 0;
}

.brand-container {
  display: flex;
  gap: 20px; /* Відступ між зеленим блоком і картками */
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 20px;
}

.brand-grid {
  display: grid;
  flex-grow: 1; /* Займає все місце, що залишилось справа */

  /* Тепер тут тільки 4 рівні колонки, бо CTA стоїть окремо зліва */
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 140px 140px; /* Фіксована висота рядків */
  gap: 20px;
}

.brand-cta {
  flex-shrink: 0;

  width: 330px;
  height: 300px;

  background-color: #d4ede0;
  border-radius: 20px;
  padding: 30px 25px 25px 25px;

  position: relative;
  overflow: hidden;

  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cta-title {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  color: #111;
  margin: 0;
  z-index: 2;
  position: relative;
}

.cta-image {
  position: absolute;
  left: 45%;
  transform: translateX(-50%);

  bottom: 20px;

  width: 240px;
  height: auto;

  z-index: 1;
  pointer-events: none;
}

.cta-btn {
  display: block;
  width: 100%;
  background-color: #009846;
  color: #fff;
  text-align: center;
  padding: 23px 0;
  border-radius: 15px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;

  z-index: 3;
  position: relative;
  transition: background 0.3s;
}

.brand-item {
  background: #fff;
  border-radius: 20px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 35px 55px;
  text-decoration: none;
  color: #111;
  transition: all 0.3s ease;
  height: 100%;
}

.brand-item:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  border-color: #ddd;
  background-color: #e3e3e3;
}

.cta-image.mobile {
  display: none;
}
.brand-logo-image {
  max-width: 100%;
  max-height: 100px; /* ключове обмеження */
  width: auto;
  height: auto;
  object-fit: contain;
}

@media (max-width: 1750px) {
  .brand-item {
    padding: 40px 50px;
  }
}

@media (max-width: 1600px) {
  .brand-item {
    padding: 0px 40px;
  }
}

@media (max-width: 1440px) {
  .brand-item {
    padding: 0px 20px;
  }
}

@media (max-width: 1440px) {
  .brand-grid {
    gap: 12px;
  }

  .cta-title {
    font-size: 1.75rem;
  }
}

@media (max-width: 1200px) {
  .brand-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 140px 140px;
    gap: 20px;
  }

  .brand-item:nth-child(n + 5) {
    display: none;
  }

  .brand-item {
    padding: 0 60px;
  }
}

@media (max-width: 1024px) {
  .brand-item {
    padding: 0 45px;
  }

  .brand-grid {
    gap: 12px;
  }
}

@media (max-width: 860px) {
  .brand-item {
    padding: 0 35px;
  }
}

@media (max-width: 860px) {
  .brand-item {
    padding: 0 20px;
  }
}

@media (max-width: 768px) {
  .brand-container {
    flex-direction: column;
  }

  .brand-cta {
    width: 100%;
    height: 250px;
    padding: 36px 24px 24px 24px;
  }

  .cta-title {
    width: 250px;
    font-size: 1.75rem;
  }

  .brand-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;

    grid-template-rows: repeat(4, 100px);

    gap: 20px;
  }

  .brand-item:nth-child(n + 5) {
    display: flex;
  }

  .brand-item {
    padding: 0 50px;
    height: 100%;
    border-radius: 10px;
  }

  .cta-image {
    left: auto;
    transform: none;
    right: 10px;
    bottom: 20px;

    width: 270px;
  }

  .cta-image.desktop {
    display: none;
  }

  .cta-image.mobile {
    display: block;
  }
  .brand-logo-image {
    max-height: 80px;
  }
}

@media (max-width: 620px) {
  .brand-item {
    padding: 0 40px;
  }
}

@media (max-width: 520px) {
  .cta-title {
    width: 200px;
    font-size: 1.25rem;
  }

  .brand-cta {
    height: 200px;
  }

  .cta-image {
    left: auto;
    transform: none;
    right: 10px;
    bottom: 20px;

    width: 230px;
  }
}

@media (max-width: 480px) {
  .brand-item {
    padding: 0 30px;
  }

  .brand-grid {
    gap: 8px;
    grid-template-rows: repeat(4, 70px);
  }
    .brand-logo-image {
    max-height: 50px;
  }
}

@media (max-width: 426px) {
  .brand-container {
    padding: 0 10px;
  }
  .brand-grid {
    gap: 4px;
  }
}
