Heat oven to 190C/170C fan/gas 5. Drain the ricotta in a sieve for a few mins to remove the whey. Thoroughly wash the chard, and in a clean tea towel, dry the chard, then finely slice.
Heat the olive oil in a wok over a medium heat, add the leek, onion, garlic, chilli, preserved lemon, cumin and fennel seeds with a big pinch of salt and cook until the leek and onion are softened and fragrant – about 10 mins. Add the chard, herbs and a good squeeze of lemon juice and season, cook for a few mins until the leaves are wilted but not mushy. Allow to cool, and then squeeze the chard in a sieve to remove any excess moisture.
Whisk the eggs in a bowl until a little frothy and mix in the ricotta and feta. Stir in the greens mixture until well combined and grate over some nutmeg.
Remove the filo from the pack. Brush the inside of a 20 x 9cm deep cake tin with a little rapeseed oil, and lay a sheet of filo in it, smoothing over the base and up the sides with your fingers – it should cover the bottom and reach up the sides, overhanging the edge. Brush with more oil to cover the pastry and repeat, laying another sheet to make sure the base is completely covered. Gradually build up the layers, brushing with plenty of oil between sheets, adjusting the positioning of the sheets to get even coverage until the tin is fully lined.
Fill the tin with the cheese and greens mixture and cover with the filo, brushing with oil between layers and on the top. Add herbs between the layers for a pretty touch. Crumple the filo in the middle of the pie for an extra crispy ruffled texture and scatter with a few more fennel seeds. Bake for 50 mins until golden and the filling is set. Allow to settle for at least 20 mins before removing from the tin. Cool completely and chill in the fridge until ready to serve.