Science is helping to peel back the layers of how dogs process the world around them