Try adding flex-wrap: wrap to both the .primary-container and .secondary-container
.primary-container { flex: 1 1 33.33333%; display: flex; flex-wrap: wrap;}.secondary-container { display: flex; flex: 1 1 66.66666%; flex-wrap: wrap;}
This should allow the child elements to wrap onto new lines when there is not enough space available in the row.