Gold is at record highs, mining companies are generating billions in free cash flow, and the world is scrambling for critical metals.