Average speed declines with increasing atomic mass. A small fraction of the atoms in a gas move much faster than the average speed. Atoms can't escape from the lower parts of the atmosphere of a planet because they collide with other particles after traveling a short distance. In the thin outer atmosphere, however, a rapidly moving atom is unlikely to collide and be reflected back by another atom before escaping. Density is the mass of gas per unit volume.
Gas pressure is the force per unit area exerted by the gas.
Gas pressure is proportional to the product of density and temperature. Hydrostatic equilibrium occurs when the decrease of gas pressure with height balances the downward pull of gravity. Pressure falls gradually with height until the atmosphere blends into interplanetary space. A blackbody is one that absorbs all of the electromagnetic radiation that falls on it. A heated blackbody emits electromagnetic radiation at the maximum rate possible for a body of a given temperature and size.