This is so so right. I've went from someone who was skinnyfat until my early 20s to maintaining an 8-pack (around 7-8% bf) which has its own problems..but i digress it is generally great, simply by controlling hormones and eating to sleep well. I usually eat whatever I want, but I consider the effects a certain food has on insulin. By the way, this change coincided with me studying nutrition/biochemistry and undergoing a master in dietetics at a tertiary institution so it isn't based on pure anecdata. REMEMBER THIS - CONTROL YOUR HORMONES

Your body won't put on fat without insulin, the downside is that you probably wont put on a lot of muscle either. This is a heuristic I employ however is more complicated in reality. We can go into this if you want.

In order to blunt the insulin response of say a sugary snack, you can combine a fat source (pistachios) etc. so there is a balance of fats, carbohydrates and protein. This lowers the insulin response, and leads to lower fat accumulation - remember fat not weight - you still gonna put on weight. Other tricks you can employ include timing these treats or taking magnesium which helps your insulin sensitivity.

What I do:
Usually perform some fasted training - usually 20-40 minutes of loaded carries in the morning, something like suitcase carries, farmers walks that requires some form of resistance - not everyday maybe every other day.

morning green tea usually boosts my energy levels - and has some l-theanine and caffeine for body composition benefits

what is actually important is receiving some low-angle light from outdoors as this is optimal for mood, depression (https://www.youtube.com/watch?v=nm1TxQj9IsQ) and sleep later in the day - (https://hubermanlab.com/toolkit-for-sleep/). Why is sleep important - A deficit in sleep will reduce leptin [https://www.ncbi.nlm.nih.gov/pmc/articles/PMC535701/] which is a hormone that suppresses hunger. If you sleep badly You might crave certain foods (especially carby crap/sweets that you dont really need). So let's control sleep, because you are controlling the root cause of your dietary compulsions. When i don't sleep well, it helps to know that I am simply at the whims of my hormones, and I nap lol.
I also perform:
Cold exposure according to andrew huberman protocol - this lowers body fat/increases the expression of dopamine and primes your body to create brown fat which has more mitochondria https://www.instagram.com/tv/CT2j35IAeLZ/?hl=en

I usually exercise outdoors in the sun - which is kind of a bad idea for other reasons here in Australia due to a hole in the ozone layer (https://www.cancer.org.au/cancer-information/types-of-cancer...) but it ensures adequate vitamin d which has been shown to be important lately given the rise of COVID..

The time I exercise is important - it's in the afternoon around 4-6pm for an hour or more.

I take magnesium (chelated 100-300gr, you should take biglycinate if you can 100-300gr) 2 hours before bed. This alone improved sleep by 50%. THen combined with blue light blockers and f.lux - this usually results in 8 hrs uninterrupted sleep 99% consistency. Probably the biggest ROI of any product was the blue light blockers, they knock me out around 30 minutes after i wear them - not sure if placebo but when I don't wear them i dont sleep well.

Also - forget your idea of weight loss. You want to be in health. This doesn't mean weight loss - if you're 90kg and 10% body fat that's far superior to 80 kg and 25% bodyfat...

FWIW: If you want a magic pill to fix your problems you probably won't find it. You need to take care of the main things: sleep, diet, exercise (in that order)...sleep rules all.

remember - we are simply meat bags with levers (that are hormones) my guy. you can pull the levers with sleep, diet, exercise and timing of these factors.

That being said, there are certain things you can take that might bring you from 95% to 98% - i write about nootropics at https://nootritious.com - hint there's nothing that is better than sleep. so optimise that before anything else.