\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/Boxout}[2025-08-20]

\RequirePackage{PrimeTeX/packages/Layout}
\RequirePackage{PrimeTeX/packages/Color}

\providelength{\boxoutpadding}[0.5em]

\colorlet{boxoutbgcolor}{PrimePaleBlue}
\colorlet{boxoutfgcolor}{PrimeBlue}

\NewDocumentCommand{\boxout}{%
	O{0in} m m >{\TrimSpaces}m +m%
}{%
	\begin{wrapfigure}{#2}[#1]%
		\fcolorbox{boxoutfgcolor}{boxoutbgcolor}{%
			\begin{minipage}{#3}%
				\vspace{\boxoutpadding}%
				{\Centering%
					\begin{minipage}{\boxoutpadding*-2 + \textwidth}%
						\label{box:#4}%
						\setlength{\parskip}{\medskipamount}%
						{\Centering\slab{\strong{#4}}\par}%
						\justifying\small{}#5%
					\end{minipage}%
				\par}%
				\vspace{\boxoutpadding}%
			\end{minipage}%
		}%
	\end{wrapfigure}%
}

\NewDocumentCommand{\bigboxout}{%
	O{\bigfloatoverhang} m >{\TrimSpaces}m +m%
}{%
	\bigfloat[#1]{figure}{#2}{%
		\fcolorbox{boxoutfgcolor}{boxoutbgcolor}{%
			\begin{minipage}{\boxoutpadding*-2 + \textwidth}%
				\vspace{\boxoutpadding}%
				{\Centering%
					\begin{minipage}{\boxoutpadding*-2 + \textwidth}%
						\label{box:#3}%
						\setlength{\parskip}{\medskipamount}%
						{\Centering\slab{\strong{#3}}\par}%
						\justifying\small{}#4%
					\end{minipage}%
				\par}%
				\vspace{\boxoutpadding}%
			\end{minipage}%
		}%
	}%
}