Butter a 23cm square cake tin and line with baking parchment. Heat the oven to 180C/160C fan/gas 4. First, make the cookie layer. Put the butter and both sugars in a bowl and beat with an electric whisk until just combined. Alternatively, do this in a stand mixer. Add the whole egg and egg yolk, and beat again until combined. Mix in the flour, ¼ tsp salt, the bicarbonate of soda and chocolate chunks. Press the cookie dough into the base of the prepared tin using the back of a spoon, then chill for 30 mins.
For the brownie layer, melt the butter and chocolate in a heatproof bowl over a pan of just simmering water, stirring until smooth and combined. Leave to cool slightly, about 10 mins. Whisk the eggs, vanilla and sugar together in a large bowl with an electric whisk until slightly thickened, about 3 mins.
Fold the buttery chocolate mixture, cocoa and flour together to combine. Spoon the brownie mixture over the cookie dough layer, dot with the chocolate chunks, and sprinkle with sea salt flakes, if you like. Bake in the centre of the oven for 50 mins-1 hr, or until a skewer inserted into the middle comes out with just a few crumbs clinging to it. Leave to cool completely in the tin before cutting into squares.