Считайте элементы с помощью CSS, если у вас есть только 2 - не более или меньше
.cards-row:first-child:nth-last-child(2),
.cards-row:first-child:nth-last-child(2) ~ .cards-row{
margin-bottom: 2.2rem;
}
Matt Miller