/**
 * Custom Chaldean Numerology — print stylesheet.
 *
 * SCOPE / COORDINATION NOTE: every selector below is namespaced under
 * .ccn-print-report / .ccn-print-* (see templates/print-report.php for the
 * full class contract) — a distinct namespace from the on-screen
 * .ccn-calculator / .ccn-results classes used by the live calculator UI
 * (built separately). This file can safely be enqueued alongside that
 * engineer's calculator.css, even if calculator.css also defines its own
 * @media print rules, because the two never target the same selectors.
 *
 * Everything here is wrapped in @media print rather than relying solely on
 * wp_enqueue_style()'s 4th ($media) argument, so this file is print-safe no
 * matter how it ends up enqueued or included. That said, the PREFERRED
 * wiring — once includes/class-ccn-shortcode.php exists — is still to pass
 * 'print' as the 4th argument, so this CSS is skipped entirely for screen
 * media instead of just being inert there:
 *
 *   wp_enqueue_style(
 *       'ccn-print',
 *       CCN_PLUGIN_URL . 'public/css/print.css',
 *       array(),
 *       CCN_VERSION,
 *       'print'
 *   );
 *
 * (See this plugin's readme.txt / the report handed back after this task
 * for the exact one-line addition requested from whoever owns that file.)
 *
 * Explicit black-on-white colors are used throughout instead of any
 * on-screen CSS custom properties (--ccn-primary, --ccn-background, etc.)
 * — those may resolve to colors that are unreadable or wasteful on paper,
 * and a print stylesheet should never depend on the active site theme.
 */

