People gather before marching to protest Donald Trump’s election as president. (Don Ryan/Associated Press)

If you’re despondent over the election, consider this reminder from F. Scott Fitzgerald: “The test of a first-rate intelligence is the ability to hold two opposed ideas in mind at the same time, and still retain the ability to function.”

The “opposed ideas” we need to juggle simultaneously concern who we are as Americans — a multiracial, multicultural nation coming to terms with our galloping diversity, or an us-against-them nation more torn apart by race, age, gender, geography, immigrant status and socioeconomic circumstance than at any time in living memory.

That second idea has had a triumphant 2016. But it hasn’t repealed the first idea. Twenty- first-century America is growing more polarized and more inclusive at the same time.

The ugly aftermath of a toxic political campaign isn’t the easiest moment to celebrate the kumbaya half of our two-sided coin. It’s especially dicey to do so using data from public opinion surveys, given polling’s many misfires in this election. Nevertheless, let me try.

Item: In a nationwide Pew Research Center survey taken this spring, 59 percent of Americans said immigrants mostly strengthen our country, while 33 percent said they mostly burden our country. When the same question was asked in 1994, these numbers had been reversed: Sixty-three percent said burden; 31 percent said strengthen.

Item: Americans now believe same-sex marriage should be legally recognized by 61 percent to 37 percent. In 1996, they opposed same-sex marriage by 68 percent to 27 percent.

Item: In a nationwide survey this spring that I worked on with the nonprofit group Encore.org exploring attitudes toward America’s “gray-brown” divide, 30 percent of respondents said the fact that most older adults are white and conservative, while a growing share of younger adults are nonwhite and liberal, will make it more difficult to solve our nation’s most pressing problems. But 65 percent said that this growing diversity is more likely to be a source of national strength.

Item: Half a century ago, interracial marriages were illegal in a third of our states and a gasp-inducing taboo everywhere else. Today weddings among whites, blacks, Hispanics or Asians (16 percent) are more common than marriages between Democrats and Republicans (9 percent).

That last data point captures the current paradox. As our racial and cultural walls become more porous, our partisan chasms have grown wider. Politics is no longer just a contest of my ideas vs. yours. It’s gotten meaner and more tribal. My group identity against yours. My grievances against yours. My insistence on these shifting boundaries vs. your resistance to them.

Any polity that lurches from President Obama to Donald Trump doesn’t have a settled idea about who it is. This isn’t new. Amid the tumult of the Industrial Revolution, as the verities of religion were being undercut by the march of science, the British poet Matthew Arnold wrote about “wandering between two worlds, one dead, the other powerless to be born.”

We’re in such a moment now. Globalization, immigration, automation, the digital revolution, the women’s revolution and the inclusion revolution are creating a new constellation of winners and losers. A wide swath of Americans feel like outcasts from the economy, exiles from the culture, strangers in their own land. Their sense of loss is palpable, as Trump understood. At the same time, another swath isn’t yet sure if they’ve won a full seat at the table. Their anxieties and aspirations are every bit as legitimate.

These transitions do not last forever. Tick by tock, demographic change and generational replacement will tilt the balance toward the forces of inclusion. All the trends cited above are powered by millennials, our youngest, largest and most diverse generation. A lot of them didn’t show up at the polls last week, but they’ll be running the show for decades to come — no doubt with some zigs and zags along the way.

As for the rest of us, we’d do well to heed the wisdom of the proverb that says societies become great when old men plant trees whose shade they know they will never sit under. The future of today’s young is the last report card for today’s old. Our fates are shared, even if we don’t look alike. That’s not just my opinion. In this great, big, mixed-up country of ours, it’s what most Americans think.