How to finish pine woodwork/trim
Pine and spruce don't take stain evenly, due to the pitch in the wood.  The usual way to deal with it is to start with a coat of shellac, although thinned varnish will also work.

When I did a set of pantry shelves out of pine I had the same problem.  What I did was to start with a coat of clear water based varnish.  Then I mixed clear varnish with a water based dye stain (non-pigment)  stain, at about 3 parts varnish to 1 part stain.  Applied enough coats of this to get to the tone I wanted.

It took a lot of coats.  If I were doing it again, I might go to 2/3 stain 1/3 varnish.  Fortunately the coats go on really fast.