Justices spar in latest clash of religion and gay rights