Charles Leclerc took a surprise pole position in his Ferrari at the Hungarian Grand Prix on Saturday.