  Let ${\mathrm G}$ be the group $({\rm GL}_{2}\times {\rm GU}(1))/{\rm
GL}_{1}$ over a totally real field $F$, and let $\mathscr{X}$ be a Hida family
for ${\rm G}$. Revisiting a construction of Howard and Fouquet, we construct an
explicit section $\mathscr{P}$ of a sheaf of Selmer groups over $\mathscr{X}$.
We show, answering a question of Howard, that $\mathscr{P}$ is a universal
Heegner class, in the sense that it interpolates geometrically defined Heegner
classes at all the relevant classical points of $\mathscr{X}$. We also propose
a `Bertolini-Darmon' conjecture for the leading term of $\mathscr{P}$ at
classical points.
  We then prove that the $p$-adic height of $\mathscr{P}$ is given by the
cyclotomic derivative of a $p$-adic $L$-function. This formula over
$\mathscr{X}$ (which is an identity of functionals on some universal ordinary
automorphic representations) specialises at classical points to all the
Gross-Zagier formulas for ${\rm G}$ that may be expected from
representation-theoretic considerations.
  Combined with a result of Fouquet, the formula implies the $p$-adic analogue
of the Beilinson-Bloch-Kato conjecture in analytic rank one, for the selfdual
motives attached to Hilbert modular forms and their twists by CM Hecke
characters. It also implies one half of the first example of a non-abelian
Iwasawa main conjecture for derivatives, in $2[F:{\bf Q}]$ variables. Other
applications include two different generic non-vanishing results for Heegner
classes and $p$-adic heights.
