Federer shines as Djokovic survives brutal heat test