After a terrorist attack in Istanbul, people valued group loyalty more—but gave less to strangers. A study shows that tragedy…