You decomposed a tree into heavy chains, reducing path queries to segment tree queries. The heavy edge rule guarantees the chain crossing property by halving subtree size with each light edge. You combined HLD with a segment tree to handle updates in and queries in per operation.
This technique generalizes to any path operation: sum, min, max, GCD, XOR. Next problem: handling edge-weighted trees with the same structure.