% additional packages needed
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{xcolor}
\usepackage{fontspec}
\usepackage{titling}
\usepackage{fancyhdr}
\usepackage[letterpaper,margin=1in,footskip=0.5in]{geometry}
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage{subfig}

\IfFontExistsTF{Open Sans}{\setmainfont{Open Sans}}{\setmainfont{Arial}}
\IfFontExistsTF{Open Sans}{\setsansfont{Open Sans}}{\setsansfont{Arial}}
\IfFontExistsTF{JetBrains Mono}{\setmonofont{JetBrains Mono}}{\setmonofont{Consolas}}
\IfFontExistsTF{Jost}{\newfontfamily\ucdisplay{Jost}}{\newfontfamily\ucdisplay{Arial}}

% define colors
\definecolor{UCRed}{HTML}{E00122}
\definecolor{UCDarkRed}{HTML}{B8011C}
\definecolor{UCBearcatsBlack}{HTML}{333333}
\definecolor{UCLightGrey}{HTML}{F3F3F3}
\definecolor{UCMist}{HTML}{D8D5D0}

% hyperlink colors
\hypersetup{colorlinks=true, urlcolor=UCDarkRed, linkcolor=UCDarkRed, citecolor=UCRed}

% section header colors
\titleformat{\section}{\color{UCRed}\ucdisplay\Large\bfseries}{\thesection}{0.8em}{}
\titleformat{\subsection}{\color{UCDarkRed}\ucdisplay\large\bfseries}{\thesubsection}{0.8em}{}
\titleformat{\subsubsection}{\color{UCDarkRed}\ucdisplay\normalsize\bfseries}{\thesubsubsection}{0.8em}{}

\parindent 0in

% add logo to title page
\pretitle{%
  \begin{center}
  \LARGE
  \includegraphics[width=6cm,height=9cm]{logo.png}

  \vspace{0.75cm}
}
\posttitle{\end{center}}

% turn on the style
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[R]{\thepage}
\fancyfoot[C]{\textcolor{UCDarkRed}{University of Cincinnati}}

\fancypagestyle{plain}{%
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyfoot[R]{\thepage}
  \fancyfoot[C]{\textcolor{UCDarkRed}{University of Cincinnati}}
}

% no blank pages between chapters
\let\cleardoublepage\clearpage

% chapter title margins and additional styling
\titleformat{\chapter}[hang]{\normalfont\ucdisplay\huge\bfseries\color{UCRed}}{\thechapter.}{1em}{}
\titlespacing*{\chapter}{0pt}{-32pt}{1cm}

% update references title
\renewcommand\bibname{References}

% remove potentially weird spacing between paragraphs
\raggedbottom

% add line after level 5 (paragraph) headers
\makeatletter
\renewcommand\paragraph{%
\@startsection{paragraph}{4}{0mm}%
{-\baselineskip}%
{.5\baselineskip}%
{\normalfont\normalsize\bfseries}}
\makeatother
