
% By Adrien Luxey-Bitri
% 2024
% CC0 - Public Domain

%% IMPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
% \usepackage{amsfonts}
% \usepackage{amssymb}
%\usepackage{lmodern}
\usepackage{iwona}
\usepackage{color}
\usepackage{xspace}
\usepackage{amsmath}
\usepackage{hanging}
\usepackage{tikz}
\usepackage{tcolorbox}
\usepackage{csquotes} % guillemets français
\frenchspacing
\FrenchFootnotes
\usepackage{perpage} % Reset footnote counter every page
\MakePerPage{footnote}
\usepackage{booktabs} % jolis tableaux
\usepackage{changepage} % For adjustwidth blocks
\usepackage{soul} % \st for strike-through
% \usepackage{etoc} % localtableofcontents

%% BIBLIO %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[
  hyperref,
  sorting=ynt,
  % style=alphabetic,
  singletitle=true,
  maxcitenames = 10,
  maxbibnames = 10,
  backend=biber]{biblatex}
\addbibresource{bibliography.bib}
\renewcommand*{\newunitpunct}{\addcomma\space}
\DefineBibliographyStrings{french}{%
        in = {À},%
        urlseen = {vu le}%
}
\AtBeginBibliography{\footnotesize}

%% COMMENTAIRES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\annote}[3]{{
  \colorbox{#3}{\bfseries\sffamily\footnotesize\textcolor{white}{#2}}
  \color{#3}
  $\blacktriangleright$\textit{#1}$\blacktriangleleft$}
}
%% Uncomment for final version (removes notes)
%\renewcommand{\annote}[3]{}

\newcommand{\commentAL}[1]{\annote{#1}{AL}{blue}}
\renewcommand*{\bibfont}{\scriptsize}

%% TEMPLATING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{pgf}
\usepackage{xifthen, tikz}

\usetheme{default} 

\makeatletter


%%% COLORS
\definecolor{bleuroi}{RGB}{0, 8, 88}
\definecolor{vertemeraude}{RGB}{0, 64, 44}
\definecolor{lightgray}{RGB}{245,245,245}
\definecolor{encre_de_chine}{RGB}{9,36,53}
\definecolor{im_lost_in_your_eyes}{RGB}{110,138,159}
\definecolor{metallic_grey}{RGB}{209,219,221}
\definecolor{metallic_white}{RGB}{229,239,241}
\definecolor{boss}{RGB}{229,72,27}
\definecolor{toon_eyes}{RGB}{3,4,6}

\setbeamercolor{frametitle}{bg=white,fg=toon_eyes}
\setbeamercolor{lower separation line head}{bg=toon_eyes}
\setbeamercolor*{normal text}{fg=toon_eyes,bg=white} 
\setbeamercolor*{block title}{fg=white,bg=bleuroi}
\setbeamercolor*{block body}{fg=toon_eyes,bg=bleuroi!5}
\setbeamercolor{alerted text}{fg=vertemeraude}
\setbeamercolor*{example text}{fg=toon_eyes,bg=white} 
\setbeamercolor*{structure}{fg=toon_eyes,bg=white}
% sectionnavigation:
\setbeamercolor*{section in head/foot}{fg=vertemeraude,bg=white}

\setbeamerfont*{framesubtitle}{size=\normalsize}

%% ITEMS
\setbeamertemplate{itemize items}{--}

%%% TITLE
\setbeamertemplate{frametitle}
{%
  \begin{beamercolorbox}[wd=\paperwidth,dp=1ex,ht=2.8ex,leftskip=.7cm,rightskip=.7cm]{frametitle}%
    \usebeamerfont{frametitle}\strut\insertframetitle%
    \ifx\insertframesubtitle\@empty%
    \else%
    \hfill \usebeamerfont{framesubtitle}\strut\insertframesubtitle%
    \fi%
  \end{beamercolorbox}%
  % Horizontal line
  \vskip.25\baselineskip%
  \leaders\vrule width .85\paperwidth\vskip0.5pt%
  \vskip0pt%
  \nointerlineskip
  % Horizontal line
  % \vskip-1.5ex
  % \begin{beamercolorbox}[ht=0.3px,wd=0.8\paperwidth]{lower separation line head}\end{beamercolorbox}%
}

%%% HEADLINE
\setbeamertemplate*{headline}{} 
% \setbeamertemplate{headline}
% {%
%   \begin{beamercolorbox}[wd=\paperwidth,dp=.5ex,ht=2ex]{section in head/foot}
%     \insertsectionnavigationhorizontal{\paperwidth}{\hskip0pt plus1fill}{\hskip0pt plus1fill}\par % Centered
%     %\insertsectionnavigationhorizontal{\paperwidth}{}{\hfill\hfill} % Left aligned
%   \end{beamercolorbox}%
% }

%%% FOOTLINE
% Page numbering in footline
\setbeamertemplate{footline}{
  \hbox{\begin{beamercolorbox}[wd=1\paperwidth,ht=2.5ex,dp=1ex,right]{framenumber in head/foot}%
    \usebeamerfont{framenumber in head/foot}%
    %\insertframenumber\space/\space\inserttotalframenumber\hspace{0.3em}
    \insertframenumber\hspace{0.5em}
\end{beamercolorbox}}}

%%% BLOCK
% Rounded boxes with no shading
\pgfdeclareverticalshading[lower.bg,upper.bg]{bmb@transition}{200cm}{%
  color(0pt)=(upper.bg); color(2pt)=(upper.bg); color(4pt)=(upper.bg)}
  \setbeamertemplate{blocks}[rounded][shadow=false]

%%% TABLE OF CONTENTS
% \setbeamertemplate{section in toc}[sections numbered]
% \setbeamertemplate{subsection in toc}[subsections numbered]


%%% SECTION PAGE
% Set the colors of the section bar
\usesectionheadtemplate
{\colorbox{fg}{\color{bg} \insertsectionhead}}
{\color{fg!40!bg} \insertsectionhead}
\usesubsectionheadtemplate
{\colorbox{fg}{\color{bg} \insertsectionhead}}
{\color{fg!40!bg} \insertsectionhead}

%%% https://github.com/matze/mtheme/blob/2fa6084b9d34fec9d2d5470eb9a17d0bf712b6c8/source/beamerinnerthememetropolis.dtx#l254
\setbeamertemplate{section page}{
  \begin{center}
    \usebeamercolor[fg]{section title}
    \usebeamerfont{section title}
    \thesection. \insertsectionhead\par
    \ifx\insertsubsectionhead\@empty\else
      \usebeamercolor[fg]{subsection title}
      \usebeamerfont{subsection title}
      \vspace{2ex}
      ---\\
      \vspace{2ex}\insertsubsectionhead
    \fi
  \end{center}
}


%%% Who on Earth uses navigation bars?
\setbeamertemplate{navigation symbols}{}


%% MISC / MACROS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Reduce foot citation size
\renewcommand{\footnotesize}{\tiny}

% \let\oldtextbf\textbf
% \newcommand{\funky}[1]{\textcolor{boss}{\textbf{\underline{#1}}}}

\makeatother
