This one was definitely harder than expected. I won't say too much about it, but one trick I will mention is that Firefox developers released a new set of css commands including one called grid-template-rows: masonry. It will be supported by major browsers in the near future. Do what you will with that information. It might save you some development time.