\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{cv}[cv]

\renewcommand{\normalsize}{\fontsize{10}{11}\selectfont}

% Font
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{vollkorn}
\setsansfont[Ligatures=TeX]{metropolis}


\RequirePackage{titlesec}
\usepackage[a4paper, margin=4cm]{geometry}
\usepackage{enumitem}

\DeclareRobustCommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}}
\DeclareRobustCommand\tiny{\@setfontsize\tiny\@vipt\@viipt}
\DeclareRobustCommand\large{\@setfontsize\large\@xiipt{14}}
\DeclareRobustCommand\Large{\@setfontsize\Large\@xivpt{18}}
\DeclareRobustCommand\LARGE{\@setfontsize\LARGE\@xviipt{22}}
\DeclareRobustCommand\huge{\@setfontsize\huge\@xxpt{25}}
\DeclareRobustCommand\Huge{\@setfontsize\Huge\@xxvpt{30}}

\titleformat{\section}{\hrule \vspace{3pt} \sffamily \bfseries \scriptsize \MakeUppercase}{}{2em}{}
\titlespacing{\section}{0pt}{20pt}{8pt}

\newcommand\labelitemi  {\labelitemfont \textbullet}
\newcommand\labelitemii {\labelitemfont \bfseries \textendash}
\newcommand\labelitemiii{\labelitemfont \textasteriskcentered}
\newcommand\labelitemiv {\labelitemfont \textperiodcentered}
\newcommand\labelitemfont{\normalfont}

\newcommand{\role}[4]{%
  \noindent\begin{minipage}[t]{.7\textwidth}%
    \noindent{\LARGE \MakeTitlecase #1}

    \noindent{\itshape #3 \vspace{5pt}}
    \vspace{5pt}

    \begin{itemize}[align=left,label=\textbf{\arabic{*}},itemsep=.3em,leftmargin=3.7em,labelwidth=!]
      #4
    \end{itemize}
  \end{minipage}
  \begin{minipage}[t]{.3\textwidth}
    \raggedleft #2
  \end{minipage}
}

\newcommand{\entry}[3]{%
  \noindent\begin{minipage}[t]{.7\textwidth}%
    \noindent{\LARGE \MakeTitlecase #1 \vspace{5pt}}

    \begin{itemize}[align=left,label=\textbf{\arabic{*}},itemsep=.3em,leftmargin=3.7em,labelwidth=!]
      #3
    \end{itemize}
  \end{minipage}
  \begin{minipage}[t]{.3\textwidth}
    \raggedleft #2
  \end{minipage}

  \vspace{20pt}
}

\newcommand{\dateRangeWithMonths}[4]{
  \@tempdimc \f@size\p@
  \begin{tabular}[t]{@{}@{}}
    \Large #2\\[-3pt]
    \setlength{\normalbaselineskip}{0pt}%
    {\scriptsize \itshape #1}
  \end{tabular} -
  \begin{tabular}[t]{@{}@{}}
    #4\\[-3pt]
    \setlength{\normalbaselineskip}{0pt}%
    {\scriptsize \itshape #3}
  \end{tabular}%
}
\newcommand{\dateRangeWithYears}[2]{
  {\Large #1} - #2
}
