The law here is not completely developed. The US Supreme Court has not ruled on the extent to which electronic devices of a US person may be searched at a border.
In practice, courts have generally allowed manual, cursory searches of electronic devices (such as looking at recent photos) as being similar to a search of luggage. However, courts have disagreed on how intrusive the search can be and whether a more invasive search at the border can be conducted without some additional suspicion.
Yes. Courts have upheld that a manual search of your phone by customs is legal. But more invasive, forensic investigation of your devices has been found to be unconstitutional. I'm not sure exactly where or how the line is drawn between the two.
Relatedly, make sure you trigger the password lock on your device before handing it over. They may be able to compel you to give your biometrics but not your password (the latter is considered compelled speech, and the courts have not fully litigated whether the former is treated the same).
Nova Launcher on Android (and maybe other launchers, I do not know) has a nifty little feature to activate password lock bypassing biometrics with a gesture. Which comes in handy everytime I go through the border.
At least on Android, turning off or restarting your phone will work as well. Because you must enter your pin or password upon first starting up rather than use biometrics. At least, that seems to be the default. It may be a setting somewhere to turn that off.