% ┌                                                ┐
% │                 STYLE: Globals                 │
% └                                                ┘
% ── Fonts ───────────────────────────────────────────────────────────
\newcommand{\setFont}[1]{\fontfamily{#1}\selectfont}
\newcommand{\setFontType}[1]{
    \ifthenelse{\equal{#1}{mono}}{
        \renewcommand{\familydefault}{\ttdefault}
    }{
        \ifthenelse{\equal{#1}{serif}}{
            \renewcommand{\familydefault}{\rmdefault}
        }{
            \renewcommand{\familydefault}{\sfdefault}
        }
    }
}

% ── Small common style elements ─────────────────────────────────────
% Spacing (vertical)
\newcommand{\rmvspace}[1][0.5]{\vspace{-#1pc}}

% Spacing (horizontal)
\newcommand{\smallhspace}{\hspace{2mm}}
\newcommand{\mediumhspace}{\hspace{5mm}}
\newcommand{\largehspace}{\hspace{1cm}}

% other elements
\renewcommand{\footrulewidth}{0.4pt}
\newcommand{\TODO}{\color{red} \hl{TODO:} \color{black}}
\newcommand{\bi}[1]{\textbf{\textit{#1}}}
\renewcommand{\quote}[1]{``\textit{#1}''}

% Add a color shade (similar to \fhlc, but nicer boxes)
\newcommand{\background}[3]{%
    \tcbox[on line,
        boxsep=\backgroundPadding,
        arc=\backgroundRounding,
        left=0pt,
        right=0pt,
        top=0pt,
        bottom=0pt,
        frame empty,
        colback=#1!#2!white,
        highlight math style={enhanced}
    ] {\textbf{#3}}%
}

% Abstraction of background, where the brightness is set to 20%
\newcommand{\shade}[2]{\background{#1}{\arabic{shadeStrength}}{#2}}

% This command is used for the short and inline descriptors
\newcommand{\bg}[2]{\background{#1}{\arabic{descriptorShadeStrength}}{#2}}

% Add a gray backdrop
\newcommand{\backdrop}[1]{\shade{black}{#1}}

% Print a table of contents as a tcolorbox
\newcommand{\printtoc}[1]{
    \renewcommand{\cfttoctitlefont}{}
    \renewcommand{\cftaftertoctitle}{\vspace{-0.75cm}}
    \renewcommand{\contentsname}{}
    \begin{tcolorbox}[
            colback=black!5!white,
            colbacktitle=#1!75!black,
            coltitle=black,
            enhanced,
            attach boxed title to top center={yshift=-2mm},
            title={\Large \tr{Contents}{Inhaltsverzeichnis}},
            fonttitle=\bfseries,
            breakable
        ]
        \hspace{1cm}
        \tableofcontents
    \end{tcolorbox}
}


% Draw box around links. First arg link, second arg display
\newcommand{\hlhref}[2]{\color{MidnightBlue}\fbox{\href{#1}{#2}}\color{black}}

% Same for urls (just one arg tho)
\newcommand{\hlurl}[1]{\color{MidnightBlue}\fbox{\url{#1}}\color{black}}
