% Encoding
\usepackage[utf8]{inputenc}

% Math packages (load before fonts to avoid conflicts)
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{appendix}
\usepackage[inline]{enumitem}

% Define theorem environments
\newtheorem{theorem}{Theorem}
\newtheorem{definition}{Definition}
\newtheorem{lemma}{Lemma}
\newtheorem{corollary}{Corollary}

% Font and spacing
\usepackage{newtxtext,newtxmath}
\usepackage{setspace}
\doublespacing

% Page geometry
\usepackage[margin=1in]{geometry}

% Essential packages
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage{subcaption}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage{listings}
\usepackage{xcolor}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage{cleveref}
\usepackage{adjustbox}
\usetikzlibrary{trees}
% Configure cleveref for algorithm2e
\crefname{algocf}{Algorithm}{Algorithms}

\usetikzlibrary{positioning, shapes, arrows.meta, fit, backgrounds, calc}
\lstset{
    basicstyle=\ttfamily\footnotesize,
    breaklines=true,
    frame=single,
    numbers=left,
    numberstyle=\tiny\color{gray},
    keywordstyle=\color{blue},
    commentstyle=\color{green!60!black},
    stringstyle=\color{red},
    showstringspaces=false,
    captionpos=b,
    inputencoding=utf8,
    extendedchars=true,
    literate={·}{{\textperiodcentered}}1 {−}{{\textminus}}1 {—}{{---}}1 {–}{{--}}1
}

% APA 7-style references and citations (requires biber)
\usepackage[style=apa,backend=biber]{biblatex}
\addbibresource{bib/references.bib}

% Page headers (SciTech format)
\usepackage{fancyhdr}
\setlength{\headheight}{14.5pt}
\addtolength{\topmargin}{-2.5pt}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{PHANTOM}
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
