https://en.wikipedia.org/wiki/Free_surface_effect
https://en.wikipedia.org/wiki/Metacentric_height
tl;dr version as I recall: keep holds either mostly full or mostly empty, make assymetric holds and tanks, and use baffles if you have no other options.