responsive overlays

This refactors overlays to be more responsive. Please note that this will not work correctly without #779.