/*  mitthesis-style.css

    v1.working, 2026-01-25
	Author: John H. Lienhard
	License: MIT License, https://ctan.org/license/mit
    This css code styles the HTML rendering of mitthesis class
*/

/* --- Resilience & typography --- */

*, *::before, *::after { box-sizing: border-box; }

html 
	{ 
	-webkit-text-size-adjust: 100%; 
	text-size-adjust: 100%;
	}
:root
	{
	--ui-sans: "Noto Sans", "DejaVu Sans", "Arial Unicode MS", Arial, "Helvetica Neue", Helvetica, sans-serif;
	--math-fallback-regular: "Noto Sans Math", "LeteSansMath", "STIX Two Math", "XITS Math", "Cambria Math", serif;
	--math-fallback-bold:    "Noto Sans Math", "LeteSansMath-Bold", "XITSMath", "STIX Two Math", "Cambria Math", serif;
	}

/* These settings partially mimic the default printed page size and width. Aims for sans serif font. */
body {
    font-family: 	system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 		12pt;       
	line-height: 	1.2;     	/* ~14pt leading */
	margin: 		36pt auto;  /* ~half-inch margins left/right, centered */
	max-width: 		min(75ch, 46rem);		/* ~75 characters per line; 46rem ≈ ~92pt*6.1 */
	hyphens: 		auto;
	overflow-wrap: 	anywhere; 				/* protect narrow columns */
	hanging-punctuation: first allow-end; 	/* improve ragged-right when present */
	}


/* Make doc-pagebreak vanish from layout but keep semantics (HTML5+) */

h1 [role="doc-pagebreak"],
h2 [role="doc-pagebreak"],
h3 [role="doc-pagebreak"],
h4 [role="doc-pagebreak"],
h5 [role="doc-pagebreak"],
h6 [role="doc-pagebreak"] 
	{
	display:	contents !important; 
	margin:		0 !important;
	padding:	0 !important;
	}


/* Adjust fonts of title on title page */

div[data-pdf-se-type="Title"]
	{
	font-size: 20pt;
	font-weight: 500; /* medium */
	hyphens: none;
	overflow-wrap: normal;
	word-break: keep-all;
	margin-top: 2em; 
	}

div[data-pdf-se-type-original="Author"] span
	{
	font-size: 14pt;
	}

div[data-pdf-se-type-original="Author"]
	{
	margin-bottom: 2em;
	}


/* Adjust fonts and space of committee page */

section[data-pdf-se-type-original="Committee_page"]
	{
	margin-top: 4em;
	}  

span[data-pdf-se-type-original="Committee_name"]
	{
	font-size: 16pt;
	font-weight: 500; /* medium */
	hyphens: none;
	overflow-wrap: normal;
	word-break: keep-all;
	}

/* For "Thesis Supervisor" and "Thesis Readers" */
span[data-pdf-se-type-original="Committee_block_title"]
	{
	font-size: 14pt;
	font-weight: 500; /* medium */
	hyphens: none;
	overflow-wrap: normal;
	word-break: keep-all;
	display: inline-block;
	margin-top: 1.3em;
	margin-bottom: 0.3em;
	font-variant: small-caps;
	}


/* Adjust fonts and space of abstract page */

section[data-pdf-se-type-original="Abstract_page"]
	{
	margin-top: 4em; 
	}  

div[data-pdf-se-type-original="Abstract_title"]
	{
	font-size: 16pt;
	font-weight: 500; /* medium */
	hyphens: none;
	overflow-wrap: normal;
	word-break: keep-all;
	}

div[data-pdf-se-type-original="Abstract_text"]
	{
	}

div[data-pdf-se-type-original="Abstract_supervisor"]
	{
	margin-top: 1em; 
	}
div[data-pdf-se-type-original="Abstract_supervisor"] p 
	{
	margin-top: 	0.2em;
	margin-bottom: 	0.2em;
	}


/* Headings H1... */

/* Heading font weights */

