$$
\begin{aligned}
f(x)= & \frac{1}{4}\left(\sin ^{2} x-\cos ^{2} x+\sqrt{3}\right)- \\
& \frac{\sqrt{3}}{2} \sin ^{2}\left(x-\frac{\pi}{4}\right)(x \in \mathbf{R}) .
\end{aligned}
$$

Find (1) the smallest positive period of the function $f(x)$;
(2) the intervals where the function $f(x)$ is monotonically increasing.
(1) Notice,
$$
\begin{array}{l}
f(x)=\frac{1}{4}(\sqrt{3}-\cos 2 x)-\frac{\sqrt{3}}{4}\left[1-\cos \left(2 x-\frac{\pi}{2}\right)\right] \\
=\frac{\sqrt{3}}{4} \sin 2 x-\frac{1}{4} \cos 2 x \\
=\frac{1}{2} \sin \left(2 x-\frac{\pi}{6}\right) .
\end{array}
$$

Thus, $T=\frac{2 \pi}{2}=\pi$.
(2) From $2 k \pi-\frac{\pi}{2} \leqslant 2 x-\frac{\pi}{6} \leqslant 2 k \pi+\frac{\pi}{2}$, we know that the monotonic increasing interval of the function $f(x)$ is
$$
\left[k \pi-\frac{\pi}{6}, k \pi+\frac{\pi}{3}\right](k \in \mathbf{Z}) .
$$