President Trump and Roy Moore’s behavior give Republicans plenty to worry about between now and 2020, but what should really be keeping them up at night are the longer-term effects of the Trump era on young voters and the enduring demographic trends those voters represent.

Though older Americans may eventually look back on Trump as a temporary national trauma, younger Americans in the Millennial and Z generations will likely carry the scars for life. Research has shown that significant experiences during people’s “critical periods”—roughly the ages of 14 to 24—typically have an outsized and enduring effect on their preferences and way of seeing the world. After 30 or so, the impact of events decreases substantially, and by the time a person reaches middle age, short of Armageddon, events do not change a person’s preferences or worldview. This means that the impact of Trump’s boorish behavior and his deep unpopularity may permanently steer the younger generations clear of the Republican Party.

This effect may be particularly powerful among women. The lewdness too often displayed by political leaders is certainly not specific to one party, but the repercussions will be more serious for Republicans. Al Franken and John Conyers’ inappropriate behavior will likely end with their resignations, but Trump’s mistreatment of women continues to generate news coverage more than a year after the infamous Access Hollywood video.

The recent elections in Virginia may have provided early evidence of this problem. Nearly two-thirds of women voted for the Democratic nominee for governor; a sizeable increase from Hillary Clinton’s share last November, and well above the 51 percent that supported the previous Democratic gubernatorial candidate.

As if the self-inflicted wounds weren’t enough, the Republican Party’s base, especially the Trump wing, is steadily shrinking thanks to several long-term demographic trends. Americans are becoming increasingly less white, better educated, less religious, and more likely to be foreign-born. Each of these shifts will make winning elections more difficult.

A decreasingly white electorate is less likely to vote Republican. Today, only 11 to 26 percent of non-whites identify as Republicans. This hasn’t mattered much historically since the Republican Party typically attracts a much higher share of the white vote than the Democratic Party, and because as late as 1990 the voting public was 90 percent white. The proportion of white voters, however, shrunk to 74 percent this past presidential election. Birthrates and immigration will continue the downward trend. Just 56 percent of millennials are white, Gen Z is even less white at 51 percent, and the Census Bureau projects that by 2020 more than half of all American children will be minorities.

Rising numbers of immigrants will also provide a test for Republicans. Eleven percent of Millennials are either immigrants or the children of immigrants, compared to just five percent for Baby Boomers. And for the next 50 years, demographers predict immigrants and their children will account for 88 percent of America’s population growth.

Efforts to build a big, beautiful wall, rescind DACA, and ban members of Muslim-majority countries will only make things harder with young Americans (and foreign-born voters). So far 78 percent of millennials oppose Trump’s wall, a majority believe ending DACA is the wrong thing to do, and two-thirds did not support the president’s travel ban. In each instance, millennials opposed Trump’s position in higher numbers than any other generation. As time goes on, it will become less obvious that some of these policies came from the president versus the party he leads. For millennials and Gen Z, especially, the party and its leader will blur into one.

The Republican Party also suffers from a widening education gap. Clinton bested Trumpby 5 and 22 percentage points respectively with college graduate and postgraduate voters. This is a problem because, as researchers have noted, millennials are on track to be the “most educated generation in American history.”

Finally, Americans’ steady abandonment of religion threatens one of the Republican Party’s most important bulwarks. About 80 percent of white evangelical voters voted for Trump, but their numbers are shrinking. The faithfulness of white evangelical voters has masked their declining numbers, but that won’t help forever. As recently as 2008, white evangelicals comprised one-fifth of the population. By 2014 that had shrunk by 3 percentage points; and among the under-30 crowd, only one in 10 identify as white evangelicals.

In short, if you thought Trump and Moore were the Republican Party’s biggest problems, think again. Millennials already are America’s largest generation, and their influence will only increase over the coming decades. Many of them, and the younger Gen Z that follows, are suffering through the president’s antics during their most impressionable years. Their views of the Republican Party will be difficult to rehabilitate.

Moreover, they are increasingly non-white, foreign-born, educated, and religiously unaffiliated—all groups the Republican Party struggles to attract. Even if President Trump and Roy Moore exited the political scene tomorrow, Republicans would still face a daunting set of challenges.