@charset "UTF-8";

/* =========================================================================
 * RedotPay Child - print.css
 *
 * 設計原則(プロンプト10「PDF出力対応」要件):
 *   - 文字色は #000000、背景色は #FFFFFF に正規化
 *   - 背景画像・装飾色は出力しない(インク節約 + 文字被り防止)
 *   - position: fixed/sticky を解除(PDFでは要素が重なり文字被りの原因)
 *   - page-break-* を活用し、見出し直後の改ページを防ぐ
 *   - URLは a[href]::after で末尾に展開(リンク追跡可能)
 *   - 余白・フォントサイズはA4見開き想定で最適化
 *
 * 検証: Chrome/Edge/Firefox/Safari の "印刷プレビュー" で
 *       見出し直後の改ページなし、リンクURL末尾出力、文字被りなしを目視確認。
 * ========================================================================= */

@media print {

	/* --- 0. ベースリセット ----------------------------------------------- */
	*,
	*::before,
	*::after {
		background: transparent !important;
		color: #000 !important;
		box-shadow: none !important;
		text-shadow: none !important;
		filter: none !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	html, body {
		margin: 0;
		padding: 0;
		font-size: 11pt;
		line-height: 1.6;
		color: #000;
		background: #fff;
	}

	@page {
		size: A4;
		margin: 18mm 16mm 22mm;
	}

	@page :left {
		margin-left: 22mm;
		margin-right: 14mm;
	}
	@page :right {
		margin-left: 14mm;
		margin-right: 22mm;
	}

	/* --- 1. 不要要素の非表示 -------------------------------------------- */
	.rdp-skip-link,
	.rdp-language-switcher,
	.rdp-cta-button,
	.rdp-faq__icon,
	#header,
	#footer,
	.header,
	.footer,
	nav,
	aside,
	.sidebar,
	.widget,
	.share-buttons,
	.related-posts,
	.comments-area,
	.no-print,
	.gtranslate_wrapper,
	[role="banner"],
	[role="contentinfo"],
	[role="navigation"] {
		display: none !important;
	}

	/* --- 2. 固定要素の解除(文字被り防止の最重要対策) ------------------ */
	*[style*="position: fixed"],
	*[style*="position:fixed"],
	*[style*="position: sticky"],
	*[style*="position:sticky"] {
		position: static !important;
	}

	.rdp-toc,
	.sticky,
	.fixed,
	.is-sticky {
		position: static !important;
		top: auto !important;
		bottom: auto !important;
	}

	/* --- 3. メインコンテンツの拡幅 -------------------------------------- */
	main,
	.main,
	.entry-content,
	.rdp-container,
	article {
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
		float: none !important;
	}

	/* --- 4. タイポグラフィ ---------------------------------------------- */
	h1, h2, h3, h4, h5, h6 {
		page-break-after: avoid;
		break-after: avoid-page;
		page-break-inside: avoid;
		color: #000 !important;
		border-left: none !important;
		padding-left: 0 !important;
	}
	h1 { font-size: 22pt; margin: 0 0 8pt; }
	h2 { font-size: 16pt; margin: 14pt 0 6pt; border-bottom: 2pt solid #000; padding-bottom: 2pt; }
	h3 { font-size: 13pt; margin: 10pt 0 4pt; }
	h4 { font-size: 11.5pt; margin: 8pt 0 4pt; }

	p, li {
		orphans: 3;
		widows: 3;
		page-break-inside: avoid;
	}

	/* --- 5. 画像 / 表 ---------------------------------------------------- */
	img, svg, picture {
		max-width: 100% !important;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	table {
		page-break-inside: auto;
		border-collapse: collapse;
		width: 100% !important;
	}
	thead { display: table-header-group; } /* 各ページにヘッダ繰返し */
	tr, td, th { page-break-inside: avoid; }
	th, td { border: 1pt solid #000 !important; padding: 4pt 6pt; }

	/* --- 6. リンクURL展開 ----------------------------------------------- */
	a[href]:not([href^="#"]):not([href^="javascript:"])::after {
		content: " (" attr(href) ")";
		font-size: 9pt;
		color: #555 !important;
		word-break: break-all;
	}
	a[href^="#"]::after { content: ""; }

	/* --- 7. 結論ボックス・FAQの整形 ------------------------------------ */
	.rdp-conclusion-box {
		border: 1.5pt solid #000 !important;
		background: transparent !important;
		padding: 8pt 10pt !important;
		page-break-inside: avoid;
	}
	.rdp-conclusion-box__title {
		color: #000 !important;
	}
	.rdp-conclusion-box__title::before { content: "[結論] "; font-size: 11pt; }

	.rdp-faq__item {
		border-bottom: 1pt solid #000 !important;
		page-break-inside: avoid;
	}
	.rdp-faq__answer { display: block !important; padding: 4pt 0 8pt !important; }

	/* --- 8. パンくず・著者BOX --------------------------------------------- */
	.rdp-breadcrumb {
		font-size: 9pt;
		color: #444 !important;
		margin-bottom: 8pt;
	}
	.rdp-author-box {
		border: 1pt solid #000 !important;
		background: transparent !important;
		padding: 6pt 10pt !important;
		page-break-inside: avoid;
	}

	/* --- 9. 印刷時にだけ表示する出典クレジット ---------------------------- */
	body::after {
		content: "Source: " attr(data-print-source);
		display: block;
		margin-top: 12pt;
		padding-top: 6pt;
		border-top: 1pt solid #000;
		font-size: 9pt;
		color: #444 !important;
	}
}
