Habitability Through Time: Photochemistry and Aerosols of Planetary Atmospheres