  We investigate experimentally the supercurrent in a clean carbon nanotube
quantum dot, close to orbital degeneracy, connected to superconducting leads in
a regime of strong competition between local electronic correlations and
superconducting proximity effect. For an odd occupancy of the dot and
intermediate coupling to the reservoir, the Kondo effect can develop in the
normal state and screen the local magnetic moment of the dot. This leads to
singlet-doublet transitions that strongly affect the Josephson effect in a
single-level quantum dot: the sign of the supercurrent changes from positive to
negative (0 to $\pi$-junction). In the regime of strongest competition between
the Kondo effect and proximity effect, meaning that the Kondo temperature
equals the superconducting gap, the magnetic state of the dot undergoes a first
order quantum transition induced by the superconducting phase difference across
the junction. This is revealed experimentally by anharmonic current-phase
relations. In addition, the very specific electronic configuration of clean
carbon nanotubes, with two nearly orbitally degenerated states, leads to
different physics depending whether only one or both quasi-degenerate upper
levels of the dots participate to transport, which is determined by their
occupancy and relative widths. When the transport of Cooper pairs takes place
through only one of these levels, we find that the phase diagram of the
phase-dependent 0-$\pi$ transition is a universal characteristic of a
discontinuous level-crossing quantum transition at zero temperature. In the
case were two levels participate to transport, the nanotube Josephson current
exhibits a continuous 0-$\pi$ transition, independent of the superconducting
phase, revealing a different physical mechanism of the transition.
