%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% CELbeamer.cls
%% Provided as a template class for presentations
%% Modified from sdqbeamer.cls (v4.0.0, 2025 Feb.) in KIT-Design
%% See changelog.md for detailed changes
%% Last modified on: 23.10.2025
%% For the original sdqbeamer.cls, see https://sdq.kastel.kit.edu/wiki/Dokumentvorlagen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{CELbeamer}[2025-08-15 v1.0.0 CEL Beamer class]

\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
% \RequirePackage{pgffor}
\newif\ifsectionnavigationoption
\newif\ifsectionnavigation
\sectionnavigationoptionfalse
\newif\ifgerman
\newif\iffranklin
\newif\ifsmallfooterfont
\smallfooterfontfalse
\newif\ifkitgrid
\newif\ifspaceforface
\spaceforfacefalse
\newif\ifoverviewatsection
\overviewatsectionfalse
\newif\ifshowallatfirstoverview
\showallatfirstoverviewtrue
\newif\ifshowsubsectionsatfirstoverview
\showsubsectionsatfirstoverviewfalse

\def\groupname#1{\def\@groupname{#1}}
\def\groupnamewidth#1{\def\@groupnamewidth{#1}}

% see README.md
\DeclareOption{en}{
  \germanfalse
  \PassOptionsToPackage{autostyle}{csquotes}
  }
\DeclareOption{de}{
  \germantrue
  }
\DeclareOption{navbaron}{
  \sectionnavigationoptiontrue
}
\DeclareOption{smallfoot}{
  \smallfooterfonttrue
}
\DeclareOption{bigfoot}{
  \smallfooterfontfalse
}
\DeclareOption{helvet}{
  \franklinfalse
}
\DeclareOption{franklin}{
  \franklintrue
}
\DeclareOption{kitgrid}{
  \kitgridtrue
}
\DeclareOption{spaceforface}{
  \spaceforfacetrue
}
\DeclareOption{overviewatsection}{
  \overviewatsectiontrue
}
\DeclareOption{showsubsectionsatfirstoverview}{
  \showsubsectionsatfirstoverviewtrue
}

\ExecuteOptions{en,small,helvet}

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{beamer}}

\ProcessOptions\relax

% The standard font sizes are:
%                default  |  if adjusted, to
% \tiny         = 10pt    |      12pt
% \scriptsize   = 11pt    |      14pt
% \footnotesize = 12pt    |      16pt
% \small        = 14pt    |      20pt
% \normalsize   = 17pt    |      23pt
% \large        = 20pt    |      25pt
% \Large        = 25pt    |      28pt
% \LARGE        = 30pt    |      
% \huge         = 36pt    |      
% \Huge         = 48pt    |      
% \HUGE         = 60pt    |       
%
% onlytextwidth allows columns to appear only within the margins.
\LoadClass[17pt,utf8,onlytextwidth]{beamer}
\renewcommand{\tiny}{\fontsize{12pt}{15pt}\selectfont}
\renewcommand{\scriptsize}{\fontsize{14pt}{17pt}\selectfont}
\renewcommand{\footnotesize}{\fontsize{16pt}{19pt}\selectfont}
\renewcommand{\small}{\fontsize{20pt}{24pt}\selectfont}
\renewcommand{\normalsize}{\fontsize{23pt}{28pt}\selectfont}
\renewcommand{\large}{\fontsize{25pt}{30pt}\selectfont}
\renewcommand{\Large}{\fontsize{28pt}{33pt}\selectfont}
% If German language is used, the babel package is required.
% For English, it is not required, but it ensures consistent hyphenation and date formats.
\ifgerman
\RequirePackage[ngerman]{babel}
\fi
\RequirePackage{csquotes}
\RequirePackage{hyperref}
\RequirePackage[absolute,overlay]{textpos}

%% ┏━━━━━━━━━━━━━┓
%% ┃ Typographie ┃
%% ┗━━━━━━━━━━━━━┛

\RequirePackage{microtype}

\RequirePackage{helvet}
\RequirePackage[scaled=.92]{beramono}
% These two below are the WRONG math font - DO NOT enable them
% \RequirePackage{libertineRoman}
% \RequirePackage{lmodern}
\RequirePackage{exscale} % Correct scaling of \sum, \prod, \int, and the likes
% Semibold
\DeclareRobustCommand{\sbseries}{\fontseries{sb}}
\DeclareTextFontCommand{\textsb}{\sbseries\selectfont}

% Überschriften in Franklin (nur wenn Paket-Option gesetzt, sonst auch Helvetica)
\iffranklin
  \setbeamerfont{title}{family*=LibreFranklin-TLF,series=\sbseries,size=\Huge}
  \setbeamerfont{subtitle}{family*=LibreFranklin-TLF,series=\sbseries,size=\Large}
  \setbeamerfont{frametitle}{family*=LibreFranklin-TLF,series=\sbseries,size=\huge}
  \setbeamerfont{framesubtitle}{family*=LibreFranklin-TLF,series=\sbseries,size=\LARGE}
  \setbeamerfont{section in toc}{family*=LibreFranklin-TLF}
  \setbeamerfont{author}{family*=LibreFranklin-TLF,series=\mdseries,size=\large}
  \setbeamerfont{date}{family*=LibreFranklin-TLF,series=\mdseries,size=\large}
\else
  \setbeamerfont{title}{series=\bfseries,size=\Huge}
  \setbeamerfont{subtitle}{family*=phv,series=\bfseries,size=\Large} % originally was \normalsize
  \setbeamerfont{frametitle}{series=\bfseries,size=\huge}
  \setbeamerfont{framesubtitle}{series=\bfseries,size=\LARGE}
  \setbeamerfont{author}{family*=phv,series=\mdseries,size=\large}
  \setbeamerfont{date}{family*=phv,series=\mdseries,size=\large}
\fi


% Aufzählungen
\setbeamertemplate{itemize items}[square]

% Boxen
\setbeamerfont{highlight box}{series=\bfseries, size=\normalsize}
\setbeamerfont{standard box}{series=\bfseries, size=\normalsize}


%% ┏━━━━━━━━━━━━━━┓
%% ┃ /Typographie ┃
%% ┗━━━━━━━━━━━━━━┛

%% ┏━━━━━━━━━━━━━━━┓
%% ┃ Frame-Layout ┃
%% ┗━━━━━━━━━━━━━━━┛

% Seitenverhältnis
%
% Die Folien benutzen dieselbe Geometrie wie die PowerPoint-Vorlagen des KIT.

\RequirePackage{geometry}
\geometry{papersize={33.867cm,19.05cm}}

% Ränder laut pptx: 1,03 cm
\newlength{\kitoutermargin}
\setlength{\kitoutermargin}{1.03cm}
% Höhe der Fußzeile laut pptx: 1,62cm
\newlength{\kitbottom}
\setlength{\kitbottom}{1.62cm}
% Abstände im Raster
\newlength{\kitcolumn}
\setlength{\kitcolumn}{4.8cm}
\newlength{\kitcolumnsep}
\setlength{\kitcolumnsep}{0.6cm}
\newlength{\kitrow}
\setlength{\kitrow}{2.8cm}
\newlength{\kitrowsep}
\setlength{\kitrowsep}{0.6cm}

% Position of the vertical helper lines
\newlength{\kitcolumnoneleft}
\setlength{\kitcolumnoneleft}{\kitoutermargin}
\newlength{\kitcolumnoneright}
\setlength{\kitcolumnoneright}{\dimexpr\kitoutermargin+\kitcolumn\relax}

\newlength{\kitcolumntwoleft}
\setlength{\kitcolumntwoleft}{\dimexpr\kitoutermargin+\kitcolumn+\kitcolumnsep\relax}
\newlength{\kitcolumntworight}
\setlength{\kitcolumntworight}{\dimexpr\kitoutermargin+2\kitcolumn+\kitcolumnsep\relax}

