The panoramic roofs were problematic even when new - throw them sitting out unused and rotting away in the sun and under snow for ~2 years and they are even worse. I had a dieselgate '12 Sportwagen that I bought in April 2019, ended up trading it in March 2020 because it had spent over a month in the shop for CPO repairs for the stupid roof - fortunately it was CPO but I think VWoA probably spent about $5k on repairs for that car all relating to the pano roof. First the sunshade was broken and they fixed, that was ~month #2 and was in the shop for ~3 days for that. Month #8 I got a flat tire and when pulling the spare found the spare tire well full of water - car was in the shop twice and a combined 6 weeks for to get that fixed - I traded it in for the e-Golf nearly immediately after getting it out of the shop after that repair (many reasons, not just the sunroof problems).
I would go CPO if you get one - the sitting out in storage did not do any favors for these cars. Make sure the a/c works well at idle, very common problem with the RCV valve that causes no cooling at idle but once you get moving a/c will cool nicely.
They are hit or miss after sitting idle, the '11 in my signature (also a CPO) has been problem free (knock on wood) despite also having a pano roof and sitting in storage for about 1.5 years. My '12 was a basket case in comparison.