p-Type electrical conduction and wide optical band gap in Mg-doped CuAlS2