h1[data-pdf-se-type="H1"],
h1[data-pdf-se-type-original="chapter"],
h2[data-pdf-se-type="H2"],
h3[data-pdf-se-type="H3"],
h4[data-pdf-se-type="H4"] 
	{
	font-weight: 700;
	}

/* Heading sizes */

h1[data-pdf-se-type="H1"],
h1[data-pdf-se-type-original="chapter"] { font-size: 20pt; }
h2[data-pdf-se-type="H2"] { font-size: 18pt; }
h3[data-pdf-se-type="H3"] { font-size: 16pt; }
h4[data-pdf-se-type="H4"] { font-size: 12pt; }
h5[data-pdf-se-type="H5"] { font-size: 12pt; }

/* Increase vertical space above H1 and H2 headings */

h1[data-pdf-se-type="H1"],
h1[data-pdf-se-type-original="chapter"] 
	{
	margin-top: 2em;   
	}
h2[data-pdf-se-type="H2"] 
	{
	margin-top: 1.5em;   
	}
	
/* Keep h5 (\paragraph) inline with text that follows */

h5[data-pdf-se-type-original="paragraph"] {
    display: inline-block;
    margin-right: 0.5em;
    text-align: left;  
}
h5[data-pdf-se-type-original="paragraph"] + div[data-pdf-se-type-original="text-unit"] {
    display: inline;
}
h5[data-pdf-se-type-original="paragraph"] + div[data-pdf-se-type-original="text-unit"] > p {
    display: inline;
    }

/* Numbered chapter and section titles are composed of two spans. The margin creates space between them. */

h1[data-pdf-se-type="H1"] > span:first-of-type { margin-inline-end: 0.75em; }
h2[data-pdf-se-type="H2"] > span:first-of-type,
h3[data-pdf-se-type="H3"] > span:first-of-type,
h4[data-pdf-se-type="H4"] > span:first-of-type { margin-inline-end: 0.5em; }


/* Math, inline formula wrappers and SVG text inside headings:
   - set math fallback font
   - request bold math face and normal style
   - inherit heading font-size and tighten line-height for math material */
:is(h1,h2,h3,h4,h5,h6,[data-pdf-se-type="Heading"]) 
:is(
	math,
	.inline,
	span[data-pdf-se-type="Formula"],
	.formula,
	.math,
	.eq,
	svg text
	) 
	{
	font-family: 	var(--math-fallback-bold);
	font-weight: 	700;
	font-style: 	normal;
	line-height: 	1;
	font-size: 		inherit;
	}

/* when doing superscripts in a lazy way as $^{-1}$, an empty mrow is created. Fix spacing */

span[data-pdf-se-type="Formula"].inline:has(math msup > mrow:empty) 
	{
	letter-spacing: -0.1em;
	}


/* Tables */
	
/* Increase the default separation of all table columns */

table[data-pdf-se-type="Table"]
	{
	border-collapse: separate;
	border-spacing: 0;
	}

/* Center data tables only (leave ARIA presentation tables alone) */
table[data-pdf-se-type="Table"]:not(.ARIA-role-presentation) 
	{
	margin-left: 	auto;
	margin-right: 	auto;
	margin-top: 	0.75em;
	margin-bottom: 	0.75em;
	}
	
/* Center captions for non-ARIA data tables only */
table[data-pdf-se-type="Table"]:not(.ARIA-role-presentation) + div[data-pdf-se-type="Caption"],
div[data-pdf-se-type="Caption"] + table[data-pdf-se-type="Table"]:not(.ARIA-role-presentation) 
	{
	text-align: 	center;
	margin-left: 	auto;
	margin-right: 	auto;
	}

table[data-pdf-se-type="Table"] th,
table[data-pdf-se-type="Table"] td 
	{ 
	padding: 0; 
	}

table[data-pdf-se-type="Table"] th + th,
table[data-pdf-se-type="Table"] td + td 
	{
	padding-left: 1em;
	}

/* Center all table header cells */

