  We show that the $p$-adic KZ connection associated with the family of curves
$y^q=(t-z_1)\dots (t-z_{qg+1})$ has an invariant subbundle of rank $g$, while
the corresponding complex KZ connection has no nontrivial proper subbundles due
to the irreducibility of its monodromy representation. The construction of the
invariant subbundle is based on new Dwork--type congruences for associated
Hasse--Witt matrices.
