Lot's of people fantasizing about what they'll do at the border with weaponizing the data on a burner phone. Let me present a "simpler" and actually realistic option (only for US citizens) on how to handle this:
1. Have a reasonable amount of emergency savings (6-8 months of expenses stored).
2. Have someone in-country who isn't traveling with you who can make sure your bills get paid (financial power of attorney).
3. Apply for Global Entry, which pre-clears you for border crossing.
4. Turn your phone /off/ when you land (usually a 15-20 minute walk to passport control in most airports). Powering off is important.
5. Refuse to provide the password, refuse to unlock. Provide all relevant travel documents and customs declarations, and allow free inspection of your baggage.
6. Wait... depends on the agent. Longest I've been detained was 2 days, most of the time they hem and haw for an hour or so and let you go.
7. Go on with your life.
Step #1 and #2 is in case you get arrested, which will almost guarantee losing your job, at least for right then. Since you can clearly establish no priors and that you aren't a flight risk, getting bail and then finding another job should be relatively easy to do within 6-8 months for most of the HN crowd. Also, invest in pre-paid legal.
Obviously, this is assuming things go mostly okay and you don't get murdered at the airport, however the realistic probability of this occurring is fantastically low (these types of crimes are almost always committed in the US by local law enforcement, not federal law enforcement, as feds undergo much more stringent requirements and aren't just your high school bully drunk on power with a gun).
Steps #1 and #2 you should be doing anyway, just out of good financial sense. Step #3 you should do anyway if you're traveling internationally regularly just to make your life easier when black swan events don't happen. And Step #4 you should do EVERY time you are about to let your phone out of your possession, whether involving the government or not, because it prevents most forms of attacks against an encrypted device and disables biometric unlock (which can be coerced/forced/done when you are dead).
The hardest step is honestly #7, because after what I've experienced in my travels (and let me tell you, the US CBP is MUCH MUCH more professional, courteous, and reasonable than many many other countries), nobody really believes you and there are way too many people that are apologists for the powerful. Governments, pretty much universally, suck. The only difference between whether you personally experience the suck or not is whether or not you happen to get randomly selected or fall outside the bounds of what the government expects of you. There is no requirement that you do anything "wrong" in either the moral or legal sense, to end up stuck in the suck. Embrace the suck early if you plan to exercise your rights, because doing so will bring the suck on to you full force, but if you're the self-righteous type at least you'll get some sense of satisfaction out of it.