\whatsnote_provide_module:n { cover }

\keys_define:nn { whats / coverset }
  {
    title .tl_set:N    = \l__whatsnote_cover_title_tl,
    subtitle .tl_set:N = \l__whatsnote_cover_subtitle_tl,
    bioinfo .tl_set:N  = \l__whatsnote_cover_bioinfo_tl,
    color .tl_set:N    = \l__whatsnote_cover_color_tl,
      color .initial:n = gray,
    head .tl_set:N     = \l__whatsnote_cover_head_tl,
    logo .tl_set:N     = \l__whatsnote_cover_logo_tl,
  }

\NewDocumentCommand \coverset { m }
  {
    \keys_set:nn { whats / coverset } {#1}
    \exp_args:NNne
    \seq_set_split:Nnn \l__whatsnote_cover_head_seq {/}
      { \l__whatsnote_cover_head_tl }
    \exp_args:NNne
    \seq_set_split:Nnn \l__whatsnote_cover_logo_seq {/}
      { \l__whatsnote_cover_logo_tl }
  }

\RequirePackage{ graphicx, geometry, circuitikz, pagecolor }
\geometry{ margin = 1in }
\graphicspath
  {
    {./figure/} {./figures/} {./image/} {./images/}
    {./graphics/} {./graphic/} {./pictures/} {./picture/}
  }
\ExplSyntaxOff
\usetikzlibrary{ fadings, patterns, arrows, decorations.markings }
\tikzset
  {
    > = stealth',
    every picture/.append style =
      { line join = round, line cap = round, thick }
  }
\ExplSyntaxOn

\cs_new_protected_nopar:Npn \whatsnote_maketitle:
  {
    \newpagecolor{\l__whatsnote_cover_color_tl!10}
    \begin{titlepage}
      \begin{tikzpicture}[ remember~picture, overlay ]
        \fill [ white, opacity = .5 ] (current~page.south~east) rectangle +
          (-.8\paperwidth, .6\paperheight);
        \fill [ white, opacity = .5 ] (current~page.south~east) rectangle +
          (-.7\paperwidth, .7\paperheight);
        \node
          [ shift = {(-.35*\paperwidth,.65*\paperheight)},
            darkgray, font = \Huge\bfseries\sffamily
          ] at (current~page.south~east) { \l__whatsnote_cover_title_tl };
        \node
          [ shift = {(-.75*\paperwidth,.3*\paperheight)},
            rotate = 90, gray, opacity = .6, font = \huge\bfseries\sffamily
          ] at (current~page.south~east) { \l__whatsnote_cover_subtitle_tl };
        \node
          [ shift = {(.15*\paperwidth,.075*\paperheight)},
            gray, opacity = .4, font = \large
          ] at (current~page.south) { \l__whatsnote_cover_bioinfo_tl };
        \tl_if_empty:NF { \l__whatsnote_cover_head_tl }
          {
            \node
              [ rotate~around =
                  {
                    \seq_item:Nn \l__whatsnote_cover_head_seq {2} \c_colon_str
                    ([yshift = .35*\paperheight]current~page.center)
                  },
                yshift = .35*\paperheight
              ] at (current~page.center)
              {
                \includegraphics[ width = \paperwidth ]
                  { \seq_item:Nn \l__whatsnote_cover_head_seq {1} }
              };
          }
        \tl_if_empty:NF { \l__whatsnote_cover_logo_tl }
          {
            \node (cover~logo)
              [ shift = {(.65*\paperwidth,.3*\paperheight)}]
              at (current~page.south~west)
              {
                \includegraphics[ height=.3\paperheight ]
                  { \seq_item:Nn \l__whatsnote_cover_logo_seq {1} }
              };
            \fill
              [ pattern = \seq_item:Nn \l__whatsnote_cover_logo_seq {2},
                pattern~color = \l__whatsnote_cover_color_tl!15!white!25,
                scope~fading = south
              ] (cover~logo.south~west) rectangle (cover~logo.north~east);
          }
      \end{tikzpicture}
    \end{titlepage}
    \thispagestyle{empty}
    \cleardoublepage
    \restorepagecolor
  }

\RenewDocumentCommand \maketitle { }
  {
    \group_begin:
    \whatsnote_maketitle:
    \group_end:
  }

\endinput
