Theory of planetary atmospheres