check the popup height against the viewport height
move the popup vertically to fit in the viewport
if the popup is really tall and user has increased zoom settings,
it's possible it is too tall to fit, in this case stick it to the
top and let it clip at the bottom of viewport
also use a little gap, looks nicer than having the popup stick
exactly on the edge of the viewport