Energetics, electric-field gradients and optical properties of YH3 (YD3) by first-principles calculations