The origin and evolution of atmospheres and oceans