It’s hard to remember the last time both parties had wrenching, emotional internal battles over their platforms, documents that very few people read and presidents never feel are binding on their own actions. But that’s happening this year, with both Republicans and Democrats fighting over what to declare that they believe. The Democratic platform has moved to the left this year, in ways that would likely prove popular if the electorate were actually familiar with the details: a $15 minimum wage, aggressive action on climate change, and expanded Social Security benefits, among other things.

In some small ways, the Republican platform may be moving left as well. The struggle over that movement shows that even as the party faces a catastrophic short-term problem — in the person of one Donald J. Trump — it’s still struggling with a long-term problem: how to make peace with modernity and social change.

The short-term problem is obvious. Despite Hillary Clinton’s clear vulnerabilities, if the electorate makes its decision just on personality, Republicans will lose. The public as a whole may not like or trust Clinton, but they really don’t like Trump.

The ideological challenge the GOP faces is more fundamental, though; it was there before this election and will be there after it. And nowhere is it clearer than on issues around sexuality and identity.

These issues are now at the center of an emerging GOP platform fight. In its 2012 platform, the party called the legalization of gay marriage “an assault on the foundations of our society” and proclaimed, ” We reaffirm our support for a Constitutional amendment defining marriage as the union of one man and one woman.” But as Tal Kopan of CNN reported this morning, a draft of the party’s new platform reveals that “in a major shift, the platform would drop the pursuit of a constitutional amendment that would define marriage as between a man and a woman, opting instead to oppose the Supreme Court decision legalizing same-sex marriage and calling on the matter to be decided by the states.”

In other words, Republicans gone from arguing that same-sex marriage would cause society to crumble, to pleading that we just let them keep it illegal in conservative states. Which won’t happen, of course; the Supreme Court ended the legal debate, and a clear majority of the public supports marriage equality. But this is still a wrenching issue within the GOP, and there will be some resisting that change with all their might. Even if they fail, though, the party finds itself once again torn between two incompatible goals: reflecting the beliefs of its older, white, socially conservative base on the one hand, and appealing to the voters it needs to obtain a national majority on the other.

The trouble is that just having that internal argument can alienate you from the voters that are increasing as a proportion of the electorate, particularly racial minorities and young people. In the latest Pew Research poll, Clinton led Trump by 30 points among voters under 30; Obama beat Romney in 2012 among these voters by 23 points.

This all reflects the recent history of the Republican Party’s struggles with issues of gay civil rights: They get continuously dragged in a more progressive direction, kicking and screaming the whole way, always changing their position to remain a couple of steps behind the public. Conservatives used to be just fine with gay people being discriminated against on the job or in housing, and agreed that society should shame and condemn them. Then they said, we don’t agree with widespread discrimination, we just don’t want them in the military or getting married. Then they said, okay, the military question isn’t a big deal anymore; now we just want to make sure Christian bakers don’t have to make cakes for gay weddings. And on the marriage question, they’re now retreating from “pass a constitutional amendment outlawing gay marriage” to “let each state decide for itself.”

Then there’s the issue of transgender rights, which has also consumed the GOP of late. It’s hard to present yourself as a modern party working to come up with solutions to the country’s pressing problems when you’re spending a significant amount of your time trying to stop transgendered people from going to the bathroom in peace. And while Trump himself doesn’t seem to care much about that particular issue, it provides social conservatives an opportunity to flex their muscles by making sure that the platform includes a provision supporting state laws that force transgender people to use public bathrooms according to the gender on their birth certificate. So it’s a good bet that the final platform will include an emphatic endorsement of that particularly cruel form of discrimination.

Put all of this together with immigration, an issue Trump cares very much about, and you have a picture of a party that reflects the views of its base — distressed by increasing diversity, uncomfortable with change, and eager to turn back the clock to a time when the position of people like them atop the social hierarchy was unquestioned.

That’s not what the party, or at least its more thoughtful members, wants to be down the line. But it’s who they are now, and who they’re likely to remain, at least for the near future.