/* =========================================================
   TradManga — Dossiers : version imprimable (A4)
   ========================================================= */

:root {
	--p-accent: #e8192c;
	--p-gold: #c99a1e;
	--p-ink: #1a1922;
	--p-text: #2d2c37;
	--p-muted: #6e6d7c;
	--p-line: #dcdbe3;
	--p-soft: #f5f4f8;
}

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

	@top-left {
		font: 500 7.5pt 'Poppins', sans-serif;
		color: #8a8996;
		vertical-align: bottom;
		padding-bottom: 3mm;
	}
	@top-right {
		font: 600 7.5pt 'Poppins', sans-serif;
		color: #e8192c;
		vertical-align: bottom;
		padding-bottom: 3mm;
	}
	@bottom-left {
		font: 400 7.5pt 'Poppins', sans-serif;
		color: #8a8996;
		vertical-align: top;
		padding-top: 3mm;
	}
	@bottom-right {
		content: counter(page) " / " counter(pages);
		font: 600 7.5pt 'Poppins', sans-serif;
		color: #1a1922;
		vertical-align: top;
		padding-top: 3mm;
	}
}
/* Pas d'en-tête ni de pied sur la couverture */
@page :first {
	margin: 0;
	@top-left { content: none; }
	@top-right { content: none; }
	@bottom-left { content: none; }
	@bottom-right { content: none; }
}

* { box-sizing: border-box; }
html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
body.tmp {
	margin: 0;
	font-family: 'Poppins', system-ui, sans-serif;
	font-size: 9.6pt;
	line-height: 1.58;
	color: var(--p-text);
	background: #fff;
	hyphens: auto;
	-webkit-hyphens: auto;
}

/* ---------- Barre d'aperçu (écran uniquement) ---------- */
.tmp-bar {
	position: sticky; top: 0; z-index: 10;
	display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
	padding: 12px 20px;
	background: #16151d; color: #c9c8d3;
	font-size: 13px;
}
.tmp-bar span { flex: 1 1 320px; }
.tmp-bar button {
	background: #e8192c; color: #fff; border: 0; border-radius: 8px;
	padding: 8px 16px; font: 600 13px 'Poppins', sans-serif; cursor: pointer;
}
.tmp-bar a { color: #f0c040; text-decoration: none; font-weight: 500; }

/* ---------- Couverture ---------- */
.tmp-cover {
	position: relative;
	height: 297mm;
	padding: 22mm 20mm 20mm;
	display: flex;
	flex-direction: column;
	background:
		radial-gradient(circle at 88% 12%, rgba(232, 25, 44, .10) 0, rgba(232, 25, 44, 0) 45%),
		radial-gradient(circle at 10% 95%, rgba(240, 192, 64, .16) 0, rgba(240, 192, 64, 0) 40%),
		#ffffff;
	break-after: page;
	overflow: hidden;
}
.tmp-cover::after {
	content: "";
	position: absolute; left: 0; top: 0; bottom: 0;
	width: 7mm;
	background: linear-gradient(180deg, var(--p-accent) 0%, var(--p-accent) 70%, var(--p-gold) 70%, var(--p-gold) 100%);
}
.tmp-cover-top { display: flex; align-items: center; justify-content: space-between; gap: 10mm; }
.tmp-logo { max-height: 16mm; max-width: 60mm; width: auto; }
.tmp-sitename { font-size: 18pt; font-weight: 700; color: var(--p-ink); }
.tmp-kicker {
	font-size: 8.5pt; font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
	color: var(--p-accent);
	border: 1px solid var(--p-accent); border-radius: 99px;
	padding: 1.2mm 4mm;
}
.tmp-cover-main { margin-top: auto; margin-bottom: auto; padding-top: 10mm; }
.tmp-cover-bar { width: 26mm; height: 2.2mm; background: var(--p-accent); border-radius: 2mm; margin-bottom: 8mm; }
.tmp-cover h1 {
	font-size: 40pt;
	line-height: 1.04;
	font-weight: 700;
	letter-spacing: -1px;
	color: var(--p-ink);
	margin: 0 0 7mm;
	max-width: 150mm;
	hyphens: manual;
}
.tmp-cover-img { margin: 0 0 7mm; max-width: 150mm; }
.tmp-cover-img img {
	display: block; width: auto; height: auto;
	max-width: 100%; max-height: 105mm;
	border-radius: 3mm;
	box-shadow: 0 2mm 6mm rgba(26, 25, 34, .14);
}
.tmp-lead { font-size: 12pt; line-height: 1.6; color: var(--p-muted); margin: 0 0 12mm; max-width: 145mm; hyphens: manual; }
.tmp-facts { list-style: none; display: flex; gap: 6mm; margin: 0; padding: 0; }
.tmp-facts li {
	border-top: 2px solid var(--p-ink);
	padding-top: 2.5mm;
	min-width: 32mm;
}
.tmp-facts strong { display: block; font-size: 12pt; color: var(--p-ink); line-height: 1.3; }
.tmp-facts span { font-size: 8pt; color: var(--p-muted); text-transform: uppercase; letter-spacing: 1px; }
.tmp-cover-foot {
	font-size: 8.5pt; color: var(--p-muted);
	border-top: 1px solid var(--p-line);
	padding-top: 4mm;
}
.tmp-cover-foot strong { display: block; color: var(--p-ink); font-weight: 600; font-size: 9.5pt; word-break: break-all; }

/* ---------- Sommaire ---------- */
.tmp-toc { break-after: page; }
.tmp-toc-title {
	font-size: 22pt; font-weight: 700; color: var(--p-ink);
	margin: 0 0 7mm; padding-bottom: 3mm;
	border-bottom: 2.5px solid var(--p-accent);
}
.tmp-toc ol { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 10mm; }
.tmp-toc li {
	display: flex; gap: 3mm; align-items: baseline;
	padding: 2.2mm 0;
	border-bottom: 1px solid var(--p-line);
	break-inside: avoid;
	font-size: 9.6pt;
	line-height: 1.4;
}
.tmp-toc-num {
	flex: 0 0 7mm;
	font-weight: 700;
	color: var(--p-accent);
}
.tmp-toc a { color: var(--p-ink); text-decoration: none; }
.tmp-toc-note { margin-top: 8mm; font-size: 8.5pt; color: var(--p-muted); }
.tmp-ref-demo { font-weight: 600; color: var(--p-accent); }

/* ---------- Contenu ---------- */
.tmp-content { padding: 0; }
.tmp-content h2 {
	font-size: 15pt;
	line-height: 1.25;
	font-weight: 700;
	color: var(--p-ink);
	margin: 9mm 0 3.5mm;
	padding-top: 3mm;
	border-top: 2px solid var(--p-accent);
	break-after: avoid;
	page-break-after: avoid;
	hyphens: manual;
}
.tmp-content > h2:first-child { margin-top: 0; }
.tmp-content h3 {
	font-size: 11pt;
	line-height: 1.3;
	font-weight: 600;
	color: var(--p-ink);
	margin: 5.5mm 0 2mm;
	padding-left: 2.5mm;
	border-left: 2.5px solid var(--p-gold);
	break-after: avoid;
	page-break-after: avoid;
	hyphens: manual;
}
.tmp-content p { margin: 0 0 2.6mm; orphans: 3; widows: 3; text-align: justify; }
.tmp-content strong { color: var(--p-ink); font-weight: 600; }
.tmp-content a { color: inherit; text-decoration: none; }
.tmp-content ul, .tmp-content ol { margin: 0 0 3mm; padding-left: 5mm; }
.tmp-content li { margin-bottom: 1.4mm; }

/* Renvois [S01] : discrets, en couleur, sans encadré */
.tmp-content a.tmd-ref,
.tmp-content a[href^="#s"] {
	font-size: 7.2pt;
	font-weight: 600;
	color: var(--p-accent);
	white-space: nowrap;
	letter-spacing: .2px;
}

/* Tableaux : compacts, en-tête répété sur chaque page */
.tmp-content .tmd-table,
.tmp-content figure.wp-block-table { margin: 3.5mm 0 4.5mm; }
.tmp-content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 8pt;
	line-height: 1.4;
	hyphens: manual;
}
.tmp-content thead { display: table-header-group; }
.tmp-content th {
	text-align: left;
	font-weight: 600;
	color: #fff;
	background: var(--p-ink);
	padding: 1.8mm 2.2mm;
	border: 0;
}
.tmp-content td {
	padding: 1.6mm 2.2mm;
	border-bottom: 1px solid var(--p-line);
	vertical-align: top;
}
.tmp-content tbody tr:nth-child(even) td { background: var(--p-soft); }
.tmp-content tr { break-inside: avoid; page-break-inside: avoid; }
.tmp-content td:first-child { font-weight: 500; color: var(--p-ink); }

