Sedimentary carbonate record of calcium-magnesium cycling