\def\modele@pegase{pegase}
\def\cv@h@pegase{2}

% =============== FOND ===============
\newcommand*\fond@pegase{%
	% dégradé à droite
	\fill[left color=white,right color=\cmdPAS@bg@bordercolor!10] (16,-6) rectangle+(6,-20);
	\draw[very thick,gray] (15,-6) -- (15,-27);
	% rectangle plein haut
	\fill[left color=\cmdPAS@bg@bgcolor,right color=\cmdPAS@bg@bordercolor] (0,-\cv@h@pegase) rectangle+(\paperwidth,-2);
	\fill[\cmdPAS@bg@bordercolor] (0,-2-\cv@h@pegase) -- (\paperwidth,-2-\cv@h@pegase) -- (\paperwidth,-3-\cv@h@pegase) -- (.55\paperwidth,-3-\cv@h@pegase) -- (.5\paperwidth,-4-\cv@h@pegase) -- (0,-4-\cv@h@pegase) -- cycle;
	% dégradé gauche
	\fill[right color=white,left color=\cmdPAS@bg@bordercolor!10] (0,0) rectangle+(1.5,-30);
	% liseret à droite 
	\draw[very thick,gray] (1.5,0) -- (1.5,-30);
	% rectangle bas
	\fill[\cmdPAS@bg@bgcolor] (0,-27) rectangle+(\paperwidth,2);
	\draw[very thick,gray] (0,-27) -- (\paperwidth,-27);
	\fill[left color=\cmdPAS@bg@bordercolor!10,right color=\cmdPAS@bg@bordercolor!40] (0,-24) -- (.5\paperwidth,-24) -- (.55\paperwidth,-24.75) -- (\paperwidth,-24.75) -- (\paperwidth,-25) -- (0,-25) -- cycle;
	\ifx\cmdPAS@bg@pic\@empty%
	\else
		\ifx\cmdPAS@bg@borderpic\@empty
			\node[right] (photo) at (1.7,-2-\cv@h@pegase) {\includegraphics[scale=\cmdPAS@bg@scalepic]{\cmdPAS@bg@pic}};
		\else
			\node[right,draw=\cmdPAS@bg@borderpic,very thick,inner sep=1pt] (photo) at (1.7,-2-\cv@h@pegase) {\includegraphics[scale=\cmdPAS@bg@scalepic]{\cmdPAS@bg@pic}};
		\fi
	\fi
	\node[color=\cmdPAS@bg@postecolor,above left] at (21,-2-\cv@h@pegase) {\scshape\cmdPAS@bg@postesize\bfseries\cmdPAS@bg@poste};
	\node[color=\cmdPAS@bg@postecolor!50!\cmdPAS@bg@bordercolor,above left,yscale=-1,scope fading=south,opacity=.4] at (21,-1.9-\cv@h@pegase) {\scshape\cmdPAS@bg@postesize\bfseries\cmdPAS@bg@poste};
	
}

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

%=============== INFO DROITE ===============
\newcommand*\infoRight@pegase[1]{%
	\AddToShipoutPicture{%
		\AtPageLowerLeft
		{%
			\begin{tikzpicture}
				\ifx\cmdPAS@bg@pic\@empty%
					\coordinate (cadre) at (1.7,-3.25);
				\else
					\coordinate (cadre) at ($(photo.east)+(.3,-.2)$);
				\fi
				\clip (0,0) rectangle+(\paperwidth,-\paperheight);
				\node[below right] at (cadre){
					\begin{minipage}{10cm}
						#1
					\end{minipage}};
			\end{tikzpicture}
		}
	}
}

%=============== TITRE ===============
\newcommand*\title@pegase[1]{%
	\noindent
	\begin{tikzpicture}
		\foreach \i/\c in {0.09/10,0.08/20,0.07/30,0.06/40,0.05/50,0.04/60,0.03/70,0.02/80,0.01/90,0/100}
		{
			\fill[black!\c] (\i,-\i) rectangle+(0.5,-0.5);
		}
		\fill[\cmdPAS@title@bordercolor] (-.1,.1) rectangle+(.5,-.5);
		\fill[white] (0,0) rectangle+(.5,-.5);
		\node[right,text=\cmdPAS@title@color] at (7mm,-2mm) {\scshape\bfseries #1};
	\end{tikzpicture}
}

%=============== MARGES ===============
\newcommand*\margins@pegase{%
\FPeval\result{clip(\cv@h@pegase+5)}
\newgeometry{tmargin=\result cm,bmargin=1.3cm,lmargin=1.2cm,rmargin=1.5cm}
}

%=============== CLEARPAGE ===============
\newcommand*\clearpage@pegase{%
	% dégradé à droite
	\fill[left color=white,right color=\cmdPAS@bg@bordercolor!10] (16,0) rectangle+(6,-30);
	\draw[very thick,gray] (15,0) -- (15,-30);
	% dégradé à gauche
	\fill[right color=white,left color=\cmdPAS@bg@bordercolor!10] (0,0) rectangle+(1.5,-30);
	\draw[very thick,gray] (1.5,0) -- (1.5,-30);
	% rectangle en bas
	\draw[very thick,gray] (0,-27) -- (\paperwidth,-27);
	\fill[left color=\cmdPAS@bg@bordercolor!10,right color=\cmdPAS@bg@bordercolor!40] (0,-24) -- (.5\paperwidth,-24) -- (.55\paperwidth,-24.75) -- (\paperwidth,-24.75) -- (\paperwidth,-25) -- (0,-25) -- cycle;
	\draw[very thick,gray] (0,-27) -- (\paperwidth,-27);
	\fill[\cmdPAS@bg@bgcolor] (0,-27) rectangle+(\paperwidth,2);
}
\newcommand*\clearmargins@pegase{%
	\newgeometry{tmargin=2cm,bmargin=2cm,lmargin=1.2cm,rmargin=1.5cm}
}