@media print {

	/*
	 * Standalone print-view route: if the "Print Report" button opens/prints
	 * a dedicated page containing the full theme (header/nav/sidebar/footer)
	 * plus the report, this hides everything except the report itself. If
	 * instead the print flow opens a blank window/tab containing ONLY the
	 * report markup, this rule is a harmless no-op (there is nothing else
	 * under <body> for it to hide).
	 */
	body > *:not(.ccn-print-report):not(:has(.ccn-calculator)) {
		display: none !important;
	}

	/*
	 * LIVE-PAGE PRINT PATH: the shipped "Print Report" button calls
	 * window.print() directly on the current page (it does not build a
	 * separate .ccn-print-report DOM) -- see public/js/calculator.js. Without
	 * these rules the :not(.ccn-print-report) rule above would hide the
	 * entire page, including the live results, producing a BLANK printout.
	 * These rules bridge that flow: hide every ancestor of .ccn-calculator
	 * one level at a time is impractical in pure CSS, so instead hide the
	 * calculator's own non-results children and rely on the theme's own
	 * layout collapsing (most themes' header/footer are display:none-able
	 * siblings, not ancestors, of the content area) -- combined with the
	 * :has() escape hatch above (supported in all current evergreen
	 * browsers users actually print from) so a .ccn-calculator anywhere on
	 * the page keeps its ancestor chain visible instead of being nuked by
	 * the aggressive "hide everything" rule meant for the dedicated
	 * .ccn-print-report route.
	 */
	.ccn-calculator > .ccn-header,
	.ccn-calculator > .ccn-chart-wrap,
	.ccn-calculator > .ccn-explanation,
	.ccn-calculator > .ccn-form {
		display: none !important;
	}

	.ccn-calculator {
		background: #ffffff !important;
		box-shadow: none !important;
		border: none !important;
		padding: 0 !important;
		max-width: 100% !important;
	}

	.ccn-results {
		display: block !important;
		color: #000000 !important;
	}

	.ccn-print-btn {
		display: none !important;
	}

	.ccn-results-heading {
		font-size: 18pt;
		color: #000000 !important;
	}

	.ccn-cards {
		display: block !important;
	}

	.ccn-card {
		break-inside: avoid;
		page-break-inside: avoid;
		border: 0.5pt solid #999999 !important;
		background: #ffffff !important;
		box-shadow: none !important;
		margin-bottom: 12pt;
		padding: 10pt !important;
	}

	.ccn-card-title,
	.ccn-card-value,
	.ccn-card-short,
	.ccn-card-note,
	.ccn-card-breakdown,
	.ccn-report {
		color: #000000 !important;
		background: none !important;
	}

	/* Belt-and-suspenders: never print interactive controls, even if one
	   ends up nested inside the report container by mistake. */
	.ccn-print-report button,
	.ccn-print-report input,
	.ccn-print-report select,
	.ccn-print-report textarea,
	.ccn-print-report [type="submit"],
	.ccn-calculator-form,
	.ccn-calculator button,
	.ccn-calculator input,
	.ccn-calculator select,
	.ccn-print-button,
	.ccn-print-hide {
		display: none !important;
	}

	html,
	body {
		background: #ffffff !important;
		color: #000000 !important;
	}

	.ccn-print-report {
		display: block !important;
		position: static !important;
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 !important;
		padding: 0.5in !important;
		background: #ffffff !important;
		color: #000000 !important;
		font-family: Georgia, "Times New Roman", serif;
		font-size: 12pt;
		line-height: 1.4;
	}

	.ccn-print-header {
		border-bottom: 2pt solid #000000;
		margin-bottom: 16pt;
		padding-bottom: 8pt;
	}

	.ccn-print-title {
		font-size: 20pt;
		margin: 0 0 4pt 0;
		color: #000000 !important;
	}

	.ccn-print-name,
	.ccn-print-date {
		margin: 2pt 0;
		font-size: 10pt;
		color: #000000 !important;
	}

	/* One number's block per page-break unit — never split a result across
	   a page boundary if it can be avoided. */
	.ccn-print-section {
		break-inside: avoid;
		page-break-inside: avoid;
		margin-bottom: 18pt;
		border-bottom: 0.5pt solid #999999;
		padding-bottom: 10pt;
	}

	.ccn-print-section:last-of-type {
		border-bottom: none;
	}

	.ccn-print-section h2 {
		font-size: 15pt;
		color: #000000 !important;
		background: none !important;
		margin: 0 0 6pt 0;
		border-bottom: 1pt solid #000000;
		padding-bottom: 3pt;
	}

	.ccn-print-final-number {
		font-size: 13pt;
		font-weight: bold;
		color: #000000 !important;
	}

	.ccn-print-master-badge {
		font-weight: normal;
		font-style: italic;
		font-size: 10pt;
	}

	.ccn-print-compound,
	.ccn-print-reduction,
	.ccn-print-tie-note {
		font-size: 10pt;
		color: #333333 !important;
		margin: 3pt 0;
	}

	.ccn-print-breakdown-table {
		border-collapse: collapse;
		width: 100%;
		margin: 8pt 0;
		break-inside: avoid;
		page-break-inside: avoid;
	}

	.ccn-print-breakdown-table caption {
		text-align: left;
		font-size: 9pt;
		color: #333333 !important;
		margin-bottom: 3pt;
	}

	.ccn-print-breakdown-table th,
	.ccn-print-breakdown-table td {
		border: 0.5pt solid #666666;
		padding: 3pt 6pt;
		text-align: center;
		font-size: 9pt;
		color: #000000 !important;
		background: #ffffff !important;
	}

	.ccn-print-breakdown-table th {
		background: #eeeeee !important;
		font-weight: bold;
	}

	.ccn-print-interpretation {
		margin-top: 8pt;
	}

	.ccn-print-interpretation h3 {
		font-size: 12pt;
		margin: 6pt 0 3pt 0;
		color: #000000 !important;
	}

	.ccn-print-interpretation-field {
		break-inside: avoid;
		page-break-inside: avoid;
		margin: 6pt 0;
	}

	.ccn-print-interpretation-field h4 {
		font-size: 10.5pt;
		margin: 0 0 2pt 0;
		color: #000000 !important;
		text-transform: uppercase;
		letter-spacing: 0.02em;
	}

	.ccn-print-interpretation-text {
		font-size: 10.5pt;
		color: #000000 !important;
	}

	.ccn-print-interpretation-text p:first-child {
		margin-top: 0;
	}

	/* Don't print Chrome/Firefox's automatic "(URL)" suffix after links. */
	.ccn-print-report a[href]::after {
		content: none !important;
	}

	.ccn-print-footer {
		margin-top: 16pt;
		padding-top: 8pt;
		border-top: 0.5pt solid #999999;
		font-size: 8pt;
		color: #555555 !important;
		text-align: center;
	}
}
