you’ll need a small arsenal of tools. torx wrenches to remove the sunroof glass, small screwdrivers to pry clips off, and a few hours.
start with the roof fully closed. open the cloth cover and pull inwards on the fuzzy accordion flaps on either side. with some gentle wiggling, the bottoms of the accordion flaps should come loose.
now, tilt the roof open. behind where the accodion flaps usually sit are torx bolts, 3 on each side, which hold the sunroof glass in place. remove all 6 and lift the glass off the car.
use an untangled coathanger to fish the rain gutter tray out of your headliner. you will need to do this from above the car, because the cloth sunroof cover panel needs to be slid closed to get to the gutter. the gutter also has a strap attaching it to the cloth cover.
once the gutter is slid forward, you’ll see it slides on two clips in a track, one on each side. detach the gutter from these clips by prying off the little cone-shaped snap-on clip. cover this clip before you start prying, otherwise it will fly off inside your headliner, never to be found again. leave the clips in their place in the tracks, there’s no need to remove them.
now, on the tilted-up rear portion of the sunroof bracket you will see the dangling remains of the arms, which originally attached to the gutter. these have broken, which is causing your leaking and gutter-stuck-in-the-roof problem. both arms are attached to the mechanism with cone-shaped clips identical to the ones on the slides. again, cover them before prying, so they don’t escape.
lift the gutter out of the roof. detach it from the strap that goes to the cloth cover. put the new gutter in place, attach the strap. put the arms in the bracket first and install the cone-clips, then install the slides and attach the cone-clips.
make sure the cloth cover is properly aligned, and slide it back inside the roof. set the glass back on the car. get back in the car, and install the 6 torx bolts for the sunroof glass. you may or may not have to tilt the roof closed to do this, I can’t remember. make sure you get the glass installed perfectly flush with the roof, or it will leak.
tilt the roof closed and re-clip the accordion flaps. slide your sunroof open and check it’s operation. slide it closed, ooh and aah as the cloth cover magically reappears instead of staying back in the headliner. tilt the roof open and check that the gutter is sliding as it should. done
happy wrenching