/* print.css — site-wide print styles
 *
 * Loaded via <link media="print"> from pelicanconf.py EXTRA_HEAD_DATA.
 * Overrides Bootstrap's aggressive print reset and the elegant theme's
 * screen-only layout to produce clean, readable printed pages.
 *
 * Sections:
 *   1. Page geometry and base typography
 *   2. Override Bootstrap print reset
 *   3. Site chrome: hide navigation, header, footer
 *   4. Article postmatter: hide non-content elements
 *   5. Article layout: single-column, readable width
 *   6. Headings and links
 *   7. RST sidebars: vignettes, glossary, example
 *   8. Admonitions
 *   9. Tables and figures
 *  10. Code blocks
 *  11. Page break control
 */

/* ---- 1. Page geometry and base typography ---- */

@page {
	size: A4;
	margin: 20mm 18mm 20mm 18mm;
}

body {
	font-size: 10.5pt !important;
	line-height: 1.5 !important;
	color: #1a1a1a !important;
}

p {
	orphans: 3;
	widows: 3;
}

/* ---- 2. Override Bootstrap print reset ---- */
/* Bootstrap forces transparent backgrounds and black text on everything.
   We selectively restore color where it aids readability. */

h1, h2, h3, h4, h5, h6 {
	color: maroon !important;
}

a, a:visited {
	color: #1a1a1a !important;
	text-decoration: none !important;
}

/* Suppress Bootstrap's url-after-link printing for inline links */
a[href]:after {
	content: "" !important;
}

abbr[title]:after {
	content: "" !important;
}

/* ---- 3. Site chrome: hide navigation, header, footer ---- */

#nav-bar,
.navbar,
.navbar-inner,
#site-header,
#sidebar,
footer,
#footer,
.site-footer,
#search,
.search-form {
	display: none !important;
}

/* ---- 4. Article postmatter: hide non-content elements ---- */

.applause_button,
#post-share-links,
.author-blurb,
ul.articles-timeline,
#article-sidebar,
.article-content > hr,
.related-posts-list,
#comment-message,
.accordion {
	display: none !important;
}

/* Comments and related-posts sections lack unique ids/classes;
   hide the parent <section> elements via their children */
section:has(> #comment-message),
section:has(> .related-posts-list) {
	display: none !important;
}

/* ---- 5. Article layout: single-column, readable width ---- */

/* Remove Bootstrap grid constraints */
.container,
.container-fluid,
.row,
.row-fluid {
	width: 100% !important;
	max-width: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* Let article content fill the page */
.span8,
.article-content,
[class*="span"] {
	width: 100% !important;
	float: none !important;
	margin-left: 0 !important;
}

/* Table of contents: keep but simplify */
.table-of-content {
	width: 100% !important;
	float: none !important;
	margin: 0 0 1em 0 !important;
	padding: 0 !important;
}

/* ---- 6. Headings and links ---- */

h1 {
	font-size: 1.6em !important;
	margin-bottom: 0.3em !important;
}

h1 small.subtitle {
	display: block !important;
	font-size: 0.65em !important;
	color: #555 !important;
	margin-top: 0.2em !important;
}

h2 {
	font-size: 1.25em !important;
	margin-top: 1.8em !important;
	margin-bottom: 0.6em !important;
}

h3 {
	font-size: 1.1em !important;
}

/* ---- 7. RST sidebars: vignettes, glossary, example ---- */

div.sidebar {
	background: none !important;
	border-left: 2.5pt solid maroon !important;
	padding: 0.6em 1em !important;
	margin: 1.2em 0 !important;
	float: none !important;
	width: auto !important;
	font-size: 0.92em !important;
}

div.sidebar p.sidebar-title {
	color: maroon !important;
	font-weight: 700 !important;
}

div.glossary.sidebar {
	border-left: none !important;
	border: 0.5pt solid #aaa !important;
	padding: 0.8em 1.2em !important;
}

div.example.sidebar {
	border-left: none !important;
	border: 0.5pt solid #aaa !important;
	padding: 0.8em 1.2em !important;
}

div.example.sidebar .literal {
	background: none !important;
	border: 0.5pt solid #ccc !important;
}

/* ---- 8. Admonitions ---- */

div.admonition {
	background: none !important;
	border: 0.5pt solid #aaa !important;
	page-break-inside: avoid;
}

div.admonition p.admonition-title {
	background: none !important;
	color: #1a1a1a !important;
	border-bottom: 0.5pt solid #ccc !important;
}

/* ---- 9. Tables and figures ---- */

table.docutils {
	width: 100% !important;
	max-width: 100% !important;
	margin-left: 0 !important;
	font-size: 85% !important;
}

img {
	max-width: 100% !important;
}

figure, .figure {
	page-break-inside: avoid;
}

/* ---- 10. Code blocks ---- */

pre {
	white-space: pre-wrap !important;
	word-wrap: break-word !important;
	font-size: 0.85em !important;
	border: 0.5pt solid #ccc !important;
	padding: 0.5em !important;
}

div.highlight pre,
figure.code pre {
	color: #333 !important;
	background: none !important;
}

pre.literal-block {
	color: #333 !important;
	background: none !important;
}

.literal {
	background: none !important;
	border: 0.5pt solid #ddd !important;
	font-size: 0.88em !important;
}

/* ---- 11. Page break control ---- */

h1, h2, h3, h4 {
	page-break-after: avoid;
}

div.sidebar,
div.admonition,
figure,
.figure,
pre,
table {
	page-break-inside: avoid;
}