table[data-pdf-se-type="Table"] th 
	{
	text-align: center;
	}

/* Bold math in table header cells */
th math, th math * 
	{
	font-weight: 700 !important;
	font-style: normal !important; /* prevents italics on symbols */
    /* font-size: 14pt; */ /* seems to match bold text better than 12pt */
	}

/* Horizontal rules in tables */ 

/* Removes any borders from all table cells by default */
table:not([role="presentation"]) th,
table:not([role="presentation"]) td {
    border: none;
}


/* --- Booktabs-style horizontal rules --- */

/* Colors for table rules (light mode defaults) */
:root 
	{
	  --table-rule: #8c8c8c;         /* body/bottom rule */
	  --table-rule-strong: #808080;  /* header/top and mid rule */
	}

/* Dark-mode overrides */
@media (prefers-color-scheme: dark) 
	{
	  :root {
	    --table-rule: #4f4f4f;        /* bottom rule — visible on #121212 */
	    --table-rule-strong: #8a8a8a; /* header rules — brighter */
	  }
	}

/* Ensure no vertical borders */
table:not([role="presentation"]) th,
table:not([role="presentation"]) td 
	{
	border: none;
	}

/* Top rule above the table header row (toprule) */
table:not([role="presentation"]) tr:first-child th 
	{
	border-top: 1px solid var(--table-rule-strong);
	padding-top: 0.25em;
	padding-bottom: 0.25em;
	}

/* Mid rule below header (midrule) */
table:not([role="presentation"]) th 
	{
	padding-bottom: 0.25em;
	padding-top: 0.25em;
	border-bottom: 1px solid var(--table-rule-strong);
	}

/* Slight increase in separation of non-header rows (readability) */
table:not([role="presentation"]) tr > td
	{
	padding-top: 0.1em;
	}

/* Bottom rule below last body row (bottomrule) */
table:not([role="presentation"]) tbody tr:last-child td 
	{
	border-bottom: 1px solid var(--table-rule);
	padding-bottom: 0.25em;
	}

/* Keep any other incidental borders consistent */
table:not([role="presentation"]), th, td {
  border-color: var(--table-rule);
}

/* adjust tables using p{..cm} columns */
th div p, td div p
	{
	margin-top: 	0.2em;
	margin-bottom: 	0.2em;
	}

/* Special handling of ARIA (presentation) tables */

/* Keep presentation tables (not data tables) at left margin */
.ARIA-role-presentation[data-pdf-se-type="Table"]
	{
	  padding-left: 0;
	  border-collapse: collapse;
	}

.ARIA-role-presentation[data-pdf-se-type="Table"] td + td,
.ARIA-role-presentation[data-pdf-se-type="Table"] th + th 
	{
    padding-left: 	0.5em;
	padding-right: 	0.5em;
	}

/* Alignments for presentation table holding author, certifier, acceptor on title page */

div[data-pdf-se-type-original="Title_sig_block"] table.ARIA-role-presentation
	{
	  padding-left: 0;
	  border-collapse: collapse;
	  margin-top: 1em;
	}
div[data-pdf-se-type-original="Title_sig_block"] table.ARIA-role-presentation td
	{
	  vertical-align: baseline;
	}
div[data-pdf-se-type-original="Title_sig_block"] table.ARIA-role-presentation td + td,
div[data-pdf-se-type-original="Title_sig_block"] table.ARIA-role-presentation th + th 
	{
    padding-left: 	0.5em;
	padding-right: 	0.5em;
	}

div[data-pdf-se-type-original="Title_sig_block"] table.ARIA-role-presentation tr td span
	{
	margin-top: 0.5em;
	display: inline-block;
	}


/* Captions */

/* The effectiveness of all this is changed/reduced by loading the caption/subcaption packages */

/* Let's keep caption labels on the same line as caption text */
div[data-pdf-se-type="Caption"] > p[data-pdf-se-type="P"] 
	{    
	display: inline;
/*	font-weight: bold;	*/  /* Would make all caption text bold; change math-fallback below */
	}
	