\newlength{\kitcolumnthreeleft}
\setlength{\kitcolumnthreeleft}{\dimexpr\kitoutermargin+2\kitcolumn+2\kitcolumnsep\relax}
\newlength{\kitcolumnthreeright}
\setlength{\kitcolumnthreeright}{\dimexpr\kitoutermargin+3\kitcolumn+2\kitcolumnsep\relax}

\newlength{\kitcolumnfourleft}
\setlength{\kitcolumnfourleft}{\dimexpr\kitoutermargin+3\kitcolumn+3\kitcolumnsep\relax}
\newlength{\kitcolumnfourright}
\setlength{\kitcolumnfourright}{\dimexpr\kitoutermargin+4\kitcolumn+3\kitcolumnsep\relax}

\newlength{\kitcolumnfiveleft}
\setlength{\kitcolumnfiveleft}{\dimexpr\kitoutermargin+4\kitcolumn+4\kitcolumnsep\relax}
\newlength{\kitcolumnfiveright}
\setlength{\kitcolumnfiveright}{\dimexpr\kitoutermargin+5\kitcolumn+4\kitcolumnsep\relax}

\newlength{\kitcolumnsixleft}
\setlength{\kitcolumnsixleft}{\dimexpr\kitoutermargin+5\kitcolumn+5\kitcolumnsep\relax}
\newlength{\kitcolumnsixright}
\setlength{\kitcolumnsixright}{\dimexpr\kitoutermargin+6\kitcolumn+5\kitcolumnsep\relax}

% Position der horizontalen Hilfslinien
\newlength{\kitrowonetop}
\setlength{\kitrowonetop}{\kitoutermargin}
\newlength{\kitrowonebottom}
\setlength{\kitrowonebottom}{\dimexpr\kitoutermargin+\kitrow\relax}

\newlength{\kitrowtwotop}
\setlength{\kitrowtwotop}{\dimexpr\kitoutermargin+\kitrow+\kitrowsep\relax}
\newlength{\kitrowtwobottom}
\setlength{\kitrowtwobottom}{\dimexpr\kitoutermargin+2\kitrow+\kitrowsep\relax}

\newlength{\kitrowthreetop}
\setlength{\kitrowthreetop}{\dimexpr\kitoutermargin+2\kitrow+2\kitrowsep\relax}
\newlength{\kitrowthreebottom}
\setlength{\kitrowthreebottom}{\dimexpr\kitoutermargin+3\kitrow+2\kitrowsep\relax}

\newlength{\kitrowfourtop}
\setlength{\kitrowfourtop}{\dimexpr\kitoutermargin+3\kitrow+3\kitrowsep\relax}
\newlength{\kitrowfourbottom}
\setlength{\kitrowfourbottom}{\dimexpr\kitoutermargin+4\kitrow+3\kitrowsep\relax}

\newlength{\kitrowfivetop}
\setlength{\kitrowfivetop}{\dimexpr\kitoutermargin+4\kitrow+4\kitrowsep\relax}
\newlength{\kitrowfivebottom}
\setlength{\kitrowfivebottom}{\dimexpr\kitoutermargin+5\kitrow+4\kitrowsep\relax}

% Width of elements that span multiple columns
\newlength{\kitonecolumn}
\setlength{\kitonecolumn}{\kitcolumn}
\newlength{\kittwocolumns}
\setlength{\kittwocolumns}{\dimexpr2\kitcolumn+\kitcolumnsep\relax}
\newlength{\kitthreecolumns}
\setlength{\kitthreecolumns}{\dimexpr3\kitcolumn+2\kitcolumnsep\relax}
\newlength{\kitfourcolumns}
\setlength{\kitfourcolumns}{\dimexpr4\kitcolumn+3\kitcolumnsep\relax}
\newlength{\kitfivecolumns}
\setlength{\kitfivecolumns}{\dimexpr5\kitcolumn+4\kitcolumnsep\relax}
\newlength{\kitsixcolumns}
\setlength{\kitsixcolumns}{\dimexpr6\kitcolumn+5\kitcolumnsep\relax}

% Height of elements that span multiple rows
\newlength{\kitonerow}
\setlength{\kitonerow}{\kitrow}
\newlength{\kittworows}
\setlength{\kittworows}{\dimexpr2\kitrow+\kitrowsep\relax}
\newlength{\kitthreerows}
\setlength{\kitthreerows}{\dimexpr3\kitrow+2\kitrowsep\relax}
\newlength{\kitfourrows}
\setlength{\kitfourrows}{\dimexpr4\kitrow+3\kitrowsep\relax}
\newlength{\kitfiverows}
\setlength{\kitfiverows}{\dimexpr5\kitrow+4\kitrowsep\relax}

% Background grid visible 
\defbeamertemplate{background canvas}{kitgrid}{
  \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\paperheight}
    % horizontal
    \pgfpathmoveto{\pgfpoint{0cm}{\paperheight-\kitrowonetop}}
    \pgfpathlineto{\pgfpoint{\paperwidth}{\paperheight-\kitrowonetop}}
    \pgfpathmoveto{\pgfpoint{0cm}{\paperheight-\kitrowonebottom}}
    \pgfpathlineto{\pgfpoint{\paperwidth}{\paperheight-\kitrowonebottom}}
    \pgfpathmoveto{\pgfpoint{0cm}{\paperheight-\kitrowtwotop}}
    \pgfpathlineto{\pgfpoint{\paperwidth}{\paperheight-\kitrowtwotop}}
    \pgfpathmoveto{\pgfpoint{0cm}{\paperheight-\kitrowtwobottom}}
    \pgfpathlineto{\pgfpoint{\paperwidth}{\paperheight-\kitrowtwobottom}}
    \pgfpathmoveto{\pgfpoint{0cm}{\paperheight-\kitrowthreetop}}
    \pgfpathlineto{\pgfpoint{\paperwidth}{\paperheight-\kitrowthreetop}}
    \pgfpathmoveto{\pgfpoint{0cm}{\paperheight-\kitrowthreebottom}}
    \pgfpathlineto{\pgfpoint{\paperwidth}{\paperheight-\kitrowthreebottom}}
    \pgfpathmoveto{\pgfpoint{0cm}{\paperheight-\kitrowfourtop}}
    \pgfpathlineto{\pgfpoint{\paperwidth}{\paperheight-\kitrowfourtop}}
    \pgfpathmoveto{\pgfpoint{0cm}{\paperheight-\kitrowfourbottom}}
    \pgfpathlineto{\pgfpoint{\paperwidth}{\paperheight-\kitrowfourbottom}}
    \pgfpathmoveto{\pgfpoint{0cm}{\paperheight-\kitrowfivetop}}
    \pgfpathlineto{\pgfpoint{\paperwidth}{\paperheight-\kitrowfivetop}}
    \pgfpathmoveto{\pgfpoint{0cm}{\paperheight-\kitrowfivebottom}}
    \pgfpathlineto{\pgfpoint{\paperwidth}{\paperheight-\kitrowfivebottom}}
    % vertikal
    \pgfpathmoveto{\pgfpoint{\kitcolumnoneleft}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumnoneleft}{\paperheight}}
    \pgfpathmoveto{\pgfpoint{\kitcolumnoneright}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumnoneright}{\paperheight}}
    \pgfpathmoveto{\pgfpoint{\kitcolumntwoleft}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumntwoleft}{\paperheight}}
    \pgfpathmoveto{\pgfpoint{\kitcolumntworight}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumntworight}{\paperheight}}
    \pgfpathmoveto{\pgfpoint{\kitcolumnthreeleft}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumnthreeleft}{\paperheight}}
    \pgfpathmoveto{\pgfpoint{\kitcolumnthreeright}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumnthreeright}{\paperheight}}
    \pgfpathmoveto{\pgfpoint{\kitcolumnfourleft}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumnfourleft}{\paperheight}}
    \pgfpathmoveto{\pgfpoint{\kitcolumnfourright}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumnfourright}{\paperheight}}
    \pgfpathmoveto{\pgfpoint{\kitcolumnfiveleft}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumnfiveleft}{\paperheight}}
    \pgfpathmoveto{\pgfpoint{\kitcolumnfiveright}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumnfiveright}{\paperheight}}
    \pgfpathmoveto{\pgfpoint{\kitcolumnsixleft}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumnsixleft}{\paperheight}}
    \pgfpathmoveto{\pgfpoint{\kitcolumnsixright}{0cm}}
    \pgfpathlineto{\pgfpoint{\kitcolumnsixright}{\paperheight}}
    % zeichnen
    \pgfsetstrokecolor{kit-orange50}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

