Explore the concept of soil mechanics in civil engineering, focusing on its pivotal role in foundation design and construction. Discuss the fundamental principles governing soil behavior under various loading conditions, including consolidation, shear strength, and settlement?