Key property: Work by gravity is PATH-INDEPENDENT. It depends only on the vertical displacement (change in height).
W_gravity = -mg * delta_h = mg(h_initial - h_final)
Where delta_h = h_final - h_initial.
Going down by h: W_gravity = +mgh (gravity does positive work) Going up by h: W_gravity = -mgh (gravity does negative work)
For any curved path: Only the vertical component of displacement matters. Along a curved incline of length L at angle theta: h = Lsin(theta) W_gravity = mgLsin(theta)
This path independence is precisely what makes gravity a conservative force. Friction work DOES depend on path length, making friction non-conservative.