2 Given a regular triangular prism with a base edge length of 1, and the diagonals of two non-adjacent faces are perpendicular to each other, then the length of its lateral edge is ( ).
(A) $\sqrt{2}$
(B) $\frac{\sqrt{2}}{2}$
(C) 2
(D) $\frac{\sqrt{3}}{2}$
(2) Let $A B C-A_{1} B_{1} C_{1}$ be a regular triangular prism, with the length of the side edge being $a$, and the side diagonals $A B_{1}$ and $B C_{1}$ being perpendicular to each other. Then $\overrightarrow{B_{1} A} \cdot \overrightarrow{B C_{1}}=0$, which means
$$
\left(\overrightarrow{B_{1} B}+\overrightarrow{B A}\right) \cdot\left(\overrightarrow{B B_{1}}+\overrightarrow{B_{1} C_{1}}\right)=0,
$$

Therefore,
$$
\overrightarrow{B_{1} B} \cdot \overrightarrow{B B_{1}}+\overrightarrow{B_{1} B} \cdot \overrightarrow{B_{1} C_{1}}+\overrightarrow{B A} \cdot \overrightarrow{B B_{1}}+\overrightarrow{B A} \cdot \overrightarrow{B_{1} C_{1}}=0 \text {, }
$$

which simplifies to
$$
-a^{2}+0+0+\cos 60^{\circ}=0 \text {. }
$$

Thus, $a=\frac{\sqrt{2}}{2}$. Therefore, the answer is B.