DistanceToNearestSurface increase max distance?

I’ve been trying to mask a large area around the coasts of my ocean. I’m using the “distancetonearestsurface” node, and it’s exactly what I’m looking for. Problem is after a certain threshold it “breaks off” and it masks all of my ocean. Why does it happen? How can I increase the “max range”?

346461-offset.gif