Improvements to the permalinks UI

Closes #4454

* Relies on Flexbox more heavily
* Adds JS to simulate how it should work