Demand Shocks and The Dynamics of Comparative Advantage