% Outside edges
\ifspaceforface
  \newlength{\spaceforface}
  \setlength{\spaceforface}{\kittwocolumns}
  \setbeamersize{text margin left=\kitoutermargin,text margin right=\spaceforface}
\else
  \setbeamersize{text margin left=\kitoutermargin,text margin right=\kitoutermargin} 
\fi

% keine Navigationssymbole
\setbeamertemplate{navigation symbols}{}
\setbeamercovered{invisible}
\beamer@compresstrue 
% Miniframes (Navigations-Punkte) für Subsections immer in einer Zeile, ohne Umbrüche
% Miniframes (navigation points) for subsections always in one line, without breaks

% Mehrere Folienlayouts erlauben
% siehe https://stackoverflow.com/questions/3158665/having-multiple-slide-templates-in-latex-beamer

%%
%% Standard-Layout
%%

\BeforeBeginEnvironment{frame}{%
  \restoregeometry
  % Section navigation reset to package option
  \ifsectionnavigationoption\sectionnavigationtrue\else\sectionnavigationfalse\fi
  % KIT-Logo rgb
  \setbeamertemplate{frametitle}[KIT 2025]{\paperwidth}
  \setbeamertemplate{footline}[KIT 2025]
  \setbeamertemplate{background}[default]
  \setbeamertemplate{logo}[KIT 2025 title/toc]{kitlogo_rgb} % orignally was {logo}{}
  \ifkitgrid\setbeamertemplate{background canvas}[kitgrid]\fi
  % \setbearmertemplate{fundings}{}
}

% ┌───────────┐
% │   Header  │
% └───────────┘

