What Explains Nostalgia?

I’ve been puzzling over the concept of nostalgia for some time.  What is it?

That bittersweet pain you have as a parent when you see your kid growing up and remember in a flash their babyhood.  Or the feeling when a song from your youth comes on the radio.  It’s a very distinct kind of pleasure mixed with sadness.

What would be the evolutionary advantage of nostalgia?  Why would this unique emotional mix of both happiness and sadness be beneficial?

Appreciation of the past makes sense.  It prevents us from ignoring emergent ideas and traditions we don’t understand, because we have some built in reverence for the past.  I get the value of that.  But why the sadness?  Why does the past make us sad?

Yes, perhaps it’s just that it’s a reminder of the passage of time, which is a reminder of our own imminent death, and death is something we fear and feel sadness about.  But nostalgia seems to have a slightly different quality than this.  This answer strikes me as too simple.