\usepackage{microtype}
\usepackage{lettrine}

\usepackage{mathspec}
\setmainfont{Linux Libertine O}
\setmathfont(Digits){TeX Gyre Pagella Math}
\setmathfont(Latin,Greek){Linux Libertine O}
\setmonofont[Scale=0.8]{Noto Sans Mono}
\setsansfont{Noto Sans}
\newfontfamily\yevon{FFXYevon.ttf}

\usepackage{pifont}
\newcommand{\sephim}{\vspace{1em}\fancybreak{\ding{98}}\vspace{1em}}
\newcommand{\sepffx}{\vspace{0.5em}\begin{center}{\yevon
      A}\end{center}\vspace{0.5em}}

\setlength\afterchapskip{3em}

\usepackage{titling}

\makeatletter
\def\cftchapterpresnum #1\@cftasnum{}
\cftsetindents{chapter}{0pt}{0pt}
\makeatother
\renewcommand*{\cftchapterfont}{\normalfont}
\renewcommand*{\cftchapterpagefont}{\normalfont}

\usepackage{polyglossia}
\setdefaultlanguage[variant=british]{english}

\usepackage{xcolor}
\definecolor{shadecolor}{gray}{0.85}
\usepackage{graphicx}

\PassOptionsToPackage{hyphens}{url}\usepackage[hidelinks]{hyperref}

\makeatletter
     \DeclareMathSymbol{0}{\mathalpha}{\eu@DigitsArabic@symfont}{`0}
     \DeclareMathSymbol{1}{\mathalpha}{\eu@DigitsArabic@symfont}{`1}
     \DeclareMathSymbol{2}{\mathalpha}{\eu@DigitsArabic@symfont}{`2}
     \DeclareMathSymbol{3}{\mathalpha}{\eu@DigitsArabic@symfont}{`3}
     \DeclareMathSymbol{4}{\mathalpha}{\eu@DigitsArabic@symfont}{`4}
     \DeclareMathSymbol{5}{\mathalpha}{\eu@DigitsArabic@symfont}{`5}
     \DeclareMathSymbol{6}{\mathalpha}{\eu@DigitsArabic@symfont}{`6}
     \DeclareMathSymbol{7}{\mathalpha}{\eu@DigitsArabic@symfont}{`7}
     \DeclareMathSymbol{8}{\mathalpha}{\eu@DigitsArabic@symfont}{`8}
     \DeclareMathSymbol{9}{\mathalpha}{\eu@DigitsArabic@symfont}{`9}
\makeatother

\emergencystretch 3em % keeps text fully justified
\raggedbottom

\setsecnumdepth{chapter} % unnumbered sections

\opt{nonamechapters}{
  \usepackage[explicit]{titlesec}
  \titleformat{\chapter}[display]
  {\HUGE\bfseries}{\thechapter}{0pt}{\Huge}}

\opt{namechapters}{
  \chapterstyle{lyhne}
}

\usepackage{nameref}
\makeatletter
\newcommand*{\currentname}{\@currentlabelname}
\makeatother

\nouppercaseheads

\makepagestyle{multititlechapters}
\makeevenhead{multititlechapters}{\thepage}{}{\itshape\thetitle}
\makeoddhead{multititlechapters}{\itshape\currentname}{}{\thepage}

\makepagestyle{multititlenochapters}
\makeevenhead{multititlenochapters}{\thepage}{}{\itshape\thetitle}
\makeoddhead{multititlenochapters}{\itshape
  Chapter~\thechapter}{}{\thepage}

\makepagestyle{multinotitlechapters}
\makeevenhead{multinotitlechapters}{\thepage}{}{\itshape\theauthor}
\makeoddhead{multinotitlechapters}{\itshape\currentname}{}{\thepage}

\makepagestyle{multinotitlenochapters}
\makeevenhead{multinotitlenochapters}{\thepage}{}{\itshape\theauthor}
\makeoddhead{multinotitlenochapters}{\itshape Chapter~\thechapter}{}{\thepage}

\makepagestyle{singletitle}
\makeevenhead{singletitle}{\thepage}{}{\itshape\theauthor}
\makeoddhead{singletitle}{\itshape\thetitle}{}{\thepage}

\settocdepth{chapter}
\bibintoc

\counterwithout{footnote}{chapter}

\newcommand*{\titlegen}{\begingroup% Scripts, T&H p 151
  \centering
  \vspace*{0.1\textheight}
  {\Huge\bfseries\thetitle}\\[\baselineskip]
  {\large\itshape by \theauthor}\\[\baselineskip]
  \vfill
  \rule{0.4\textwidth}{0.4pt}\\[\baselineskip]
  {\large\the\year}\par
  \vspace*{0.1\textheight}
  \endgroup}

\newcommand*{\titleasal}{
  \begin{center}
    {\scshape A Shot At Life}
  \end{center}
  \cleardoublepage
  \begingroup
  \begin{minipage}{0.05\textwidth}
    \color{red}
    \rule{6pt}{\textheight}
  \end{minipage}
  \hspace{0.05\textwidth}
  \begin{minipage}{0.6\textwidth}
    {\Large MEZ} \\
    \rule{0.9\textwidth}{1pt} \par
    \vspace{3\baselineskip}
    {\noindent\Huge\bfseries A SHOT} \par
    \vspace{2\baselineskip}
    {\noindent\Huge\bfseries AT LIFE} \par
    \vspace{6\baselineskip}
    {\scshape a Final Fantasy X fanfiction} \par
    \vspace{0.4\baselineskip}
    \rule{0.9\textwidth}{1pt} \par
    \vspace{\baselineskip}
    {\Large 2025}
  \end{minipage}
  \hfill
  \begin{minipage}{0.15\textwidth}
    \vspace{2\baselineskip}
    {\color{red}
      \HUGE
      {\yevon L} \\[1.15\baselineskip]
      {\yevon I} \\[1.15\baselineskip]
      {\yevon F} \\[1.15\baselineskip]
      {\yevon E}
    }\par
  \end{minipage}
  \endgroup
  \begin{center}
    {\yevon A}
  \end{center}
  \vspace*{\fill}
  \noindent
  Written in 2021--2025, at approximately 54.6,-5.9.

  \noindent
  Typeset by the author in Linux Libertine, Noto Sans, and FFXYevon, using Emacs and
  \LaTeX.

  \noindent
  This work of fanfiction is licensed under \textbf{Creative Commons
    Attribution-NonCommercial 4.0 International}.

  \noindent
  For chapter summaries, warnings, metadata, and additional
  information, see \url{https://tre.praze.net/ffx/asal}.

  \noindent
{\scriptsize{\yevon Now is the time to shape your stories Your fate is in your hands}}}