The chemistry of the great extinction