Preimage of codimension one subvarieties under a dominant map Let $f:X\to Y$ be a dominant morphism of projective varieties over an algebraically closed field. If $Z\subset Y$ is a codimension $1$ subvariety, do the irreducible components of $f^{-1}(Z)$ necessarily have codimension $1$ in $X$?
I am asking about codimension $1$ since I know codimension $1$ usually behaves the best.
If this is true, is there an easy explanation? If this is almost true, what is the correction?
 A: EDIT: I rewrote this answer with more details.
You need some more assumptions; the easiest one I know is to require that the dimension of the fiber $f^{-1}(\eta)$ of the generic point $\eta \in Y$ is equal to $\dim(X) - \dim(Y)$.
(1)  Let $f : X \to Y$ be a morphism of schemes over a base scheme $S$.  Recall that if $X \to S$ is universally closed, then $f : X \to Y$ is also universally closed.  In fact we can factor $f$ through the closed immersion $X \hookrightarrow X \times_S Y$ and the projection $X \times_S Y \to Y$; closed immersions are proper, hence a priori universally closed, and the second is a base change of a universally closed morphism, hence also universally closed.  See (Stacks, 01W6).
(2)  Suppose the structural morphism $X \to S$ is universally closed.  Any $S$-morphism $f : X \to Y$ is closed by (1), and hence surjective if it is dominant.
(3)  The following proposition is from (EGA, IV_2, 5.6.6):
Let $X$ and $Y$ be irreducible schemes, $Y$ locally noetherian, $f : X \to Y$ dominant and locally of finite type.  Let $e = \dim(f^{-1}(\eta))$ be the dimension of the generic fiber ($\eta \in Y$ being the generic point).  Then one has the inequality
$$ \dim(X) \leq \dim(Y) + e. $$
Further, if $Y$ is universally catenary then one has equality if and only if
$$ \dim(Y) = \sup_{y \in f(X)} \dim(\mathscr{O}_{Y,y}). $$
Note that this clearly holds when $f$ is surjective (EGA, IV_2, 5.1.4).
(4)  Let $S$ be a locally noetherian and universally catenary scheme, and let $X$ and $Y$ be schemes locally of finite type over $S$, with $X$ proper over $S$.  Let $Z \subset Y$ be a closed irreducible subscheme, let $(W_\alpha)$ be the irreducible components of the inverse image $f^{-1}(Z)$, and let $f_\alpha : W_\alpha \to Z$ denote the restrictions of $f$ to $W_\alpha$.  Since $X$ and $Y$ are locally of finite type over $S$, $W_\alpha$ and $Z$ are locally of finite type over $S$ and it follows that $f_\alpha : W_\alpha \to Z$ are locally of finite type (Stacks, 01T8).  Also, $Z$ is universally catenary (Stacks, 02J9) and locally noetherian (Stacks, 01T6).  Since $W_\alpha$ is proper over $S$, $f_\alpha$ is surjective by (2).  Hence by (3) one sees
$$ \dim(W_\alpha) = \dim(Z) + e, $$
where $e$ is the dimension of the fiber of the generic point $\eta \in Y$, and in particular the inverse image $f^{-1}(Z)$ is purely of dimension $\dim(Z) + e$.
(5)  If $X$ and $Y$ are further biequidimensional (EGA, 0_IV, 14.3.3), i.e. one has the formula
$$ \dim(W) + \mathrm{codim}(W, X) = \dim(X) $$
for every closed subspace $W \subset X$ (and likewise for $Y$), then one can rewrite (4) as
$$ \mathrm{codim}(f^{-1}(Z), X) = \mathrm{codim}(Z, Y) + m - n - e, $$
where $m$ and $n$ are the dimensions of $X$ and $Y$, respectively.
(6)  In particular, when $S = \mathrm{Spec}(k)$ is the spectrum of a field $k$, then $X$ and $Y$ are biequidimensional (EGA, IV_2, 5.2.1) and the formula of (5) holds.  More generally, $S$ only needs to be Jacobson (and locally noetherian, universally catenary); this is not in EGA but I believe it's buried in some form in the Stacks project (see the comments on (Stacks, 02S2)).
(7)  Concluding, we have seen that in good cases, and in particular in your case, when the dimension of the generic fiber is equal to $\dim(X) - \dim(Y)$, the codimension of the inverse image $f^{-1}(Z)$ in $X$ is equal to the codimension of $Z$ in $Y$.
A: [This answer has been edited to discuss the general case.]
I will assume that variety means irreducible (otherwise you could work on individual irreducible components).  Then $f:X \to Y$ is dominant by assumption, and has closed image since its source is projective, thus it is surjective.
Thus $f^{-1}(Z) \to Z$ is also surjective.
Now, as described in e.g. this MO answer (or in a Hartshorne exercise, maybe in Section 4 of Chapter II), for the proper map $f$, the function $y \mapsto \dim f^{-1}(y)$ is upper semicontinuous, so if $z \in Z$, then the dimensions of $f^{-1}(z)$ are at least $\dim X - \dim Y$.  This implies that $f^{-1}(Z)$ contains components of 
codimension $1$. (The intuition is just that we can add the dimension of $Z$ and of a typical fibre.  One way to make this precise is to note that if every component of $f^{-1}(Z)$ were of codimension at least $2$, then since it dominates $Z$, we would see that
a generic fibre would be of dimension $\dim X - \dim Y -1$, whereas we already noted that every fibre has dimension at least $\dim X - \dim Y$.)

In general you can't do better than this, because there are morphisms of $3$-folds (just to take an example) which are birational, but in which the preimage of some particular point $y \in Y$ is a curve.  Then if you take $Z$ to be a generic codim'n one subvariety passing through $y$, its preimage will be the union of a codim'n subvariety of $X$ (the proper transform of $Z$) and the curve $f^{-1}(P)$.   So in general you can't expect $f^{-1}(Z)$ to be equidimensional.
Note also that $f^{-1}(Z)$ can also contain multiple components of codimension $1$.  (E.g. let $X \to Y$ be the blow up of a surface at a point, and let $Z$ be a curve that passes through the blown up point.)

Rereading the question, I see that the point of the question might be the equidimensionality, and so you might be interested in the counterexample involving $3$-folds.  This MO question and answers gives one such example.
