I have encountered this question while studying the derivation of the heat equation in two or three dimensions. In Haberman's PDE text, he provides the following figure:

Here, $\boldsymbol{\phi}$ is the heat flux vector, and the magnitude of $\phi$ is the amount of heat energy flowing per unit time per unit surface area. The vector $\boldsymbol{\hat{n}}$ is the unit outward normal vector.
Looking at point $B$, the author says "the outward normal component of the heat flux vector is $\lvert \boldsymbol{\phi} \rvert \cos \theta = \boldsymbol{\phi} \cdot\boldsymbol{n}/\lvert \boldsymbol{n} \rvert = \boldsymbol{\phi} \cdot \boldsymbol{\hat{n}} $."
I agree that the outward normal component of the heat flux vector is $\lvert \boldsymbol{\phi} \rvert \cos \theta $. I also agree that $\boldsymbol{\phi} \cdot\boldsymbol{n}/\lvert \boldsymbol{n} \rvert = \boldsymbol{\phi} \cdot \boldsymbol{\hat{n}} $.
However, I am struggling to see why $\lvert \boldsymbol{\phi} \rvert \cos \theta = \boldsymbol{\phi} \cdot\boldsymbol{n}/\lvert \boldsymbol{n} \rvert$. Can someone point me in the right direction?