Justice Brett Kavanaugh and a lawyer for the city of Philadelphia sparred Wednesday at the U.S. Supreme Court, where the justices spent more than an hour examining whether a nondiscrimination provision in a foster parent program violates the rights of a religious group that is opposed to same-sex marriage.