We present a model of cold QCD matter that bridges nuclear and quark matter through the duality relation between quarks and baryons. The baryon number and energy densities are expressed as functionals of either the baryon momentum distribution, f_{B}, or the quark distribution, f_{Q}, which are subject to the constraints on fermions, 0≤f_{B,Q}≤1. The theory is ideal in the sense that the confinement of quarks into baryons is reflected in the duality relation between f_{Q} and f_{B}, while other possible interactions among quarks and baryons are all neglected. The variational problem with the duality constraints is formulated and we explicitly construct analytic solutions, finding two distinct regimes: a nuclear matter regime at low density and a quarkyonic regime at high density. In the quarkyonic regime, baryons underoccupy states at low momenta but form a momentum shell with f_{B}=1 on top of a quark Fermi sea. Such a theory describes a rapid transition from a soft nuclear equation of state to a stiff quarkyonic equation of state. At this transition, there is a rapid increase in the pressure.