Dynamic interactions between crustal shortening, extension, and magmatism in the North American Cordillera