/* =========================================================
   1. VARIABLES
========================================================= */
:root {
	--primary: #173b5e;
	--primary-dark: #102943;
	--primary-light: #2c658f;
	--accent: #25a59e;
	--accent-light: #e8f6f4;
	--background: #f3f6fa;
	--surface: #ffffff;
	--text: #293b4b;
	--muted: #718091;
	--border: #e1e8ef;
	--warning: #d59a38;
	--shadow: 0 8px 30px rgba(20, 45, 70, .07);
	--radius: 14px;
	--header-height: 75px;
	--reading-width: 950px;
	--scroll-offset: 100px;
}
/* =========================================================
   2. BASE
========================================================= */
* {
	box-sizing: border-box;
}
html {
	scroll-behavior: smooth;
	scroll-padding-top: var(--scroll-offset);
}
body {
	margin: 0;
	background: var(--background);
	color: var(--text);
	font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont,
		"Segoe UI", sans-serif;
	font-size: 16px;
	line-height: 1.8;
	transition: background .2s, color .2s;
}
a {
	color: var(--primary-light);
}
button, input {
	font: inherit;
}
button {
	cursor: pointer;
}
img {
	max-width: 100%;
	height: auto;
}
:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 4px;
}
/* =========================================================
   3. ACCESSIBILITÉ
========================================================= */
.skip-link {
	position: absolute;
	top: -100px;
	left: 15px;
	background: white;
	color: black;
	padding: 12px 20px;
	z-index: 9999;
}
.skip-link:focus {
	top: 15px;
}
/* =========================================================
   4. PROGRESSION DE LECTURE
========================================================= */
.progress-container {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 4px;
	background: rgba(255, 255, 255, .2);
	z-index: 2000;
}
.progress-bar {
	height: 100%;
	width: 0;
	background: var(--accent);
	transition: width .1s;
}
/* =========================================================
   5. HEADER
========================================================= */
.top-header {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	position: relative;
	z-index: 100;
}
.top-header-inner {
	max-width: 1250px;
	margin: auto;
	min-height: var(--header-height);
	padding: 15px 25px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
}
.brand {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	flex-shrink: 0;
}
.brand img {
	width: 277px;
	height: 43px;
	object-fit: contain;
	object-position: left center;
	display: block;
}
.header-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}
.header-button {
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
	padding: 9px 13px;
	border-radius: 9px;
	font-size: 13px;
}
.header-button:hover {
	background: var(--primary);
	color: white;
}
/* =========================================================
   6. HERO
========================================================= */
.hero {
	background: linear-gradient(135deg, #10243c, #20547c);
	color: white;
	padding: 65px 25px;
}
.hero-inner {
	max-width: 1150px;
	margin: auto;
}
.eyebrow {
	color: #8ee0d8;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 2px;
}
.hero h1 {
	font-size: clamp(30px, 5vw, 48px);
	line-height: 1.2;
	max-width: 950px;
	margin: 20px 0;
}
.hero-description {
	color: #d5e2ee;
	max-width: 850px;
	font-size: 18px;
}
.hero-meta {
	margin-top: 25px;
	color: #c1d4e4;
	font-size: 13px;
}
/* =========================================================
   7. CONTENEUR
========================================================= */
.container {
	max-width: 1450px;
	margin: auto;
	padding: 30px 25px 100px;
}
/* =========================================================
   8. BARRE D'OUTILS
========================================================= */
.toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 20px;
}
.toolbar button {
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
	border-radius: 9px;
	padding: 10px 15px;
	font-size: 13px;
	transition: .2s;
}
.toolbar button:hover {
	background: var(--primary);
	color: white;
}
/* =========================================================
   9. RECHERCHE
========================================================= */
.search-panel {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 18px;
	margin-bottom: 25px;
	box-shadow: var(--shadow);
}
.search-label {
	display: block;
	font-weight: 700;
	font-size: 14px;
	margin-bottom: 8px;
}
.search-row {
	display: flex;
	gap: 10px;
}
.search-input {
	flex: 1;
	min-width: 0;
	padding: 13px 16px;
	border: 1px solid var(--border);
	border-radius: 9px;
	background: var(--surface);
	color: var(--text);
}
.search-button {
	border: 0;
	background: var(--primary);
	color: white;
	border-radius: 9px;
	padding: 10px 18px;
}
.search-information {
	margin-top: 12px;
	color: var(--muted);
	font-size: 12px;
}
/* =========================================================
   10. NAVIGATION FIXE DES RÉSULTATS
========================================================= */
.search-dock {
	position: fixed;
	z-index: 1500;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 10px 14px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	box-shadow: 0 5px 25px rgba(0, 0, 0, .18);
	white-space: nowrap;
}
.search-dock button {
	border: 0;
	background: var(--primary);
	color: white;
	border-radius: 8px;
	padding: 9px 13px;
	font-size: 13px;
}
.search-dock button:disabled {
	opacity: .4;
	cursor: not-allowed;
}
.search-counter {
	min-width: 65px;
	text-align: center;
	font-size: 13px;
	font-weight: 700;
	color: var(--text);
}
/* =========================================================
   11. SURBRILLANCE DES OCCURRENCES
========================================================= */
mark.search-highlight {
	background: #ffeb65;
	color: #302600;
	padding: 1px 3px;
	border-radius: 3px;
	font-weight: 700;
}
mark.search-highlight.current {
	background: #ffad35;
	color: #302000;
	outline: 2px solid #e28c16;
	outline-offset: 2px;
}
/* =========================================================
   12. GRILLE PRINCIPALE
========================================================= */
.layout {
	display: grid;
	grid-template-columns: 285px minmax(0, 1fr);
	gap: 30px;
	align-items: start;
}
/* =========================================================
   13. SOMMAIRE
========================================================= */
.toc {
	background: var(--surface);
	padding: 22px;
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	border: 1px solid var(--border);
	position: sticky;
	top: 20px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
}
.toc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 15px;
}
.toc h2 {
	font-size: 18px;
	margin: 0;
}
.toc ol {
	padding-left: 24px;
	margin: 0;
	counter-reset: none;
}
.toc li {
	margin: 9px 0;
	font-size: 13px;
	line-height: 1.5;
}
.toc a {
	text-decoration: none;
	color: var(--text);
}
.toc a:hover, .toc a.active {
	color: var(--accent);
	font-weight: 700;
}
.toc-toggle {
	display: none;
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
	border-radius: 7px;
	padding: 5px 9px;
}
/* =========================================================
   14. CONTENU DOCUMENTAIRE
========================================================= */
.content {
	min-width: 0;
	counter-reset: main-section;
}
.intro-card, .section-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 32px;
	margin-bottom: 25px;
	box-shadow: var(--shadow);
}
/* =========================================================
   15. NUMÉROTATION AUTOMATIQUE DES RUBRIQUES
========================================================= */
.content>article>h2, .content>section>h2 {
	counter-increment: main-section;
	font-size: 25px;
	line-height: 1.35;
	color: var(--primary);
	margin-top: 0;
}
.content>article>h2::before, .content>section>h2::before {
	content: counter(main-section) ". ";
	color: var(--accent);
	font-weight: 800;
}
/* Sous-rubriques */
.content>article, .content>section {
	counter-reset: subsection;
}
.content h3 {
	counter-increment: subsection;
	font-size: 19px;
	color: var(--primary-light);
	margin-top: 30px;
}
.content h3::before {
	content: counter(main-section) "." counter(subsection) " ";
	color: var(--accent);
	font-weight: 700;
}
.content h4 {
	font-size: 16px;
	color: var(--primary);
}
.section-number {
	display: block;
	color: var(--accent);
	font-size: 12px;
	font-weight: bold;
	letter-spacing: 1px;
	margin-bottom: 10px;
}
.section-card li {
	padding: 3px 0;
}
.section-card li::marker {
	color: var(--accent);
}
/* =========================================================
   16. ENCARTS
========================================================= */
.highlight {
	background: var(--accent-light);
	border-left: 4px solid var(--accent);
	padding: 18px 22px;
	border-radius: 5px;
	margin: 25px 0;
}
.warning {
	background: #fff5e8;
	border-left: 4px solid var(--warning);
	padding: 18px 22px;
	border-radius: 5px;
	margin: 25px 0;
}
.info-box {
	background: #edf3fa;
	border-left: 4px solid var(--primary-light);
	padding: 18px 22px;
	margin: 25px 0;
}
/* =========================================================
   17. TABLEAUX
========================================================= */
.table-wrapper {
	overflow-x: auto;
	margin: 25px 0;
}
table {
	width: 100%;
	border-collapse: collapse;
	min-width: 550px;
}
caption {
	text-align: left;
	font-weight: bold;
	padding: 12px 0;
}
th, td {
	text-align: left;
	border: 1px solid var(--border);
	padding: 13px;
	vertical-align: top;
}
th {
	background: var(--primary);
	color: white;
}
tbody tr:nth-child(even) {
	background: rgba(120, 150, 180, .07);
}
/* =========================================================
   18. GLOSSAIRE
========================================================= */
.glossary-list div {
	padding: 15px 0;
	border-bottom: 1px solid var(--border);
}
.glossary-list dt {
	font-weight: bold;
	color: var(--primary);
}
.glossary-list dd {
	margin: 5px 0 0;
}
/* =========================================================
   19. FAQ
========================================================= */
.faq-item {
	border-bottom: 1px solid var(--border);
	padding: 15px 0;
}
.faq-item summary {
	cursor: pointer;
	font-weight: bold;
	color: var(--primary);
}
.faq-item p {
	padding-top: 10px;
}
/* =========================================================
   20. FOOTER
========================================================= */
footer {
	background: var(--primary-dark);
	color: #d5e2ee;
	padding: 40px 20px;
	text-align: center;
}
footer p {
	max-width: 850px;
	margin: 10px auto;
}
footer a {
	color: #9de2dc;
}
/* =========================================================
   21. INFORMATIONS D'IMPRESSION
========================================================= */
.print-only {
	display: none;
}
/* =========================================================
   22. MODE SOMBRE
========================================================= */
body.dark {
	--background: #101923;
	--surface: #192633;
	--text: #e4edf5;
	--muted: #a7b6c4;
	--border: #314252;
	--primary: #9ec8ed;
	--primary-light: #83b7e4;
	--accent-light: #1b3a3a;
	--shadow: 0 8px 30px rgba(0, 0, 0, .2);
}
body.dark .warning {
	background: #42351f;
}
body.dark .info-box {
	background: #20384c;
}
body.dark th {
	background: #254a68;
}
/* =========================================================
   23. RETOUR EN HAUT
========================================================= */
.back-top {
	position: fixed;
	right: 20px;
	bottom: 90px;
	border: 0;
	background: var(--primary);
	color: white;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transform: translateY(10px);
	transition: .2s;
	z-index: 500;
}
.back-top.visible {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
}
/* =========================================================
   24. RESPONSIVE
========================================================= */
@media ( max-width :1050px) {
	.layout {
		grid-template-columns: 240px minmax(0, 1fr);
		gap: 20px;
	}
}
@media ( max-width :850px) {
	.layout {
		grid-template-columns: 1fr;
	}
	.toc {
		position: relative;
		top: auto;
		max-height: none;
	}
	.toc-toggle {
		display: inline-block;
	}
	.toc-list {
		display: none;
	}
	.toc.open .toc-list {
		display: block;
	}
}
@media ( max-width :650px) {
	.top-header-inner {
		flex-wrap: wrap;
		padding: 12px 15px;
	}
	.brand img {
		width: min(277px, 70vw);
		height: auto;
		aspect-ratio: 277/43;
	}
	.header-actions {
		width: 100%;
		justify-content: flex-end;
	}
	.hero {
		padding: 45px 18px;
	}
	.container {
		padding: 20px 14px 100px;
	}
	.intro-card, .section-card {
		padding: 22px 18px;
	}
	.content>article>h2, .content>section>h2 {
		font-size: 22px;
	}
	.search-row {
		flex-wrap: wrap;
	}
	.search-button {
		width: 100%;
	}
	.search-dock {
		width: calc(100% - 20px);
		bottom: 10px;
		gap: 7px;
		padding: 8px;
	}
	.search-dock button {
		padding: 9px 10px;
		font-size: 12px;
	}
	.back-top {
		right: 12px;
		bottom: 85px;
	}
}
/* =========================================================
   25. IMPRESSION ET EXPORT PDF
========================================================= */
@page {
	size: A4;
	margin: 17mm 18mm 18mm;
}
@media print {
	* {
		box-shadow: none !important;
		text-shadow: none !important;
	}
	html, body {
		background: white !important;
		color: #111 !important;
		font-family: Arial, sans-serif;
		font-size: 10.5pt;
		line-height: 1.55;
		scroll-behavior: auto !important;
	}
	/* Masquage intégral des commandes */
	.header-actions, .toolbar, .toc, .search-panel, .search-dock,
		.progress-container, .back-top, footer, .skip-link, .toc-toggle {
		display: none !important;
	}
	/* Conservation du logo */
	.top-header {
		border: none !important;
		background: white !important;
	}
	.top-header-inner {
		padding: 0 0 12px;
		min-height: auto;
	}
	.brand img {
		width: 277px;
		height: 43px;
		object-fit: contain;
	}
	/* Titre principal */
	.hero {
		background: white !important;
		color: black !important;
		padding: 15px 0 25px;
	}
	.hero h1 {
		color: black !important;
		font-size: 23pt;
	}
	.hero-description, .hero-meta, .eyebrow {
		color: #333 !important;
	}
	/* Mise en page */
	.container {
		max-width: none;
		padding: 0;
	}
	.layout {
		display: block;
	}
	.intro-card, .section-card {
		box-shadow: none;
		border: none;
		border-bottom: 1px solid #ddd;
		border-radius: 0;
		padding: 15px 0;
		margin-bottom: 15px;
		background: white !important;
	}
	.content>article>h2, .content>section>h2 {
		color: black !important;
		break-after: avoid-page;
		page-break-after: avoid;
	}
	.content h3, .content h4 {
		color: #222 !important;
		break-after: avoid-page;
		page-break-after: avoid;
	}
	/* Éviter les coupures */
	p, li, dt, dd, .highlight, .warning, .info-box, .faq-item {
		orphans: 3;
		widows: 3;
	}
	h1, h2, h3, h4 {
		break-after: avoid-page;
		page-break-after: avoid;
	}
	.section-card, .intro-card {
		break-inside: auto;
		page-break-inside: auto;
	}
	.faq-item, tr {
		break-inside: avoid;
		page-break-inside: avoid;
	}
	thead {
		display: table-header-group;
	}
	/* Informations auteur et source */
	.print-only {
		display: block !important;
	}
	.print-information {
		border: 1px solid #aaa;
		padding: 15px;
		margin: 25px 0;
		font-size: 9pt;
		overflow-wrap: anywhere;
	}
	.print-information a {
		color: black !important;
		text-decoration: underline;
	}
	/* Couleurs d'impression */
	.highlight, .warning, .info-box {
		background: white !important;
		color: black !important;
		border: 1px solid #aaa;
	}
	th {
		background: #e8e8e8 !important;
		color: black !important;
		print-color-adjust: exact;
		-webkit-print-color-adjust: exact;
	}
	a {
		color: black !important;
		text-decoration: underline;
	}
	/* Références de recherche */
	mark.search-highlight {
		background: #fff0a0 !important;
		color: black !important;
		print-color-adjust: exact;
		-webkit-print-color-adjust: exact;
	}
	mark.search-highlight.current {
		outline: none;
	}
}
/* =========================================================
   26. ACCESSIBILITÉ : MOUVEMENTS RÉDUITS
========================================================= */
@media ( prefers-reduced-motion :reduce) {
	*, *::before, *::after {
		scroll-behavior: auto !important;
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
	}
}