“Any diet” is still putting you at a net caloric deficit. There is no other principle that can explain weight loss that I know of. Whether you’re counting calories to achieve that deficit or following a “diet” it comes down to the exact same thing. Counting calories just demystifies the process of weight loss.