/* A4 field-manual print edition. Loaded after the screen styles. */

@page {
	size: A4 portrait;
	margin: 12mm 12mm 15mm;
	background: #fff;

	@bottom-left {
		content: "CONDITION FIRST, COMPUTE SECOND";
		color: #555;
		font-family: "Geist Mono", monospace;
		font-size: 6pt;
		font-weight: 500;
		letter-spacing: 0.2em;
	}

	@bottom-right {
		content: "PAGE " counter(page) " / " counter(pages);
		color: #000;
		font-family: "Geist Mono", monospace;
		font-size: 6pt;
		font-weight: 600;
		letter-spacing: 0.18em;
	}
}

@media print {
	:root,
	:root.dark {
		--cv-paper: #fff;
		--cv-ink: #000;
		--cv-ink-strong: #000;
		--cv-article: #222;
		--cv-muted: #555;
		--cv-rule: #d9d9d9;
		--cv-chip: #f2f2f2;
		--cv-link: #000;
		--background: #fff;
		--foreground: #000;
		--card: #fff;
		--card-foreground: #000;
		--popover: #fff;
		--popover-foreground: #000;
		--muted: #f2f2f2;
		--muted-foreground: #555;
		--secondary: #f2f2f2;
		--secondary-foreground: #000;
		--border: #d9d9d9;
		--sidebar: #fff;
		--sidebar-foreground: #000;
		--editorial-paper: #fff;
		--editorial-ink: #000;
		--editorial-body: #222;
		--editorial-muted: #555;
		--editorial-teal: #000;
		--editorial-brick: #000;
		--editorial-rule: #d9d9d9;
		--editorial-rule-strong: #000;
		--editorial-margin: 32mm;
	}

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

	html,
	body,
	#inner-body {
		width: auto !important;
		min-width: 0 !important;
		background: #fff !important;
		color: #000 !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	body {
		margin: 0 !important;
	}

	/* Print is deliberately ink-only: no syntax, link, or callout colours. */
	article *,
	article *::before,
	article *::after {
		color: #000 !important;
		text-shadow: none !important;
	}

	article pre,
	article code,
	article .codehilite,
	article .highlight,
	article .highlighttable,
	article .arithmatex,
	article kbd {
		background: #fff !important;
		background-image: none !important;
	}

	article pre,
	article .codehilite,
	article .highlight {
		border: 0.5pt solid #000 !important;
	}

	#inner-body {
		min-height: 0;
		border: 0;
	}

	main,
	.container-wrapper,
	[data-slot="sidebar-wrapper"],
	[data-slot="docs"],
	[data-slot="docs"] > div {
		display: block !important;
		width: 100% !important;
		max-width: none !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	footer,
	dialog,
	#desktop-sidebar,
	.sidebar-collapse-button,
	.article-toc-rail,
	#toc,
	#bottom-navigation,
	.editorial-page-actions,
	.external_links,
	.codehilite > button,
	.codexec > button,
	a.headerlink {
		display: none !important;
	}

	/* First-page masthead */
	.editorial-site-header,
	.dark .editorial-site-header {
		position: static;
		display: block !important;
		width: 100%;
		margin: 0 0 4.5mm;
		background: #fff !important;
		backdrop-filter: none;
	}

	.editorial-site-header__inner,
	.editorial-site-header__rule {
		width: 100%;
		margin: 0;
	}

	.editorial-site-header__inner {
		min-height: 7mm;
	}

	.editorial-site-brand {
		gap: 2.5mm;
		color: #555 !important;
		font-size: 6pt;
		letter-spacing: 0.22em;
	}

	.editorial-site-tools > * {
		display: none !important;
	}

	.editorial-site-tools::after {
		content: "PRINT ED. 1 · FIELD NOTES";
		color: #555;
		font-family: var(--font-mono);
		font-size: 6pt;
		font-weight: 500;
		letter-spacing: 0.2em;
		text-transform: uppercase;
	}

	.editorial-site-header__rule {
		border-bottom: 0.7pt solid #000;
	}

	/* Article cover and contents */
	article,
	html.sidebar-collapsed article {
		display: flex;
		width: 100% !important;
		max-width: none !important;
		margin: 0 !important;
		padding: 0 !important;
		gap: 5mm;
		color: #000 !important;
		font-size: 9.5pt;
		line-height: 1.45;
	}

	.editorial-page-intro {
		gap: 3mm;
	}

	.editorial-kicker,
	article p.editorial-citation-line {
		font-size: 6pt;
		font-weight: 600;
		letter-spacing: 0.22em;
		line-height: 1.45;
	}

	article #page-header h1 {
		max-width: 155mm;
		margin: 0;
		font-size: 34pt;
		line-height: 0.98;
		letter-spacing: -0.035em;
	}

	article #summary {
		max-width: 125mm;
		margin: 0;
		font-size: 10.5pt;
		line-height: 1.42;
	}

	article p.editorial-citation-line {
		margin-top: 1mm;
		color: #555;
	}

	.article-contents {
		grid-template-columns: 27mm minmax(0, 1fr);
		gap: 6mm;
		margin-top: 2mm;
		break-inside: avoid;
	}

	/* The interactive "On This Page" rail is navigation, never printed copy. */
	#toc,
	.article-toc-rail {
		display: none !important;
	}

	.article-contents__label {
		padding-top: 1.5mm;
		font-size: 6pt;
	}

	.article-contents__list a {
		min-height: 6mm;
		gap: 2.5mm;
	}

	.article-contents__number,
	.article-contents__jump {
		font-size: 6pt;
	}

	.article-contents__title {
		max-width: 92mm;
		font-size: 8.5pt;
		line-height: 1.2;
	}

	.article-contents__detail {
		font-size: 6.5pt;
	}

	/* Main column plus the printed marginalia rail */
	article .typography {
		padding-left: 32mm;
		font-size: 9.5pt;
	}

	article p,
	article li {
		font-size: 9.5pt;
		line-height: 1.48;
		letter-spacing: 0;
		orphans: 3;
		widows: 3;
	}

	article p:not(:first-child) {
		margin-top: 2.3mm;
	}

	article ul,
	article ol {
		margin-top: 2mm;
		margin-bottom: 2mm;
	}

	article li {
		margin-top: 1mm;
	}

	article .typography h2 {
		margin-top: 9mm;
		border-top: 0.7pt solid #000;
		padding-top: 2mm;
		font-size: 16pt;
		line-height: 1.15;
		break-after: avoid;
	}

	article .typography h3 {
		margin-top: 6mm;
		font-size: 11.5pt;
		line-height: 1.2;
		break-after: avoid;
	}

	article .typography h4,
	article .typography h5,
	article .typography h6 {
		margin-top: 4mm;
		font-size: 7pt;
		line-height: 1.35;
		break-after: avoid;
	}

	article .typography h2::before,
	article .typography h3::before {
		right: calc(100% + 6mm);
		width: 26mm;
		font-size: 6pt;
	}

	article .typography h2::before {
		top: 2.8mm;
	}

	article .typography h3::before {
		top: 1mm;
	}

	article blockquote {
		margin: 3mm 0;
		border-left-width: 1.2pt;
		padding: 0.5mm 0 0.5mm 3.5mm;
		font-size: 9pt;
	}

	/* Only NOTE callouts become marginalia; warnings remain in the text. */
	article .typography > .admonition.note,
	article .typography > details.note {
		float: left;
		clear: left;
		width: 26mm;
		margin: 1mm 0 5mm -32mm;
		border: 0;
		border-top: 0.7pt solid #000;
		background: transparent;
		padding: 2mm 0 0;
		break-inside: avoid;
	}

	article .typography > .admonition.note > p.admonition-title::before,
	article .typography > details.note > summary::before {
		font-size: 6pt;
		line-height: 1.3;
	}

	article .typography > .admonition.note > :not(.admonition-title),
	article .typography > details.note > :not(summary),
	article .typography > .admonition.note p,
	article .typography > details.note p {
		font-size: 7pt;
		line-height: 1.38;
	}

	article .admonition:not(.note),
	article details:not(.note) {
		margin: 4mm 0;
		border-left-width: 1.2pt;
		padding: 3mm 4mm;
		break-inside: auto;
	}

	article .admonition > p.admonition-title,
	article details > summary {
		font-size: 7pt;
		line-height: 1.35;
		padding: 0 0 2mm;
	}

	article .admonition > :not(.admonition-title),
	article details > :not(summary) {
		margin-top: 2mm;
		padding: 0;
	}

	article details summary::after {
		display: none !important;
	}

	/* Equations and data tables retain the reference's ruled treatment. */
	article div.arithmatex {
		margin: 3mm 0;
		border-top: 0.5pt solid #d9d9d9;
		border-bottom: 0.5pt solid #d9d9d9;
		padding: 2.5mm 9mm 2.5mm 3mm;
		font-size: 9pt;
		break-inside: avoid;
	}

	article div.arithmatex::after {
		right: 1mm;
		font-size: 6pt;
	}

	article .arithmatex .katex-display {
		margin: 0;
		overflow: visible;
		padding: 0;
	}

	article .katex {
		font-size: 1em;
	}

	article .table-wrapper {
		overflow: visible !important;
	}

	article table {
		width: 100%;
		margin: 4mm 0;
		border-top: 0.7pt solid #000;
		border-bottom: 0.7pt solid #000;
		font-size: 7.2pt;
		break-inside: avoid;
	}

	article table thead tr th {
		height: auto;
		padding: 1.6mm 1.5mm;
		font-size: 5.5pt;
		letter-spacing: 0.17em;
		white-space: normal;
	}

	article table tbody tr td {
		padding: 1.5mm;
		font-size: 7.2pt;
		white-space: normal;
	}

	article table tr,
	article img,
	article figure,
	article blockquote {
		break-inside: avoid;
	}

	article pre,
	article pre code,
	article .codehilite,
	article .codehilite pre,
	article .codehilite code {
		max-height: none !important;
		font-size: 7pt;
		line-height: 1.35;
		white-space: pre-wrap !important;
		overflow: visible !important;
		overflow-wrap: anywhere;
	}

	article pre,
	article .codehilite {
		margin: 3mm 0;
		padding: 2.5mm 3mm;
		break-inside: avoid;
	}

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