The evolution of sedimentary systems on Mars, and implications for climate in the Hesperian-Amazonian epochs