Refactor the bunting

This makes the bunting checks clearer and better tested, and adds a "bunted" class to the wrapper div when bunting is present on the page.