Using gravitational potential energy and elastic potential energy in a problem?

This is a problem my professor worked on in class:

The first thing he said was that we would use position 2 as the "reference height" and I'm not sure what that means exactly. He goes on to say that this means that position 1 has a positive gravitational potential energy and position 3 has a negative gravitational potential energy. I understand that as the block goes down the incline, the gravitational potential energy should decrease as it is converted into kinetic energy, but I guess I'm not really sure why it's negative at position 3.

He then says we can basically ignore what happens in position 2 because total mechanical energy is the same, and this is where I get confused.

He gives us $$\tfrac{1}{2} mv^2 + mgd\sin\theta = -mgx\sin\theta + \tfrac{1}{2}kx^2$$ and tells us to solve for $x$. I feel like I understand the left side of that equation. The initial kinetic energy is the one with the known velocity that was given, since it was projected downward with a given speed, while $mgd\sin\theta$ represents the gravitational potential energy. Then on the right side, which is where I'm confused, the kinetic energy is 0 because the block has momentarily stopped. Hence $-mgx\sin\theta + \tfrac{1}{2}kx^2$ represents the total potential energy. Why is $-mgx\sin\theta$ negative and why isn't $kx^2$ negative? The reason I ask about $kx^2$ is because it seems like the displacement of the spring is opposite the direction of the force exerted by the spring, so I would expect the work done to be negative.

And finally, how come one side is equal to the other if the right side involves a completely different aspect to it (the spring) that isn't found in the initial conditions. I'm getting confused as to which forces I'm supposed to be keeping track of.

"the gravitational potential energy should DECREASE as it is converted into kinetic energy, but I guess I'm not really sure why it's negative at position 3."

To try and explain this I'll use an analogy. Imagine for a second you have a cat, and you throw the cat up into the air. If you choose to use the ground as a reference point, then the cat starts off with some vertical displacement, and will arc its way downwards until it hits zero, when it hits the ground. Instead, lets try taking the moment the cat leaves our hands as a reference point. Instead, the cat's distance away from you will increase for a while, come to a standstill, drop PAST your hands, and become negative. In a sense, that's the theory behind the statement you've made. Gravitational potential energy really doesn't have any meaning unless you state from which reference point your'e taking the measurement from, just as the cat's height has no meaning unless you say whether you are measuring from your hands or from your feet.

"but why is −mgxsinθ negative and why isn't kx2 negative?"

Because xsinθ is a distance, it will be positive. But that's not what we really want here. Since the block is BELOW the reference point we've taken (point 2), its distance is actually negative. Take the cat example I used, if we take our hands as the reference point, and the cat is below them, it follows that the distance in the upward direction is negative. kx^2 isn't negative, because the distance in this case is assumed to be inwards toward the spring, as it represents the elastic potential energy. Let's take an analogy. Say the cat that we have thrown arcs, and instead of landing on the floor lands on a trampoline. Logically, the more that the trampoline bends inward, the greater force the cat will feel, and the greater potential the cat will have to fly off into space. This means that the cat's Elastic potential energy will have some correlation to the distance travelled into the trampoline. It's the same principle for the spring, the greater value of x, the more you travel into the spring, the more potential energy you have.

"And finally, how come one side is equal to the other if the right side involves a completely different aspect to it (the spring) that isn't found in the initial conditions. "

Oh, but it IS found in the initial conditions. Here's what the full equation would look like.

Gravitational Potential energy + Kinetic energy + Elastic potential energy (reference point 1)

= Gravitational Potential energy + Kinetic energy + Elastic potential energy(Reference point 3)

But then where did it go on the left hand side? Simple, the block was just not touching the spring yet, so the value of the Elastic potential energy at point one was ZERO, (similar to how the value of the kinetic energy at point 3 is zero).