/* Bibliographie : 2 colonnes, domaine affiché après chaque lien */
.tmp-content ul:has(> li.tmd-source) {
	list-style: none;
	padding: 0;
	columns: 2;
	column-gap: 7mm;
	column-rule: 1px solid var(--p-line);
	font-size: 7.6pt;
	line-height: 1.45;
	hyphens: auto;
}
.tmp-content li.tmd-source {
	break-inside: avoid;
	margin: 0 0 2mm;
	padding: 0 0 2mm;
	border-bottom: 1px solid var(--p-line);
	text-align: left;
}
.tmp-content li.tmd-source a[href^="http"] { color: var(--p-ink); text-decoration: underline; text-decoration-color: var(--p-line); }
.tmp-content li.tmd-source a[data-host]::after {
	content: " (" attr(data-host) ")";
	color: var(--p-muted);
	font-size: .92em;
	text-decoration: none;
}
.tmp-content li.tmd-source > strong:first-child a { font-size: 7.6pt; }

.tmp-content .tmd-top { display: none; }

/* ---------- Écran : aperçu façon feuilles ---------- */
@media screen {
	body.tmp { background: #e9e8ee; font-size: 15px; }
	.tmp-cover, .tmp-toc, .tmp-content {
		width: 210mm;
		max-width: 100%;
		margin: 24px auto;
		background-color: #fff;
		box-shadow: 0 6px 30px rgba(0, 0, 0, .12);
	}
	.tmp-toc, .tmp-content { padding: 18mm 16mm; }
	.tmp-cover { height: auto; min-height: 297mm; }
}
@media screen and (max-width: 800px) {
	.tmp-cover { min-height: 0; padding: 32px 24px 24px 36px; }
	.tmp-cover h1 { font-size: 30px; }
	.tmp-toc, .tmp-content { padding: 24px 18px; }
	.tmp-toc ol, .tmp-content ul:has(> li.tmd-source) { columns: 1; }
	.tmp-facts { flex-wrap: wrap; }
}

/* ---------- Impression ---------- */
@media print {
	.tmp-bar { display: none !important; }
	body.tmp { font-size: 9.6pt; }
}
