WASHINGTON (AP) - Wisconsin Sen. Tammy Baldwin was on the Senate floor, but her mind was on the other side of the Capitol.
The House was voting that July afternoon on Democratic legislation to protect same-sex and interracial marriages in the wake of the Supreme Court's decision to overturn the federal right to an abortion. And it was suddenly winning more Republican votes than Baldwin - or anyone else - had expected.
Baldwin, who became the first openly gay senator when she was elected a decade ago, said she was "overjoyed" as she saw the votes coming in. She excitedly walked over to Ohio Sen. Rob Portman, who was also on the Senate floor and had been one of the first Republican senators to come out in favor of same-sex marriage.
"Did you see this?" Baldwin asked, showing Portman a list of Republicans who had voted for the House bill - almost four dozen.
Portman, who had worked with her on the issue in the past, was immediately on board. "Count me in," he told her.
Along with Maine Sen. Susan Collins, who eventually led the bipartisan effort with Baldwin, the senators teamed up with Sens. Kyrsten Sinema, D-Ariz., and Thom Tillis, R-N.C., to try to find the additional Republican votes necessary to pass the Senate.
It was a monthslong effort, building on a decadeslong push, in which they implored their colleagues senator to senator, tweaked the bill to make it more appealing - without changing what it would do - and enlisted key outside allies to help. They convinced skeptical Republicans that it was a personal, not political, effort for the Democrats and that "the sky is not going to fall," Baldwin said.
Collins, who has a long record of working on gay rights issues, said the GOP support in the House was a turning point. "It both surprised and heartened me," she said, "because it suggested we could get the bill through both the House and the Senate and signed before the end of the year."
In the end, they "defied political gravity," as Baldwin puts it, and passed the Respect for Marriage Act through the Senate. When the final vote was called, they had 12 Republican supporters - two more than they needed to break the filibuster in the 50-50 Senate and pass the bill. The House gave it final passage on Thursday and sent the bill to President Joe Biden for his signature.
Along the way, the five senators - Democrats Baldwin and Sinema and Republicans Collins, Portman and Tillis - found that attitudes have changed in the decade since most Republicans were openly campaigning against gay marriage. Not only because of the 2015 Supreme Court decision that legalized same-sex marriage nationwide, but because increasing numbers of people - daughters, sons, friends, staffers - were openly gay and in relationships and marriages.
"If you look at the arc of visibility around the LGBTQ community, there's more and more people who are married to a same-sex partner and maybe raising a family with their same-sex partner," said Baldwin, who has been working on gay rights issues since she entered politics almost 40 years ago. "And in some ways, you don't want to do harm, right? And recognize how important the certainty is for these families. And I think that made a huge difference in our ability to get to a super-majority in the Senate."
Still, most Republicans weren't inclined to vote for the bill. Supporters had to find at least seven more Republicans to get to yes.
In the first weeks after the House vote, the five senators went to work to find those votes. Baldwin, who had advised House lawmakers to keep the bill simple and straightforward, says "the ink wasn't even dry on the ledger yet" when she took the list of House supporters and started to talk to members from those same states, noting that their home-state colleagues across the Capitol had supported the bill and could give them "political cover," she says.
But in talking to Republicans, they quickly found that the biggest concern was religious liberty, and whether the bill would penalize private institutions or groups that did not want to perform same-sex marriages or provide services to same-sex couples. So they started crafting an amendment to address it.
"As we talked to senators we found a real openness to the bill, but concerns about religious liberty and consciousness protections," Collins said. She said they started reaching out to some religious groups, asking what they would like to see in the bill if they were going to support it.
A main concern was that a church or organization could have its tax-exempt status revoked if it didn't perform a same-sex marriage. "That was a huge issue," Collins said.
The bill, which requires states to legally recognize same-sex marriages performed in other states, would not have done that. But Collins said the senators "wanted to make sure it was crystal clear" in the amendment that churches would not be in any way penalized or required to perform marriages. So they added language affirming the rights of religious institutions and groups while keeping the original language in the bill intact.
By November, dozens of religious groups supported the bill, including the Church of Jesus Christ of Latter-day Saints.
Utah Sen. Mitt Romney, a member of the Latter-day Saints church and one of the 12 senators who eventually supported the legislation, was involved in those early talks.
"I would not have been able to support the bill were it not for the religious liberty provisions that were added, and I pointed that out to them as they were looking to collect 11 or 12 votes," Romney said after the Senate vote.
According to Portman, Romney also pushed for a series of findings at the beginning of the bill that stated that "beliefs about the role of gender in marriage are held by reasonable and sincere people based on decent and honorable religious or philosophical premises."
Tim Schultz, the president of the advocacy group 1st Amendment Partnership, directed a coalition of religious groups supporting the bill. He says that it was clear after the first House vote that the senators and progressive advocacy groups were serious about addressing the concerns and getting the bill done, and not using it as a political wedge issue. "They didn't want a show vote in the Senate," Schultz says.
As the senators organized inside, groups of influential Republicans who were supportive organized on the outside. Key to that effort were Ken Mehlman, a former Republican National Committee chairman and campaign manager for former President George W. Bush's 2004 campaign, and a group that he is funding, Centerline.
Focusing on senators in nine states, the group conducted state polls, drove local press coverage, organized telephone campaigns and put together more than 70 meetings with senators and staff. The group circulated a list of 430 prominent Republicans and conservatives who supported the legislation, including former senators and Cabinet officials.
Mehlman says the campaign was based on data and polling showing an increasing support for gay marriage. More than two-thirds of the public now supports the unions.
"Center-right voters are supportive of the freedom to marry, and those numbers have increased in recent years," Mehlman says. "Voters are supportive and often ahead of politicians on these questions."
But even as the supporters mobilized, it wasn't clear if the senators had the votes. Baldwin says that many Republicans she was talking to were skeptical of Senate Majority Leader Chuck Schumer's motivations so close to the midterm elections.
So Baldwin and the other senators met with Schumer in mid-September and told him they needed to delay a vote until after the election. It was "disappointing," she says, and she knew she and Schumer would get pushback from groups that wanted them to force the question on the floor. But she argued it was the right thing to do, and Schumer agreed. "I'm trusting your counts," she says he told her.
When the Senate returned after the election, with Senate Democrats having won a majority, Schumer announced they would hold an immediate vote on the marriage bill. By then, Baldwin and the others felt more sure of a win - and on Nov. 16, twelve Republicans voted yes in a key procedural vote to move forward.
In addition to Collins, Romney, Portman and Tillis, Republicans supporting the legislation were Richard Burr of North Carolina, Todd Young of Indiana, Shelley Moore Capito of West Virginia, Joni Ernst of Iowa, Roy Blunt of Missouri, Cynthia Lummis of Wyoming and Lisa Murkowski and Dan Sullivan of Alaska.
After that vote, as the Senate left town for Thanksgiving, some conservative groups mobilized against the bill. On Nov. 23, the Heritage Foundation announced a new $1.3 million ad campaign.
"Liberals are hurrying to cram in their far left agenda, and a few Republican senators are helping them," the ad said.
But supporters held firm despite the pressure, and the bill passed the Senate on Nov. 30. As the roll was called, Baldwin teared up, hugging Schumer and others.
"The thing that gets me so choked up is all the times somebody comes up and says this matters to me," Baldwin said afterward, through tears.
Looking back on her four decades of advocacy - she was elected to local office in the mid-1980s, after she had already come out as gay - she says she always thought she would live to see marriage equality.
"I'm not surprised that we won that in the courts," she says. "But protecting it in the legislative body is a big deal."