/* boldface labels on captions, with space after label */	
div[data-pdf-se-type="Caption"] > span[data-pdf-se-type="Lbl"] 
	{
	font-weight: bold;
	}
div[data-pdf-se-type="Caption"] > span[data-pdf-se-type="Lbl"]::after 
	{
	content: "";
	display: inline-block;
	width: 0.5em;
	}

/* Math fallback for math/formula-like children and SVG text */
div[data-pdf-se-type="Caption"] 
:is(
  math,
  .inline,
  span[data-pdf-se-type="Formula"],
  .formula,
  .math,
  .eq,
  svg text
) 
	{
/*	font-family: 	var(--math-fallback-bold);   */ 
	font-family: 	var(--math-fallback-regular);
	font-style: 	normal;
	line-height: 	inherit;
	}


/* Footnotes */

/* inline footnotes with raised superscript */

div[data-pdf-se-type-original="footnote"] > span[data-pdf-se-type-original="footnotelabel"] 
	{ 
    font-weight: normal;
	vertical-align: super;  
	font-size: 8pt;
	color: #1f4e79;
	}

div[data-pdf-se-type-original="footnote"] [data-pdf-se-type="Part"] 
	{
	display: contents;
	}
	
div[data-pdf-se-type-original="footnote"] [data-pdf-se-type="Part"] > p[data-pdf-se-type="P"] 
	{
    display: 	 	inline;
    font-size: 	 	10pt;
    font-weight: 	normal;
    color: 			#1f4e79;
	}

span[data-pdf-se-type-original="footnotemark"]
   {
   vertical-align: 	super;
   font-size: 		10pt; 
   }


/* TOC, LOF, LOT layout */

/* Baseline: flush all TOC containers */
ol[data-pdf-se-type="TOC"] 
	{
	padding-inline-start: 	0;
	margin-inline-start: 	0em;
	list-style: 			none; /* override bullets/numbers from inline styles */
	}

/* Indent any nested TOC level (works with wrapper <li> too) */
ol[data-pdf-se-type="TOC"] ol[data-pdf-se-type="TOC"] 
	{
	padding-inline-start: 2em;
	}

/* TOCI items: spacing + no markers */
li[data-pdf-se-type="TOCI"] 
	{
	list-style: 			none;
	margin-inline-start: 	0;
	margin-bottom: 			0.25em;
	}

  
/* Label spacing inside link */
li[data-pdf-se-type="TOCI"] > a > span[data-pdf-se-type="Lbl"]
	{
	font-weight: 600;
	display: inline-block;
	margin-inline-end: 0.5em;
	align-items: baseline;
	}

/* Ensure a gap between the link and the trailing page number text node */
li[data-pdf-se-type="TOCI"] > a::after 
	{
	content: 	"";
	display: 	inline-block;
	width: 		0.5em; 
	}

/* Ensure 0.5em gap after the entire TOC block */
:is(ul, ol)[data-pdf-se-type="TOC"] 
	{ 
	margin-block-end: 0.5em; 
	}
/* but NOT after nested TOC lists */
li > :is(ul, ol)[data-pdf-se-type="TOC"] 
	{ 
	margin-block-end: 0em; 
	}


/* Description lists */

dl.description 
	{
	--hang: 3em;      /* hanging width for dd paragraphs */
	--gap: 0.5em;     /* space between label and body */
	margin: 0;
	padding: 0 0 0 1em;
	}

/* Each LI wrapper: contain float + add spacing between items */
dl.description > div 
	{
	display: flow-root;
	margin-bottom: 1em; /* 1em gap between list items */
	}
dl.description  div:last-child 
	{
	margin-bottom: 0;   /* no extra space after final item */
	}

/* Label floats left; reserve hanging width + gap */
dl.description dt 
	{
	float: left;
	font-weight: 700;
	margin: 0 calc(var(--hang) + var(--gap)) 0 0;
  /* optional: prevent wrapping of label text */
  /* white-space: nowrap; */
	}

