Suppose a person(who doesn't do any sports) changes a diet, so that it has a "right" ratio of protein, carbs and fats, and a small carbs deficit. What will happen next? will he lose fat or muscle or both?
What do you mean by carb deficit? There is no carb requirement level that you can be over or under. You can eat 80% carbs or 0% carbs and be fine.
If your total intake of calories is less than your total calorie use, you will burn fat, even if you lie in bed all day.
Wether you lose fat or muscle depends on your current amount of muscle, on your level of exercise, on your genes and on your calorie deficit. Having a lot of muscle mass makes it harder to maintain it, more exercise will tend to increase muscle mass, good genes gives you more muscle mass and if your calorie deficit is large enough, you will lose large amounts of muscle mass . You can only burn about 500-1000 kcal worth of fat per day, the rest of your deficit will be balanced by breaking down your muscles, and muscles are only about 700kcal/kg compared to 7000kcal/kg in fat, so you lose that mass fast!
You can check this outsanding things to make a perfect diet http://xs.gy/fatburningguide