/**
 * Print / PDF stylesheet for the Cómo medir measuring guides.
 *
 * Enqueued with media="print" (see inc/enqueue.php) so it never touches
 * normal screen rendering — every rule here only ever applies when the
 * page is printed or exported to PDF via headless Chrome's print-to-pdf
 * (see project-docs/how the guide PDFs are generated — bin/generate-
 * guide-pdfs.js). Reuses the same guide-page.css component classes and
 * design tokens (base.css custom properties); this file only hides
 * screen-only chrome, flattens the desktop grids to a single print
 * column, and adds page-break/typography rules — no new visual language.
 */

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

	@bottom-center {
		content: counter(page) " / " counter(pages);
		font-family: "Montserrat", Arial, sans-serif;
		font-size: 9pt;
		color: #6b7278;
	}
}

@media print {

	/* ---------------------------------------------------------------- */
	/* Hide every screen-only / web-navigation element                    */
	/* ---------------------------------------------------------------- */

	#wpadminbar,
	.ed-site-header,
	.ed-site-footer,
	.ed-back-to-top,
	.ed-guide-nav,
	.ed-guide-breadcrumb,
	.ed-guide-hero .wp-block-buttons,
	.ed-guide-hero__trust,
	.ed-guide-pdf,
	.ed-guide-cta,
	.ed-guide-diagram__zoom,
	.ed-lightbox,
	#ed-guide-lightbox {
		display: none !important;
	}

	/* ---------------------------------------------------------------- */
	/* Print-only brand header — see the .ed-guide-print-header snippet   */
	/* added once near the top of <main> in each guide template. Hidden   */
	/* on screen (base rule lives in guide-page.css), shown only here.    */
	/* ---------------------------------------------------------------- */

	.ed-guide-print-header {
		display: block !important;
		margin: 0 0 8mm;
		padding-bottom: 4mm;
		border-bottom: 1px solid #e1e5e6;
	}

	.ed-guide-print-header__brand {
		margin: 0;
		font-family: "Cormorant Garamond", Georgia, serif;
		font-size: 16pt;
		font-weight: 600;
		color: #101314;
	}

	.ed-guide-print-header__brand span {
		color: #00b7b7;
	}

	/* ---------------------------------------------------------------- */
	/* Base page/typography — print reads darker/denser than screen       */
	/* ---------------------------------------------------------------- */

	html,
	body {
		background: #ffffff !important;
		font-size: 10.5pt;
	}

	main.ed-site-main {
		max-width: none;
	}

	a {
		color: #007a7a;
		text-decoration: none;
	}

	/*
	 * break-inside here is the fix for a real bug caught in visual QA: a
	 * two-line h2 (e.g. "Comprobar obstáculos antes de confirmar") was
	 * splitting mid-sentence across the page boundary — break-after alone
	 * only keeps a heading WITH what follows, it does nothing to stop the
	 * heading's own wrapped lines from being torn apart by the break.
	 */
	h1,
	h2,
	h3,
	h4 {
		break-inside: avoid;
		break-after: avoid;
	}

	/*
	 * Second bug caught in QA: the small step-number ("01"…"05") and the
	 * section eyebrow ("ANTES DE CONFIRMAR" etc.) are short standalone
	 * elements that fit alone at the bottom of a page, orphaning them from
	 * the heading that's actually supposed to follow immediately under
	 * them. break-after: avoid forces the heading to move down with them.
	 * .ed-eyebrow is display: inline-block on screen (base.css) — Chrome's
	 * print fragmentation only honours break-after reliably on block-level
	 * boxes, so it's forced to block here too (print-only, harmless).
	 */
	.ed-step-number,
	.ed-eyebrow {
		display: block;
		break-after: avoid;
	}

	.ed-section__header {
		break-inside: avoid;
	}

	/* ---------------------------------------------------------------- */
	/* Hero — becomes plain print-page content, not a bordered card        */
	/* ---------------------------------------------------------------- */

	.ed-guide-hero {
		padding-bottom: 0;
	}

	.ed-guide-hero__inner {
		width: 100%;
		padding: 0;
		background: none;
		border: 0;
		text-align: left;
	}

	.ed-guide-hero__title,
	.ed-guide-hero__desc {
		margin-inline: 0;
		max-width: none;
		text-align: left;
	}

	/* ---------------------------------------------------------------- */
	/* Flatten every desktop grid to one print column — a 2/3-column card  */
	/* row reads far worse on A4 than a clear top-to-bottom sequence.     */
	/* ---------------------------------------------------------------- */

	.ed-guide-case,
	.ed-guide-case-grid,
	.ed-t2-decision,
	.ed-t2-decision--3,
	.ed-guide-callout,
	.ed-guide-callout--media-right,
	.ed-guide-obstacles,
	.ed-t2-tools,
	.ed-guide-checklist {
		display: block !important;
	}

	.ed-guide-case-grid .ed-guide-case {
		grid-template-rows: none;
	}

	.ed-guide-case__media {
		border-top: 1px solid #e1e5e6;
		border-left: 0 !important;
	}

	.ed-guide-case__media .ed-guide-diagram,
	.ed-guide-callout .ed-guide-diagram {
		width: 70mm;
		max-width: 70mm;
		margin-inline: auto;
	}

	.ed-t2-decision-card,
	.ed-t2-tools__item,
	.ed-guide-checklist__item {
		margin-bottom: 4mm;
		border: 1px solid #e1e5e6;
	}

	/* ---------------------------------------------------------------- */
	/* FAQ — the accordion has no meaning on paper: force every answer     */
	/* open, and drop the interactive button chrome so it reads as a      */
	/* plain Q/A list instead of a row of clickable pills.                */
	/* ---------------------------------------------------------------- */

	.ed-guide-faq__answer-wrap {
		display: block !important;
	}

	.ed-guide-faq__answer[hidden] {
		display: block !important;
	}

	.ed-guide-faq__question {
		background: none !important;
		color: #101314 !important;
		cursor: default;
	}

	.ed-guide-faq__chevron {
		display: none;
	}

	.ed-guide-faq__item {
		border: 0;
		border-bottom: 1px solid #e1e5e6;
		border-radius: 0;
	}

	/* ---------------------------------------------------------------- */
	/* Page-break control — keep each logical unit on one page whenever    */
	/* it reasonably fits; never split an image from its own caption/text. */
	/* ---------------------------------------------------------------- */

	.ed-guide-case,
	.ed-t2-decision-card,
	.ed-guide-callout,
	.ed-guide-obstacles,
	.ed-t2-tip,
	.ed-t2-tools__item,
	.ed-guide-checklist__item,
	.ed-guide-faq__item,
	.ed-guide-diagram {
		break-inside: avoid;
	}

	section {
		break-inside: auto;
	}

	.ed-section {
		padding-block: 6mm;
	}
}
