Conifold transitions via affine geometry and mirror symmetry