If the pope is a private heretic does he still possess the gift of infallibility and does he lose his authority?
Infallibility is a negative protection. It does not ensure that a pope will choose to teach rightly, only that when he chooses to speak in an infallible manner he will be prevented from teaching wrongly on matters of faith or morals.
Of course, there are problems with your proposal of a pope being a “private heretic.” If he hasn’t taught wrongly, how can he be classified a heretic? If heretical ideas are his private beliefs, how do we know he holds them? The only way we can know is if there are doctrinal problems in non-infallible teaching of the pope.
Even then, we should be extremely careful to be sure that we are correct that there actually are doctrinal problems in the non-infallible teaching of the pope. As a general rule of thumb, it is more likely that when we believe the pope is teaching wrongly that we are mistaken about either what he in fact said or about what constitutes right teaching than it is that the pope is a “private heretic.”
Out of Christian charity and filial respect for our father in the faith, we owe it to any pope to study the issues carefully and check, double-check, and triple-check our facts before deciding that the pope is a “private heretic.”