% #1 = textwidth of the title
\defbeamertemplate{frametitle}{KIT 2025}[1]{
  % Oberkante Titeltext / Top title text
  \begin{textblock*}{#1}[0,0](\kitoutermargin,\kitoutermargin)%
    {\usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\insertframetitle}%
    \ifx\insertframesubtitle\@empty\else\\\fi
    {\usebeamercolor[fg]{framesubtitle}\usebeamerfont{framesubtitle}\insertframesubtitle}%
  \end{textblock*}%
  \vspace{37mm}%
}

% #1 = logo
\defbeamertemplate{logo}{KIT 2025 title/toc}[1]{
  \begin{textblock*}{28mm}(297.5mm, \kitoutermargin) % originally {24mm}
    \includegraphics[width=\linewidth]{logos/#1} 
  \end{textblock*}
  \vspace{37mm}%
}

% ┌────────────┐
% │   /Header  │   
% └────────────┘

% ┌──────────┐
% │ Footer   │   
% └──────────┘

% The footer is adjusted for two-line titles
\newlength{\kitfooterbaselinecorrection}

% small text only if "smallfoot" option is chosen 
\ifsmallfooterfont
    % 11pt wie in offiziellen Vorlage
    \setbeamerfont{footer}{size=\scriptsize}
    \setlength{\kitfooterbaselinecorrection}{2pt}
  \else
    % 12pt, besser lesbar
    \setbeamerfont{footer}{size=\footnotesize}
    \setlength{\kitfooterbaselinecorrection}{3pt}
\fi

%
% Section points that scale with the font size
%
% adjusted from https://tex.stackexchange.com/questions/292070/beamer-navigation-bar-too-long
\defbeamertemplate{mini frame}{scaled circle}
{%
  \usebeamerfont{footer}%
  \begin{pgfpicture}{0pt}{0pt}{1ex}{1ex}
    \pgfsetlinewidth{.13ex}
    \pgfpathcircle{\pgfpoint{.5ex}{.5ex}}{.5ex}
    \pgfusepath{fill,stroke}
  \end{pgfpicture}%
}
[action]
{
  \usebeamerfont{footer}%
  \setbeamersize{mini frame size=1.4ex,mini frame offset=.4ex}
}

\defbeamertemplate{mini frame in current section}{scaled circle}
{%
  \usebeamerfont{footer}%
  \begin{pgfpicture}{0pt}{0pt}{1ex}{1ex}
    \pgfsetlinewidth{.13ex}
    \pgfpathcircle{\pgfpoint{.5ex}{.5ex}}{.5ex}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in current subsection}{scaled circle}
{%
  \usebeamerfont{footer}%
  \begin{pgfpicture}{0pt}{0pt}{1ex}{1ex}
    \pgfsetlinewidth{.13ex}
    \pgfpathcircle{\pgfpoint{.5ex}{.5ex}}{.5ex}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame}{scaled rectangle}
{%
  \usebeamerfont{footer}%
  \begin{pgfpicture}{0pt}{0pt}{1ex}{1ex}
    \pgfsetlinewidth{.1ex}
    \pgfpathrectangle{\pgfpoint{0ex}{0ex}}{\pgfpoint{1ex}{1ex}}
    \pgfusepath{fill,stroke}
  \end{pgfpicture}%
}
[action]
{
  \usebeamerfont{footer}%
  \setbeamersize{mini frame size=1.4ex,mini frame offset=.4ex}
}

\defbeamertemplate{mini frame in current section}{scaled rectangle}
{%
  \usebeamerfont{footer}%
  \begin{pgfpicture}{0pt}{0pt}{1ex}{1ex}
    \pgfsetlinewidth{.1ex}
    \pgfpathrectangle{\pgfpoint{0ex}{0ex}}{\pgfpoint{1ex}{1ex}}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in current subsection}{scaled rectangle}
{%
  \usebeamerfont{footer}%
  \begin{pgfpicture}{0pt}{0pt}{1ex}{1ex}
    \pgfsetlinewidth{.1ex}
    \pgfpathrectangle{\pgfpoint{0ex}{0ex}}{\pgfpoint{1ex}{1ex}}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\setbeamertemplate{mini frame}[scaled circle]
\setbeamertemplate{mini frame in current section}[scaled circle]
\setbeamertemplate{mini frame in current subsection}[scaled circle]

%%
%% /Section points that scale with the font size
%%

\setbeamerfont{page number in head/foot}{series=\bfseries}

\newlength{\kitbottomdepth}
\newlength{\kitbottomheight}
\newlength{\kitfootergroupwidth}

% Standard footer full width
\defbeamertemplate{footline}{KIT 2025}{%
  %% The "%" at the end are necessary to avoid adding spaces
  % If no group name is given, use the entire width of the footer for the title.
  \ifdefined\@groupname%
    \ifx\@groupname\empty%
      \setlength{\kitfootergroupwidth}{0mm}%
      \else%
      % If the width of the group name is defined, use that, otherwise 89 mm
      \ifdefined\@groupnamewidth%
        \setlength{\kitfootergroupwidth}{\@groupnamewidth}%
        \else%
        \setlength{\kitfootergroupwidth}{89mm}%
      \fi%
    \fi%
  \else%
      \setlength{\kitfootergroupwidth}{0mm}%
  \fi%
  \usebeamerfont{footer}%
  % Set the baseline so that the text is approximately centered
  \setlength{\kitbottomdepth}{\dimexpr.5\kitbottom-.3\baselineskip\relax}%
  \setlength{\kitbottomheight}{\dimexpr.5\kitbottom+.7\baselineskip\relax}%
  %
  % Right and left margins set visually by trial and error
  \ifsectionnavigation%
    \begin{beamercolorbox}[wd=\paperwidth, leftskip=7.5mm, rightskip=7.5mm]{}%
      \insertnavigation{\dimexpr\paperwidth-15mm\relax}%
    \end{beamercolorbox}%
  \fi%
  \leavevmode%
  \kitfootlinepagenumber%
  % \kitfootlinedate%
  % The boxes with the title and group name are vertically centered, so that even two-line texts look nice
  % Therefore, they must be shifted down by \kitbottomdepth
  \raisebox{-\kitbottomdepth}{%
    % The box therefore has a height of \kitbottom and a depth of 0mm
    \kitfootlinetitle{\dimexpr276mm-\kitfootergroupwidth\relax}% originally 251mm; added the width of removed date width and reduced logo width
    \ifdefined\@groupname%
      \kitfootlinegroupname%
    \fi% 
  }%
  % logo in footline
  \hspace{6mm}\kitfootlinelogo{CEL_logo}% 
}

% Footer variable width for slides with full-screen image content: without section navigation, group name, and group logo
\defbeamertemplate{footline}{KIT 2025 picture}[1]{%
  \usebeamerfont{footer}%
  % Set the baseline so that the text is approximately centered
  \setlength{\kitbottomdepth}{\dimexpr.5\kitbottom-.3\baselineskip\relax}%
  \setlength{\kitbottomheight}{\dimexpr.5\kitbottom+.7\baselineskip\relax}%
  \leavevmode%
  \kitfootlinepagenumber%
  % \kitfootlinedate%
  % The box with the title is vertically centered, so that even two-line texts look nice
  % Therefore, they must be shifted down by \kitbottomdepth
  \raisebox{-\kitbottomdepth}{%
    % Die Box hat daher auch Höhe \kitbottom und Tiefe 0mm
    \kitfootlinetitle{#1}%
  }%
  % Kein Gruppenname
  \hskip\dimexpr285mm-#1\relax% originally 251mm; added the width of removed date width
  % This is a picture frame, don't put logo in the footline
  % \kitfootlinelogo{CEL_logo}%
}

% Page nummer
\newcommand{\kitfootlinepagenumber}{%
  \begin{beamercolorbox}[wd=\dimexpr\kitoutermargin+16mm\relax, ht=\kitbottomheight, dp=\kitbottomdepth, leftskip=\kitoutermargin]{footer}
      \usebeamerfont{page number in head/foot}%
      \strut\insertframenumber{}/\inserttotalframenumber%
  \end{beamercolorbox}%
}

% % Date
% \newcommand{\kitfootlinedate}{%
%   \begin{beamercolorbox}[wd=31mm, ht=\kitbottomheight, dp=\kitbottomdepth]{footer}%
%       \usebeamerfont{date in head/foot}%
%       \strut\insertshortdate%
%   \end{beamercolorbox}%
% }

% Autor/Titel in width #1
\newcommand{\kitfootlinetitle}[1]{%
    \begin{beamercolorbox}[wd=#1, ht=\kitbottom, dp=0mm]{footer}%
        % Content vertically centered; adjustment by 1.5 pt so that with single-line content the baseline of the blocks with page number is exactly hit
        \vbox to\kitbottom{\vfill\vskip\kitfooterbaselinecorrection%
          \strut\beamer@shortauthor\ifx\beamer@shortauthor\empty\else: \fi\beamer@shorttitle%
        \vfill}%
    \end{beamercolorbox}%
}

% Gruppenname
\newcommand{\kitfootlinegroupname}{%
    \begin{beamercolorbox}[wd=\kitfootergroupwidth, ht=\kitbottom, dp=0mm]{footer}
        \vbox to\kitbottom{\vfill\vskip\kitfooterbaselinecorrection%
          \strut\@groupname%
        \vfill}%
    \end{beamercolorbox}%
}

% Group Logo in footer, file name #1
\newcommand{\kitfootlinelogo}[1]{%
    \begin{beamercolorbox}[wd=15mm, ht=\kitbottomheight, dp=\kitbottomdepth]{footer}
      \raisebox{-8pt}{
        \includegraphics[width=\linewidth]{logos/#1}
      }
    \end{beamercolorbox}%
}

% ┌───────────┐
% │ / Footer  │
% └───────────┘

% ┌─────────────────┐
% │ Special-Layouts │
% └─────────────────┘

% Text/image vertically split
\define@key{beamerframe}{picture 33 vertical}[true]{%
  \kitpicturevertical{\kitcolumnfiveleft}
}

\define@key{beamerframe}{picture 50 vertical}[true]{%
  \kitpicturevertical{\kitcolumnfourleft}
}

\define@key{beamerframe}{picture 66 vertical}[true]{%
  \kitpicturevertical{\kitcolumnthreeleft}
}

\define@key{beamerframe}{picture vertical}[51]{%
  \kitpicturevertical{\dimexpr\paperwidth*(100-#1)/100\relax}
}

\newcommand{\kitpicturevertical}[1]{
  \setbeamertemplate{frametitle}[KIT 2025]{\dimexpr#1-\kitoutermargin-\kitcolumnsep\relax}
  \setbeamertemplate{logo}{}
  \setbeamertemplate{footline}[KIT 2025 picture]{\dimexpr#1-\kitoutermargin-\kitcolumn\relax}
  \newgeometry{top=0.5cm,bottom=0cm,left=\kitoutermargin,right=\dimexpr\paperwidth-#1+\kitcolumnsep\relax}
  \setbeamertemplate{background}{\hskip#1\includegraphics[height=\paperheight]{\@titleimage}}
}

% siehe README.md
\define@key{beamerframe}{picture}{%
  \titleimage{#1}
}

\define@key{beamerframe}{kitlogo}[rgb]{%
  \titlelogo{#1}
}

% ┌──────────────────┐
% │ /Special-Layouts │
% └──────────────────┘

% ┏━━━━━━━━━━━━━━━━━━━┓
% ┃ Table of contents ┃
% ┗━━━━━━━━━━━━━━━━━━━┛

\define@key{beamerframe}{tableofcontents}[blue]{%
  \setbeamertemplate{background}{
    \begin{beamercolorbox}[ht=\paperheight,wd=\kitcolumnsixleft]{#1 block}
    \end{beamercolorbox}%
    \begin{beamercolorbox}[ht=\paperheight,wd=\dimexpr\kitcolumn+\kitoutermargin\relax,center,rightskip=\kitoutermargin]{title logo box}
      \ifspaceforface{}
      \else\kittitlegrouplogo
      \fi
      \vskip\kitbottom
    \end{beamercolorbox}
  }
  \setbeamercolor{section in toc}{fg=white}
  \setbeamercolor{subsection in toc}{fg=white}
  \setbeamertemplate{logo}[KIT 2025 title/toc]{kitlogo_rgb}
  \setbeamertemplate{frametitle}[KIT 2025 title in toc]
  \setbeamertemplate{footline}{}
}

\defbeamertemplate{frametitle}{KIT 2025 title in toc}{
    \begin{textblock*}{\kitcolumn}(\kitoutermargin,\kitoutermargin)
      \begin{beamercolorbox}[wd=\kitcolumn]{}
        \usebeamerfont*{frametitle}{\color{white}\insertframetitle} % 2025KIT-template has \large
      \end{beamercolorbox}
    \end{textblock*}
}

\AtBeginSection{%
\ifoverviewatsection
\ifnum\value{section}=1
{
  \begin{frame}[tableofcontents=blue]{Overview}
    \ifshowsubsectionsatfirstoverview{
      \tableofcontents[subsectionstyle=show/show/show, subsubsectionstyle=hide/hide/hide]
    }
    \else{\tableofcontents[subsectionstyle=hide/hide/hide]}
    \fi 
  \end{frame}
}
\else
{
  \begin{frame}[tableofcontents=blue]{Overview}
    \tableofcontents[currentsection, subsectionstyle=shaded/show/hide]
  \end{frame}
}
\fi
}

%% ┏━━━━━━━━━━━━━━━━━━━━━┓
%% ┃ TOC sections styles ┃
%% ┗━━━━━━━━━━━━━━━━━━━━━┛
% \setbeamertemplate{section in toc}{{\inserttocsectionnumber.~\inserttocsection}\\[.2em]}
\setbeamertemplate{section in toc}{{-~\inserttocsection}\\[.2em]}
\setbeamercolor{section in toc}{fg=kit-royalblue}
\iffranklin
  \setbeamerfont{section in toc}{size=\Large, series=\sbseries}
\else
  \setbeamerfont{section in toc}{size=\Large, series=\bfseries}
\fi
\setbeamerfont{subsection in toc}{size=\large}

%% ┏━━━━━━━━━━━━━━━━━━━━━━┓
%% ┃ /TOC sections styles ┃
%% ┗━━━━━━━━━━━━━━━━━━━━━━┛

% ┏━━━━━━━━━━━━━━━━━━━┓
% ┃ /Table of contents ┃
% ┗━━━━━━━━━━━━━━━━━━━┛

%% ┏━━━━━━━━━━━━━━━━┓
%% ┃ /Frame-Layout  ┃
%% ┗━━━━━━━━━━━━━━━━┛

%% ┏━━━━━━━━━━━━┓
%% ┃ Titel page ┃
%% ┗━━━━━━━━━━━━┛

\def\titleimage#1{\def\@titleimage{#1}}
\def\titlelogo#1{\def\@titlelogo{#1}}
\def\grouplogo#1{\def\@grouplogo{#1}}
\def\fundinglogos#1{\def\@fundinglogos{#1}}
%% Frame options

% vertical Layouts
\define@key{beamerframe}{title white vertical}[true]{%
  \setbeamercolor*{title}{parent=title on green}
  \setbeamercolor*{subtitle}{parent=subtitle on green}
  \setbeamercolor*{title text box}{parent=green block}
  \setbeamercolor*{title logo box}{parent=white block}
  \setbeamertemplate{background}[KIT 2025 title vertical]
  \setbeamertemplate{logo}[KIT 2025 title/toc]{kitlogo_rgb} % logo in the header
  % \setbeamertemplate{fundings}[KIT 2025 title vertical]
  \setbeamertemplate{title page}[KIT 2025 vertical]
  \setbeamertemplate{frametitle}{}
  \setbeamertemplate{footline}{}
}

\define@key{beamerframe}{title blue vertical}[true]{%
  \setbeamercolor*{title}{parent=title on green}
  \setbeamercolor*{subtitle}{parent=subtitle on green}
  \setbeamercolor*{title text box}{parent=green block}
  \setbeamercolor*{title logo box}{parent=blue block}
  \setbeamertemplate{background}[KIT 2025 title vertical]
  \setbeamertemplate{logo}[KIT 2025 title/toc]{kitlogo_white}
  \setbeamertemplate{title page}[KIT 2025 vertical]
  \setbeamertemplate{frametitle}{}
  \setbeamertemplate{footline}{}
}

% horizontal Layouts
\define@key{beamerframe}{title green horizontal}[true]{%
  \setbeamercolor*{title}{parent=title on green}
  \setbeamercolor*{subtitle}{parent=subtitle on green}
  \setbeamercolor*{title logo box}{parent=green block}
  \setbeamercolor*{title text box}{parent=green block}
  \setbeamertemplate{background}[KIT 2025 title horizontal]
  \setbeamertemplate{frametitle}[KIT 2025 title horizontal]
  \setbeamertemplate{footline}[KIT 2025 title horizontal]
  % KIT-Logo according to definition, otherwise rgb
  \ifdefined\@titlelogo\else\titlelogo{rgb}\fi
  \setbeamertemplate{logo}[KIT 2025 title/toc]{kitlogo_\@titlelogo}
  \setbeamertemplate{title page}[KIT 2025 horizontal]
}

\define@key{beamerframe}{title white horizontal}[true]{%
  \setbeamercolor*{title}{parent=title on white}
  \setbeamercolor*{subtitle}{parent=subtitle on white}
  \setbeamercolor*{title logo box}{parent=white block}
  \setbeamercolor*{title text box}{parent=white block}
  \setbeamertemplate{background}[KIT 2025 title horizontal]
  \setbeamertemplate{frametitle}[KIT 2025 title horizontal]
  \setbeamertemplate{footline}[KIT 2025 title horizontal]
  % KIT-Logo nach Definition, sonst bunt
  \ifdefined\@titlelogo\else\titlelogo{rgb}\fi
  \setbeamertemplate{logo}[KIT 2025 title/toc]{kitlogo_\@titlelogo}
  \setbeamertemplate{title page}[KIT 2025 horizontal]
}

%%
%% Absolute position elements
%%
%
% From textpos documentation (https://ctan.org/pkg/textpos)
%
% \begin{textblock}{<hsize>}[<href>,<vref>](<hpos>,<vpos>)
%   The coordinates <href> and <vref> are fractions of the width and height of the text
%   box, respectively, and state that the box is to be placed so that the reference point
%   (<href>,<vref>) within the box is to be placed at the point (<hpos>,<vpos>) on the page.

% KIT-Logo
\newcommand{\kittitlekitlogo}[1]{
  \begin{textblock*}{24mm}(297.5mm,\kitoutermargin)
  \includegraphics[width=24mm]{logos/#1} 
  \end{textblock*}
}

% Title at vertical height #1 with width #2
\newcommand{\kittitletitle}[2]{
  \begin{textblock*}{#2}(\kitoutermargin,#1)
    \begin{beamercolorbox}[wd=#2]{title}
      {\usebeamerfont*{title}\inserttitle\par}%
      \ifx\insertsubtitle\empty\else\vspace{0.5cm}\fi%
      {\usebeamerfont*{subtitle}\insertsubtitle\par}%
    \end{beamercolorbox}
  \end{textblock*}
}

% Author/Date at the bottom with width #1
\newcommand{\kittitleauthors}[1]{
  \begin{textblock*}{#1}[0,1](\kitoutermargin,\dimexpr\paperheight-\kitbottom\relax)
    \begin{beamercolorbox}[wd=#1]{subtitle}
      {\usebeamerfont*{author}\insertauthor\par}%
      \ifx\insertdate\empty\else\vspace{.5cm}\fi%
      {\usebeamerfont*{date}\insertdate}%
    \end{beamercolorbox}
  \end{textblock*}
}

%%
%% Group logo
%%

\newcommand{\kittitlegrouplogo}{
  \ifdefined\@grouplogo
    \ifx\@grouplogo\empty \else
      \includegraphics[width=30mm,keepaspectratio]{logos/\@grouplogo} % originally width was 37mm
      % height=20mm,
    \fi % if \grouplogo{} is called, do not include group logo
    \else % if \grouplogo is not called at all, show text
      \colorbox{kit-purple100!20}{\parbox[b][18mm][c]{35mm}{\color{kit-purple100}\scriptsize\centering 
        \ifgerman
        Bitte Logo über \texttt{\textbackslash grouplogo\{\}} festlegen.
        \else
        Please set a logo using \texttt{\textbackslash grouplogo\{\}}.
        \fi
        }}
  \fi 
}


%%
%% Funding logos
%%
\newcommand{\fundinglogo}[1]{
  \includegraphics[width=30mm, keepaspectratio]{logos/Funding-logos/#1}  % heightg = 20mm
}
%%
%% Title page Template Definitions
%%

\defbeamertemplate{title page}{KIT 2025 vertical}{
  \kittitletitle{\kitoutermargin}{\dimexpr\kitthreecolumns-\kitcolumnsep\relax}
  \kittitleauthors{\dimexpr\kitthreecolumns-\kitcolumnsep\relax}
}

% vertical Layout
\defbeamertemplate{background}{KIT 2025 title vertical}{
    \begin{beamercolorbox}[ht=\paperheight,wd=\kitcolumnthreeright]{title text box}
    \end{beamercolorbox}%
    % \ifspaceforface{}
    % \else
      \begin{beamercolorbox}[ht=\paperheight,wd=\dimexpr2\kitcolumn+3\kitcolumnsep\relax]{title logo box}%
      \ifdefined\@titleimage%
        \ifx\@titleimage\empty\else%
        \includegraphics[height=\paperheight]{\@titleimage}%
        \fi%
      \fi%
    \end{beamercolorbox}%
    % \fi
    \begin{beamercolorbox}[ht=\paperheight,wd=\dimexpr\kitcolumn+\kitoutermargin\relax,center,rightskip=\kitoutermargin]{title logo box}
      \ifdefined\@fundinglogos%
        \ifx\@fundinglogos\empty\else%
          \foreach \logo in \@fundinglogos {
            \fundinglogo{\logo}
            \vskip\kitoutermargin
          }
        \fi%
      \fi%
      \kittitlegrouplogo
      \vskip\kitbottom
    \end{beamercolorbox}
}

% horizontales Layout

\defbeamertemplate{title page}{KIT 2025 horizontal}{
  \kittitletitle{\kitrowfourtop}{\kitfivecolumns}
  \kittitleauthors{\kitfivecolumns}
  \frametitle{none} % The upper half is rendered
}

% In horizontal mode, the frametitle is the upper half of the title
\defbeamertemplate{frametitle}{KIT 2025 title horizontal}{
    \begin{beamercolorbox}[ht=\kitrowthreebottom,wd=\paperwidth]{title logo box}%
    \ifdefined\@titleimage%
      \ifx\@titleimage\empty\else%
      \includegraphics[width=\paperwidth]{\@titleimage}%
      \fi%
    \fi%
    \end{beamercolorbox}%
}

% In horizontal mode, the footline is the lower half of the title
\defbeamertemplate{footline}{KIT 2025 title horizontal}{
    \begin{beamercolorbox}[ht=\dimexpr2\kitrowsep+2\kitrow+\kitbottom\relax,wd=\paperwidth,right,rightskip=\kitoutermargin]{title logo box}%
      \kittitlegrouplogo%
      \vskip\kitbottom
    \end{beamercolorbox}%
}

%% ┏━━━━━━━━━━━━━┓
%% ┃ /Titel page ┃
%% ┗━━━━━━━━━━━━━┛

%% ┏━━━━━━━━┓
%% ┃ Colors ┃
%% ┗━━━━━━━━┛
%% KIT-Color scheme

% KIT color  green :
\definecolor{kit-green}{RGB}{0, 150, 130}
\colorlet{kit-green100}{kit-green}
\colorlet{kit-green90}{kit-green!90!white}
\colorlet{kit-green80}{kit-green!80!white}
\colorlet{kit-green70}{kit-green!70!white}
\colorlet{kit-green60}{kit-green!60!white}
\colorlet{kit-green50}{kit-green!50!white}
\colorlet{kit-green40}{kit-green!40!white}
\colorlet{kit-green30}{kit-green!30!white}
\colorlet{kit-green25}{kit-green!25!white}
\colorlet{kit-green20}{kit-green!20!white}
\colorlet{kit-green15}{kit-green!15!white}
\colorlet{kit-green10}{kit-green!10!white}
\colorlet{kit-green5}{kit-green!5!white}

% KIT color blue:
\definecolor{kit-blue}{RGB}{70, 100, 170}
\colorlet{kit-blue100}{kit-blue}
\colorlet{kit-blue90}{kit-blue!90!white}
\colorlet{kit-blue80}{kit-blue!80!white}
\colorlet{kit-blue70}{kit-blue!70!white}
\colorlet{kit-blue60}{kit-blue!60!white}
\colorlet{kit-blue50}{kit-blue!50!white}
\colorlet{kit-blue40}{kit-blue!40!white}
\colorlet{kit-blue30}{kit-blue!30!white}
\colorlet{kit-blue25}{kit-blue!25!white}
\colorlet{kit-blue20}{kit-blue!20!white}
\colorlet{kit-blue15}{kit-blue!15!white}
\colorlet{kit-blue10}{kit-blue!10!white}
\colorlet{kit-blue5}{kit-blue!5!white}

\definecolor{kit-royalblue}{RGB}{0, 45, 76}
\colorlet{kit-royalblue100}{kit-royalblue}
\colorlet{kit-royalblue90}{kit-royalblue!90!white}
\colorlet{kit-royalblue80}{kit-royalblue!80!white}
\colorlet{kit-royalblue70}{kit-royalblue!70!white}
\colorlet{kit-royalblue60}{kit-royalblue!60!white}
\colorlet{kit-royalblue50}{kit-royalblue!50!white}
\colorlet{kit-royalblue40}{kit-royalblue!40!white}
\colorlet{kit-royalblue30}{kit-royalblue!30!white}
\colorlet{kit-royalblue25}{kit-royalblue!25!white}
\colorlet{kit-royalblue20}{kit-royalblue!20!white}
\colorlet{kit-royalblue15}{kit-royalblue!15!white}
\colorlet{kit-royalblue10}{kit-royalblue!10!white}
\colorlet{kit-royalblue5}{kit-royalblue!5!white}

% Powerpoint-"Eisblau"
\definecolor{kit-iceblue100}{RGB}{30, 53, 69}
\definecolor{kit-iceblue70}{RGB}{68, 94, 111}
\definecolor{kit-iceblue50}{RGB}{168, 185, 196}
\definecolor{kit-iceblue30}{RGB}{218, 225, 230}

% KIT color red :
\definecolor{kit-red}{RGB}{162, 34, 35}
\colorlet{kit-red100}{kit-red}
\colorlet{kit-red90}{kit-red!90!white}
\colorlet{kit-red80}{kit-red!80!white}
\colorlet{kit-red70}{kit-red!70!white}
\colorlet{kit-red60}{kit-red!60!white}
\colorlet{kit-red50}{kit-red!50!white}
\colorlet{kit-red40}{kit-red!40!white}
\colorlet{kit-red30}{kit-red!30!white}
\colorlet{kit-red25}{kit-red!25!white}
\colorlet{kit-red20}{kit-red!20!white}
\colorlet{kit-red15}{kit-red!15!white}
\colorlet{kit-red10}{kit-red!10!white}
\colorlet{kit-red5}{kit-red!5!white}

% KIT color yellow :
\definecolor{kit-yellow}{RGB}{252, 229, 0}
\colorlet{kit-yellow100}{kit-yellow}
\colorlet{kit-yellow90}{kit-yellow!90!white}
\colorlet{kit-yellow80}{kit-yellow!80!white}
\colorlet{kit-yellow70}{kit-yellow!70!white}
\colorlet{kit-yellow60}{kit-yellow!60!white}
\colorlet{kit-yellow50}{kit-yellow!50!white}
\colorlet{kit-yellow40}{kit-yellow!40!white}
\colorlet{kit-yellow30}{kit-yellow!30!white}
\colorlet{kit-yellow25}{kit-yellow!25!white}
\colorlet{kit-yellow20}{kit-yellow!20!white}
\colorlet{kit-yellow15}{kit-yellow!15!white}
\colorlet{kit-yellow10}{kit-yellow!10!white}
\colorlet{kit-yellow5}{kit-yellow!5!white}

% KIT color orange :
\definecolor{kit-orange}{RGB}{223, 155, 27}
\colorlet{kit-orange100}{kit-orange}
\colorlet{kit-orange90}{kit-orange!90!white}
\colorlet{kit-orange80}{kit-orange!80!white}
\colorlet{kit-orange70}{kit-orange!70!white}
\colorlet{kit-orange60}{kit-orange!60!white}
\colorlet{kit-orange50}{kit-orange!50!white}
\colorlet{kit-orange40}{kit-orange!40!white}
\colorlet{kit-orange30}{kit-orange!30!white}
\colorlet{kit-orange25}{kit-orange!25!white}
\colorlet{kit-orange20}{kit-orange!20!white}
\colorlet{kit-orange15}{kit-orange!15!white}
\colorlet{kit-orange10}{kit-orange!10!white}
\colorlet{kit-orange5}{kit-orange!5!white}

% KIT color lightgreen :
\definecolor{kit-lightgreen}{RGB}{140, 182, 60}
\colorlet{kit-lightgreen100}{kit-lightgreen}
\colorlet{kit-lightgreen90}{kit-lightgreen!90!white}
\colorlet{kit-lightgreen80}{kit-lightgreen!80!white}
\colorlet{kit-lightgreen70}{kit-lightgreen!70!white}
\colorlet{kit-lightgreen60}{kit-lightgreen!60!white}
\colorlet{kit-lightgreen50}{kit-lightgreen!50!white}
\colorlet{kit-lightgreen40}{kit-lightgreen!40!white}
\colorlet{kit-lightgreen30}{kit-lightgreen!30!white}
\colorlet{kit-lightgreen25}{kit-lightgreen!25!white}
\colorlet{kit-lightgreen20}{kit-lightgreen!20!white}
\colorlet{kit-lightgreen15}{kit-lightgreen!15!white}
\colorlet{kit-lightgreen10}{kit-lightgreen!10!white}
\colorlet{kit-lightgreen5}{kit-lightgreen!5!white}


% KIT color purple :
\definecolor{kit-purple}{RGB}{163, 16, 124}
\colorlet{kit-purple100}{kit-purple}
\colorlet{kit-purple90}{kit-purple!90!white}
\colorlet{kit-purple80}{kit-purple!80!white}
\colorlet{kit-purple70}{kit-purple!70!white}
\colorlet{kit-purple60}{kit-purple!60!white}
\colorlet{kit-purple50}{kit-purple!50!white}
\colorlet{kit-purple40}{kit-purple!40!white}
\colorlet{kit-purple30}{kit-purple!30!white}
\colorlet{kit-purple25}{kit-purple!25!white}
\colorlet{kit-purple20}{kit-purple!20!white}
\colorlet{kit-purple15}{kit-purple!15!white}
\colorlet{kit-purple10}{kit-purple!10!white}
\colorlet{kit-purple5}{kit-purple!5!white}

% KIT color brown :
\definecolor{kit-brown}{RGB}{167, 130, 46}
\colorlet{kit-brown100}{kit-brown}
\colorlet{kit-brown90}{kit-brown!90!white}
\colorlet{kit-brown80}{kit-brown!80!white}
\colorlet{kit-brown70}{kit-brown!70!white}
\colorlet{kit-brown60}{kit-brown!60!white}
\colorlet{kit-brown50}{kit-brown!50!white}
\colorlet{kit-brown40}{kit-brown!40!white}
\colorlet{kit-brown30}{kit-brown!30!white}
\colorlet{kit-brown25}{kit-brown!25!white}
\colorlet{kit-brown20}{kit-brown!20!white}
\colorlet{kit-brown15}{kit-brown!15!white}
\colorlet{kit-brown10}{kit-brown!10!white}
\colorlet{kit-brown5}{kit-brown!5!white}

% KIT color cyan :
\definecolor{kit-cyan}{RGB}{35, 161, 224}
\colorlet{kit-cyan100}{kit-cyan}
\colorlet{kit-cyan90}{kit-cyan!90!white}
\colorlet{kit-cyan80}{kit-cyan!80!white}
\colorlet{kit-cyan70}{kit-cyan!70!white}
\colorlet{kit-cyan60}{kit-cyan!60!white}
\colorlet{kit-cyan50}{kit-cyan!50!white}
\colorlet{kit-cyan40}{kit-cyan!40!white}
\colorlet{kit-cyan30}{kit-cyan!30!white}
\colorlet{kit-cyan25}{kit-cyan!25!white}
\colorlet{kit-cyan20}{kit-cyan!20!white}
\colorlet{kit-cyan15}{kit-cyan!15!white}
\colorlet{kit-cyan10}{kit-cyan!10!white}
\colorlet{kit-cyan5}{kit-cyan!5!white}

% KIT color gray :
\definecolor{kit-gray}{RGB}{0, 0, 0}
\colorlet{kit-gray100}{kit-gray}
\colorlet{kit-gray90}{kit-gray!90!white}
\colorlet{kit-gray80}{kit-gray!80!white}
\colorlet{kit-gray70}{kit-gray!70!white}
\colorlet{kit-gray60}{kit-gray!60!white}
\colorlet{kit-gray50}{kit-gray!50!white}
\colorlet{kit-gray40}{kit-gray!40!white}
\colorlet{kit-gray30}{kit-gray!30!white}
\colorlet{kit-gray25}{kit-gray!25!white}
\colorlet{kit-gray20}{kit-gray!20!white}
\colorlet{kit-gray15}{kit-gray!15!white}
\colorlet{kit-gray10}{kit-gray!10!white}
\colorlet{kit-gray5}{kit-gray!5!white}

\setbeamercolor*{normal text}{fg=kit-royalblue}
\setbeamercolor*{alerted text}{fg=kit-red100}
\setbeamercolor*{example text}{fg=kit-royalblue}
\setbeamercolor*{structure}{fg=kit-royalblue}
\setbeamercolor*{frametitle}{fg=normal text.fg}
\setbeamercolor*{framesubtitle}{fg=kit-iceblue50}
\setbeamercolor*{footer}{fg=kit-iceblue50.fg}

\setbeamercolor*{palette primary}{fg=normal text.fg,bg=black!15}
\setbeamercolor*{palette secondary}{fg=normal text.fg,bg=black!15}
\setbeamercolor*{palette tertiary}{fg=normal text.fg,bg=black!15}
\setbeamercolor*{palette quaternary}{fg=normal text.fg,bg=black!15}

\setbeamercolor*{item projected}{fg=white,bg=kit-green100}
\setbeamercolor*{itemize item}{fg=kit-green100}
\setbeamercolor*{itemize subitem}{fg=kit-green100}
\setbeamercolor*{itemize subsubitem}{fg=kit-green100}
\setbeamertemplate{itemize/enumerate subbody begin}{\normalsize}
\setbeamertemplate{itemize/enumerate subsubbody begin}{\normalsize}

\setbeamercolor*{block title}{fg=white,bg=kit-green100}
\setbeamercolor*{block title alerted}{use=alerted text,fg=white,bg=alerted text.fg!75!black}
\setbeamercolor*{block title example}{fg=white,bg=kit-royalblue}

\setbeamercolor*{green block}{bg=kit-green100}
\setbeamercolor*{white block}{bg=white}
\setbeamercolor*{blue block}{bg=kit-royalblue100}

\setbeamercolor*{title on green}{fg=kit-green20}
\setbeamercolor*{title on white}{fg=kit-green100}

\setbeamercolor*{subtitle on green}{fg=white}
\setbeamercolor*{subtitle on white}{fg=normal text.fg}

\setbeamercolor*{block body}{fg=normal text.fg,bg=kit-green15}
\setbeamercolor*{block body alerted}{parent=normal text,use=block title alerted,bg=block title alerted.bg!10!bg}
\setbeamercolor*{block body example}{fg=normal text.fg,bg=kit-blue15}

\setbeamercolor*{standard box}{fg=white,bg=kit-green100}%
\setbeamercolor*{highlight box}{fg=white,bg=kit-royalblue100}%
\setbeamercolor*{highlight box gray}{fg=normal text.fg,bg=kit-iceblue50}%
\setbeamercolor*{highlight box lightgray}{fg=normal text.fg,bg=kit-iceblue30}%

\setbeamercolor*{standard box framed}{fg=kit-green100,bg=}%
\setbeamercolor*{highlight box framed}{fg=kit-royalblue100,bg=}%
\setbeamercolor*{highlight box gray framed}{fg=kit-iceblue50,bg=}%

\setbeamercolor*{background canvas}{bg=white}

\setbeamercolor*{footer}{fg=kit-royalblue100!50!white}

\setbeamercolor*{mini frame}{fg=kit-royalblue100!50!white}
\setbeamercolor{section in head/foot}{fg=kit-royalblue100!50!white}

%% ┏━━━━━━━━━┓
%% ┃ /Colors ┃
%% ┗━━━━━━━━━┛


%% ┏━━━━━━━━━━━━━━━━━━━━┓
%% ┃ Block-Definitions  ┃
%% ┗━━━━━━━━━━━━━━━━━━━━┛

% Original von tex/latex/beamer/beamerinnerthemedefault.sty
% Originally from beamerinnerthemedefault.sty

% colsep* is replaced by colsep, so that the blocks do not exceed the grid
\defbeamertemplate*{block begin}{KIT 2025}
{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep=.75ex]{block title}
    \usebeamerfont*{block title}\insertblocktitle%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title}
  {}
  {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body}%
  \begin{beamercolorbox}[colsep=.75ex,vmode]{block body}%
    \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\defbeamertemplate*{block end}{KIT 2025}  
{\end{beamercolorbox}\vskip\smallskipamount}

\defbeamertemplate*{block alerted begin}{KIT 2025}
{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep=.75ex]{block title alerted}
    \usebeamerfont*{block title alerted}\insertblocktitle%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title alerted}
  {}
  {\ifbeamercolorempty[bg]{block body alerted}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body alerted}%
  \begin{beamercolorbox}[colsep=.75ex,vmode]{block body alerted}%
    \ifbeamercolorempty[bg]{block body alerted}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

\defbeamertemplate*{block alerted end}{KIT 2025}
{\end{beamercolorbox}\vskip\smallskipamount}

\defbeamertemplate*{block example begin}{KIT 2025}
{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep=.75ex]{block title example}
    \usebeamerfont*{block title example}\insertblocktitle%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title example}
  {}
  {\ifbeamercolorempty[bg]{block body example}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body example}%
  \begin{beamercolorbox}[colsep=.75ex,vmode]{block body example}%
    \ifbeamercolorempty[bg]{block body example}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\defbeamertemplate*{block example end}{KIT 2025}
{\end{beamercolorbox}\vskip\smallskipamount}

\setbeamertemplate{block begin}[KIT 2025]
\setbeamertemplate{block end}[KIT 2025]
\setbeamertemplate{block alerted begin}[KIT 2025]
\setbeamertemplate{block alerted end}[KIT 2025]
\setbeamertemplate{block example begin}[KIT 2025]
\setbeamertemplate{block example end}[KIT 2025]

% Content environment for structuring. Basically a headline followed by text
\newenvironment<>{contentblock}[1]{\begingroup%
  \setbeamertemplate{blocks}[default]
	\setbeamercolor{block body}{fg=normal text.fg,bg=}%
  \setbeamercolor{block title}{fg=normal text.fg,bg=}%
  \setbeamerfont*{block title}{family=\sffamily,series=\bfseries,size=\large}
	\begin{block}#2{#1}%
	}{\end{block}%
\endgroup}

\newenvironment<>{royalblueblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-iceblue30!50}%
	\setbeamercolor{block title}{fg=white,bg=kit-royalblue100}%
	\begin{block}#2{#1}%
	}{\end{block}%
\endgroup}

\newenvironment<>{grayblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-iceblue30!50}%
	\setbeamercolor{block title}{fg=normal text.fg,bg=kit-iceblue50}%
	\begin{block}#2{#1}%
	}{\end{block}%
\endgroup}

\newenvironment<>{lightgrayblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-iceblue30!50}%
	\setbeamercolor{block title}{fg=normal text.fg,bg=kit-iceblue30}%
	\begin{block}#2{#1}%
	}{\end{block}%
\endgroup}

\newenvironment<>{greenblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-green15}%
	\setbeamercolor{block title}{fg=white,bg=kit-green100}%
	\begin{block}#2{#1}%
	}{\end{block}
\endgroup}

\newenvironment<>{blueblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-blue15}%
	\setbeamercolor{block title}{fg=white,bg=kit-blue100}%
	\begin{block}#2{#1}%
	}{\end{block}
\endgroup}

\newenvironment<>{redblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-red15}%
	\setbeamercolor{block title}{fg=white,bg=kit-red100}%
	\begin{block}#2{#1}%
	}{\end{block}%
\endgroup}

\newenvironment<>{brownblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-brown15}%
	\setbeamercolor{block title}{fg=white,bg=kit-brown100}%
	\begin{block}#2{#1}%
	}{\end{block}%
\endgroup}

\newenvironment<>{purpleblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-purple15}%
	\setbeamercolor{block title}{fg=white,bg=kit-purple100}%
	\begin{block}#2{#1}%
	}{\end{block}%
\endgroup}

\newenvironment<>{yellowblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-yellow30}%
	\setbeamercolor{block title}{fg=normal text.fg,bg=kit-yellow100}%
	\begin{block}#2{#1}%
	}{\end{block}%
\endgroup}

\newenvironment<>{lightgreenblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-lightgreen15}%
	\setbeamercolor{block title}{fg=white,bg=kit-lightgreen100}%
	\begin{block}#2{#1}%
	}{\end{block}%
\endgroup}

\newenvironment<>{orangeblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-orange15}%
	\setbeamercolor{block title}{fg=white,bg=kit-orange100}%
	\begin{block}#2{#1}%
	}{\end{block}%
\endgroup}

\newenvironment<>{cyanblock}[1]{\begingroup%
	\setbeamercolor{block body}{fg=normal text.fg,bg=kit-cyan15}%
	\setbeamercolor{block title}{fg=white,bg=kit-cyan100}%
	\begin{block}#2{#1}%
	}{\end{block}%
\endgroup}

%%
%% Boxs
%%

\newenvironment<>{standardbox}{%
  \begin{beamercolorbox}[sep=1em,center,vmode]{standard box}%
  \usebeamerfont{standard box}%
}{%
  \end{beamercolorbox}%
}

\newenvironment<>{highlightbox}{%
  \begin{beamercolorbox}[sep=1em,center,vmode]{highlight box}
  \usebeamerfont{highlight box}%
}{%
  \end{beamercolorbox}%
}

\newenvironment<>{grayhighlightbox}{%
  \begin{beamercolorbox}[sep=1em,center,vmode]{highlight box gray}
  \usebeamerfont{highlight box}%
}{%
  \end{beamercolorbox}%
}

\newenvironment<>{lightgrayhighlightbox}{%
  \begin{beamercolorbox}[sep=1em,center,vmode]{highlight box lightgray}
  \usebeamerfont{highlight box}%
}{%
  \end{beamercolorbox}%
}

%% ┏━━━━━━━━━━━━━━━━━━━━━┓
%% ┃ /Block-Definitionen ┃
%% ┗━━━━━━━━━━━━━━━━━━━━━┛

%% Appendix pages do not count in the total number of slides

\newcommand{\beginbackup}{
   \newcounter{framenumbervorappendix}
   \setcounter{framenumbervorappendix}{\value{framenumber}}
}
\newcommand{\backupend}{
   \addtocounter{framenumbervorappendix}{-\value{framenumber}}
   \addtocounter{framenumber}{\value{framenumbervorappendix}} 
}
