Chemically mediated competition, herbivory, and the structure of coral reefs