The U.S. trade deficit widened sharply as imports tied to AI investment surged, pushing the annual goods gap to a record $1.24 trillion.