/* Definition follows the float */
dl.description dd 
	{ margin: 0; }

/* Ignore PDF wrapper divs */
dl.description > dd > div 
	{ display: contents; }

/* 3em hanging indent for body paragraphs */
dl.description dd p 
	{
	margin: 0;
	padding-left: var(--hang);
	text-indent: calc(var(--hang) * -1);
	}

/* Additional paragraphs: same hanging + 1em vertical gap */
dl.description dd > div + div > p
	{ 
	margin-top: 1em; 
	text-indent: 0;
	}


/* Special layout for nomenclature list, two column */

div[data-pdf-se-type-original="Nomenclature_list"] ul[data-pdf-se-type-original="list"] li[data-pdf-se-type="LI"], 
div[data-pdf-se-type-original="Nomenclature_list"] ul[data-pdf-se-type-original="list"] li[data-pdf-se-type="LI"] p[data-pdf-se-type="P"] 
	{
	margin-bottom: 	0;
	}
	
div[data-pdf-se-type-original="Nomenclature_list"] ul[data-pdf-se-type-original="list"]  
	{
	column-count: 2; /* Specifies exactly 2 columns */
	column-gap: 2em; /* Adds space between columns  */
	}

/* Nomenclature entry heading (e.g., "Greek letters") */
ul.list[data-pdf-se-type-original="list"] span[data-pdf-se-type-original="Nomenclature_entry_heading"]
	{
	font-style: italic;
	margin-top: 0.5em;
	margin-bottom:0.2em; /* some additional space */
	display: inline-block;
	}

/* Other enumerated and itemized lists (References are "list") */

/* Label inline with first line, paragraphs preserved */
:where(ol[data-pdf-se-type-original="enumerate"],
	ul[data-pdf-se-type-original="list"],
    ul[data-pdf-se-type-original="itemize"]) 
      li[data-pdf-se-type="LI"] 
	{
	display: 		flex;      	/* put label and body on the same row 	*/
	align-items: 	flex-start;	/* align label with top of body 		*/
	column-gap: 	0.25em;     /* space between label and text 		*/
	margin-bottom: 	0.5em;		/* vertical separation between items 	*/
	}

/* Label stays in the left column */
:where(ol[data-pdf-se-type-original="enumerate"],
	ul[data-pdf-se-type-original="list"],
    ul[data-pdf-se-type-original="itemize"])
      li[data-pdf-se-type="LI"] > span[data-pdf-se-type="Lbl"] 
	{
	flex: 0 0 auto;  /* no grow/shrink */
	}

/* Body flows in the right column; override inline-block from generator */
:where(ol[data-pdf-se-type-original="enumerate"],
	ul[data-pdf-se-type-original="list"],
    ul[data-pdf-se-type-original="itemize"])
      li[data-pdf-se-type="LI"] > [data-pdf-se-type="LBody"]
	{
	flex: 		1 1 auto;
	display: 	block !important;   /* ensures normal block flow   */
	min-width: 	0;                  /* allow wrapping in flex item */
	}

/* Inner wrappers transparent to layout */
:where(ol[data-pdf-se-type-original="enumerate"],
	ul[data-pdf-se-type-original="list"],
    ul[data-pdf-se-type-original="itemize"])
      li[data-pdf-se-type="LI"] > [data-pdf-se-type="LBody"] > [data-pdf-se-type="Part"] 
	{
	display: contents;
	}

/* Keep paragraphs as blocks so breaks are preserved */
:where(ol[data-pdf-se-type-original="enumerate"],
	ul[data-pdf-se-type-original="list"],
    ul[data-pdf-se-type-original="itemize"])
      li[data-pdf-se-type="LI"] p[data-pdf-se-type="P"] 
	{
	display: 	block;
	margin: 	0 0 0.5em 0;   /* paragraph spacing inside the body */
	}

