Mineralogy, early marine diagenesis, and the chemistry of shallow-water carbonate sediments