\def\modele@univers{univers}
\def\cv@h@univers{5}

% =============== FOND ===============
\newcommand*\fond@univers{%
	\ifx\cmdPAS@bg@pic\@empty%
	\else
		\ifx\cmdPAS@bg@borderpic\@empty
			\node[circle,fill=\cmdPAS@bg@bordercolor,inner sep=5pt] (photo) at (2.5,-.5*\cv@h@univers) {\includegraphics[scale=\cmdPAS@bg@scalepic]{\cmdPAS@bg@pic}};
		\else
			\node[circle,fill=\cmdPAS@bg@bordercolor,inner sep=5pt] (photo) at (2.5,-.5*\cv@h@univers) {\phantom{\includegraphics[scale=\cmdPAS@bg@scalepic]{\cmdPAS@bg@pic}}};
			\node[draw=\cmdPAS@bg@borderpic,very thick,inner sep=1pt] at (2.5,-.5*\cv@h@univers) {\includegraphics[scale=\cmdPAS@bg@scalepic]{\cmdPAS@bg@pic}};
		\fi
	\fi
	\draw[decorate,decoration={random steps,segment length=2mm},fill=\cmdPAS@bg@bgcolor] (-.5,-\cv@h@univers+.5) rectangle +(1.1\paperwidth,-2);
	\foreach \i in {1,...,100}
	{
		\pgfmathparse{21*rnd}\let\x\pgfmathresult
		\pgfmathparse{-\cv@h@univers+.5-2*rnd}\let\y\pgfmathresult
		\pgfmathparse{2*rnd}\let\r\pgfmathresult
		\fill[white] (\x,\y) circle (\r pt);
	}
	\node[color=\cmdPAS@bg@postecolor] at (.5\paperwidth,-.5-\cv@h@univers) {\scshape\cmdPAS@bg@postesize\bfseries\cmdPAS@bg@poste};
	% etoiles
	\pgfdeclaredecoration{stars}{initial}
	{
		\state{initial}[width=15pt]
		{
			\pgfmathparse{round(rnd*100)}
			\pgfsetfillcolor{\cmdPAS@bg@bgcolor!\pgfmathresult!white}
			\pgfsetstrokecolor{\cmdPAS@bg@bgcolor!\pgfmathresult!gray}
			\pgfnode{star}{center}{}{}{\pgfusepath{stroke,fill}}
		}
		\state{final}
		{
			\pgfpathmoveto{\pgfpointdecoratedpathlast}
		}
	}
	\path[decorate, decoration=stars, star point ratio=2, star points=5,inner sep=0, minimum size=rnd*10pt+2pt] (.99\paperwidth,-.97\paperheight) .. controls (.5\paperwidth,-.93\paperheight) and (.25\paperwidth,-\paperheight) .. (-1,-.98\paperheight);
}

%=============== INFO GAUCHE ===============
\newcommand*\infoLeft@univers[1]{%
	\AddToShipoutPicture{%
		\put(\LenToUnit{5cm},\LenToUnit{.97\paperheight})
			{%
				\rlap{
					\begin{minipage}[t]{0.5\paperwidth}
						#1
					\end{minipage}
				}
			}
	}
}

%=============== INFO DROITE ===============
\newcommand*\infoRight@univers[1]{%
	\AddToShipoutPicture{%
		\put(\LenToUnit{.97\paperwidth},\LenToUnit{.97\paperheight}){%
			\llap{%
			\begin{minipage}[t]{.5\paperwidth}
				\begin{flushright}#1\end{flushright}
			\end{minipage}
			}
		}
	}
}

%=============== TITRE ===============
\newcommand*\title@univers[1]{%
	\noindent
	\begin{tikzpicture}
		\node[fill=\cmdPAS@title@bordercolor,shape=star,rotate=20] (etoile) {};
		\node[right,text=\cmdPAS@title@color] at (.33,0) {\scshape\bfseries #1};
		\shade[left color=\cmdPAS@title@bordercolor,right color=white,very thick] ($(etoile.south west)+(0,-0.03)$) rectangle +(.9\paperwidth,-.02);
	\end{tikzpicture}
}

%=============== MARGES ===============
\newcommand*\margins@univers{%
\FPeval\result{clip(\cv@h@univers+2)}
\newgeometry{tmargin=\result cm,bmargin=1.5cm,lmargin=1cm,rmargin=1cm}
}

%=============== CLEARPAGE ===============
\newcommand*\clearpage@univers{%
	% etoiles
	\pgfdeclaredecoration{stars}{initial}
	{
		\state{initial}[width=15pt]
		{
			\pgfmathparse{round(rnd*100)}
			\pgfsetfillcolor{\cmdPAS@bg@bgcolor!\pgfmathresult!white}
			\pgfsetstrokecolor{\cmdPAS@bg@bgcolor!\pgfmathresult!gray}
			\pgfnode{star}{center}{}{}{\pgfusepath{stroke,fill}}
		}
		\state{final}
		{
			\pgfpathmoveto{\pgfpointdecoratedpathlast}
		}
	}
	\path[decorate, decoration=stars, star point ratio=2, star points=5,inner sep=0, minimum size=rnd*10pt+2pt] (.99\paperwidth,-.97\paperheight) .. controls (.5\paperwidth,-.93\paperheight) and (.25\paperwidth,-\paperheight) .. (-1,-.98\paperheight);
}
\newcommand*\clearmargins@univers{%
	\newgeometry{tmargin=2cm,bmargin=1.5cm,lmargin=1cm,rmargin=1cm}
}
