They did not believe he could win. Even after he already had.

As Silicon Valley’s cosseted ranks of tech workers awoke Wednesday to news that real estate mogul and reality television personality Donald Trump had really been elected the 45th president of the United States, many — seemingly most, if you spent enough time online — began moving through phases of grief.

To those in an industry that stood nearly united against the Republican nominee — at times willing to disparage and renounce some of their own who supported Trump — it didn’t seem possible that Trump’s campaign of isolationism, fear-mongering and sexism had succeeded.

They were in denial. They were angry. They were ready to propose that California secede from the union.

This wasn’t the America they knew, some people prominent in the industry said.

Their reaction and confusion also pointed to a much bigger truth: that Silicon Valley is far more divorced from the public, the people who use the software and devices that the tech industry creates, than they could have imagined. Few tech workers have friends — in real life or on social networks — in rural parts of the U.S., whose roads aren’t testing grounds for driverless cars or drone deliveries and where more people have high school diplomas than college degrees.

“This is a wake-up call,” said Amit Kumar, CEO of Trimian, a startup that builds online communities for college alumni and other job seekers. “The election is teaching us that the economics have not trickled down to a large part of the country.”

Though the tech industry has had its own struggles with diversifying its ranks and increasing equity for women and people of color, it has accepted diversity as an ideal worth striving for.

Immigrants, who Trump assailed and blamed for crime and job loss in America, aren’t just a fixture in tech operations — they have founded some of the best-known tech companies, from Alphabet to WhatsApp. Industry executives and venture capitalists have long pushed for immigration reform that would loosen restrictions on foreign workers’ ability to get U.S. work permits.

Under President Obama, a self-proclaimed Trekkie who mastered Facebook and YouTube in his first national campaign and adopted new tools like Snapchat to communicate with the electorate, the tech industry felt comfortable with, even embraced by, the administration.

Though Trump routinely used Twitter to broadcast his message and fire up his base, the president-elect referred to hacking problems as “the cyber” in one debate, proposed “shutting down” parts of the Internet as a response to security challenges and reportedly does not know how to use a computer.

It has left many in tech wondering: How will Silicon Valley and the tech giants of the Bay Area fit into Trump’s America?

“We just live in this bubble that is different than the rest of the country,” Cisco program manager Fei Ouyang said. “I don’t know how much influence we can play to the future democratic system.”

Several Bay Area workers took to social media Wednesday to complain that their fellow techies hadn’t put in enough effort or time canvassing and volunteering for Hillary Clinton’s campaign, even though the industry collectively donated tens of millions of dollars to support her White House bid.

Tech companies and workers donated more than $96.5 million to candidates and political parties this election cycle, according to the Center for Responsive Politics, a nonprofit that tracks spending in politics.

PayPal co-founder and renowned venture capitalist Peter Thiel, a Trump supporter who spoke at the Republican National Convention over the summer, may be the most famous political donor in Silicon Valley, as his support of Trump was denounced by his colleagues.

But his contributions of $1.25 million to Trump's campaign and pro-Trump super PACs. were far outmatched by Democratic donors.

Facebook co-founder Dustin Moskovitz pledged $20 million to various pro-Clinton organizations.

An Alphabet political action committee that pooled money from employees gave about $4.12 million to Democrats and about $1.48 million to Republicans.

Democrats also received the bulk of Facebook employees’ $3.9 million in political cash and the $747,000 from Twitter. Nearly all of the $510,000 given by LinkedIn employees went to the Party of Jefferson.

In August, Y Combinator founder Paul Graham contributed about $50,000 to Democratic groups and the Clinton campaign. He said almost everyone he knew in the tech world supported Clinton.

“In retrospect, I wonder if any amount of money would have made a difference,” Graham wrote in an email to the Chronicle on Wednesday. “The main thing I hope we all do … is not get demoralized. This is one step back, but maybe if we don’t give up it will be followed by two steps forward. That’s about as much as you can hope for in politics.”

From what little is known of Trump’s plan of governance, experts have said at least one aspect would benefit large tech giants like Apple and Alphabet, Google’s parent company.

Trump wrote in his 100-day plan that “trillions of dollars of American corporate money overseas can now be brought back at a 10 percent rate.” Under current policies, a 30 percent tax would be applied to the total amount brought back to the U.S. after foreign tax credits, a tax expert told The Chronicle earlier this year.

The lower tax rate could cause companies like Apple to bring back its stockpile of cash overseas. In its fourth quarter, Apple had about $237.6 billion in cash and equivalents, with 91 percent of that outside the U.S.

On Tuesday night, the average tech worker was not focused on the minutiae of tax breaks, though. Most were reeling.

Several recalled the moment, in crowded bars and ballrooms where left-leaning election night parties throughout the Bay Area were held, when they realized it was all over.

Facebook product marketing manager Lawrence Mak, 38, said he was on edge as Trump gained more states across television screens at Beaux in the Castro. As he sat watching state after state go to the GOP nominee, the crowd around him booed and swore.

Ouyang, the Cisco worker, moved to the U.S. 10 years ago and became a citizen this year. She said she’s now reconsidering her decision to make the United States her home.

“It’s shocking to me that there are so many people that value his side,” said Ouyang, who has two young daughters with her husband, an Arizona native. “This process reveals what this country is about, and it’s quite different from what I thought it was about.”

Beyond her personal concerns, Ouyang wonders how Trump’s presidency will affect her company’s culture. Many of Cisco’s employees are immigrants, she said.

“We know that we live in a bubble,” said state Sen.-elect Scott Wiener on Tuesday night, referring to San Franciscans. “None of us saw this coming.”

Thiel, who has long extolled the benefits that Silicon Valley would reap from a Trump presidency, doubled down on his support of the Republican candidate Wednesday.

“He has an awesomely difficult task, since it is long past time for us to face up to our country's problems,” Thiel said in a statement. “We're going to need all hands on deck.”