\usepackage{tikz}
\usetikzlibrary{patterns,patterns.meta}

\newlength\pixelsize%
\newlength\tpwidth%

\def\pixelscale{1.5}%
\pixelsize=1.5pt
\tpwidth=35em

\definecolor{bgfill}{HTML}{a9aaa9}
\definecolor{bgline}{HTML}{bbbbbb}

\makeatletter
\def\@maketitle@pretty{%
  \begin{tikzpicture}[
		remember picture,
		overlay,
		yscale=-1,
		inner sep=0pt,
	]%
		% background
		\fill[bgfill] (current page.north west) rectangle (current page.south east);
		\draw[
			pattern color=bgline,
			pattern={Lines[distance=6pt,line width=1.5pt]}
		] (current page.north west) rectangle (current page.south east);

		% sidebar
		\fill[white] (current page.north west) rectangle
			++(19pt*\pixelscale,\pdfpageheight);
		\node[anchor=north west] at (current page.north west)
			{\includegraphics[scale=\pixelscale]{cover/log-top.pdf}};
		\node[anchor=south west] at (current page.south west)
			{\includegraphics[scale=\pixelscale]{cover/log-bottom.pdf}};

		% title frame
		\draw (current page.north) ++ (0pt,2in)
			++ (0pt,0pt*\pixelscale) node (titleframe) [anchor=north]
				{\includegraphics[scale=\pixelscale]{cover/title-frame.pdf}};
		% author frame
		\draw (titleframe.south)
			++ (0pt,2pt*\pixelscale) node (authorframe) [anchor=north]
				{\includegraphics[scale=\pixelscale]{cover/author-frame.pdf}};
		% lena message
		\draw (authorframe.south)
			++ (0pt,2pt*\pixelscale) node (lena) [anchor=north]
				{\includegraphics[scale=\pixelscale]{cover/lena.png}};
		% date frame
		\draw (lena.south east)
			++ (0pt,2pt*\pixelscale) node (dateframe) [anchor=north east]
				{\includegraphics[scale=\pixelscale]{cover/date-frame.pdf}};

		% title content
		\node[anchor=north west, inner sep=8pt*\pixelscale] at (titleframe.north west)
			{%
				\color{white}%
				\parbox{224\pixelsize}{%
					\flushleft%
					\Huge%
					\strut\@title\strut%
				}%
			};
		% author content
		\draw (authorframe.west) ++ (88pt*\pixelscale,0pt) node [anchor=west]
			{\color{white}\strut\@author\strut};
		% date content
		\draw (dateframe.east) ++ (-6pt*\pixelscale,0pt) node [anchor=east]
			{\color{white}\strut\@date\strut};
  \end{tikzpicture}%
}

\def\@maketitle@draft{%
	\centering%
	\parskip=0pt%
	\vspace*{1in}%
	\def\tpwidth{35em}%
	\parbox{\tpwidth}{%
		\flushleft%
		\par{%
			\Huge%
			\strut\@title\strut%
		}%
		\vspace{5mm}%
		\par{%
			\strut\@author\strut%
		}%
	}%
	\vfill%
	\parbox{\tpwidth}{%
		\flushright%
		\par\strut\@date\strut%
		\par(DRAFT)%
	}%
	\par\vspace*{1in}%
}

\ifdraft{\let\@maketitle\@maketitle@draft}{\let\@maketitle\@maketitle@pretty}

\makeatother