/* remove any previously added pseudo-space */
:where(ol[data-pdf-se-type-original="enumerate"],
	ul[data-pdf-se-type-original="list"],
    ul[data-pdf-se-type-original="itemize"])
      li[data-pdf-se-type="LI"] > span[data-pdf-se-type="Lbl"]::after	
	{
	content: none;
	}
	
/* Lists with ragged right (target is Reference list, but this affects all ul.list */
ul[data-pdf-se-type-original="list"] li[data-pdf-se-type="LI"]  div[data-pdf-se-type="LBody"] p[data-pdf-se-type-original="text"]
	{
	text-align: left !important ;
	margin-bottom: 0.25em;
	}


/* --- Double figure width, but don't exceed 80% of page width --- */

aside[data-pdf-se-type="Aside"] 
	{
	text-align: center;
	margin-top: 2em;
	}

aside[data-pdf-se-type="Aside"] img 
	{
	display: 	block !important;
	margin: 	1em auto !important;
	width: 		min(calc(2 * 257px), 80%) !important; /* 257px = original width */
	height: 	auto !important;
	}

/* double whatever width attribute is present */
@supports (width: attr(width length)) {
	aside[data-pdf-se-type="Aside"] img[width] 
	{
		width: min(calc(2 * attr(width length)), 80%) !important;
	}
}

/* Figure captions */
aside[data-pdf-se-type="Aside"] > div[data-pdf-se-type="Caption"] 
	{
	max-width: 	80%;
	margin: 	0.5em auto 0;
	text-align: center;
	}

/* Figure text (target is any subcaption text in the figure) */
 aside[data-pdf-se-type="Aside"] div[data-pdf-se-type-original="text-unit"] > p.justify
 	{
	margin: 0.5em auto 0;
	text-align: center!important;
	}


/* --- Dark mode adjustments --- */

@media (prefers-color-scheme: dark) {
	body {
		color: 		#e8eaed;
		background: #121212;
	}

	/* Headings and captions remain bright */
	h1, h2, h3, h4,
	div[data-pdf-se-type="Caption"] 
	{
		color: #e8eaed;
	}

	hr { border-color: #2b2b2b; }

	/* Hyperlinks and cross-references */
	a[href] {
		color: #82b1ff;             /* light blue, accessible on #121212 */
		text-decoration: underline;
	}
	a[href]:visited {
	color: #b388ff;                 /* distinct violet for visited links */
	}
	a[href]:hover,
	a[href]:focus 
  	{
	color: #bbdefb;					/* even lighter on hover/focus */
	}

	/* Cross-reference links (internal anchors, e.g., [1], Eq. (2)) */
	a[href^="#"] {
	    color: #8ab4f8;             /* medium-light blue with strong contrast */
	}

	/* Within captions, tone down slightly for balance */
	div[data-pdf-se-type="Caption"] a[href] {
		color: #9ec3ff;
	}

	/* Keep footnotes legible and distinct */
	div[data-pdf-se-type-original="footnote"]
		> span[data-pdf-se-type-original="footnotelabel"],
	div[data-pdf-se-type-original="footnote"]
		[data-pdf-se-type="Part"] > p[data-pdf-se-type="P"] 
   {
		color: #9ec3ff;
	}

	/* Table borders or lines that might exist */
	table, th, td {
		border-color: #444;
	}
}

/* --- Print: layout, breaks, widows/orphans --- */

@media print {
	@page {
		size: 	Letter;    /* or A4 */
		margin: 0.5in;     /* matches ~36pt intent */
	}
	body {
		margin: 0;         /* @page controls it on print */
		max-width: none;
	}
  
	/* Avoid splitting key elements across pages */
	h1, h2, h3, h4,
		[data-pdf-se-type="Figure"],
	table[data-pdf-se-type="Table"],
	figcaption,
	div[data-pdf-se-type="Caption"] 
		{
		break-inside: avoid-page;
		}

	/* Widow & orphan control */
	p, li, dd, blockquote 
	{
		orphans: 	2;
		widows: 	2;
	}
}
