When the “religious freedom” law in Indiana first started getting national attention last week, the Republicans running for president probably thought it was an easy call. Their party has firmly backed the movement to expand religious prerogatives into the realm of commerce, and gets some of its strongest support from religious Christians. Furthermore, laws like this have been relatively uncontroversial in the past. None of them seemed prepared for the intensity of the criticism the Indiana law got, and like Governor Mike Pence, found themselves pushed to backtrack on their initial full-throated support.

They were also probably surprised by just how many directions that criticism came from, with everyone from business leaders to religious groups making their opposition clear.

This issue illustrates just how complicated a task it will be for Republican candidates to navigate their party primaries without harming themselves for the general election. It isn’t just that pleasing the GOP’s base could displease the broader electorate, though that will often be true. The challenge is made even tougher by differences of opinion within the Republican party.

What we have now is one party, the Democrats, that is demographically diverse but ideologically unified, while the other party, the Republicans, is demographically homogeneous but ideologically divided.

We shouldn’t exaggerate this; there are plenty of issues on which almost all Republicans agree. But look at what Hillary Clinton won’t have to worry about between now and next summer. There aren’t major issues where factions of Democrats square off against each other. Liberals may think some in their party are too close to Wall Street, for instance, but on most major economic issues, even people like Chuck Schumer will say most of the same things the most liberal House member would. And can you think of an issue on which Clinton could alienate the general electorate by pandering to her base? It isn’t as though she’s going to find herself in trouble next October because she advocated an increase in the minimum wage or action to address climate change.

Republicans, meanwhile, have plenty of issues like that, and their internal divisions are more complicated than simply the base vs. the establishment. Look at the Indiana issue. In this new HuffPost/YouGov poll, Democrats said businesses should not be able to refuse service to gays and lesbians even if it violated their religious beliefs, by a margin of 75-12. But Republicans were more closely divided: they took the opposite view by 56-33.

On social issues like this one there’s a critical divide within the GOP by age. A Pew poll on gay marriage last year found a huge gap between the views of younger and older Republicans: 61 percent of Republicans between 18 and 29 favored marriage equality, compared to only 22 percent of those over 65, for a difference of 39 points. The gap for Democrats was a mere 15 points. So the problem isn’t just that there’s a generation gap that makes it hard for Republicans to appeal to younger voters. They have a generation gap within their own party that makes the primary campaign harder to navigate.

Issues of gay rights make this internal GOP problem particularly vivid, but there are many other issues where Democrats are far more unified than Republicans. On issues like the minimum wage, raising capital gains taxes, or climate change, we see Democratic voters nearly unanimous and Republican voters closely divided, with either significant minorities or in some cases outright majorities disagreeing with the standard GOP position on the issue.

That doesn’t mean there will always be a robust debate within the elite of the party on those issues, because often there won’t be; for instance, Republican officeholders advocating strong action on climate are few and far between, despite the ample sentiment in favor of such action from Republican voters. But it does mean that when a new controversy erupts, there’s a chance that when Republican candidates take the expected line, they could displease some voters both inside and outside their party.

If you’re someone like Ted Cruz, who is interested only in appealing to one section of the GOP anyway, then that isn’t much of a problem. But if you have broader ambitions, it makes the primary campaign a minefield. One candidate is going to prevail in the end, but he might well have stepped on a few explosives before getting to the convention in Cleveland.