Following Qing Liu's book Algebraic Geometry and Arithmetic Curves, section 6.3.2, we say that a morphism $f: X\rightarrow Y$ of varieties over some field $k$ is local complete intersection at $x\in X$ if there exists a neighborhood $U$ of $x$ and a chain of morphisms $U\overset{i}{\hookrightarrow} Z\overset{g}{\rightarrow} Y$, where $g\circ i = f|_U$, $Z$ is some scheme over $k$, $i$ is a regular embedding and $g$ is a smooth morphism. We say $f$ is local complete intersection (l.c.i for short) if it is l.c.i at each $x\in X$.
Now, let me come to my problem. Let $X$ be a smooth complex projective variety, $Y$ be another complex projective variety (not necessarily smooth), and let $f:X\rightarrow Y$ be a morphism. Let $Z\subset Y$ be a smooth closed subvariety. Let $f : X\rightarrow Y$ be a morphism with the property that $f$ is an isomorphism over $Y\setminus Z$, and moreover $f$ is a $\mathbb{P}^n$- bundle over $Z$ for some $n$.
I believe that $f$ is a l.c.i morphism, for which I have got an argument, but I'm not completely sure if it's correct. Can someone please go through my argument and let me know if it makes sense or not?
Claim: $f$ is a l.c.i morphism.
Proof: According to Stacks project {https://stacks.math.columbia.edu/tag/069N}, being l.c.i morphism is fpqc-local on the base, and since any zariski covering is also an fpqc covering, enough to show that $f$ is l.c.i over an affine covering of $Y$. We consider two cases:
1) If $y\in Z$, choose an affine neighborhood $U$ of $y$ such that $f^{-1}(U)\cong U\times \mathbb{P}^n$ and $f|_{f^{-1}(U)}$ is the usual projection onto 1st component (recall that $f$ is a projective bundle over $Z$). Since $\mathbb{P}^n$ is l.c.i over $\mathbb{C}$, and $U$ is flat over $\mathbb{C}$, we get that $U\times \mathbb{P}^n\rightarrow U$ is also l.c.i by the fact that a flat base change of a l.c.i morphism is a l.c.i morphism (see Stacks Project, https://stacks.math.columbia.edu/tag/069I). Hence we conclude that $f^{-1}(U)\rightarrow U$ is l.c.i map.
2) If $y\in Y\setminus Z =: V$, then cover $V$ by affine opens, and since $f$ is isomorphism over $V$, clearly $f$ is a l.c.i map over each of the open affines.
Hence we conclude that $f$ is l.c.i morphism. (proved)
Can someone please let me know if this is correct? Thanks in advance.