Ecology shapes the evolutionary trade-off between predator avoidance and defence in coral reef butterflyfishes.