Variables for dynamic number of elements?

Variable modes are I think the designed solution for this, even though you’d have to define them beforehand. Sadly the amount is limited to 4 in a plan less than Enterprise.

Regarding the hug issue, you might be running into this known issue: "Empty" Auto Layout Frame keeps the size of last hidden child - #21 by Averyy

I’ve made an example: