1 For the pastry: mix together the potato starch, cornflour, brown rice flour and sweet rice flour in a mixing bowl and whisk to combine.
2 Add the xanthan gum, guar gum and salt and stir well.
3 Add the frozen margarine and using an electric whisk, mix on the lowest speed, until the edges of the margarine pieces have started to soften.
4 Pour in the water and mix until absorbed.
5 Turn out the mixture onto a large sheet of non-stick baking paper and knead it together with your hands, just enough to bring it together.
6 Place another sheet of baking paper on top and gently roll the dough out to a rough rectangle, taking care not to roll over the edges.
7 Fold the bottom third of the dough towards the middle, then fold the top third on top of it.
8 Rotate the dough one-quarter turn to your right (clockwise).
9 Roll out the dough gently as before, until smoother and more cohesive. Fold the bottom third up and overlap the top third over it.
10 Rotate the dough one-quarter turn to your right (clockwise).
11 Repeat the turning, rolling and folding process twice more.
12 Wrap the folded dough in cling film and chill for 2 hours.
13 Remove from the refrigerator and stand at room temperature for about 20 minutes.
14 Repeat the turning, rolling and folding process twice more. Wrap the dough in cling film and chill for a further 2 hours, then stand at room temperature for about 20 minutes before using.
15 For the pistachio cake layer: soak the almonds in hot water for 30 minutes. Drain.
16 Heat the oven to 170°C (150° fan) 325°F gas 3. Grease a deep 25cm| 10" square tin and line the base with non-stick baking paper.
17 Place the drained almonds, pistachios, sugar, cardamom and salt in a food processor and blend until the mixture resembles coarse breadcrumbs. Transfer to a large bowl.
18 Add the egg, egg whites and lemon zest and beat well.
19 Spread into the tin and smooth the top. Bake for about 1 hour until golden. Cool completely in the tin.
20 For the chestnut filling: sprinkle the gelatine over the water in a small bowl and set aside.
21 Bring the chestnuts, milk, salt and vanilla to a simmer in a pan and cook for about 15 minutes until the chestnuts are falling apart and the milk has reduced by half. Remove from the heat and cool slightly.
22 Add the gelatine, stirring to dissolve. Put into a food processor and blend until very smooth. Leave to cool.
23 Whisk the cream until thick.
24 Whisk together the egg yolks and sugar until pale and thick. Beat in the cooled chestnut cream, then gently fold in the whipped cream. Leave to cool and thicken, but not set.
25 For the plum filling: heat the margarine and sugar in a small pan and stir over a gentle heat until melted to form a caramel.
26 Add the plums to the pan, cut-side down, and cook for about 5 minutes. Turn the plums over, add the lemon and orange juices to the pan, then cook for a further 2-3 minutes until the fruit has softened. Remove from the heat and reserve a few for the decoration.
27 Beat the remaining plum mixture until thick.
28 Heat the oven to 200°C (180° fan) 400°F gas 6. Line two large baking trays with non-stick baking paper.
29 Divide the pastry in half. Roll out each half to a 25cm|10" square and put on the baking trays. Prick all over with a fork and bake for 8-10 minutes until golden and risen. Trim each sheet to a 23cm|9" square. Put 1 half top side down in the clean baking tin.
30 Trim the pistachio cake to the same size as the pastry square. Reserve the trimmings.
31 Spread a layer of chestnut cream over the pastry in the tin. Cover with the pistachio cake, then spoon on the plum puree and spread evenly.
32 Top with the remaining chestnut cream, then cover with the remaining pastry. Chill until the chestnut cream has set firmly.
33 Cut into slices with a serrated knife. Decorate with powdered xylitol, the reserved plum quarters, pistachio cake trimmings and chopped pistachios.