The interstellar medium near the sun. III - Detailed analysis of the line of sight to lambda Scorpii