New Zealand votes to legalise same-sex marriage