Endogenous technological and population change under increasing water scarcity