The Justices hand Trump a defeat, but deliver a win for San Francisco.