Preheat your oven to 375°F (190°C). Grease your baking dish with butter or cooking spray. This is not the moment to test your faith in non-stick surfaces.
Wash and peel the potatoes. I know, peeling potatoes is the worst, but the smooth texture is worth it. Think of it as potato therapy.
Slice the potatoes into 1/8-inch thick rounds. Consistency is key here—too thick and they'll never cook through, too thin and they'll disintegrate. A mandoline makes this job ridiculously easy, but a sharp knife and steady hand work just fine.
Place the sliced potatoes in a bowl of cold water to prevent browning while you make the sauce. Yes, this extra step matters.
In a large saucepan over medium heat, melt the butter. Add the diced onions and cook until translucent, about 3-4 minutes.
Add the minced garlic and cook for another 30 seconds until fragrant. Don't burn the garlic unless you're trying to summon disappointed Italian grandmothers.
Sprinkle the flour over the onion-garlic mixture and stir constantly for 1-2 minutes to cook out the raw flour taste. It should look like a paste.
Gradually whisk in the milk and cream. Emphasis on gradually—dump it all at once and you'll be fighting lumps for the next ten minutes.
Bring the mixture to a simmer, stirring frequently, until it thickens enough to coat the back of a spoon, about 5 minutes.
Turn off the heat and stir in the salt, pepper, nutmeg, half of the cheddar cheese, and all of the Gruyère until melted and smooth.
Drain the potatoes and pat them dry with a clean kitchen towel. Wet potatoes = watery gratin. Nobody wants that.
Layer 1/3 of the potatoes in the bottom of your prepared baking dish, slightly overlapping them like they're spooning.
Pour 1/3 of the cheese sauce over the potatoes and sprinkle with some thyme.
Repeat with another 1/3 of potatoes, 1/3 of sauce, and more thyme.
Finish with the remaining potatoes, the remaining sauce, and the reserved cheddar cheese on top. Sprinkle with the last of the thyme and a light dusting of paprika if using.
Cover the dish with aluminum foil and bake for 40 minutes.
Remove the foil and continue baking for an additional 20-25 minutes, until the top is golden brown and bubbly, and the potatoes are fork-tender.
Let stand for 10 minutes before serving. This resting time is non-negotiable unless you enjoy mouth burns and soupy potatoes.
Sprinkle with fresh parsley for that "I'm a food stylist" finish.