/* Bibliothèque des pièces du PLUi-HM (mu-plugin plui-pieces). Préfixe pp-, couleurs et polices du thème. */

.pp-bibliotheque {
	--pp-texte: #003a61;
	--pp-bleu: #2d81b1;
	--pp-bleu-texte: #266c95; /* textes bleus à 5:1 au moins, accessibilité du 18/11/2026 */
	--pp-jaune: #fbbd51;
	--pp-vert: #93cfc3;
	--pp-vert-clair: #e4f4f0;
	--pp-fond: #f4f9f9;
	--pp-gris: #5d6d79;
	--pp-trait: #e1ecee;
	--pp-icone-dossier: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 6.5A2.5 2.5 0 0 1 5.5 4h3.6c.6 0 1.2.2 1.6.6L12.3 6h6.2A2.5 2.5 0 0 1 21 8.5v9a2.5 2.5 0 0 1-2.5 2.5h-13A2.5 2.5 0 0 1 3 17.5z'/%3E%3C/svg%3E");
	--pp-icone-loupe: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232d81b1' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 20 20'/%3E%3C/svg%3E");
	--pp-icone-telecharger: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 10.5l5 5 5-5M5 20h14'/%3E%3C/svg%3E");
	color: var(--pp-texte);
	font-family: "Avant-Garde", sans-serif;
	font-size: 1.5rem;
	line-height: 1.5;
	margin: 3.2rem 0 6rem;
	max-width: 100%;
}

.pp-bibliotheque *,
.pp-bibliotheque *::before,
.pp-bibliotheque *::after {
	box-sizing: border-box;
}

.pp-bibliotheque [hidden] {
	display: none !important;
}

.pp-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- En-tête : compteurs, recherche, outils ---------- */

.pp-entete {
	background: var(--pp-fond);
	border-radius: 16px;
	padding: 2.4rem 2rem;
	margin: 0 0 3.2rem;
}

@media only screen and (min-width: 600px) {
	.pp-entete {
		padding: 3.2rem 3.6rem;
	}
}

.pp-resume {
	font-family: "Avant-Garde-Bold", sans-serif;
	font-size: 2rem;
	line-height: 1.3;
	margin: 0;
}

.pp-resume-nb {
	box-shadow: inset 0 -0.35em 0 rgba(251, 189, 81, 0.5);
}

.pp-maj {
	margin: 0.4rem 0 0;
	font-size: 1.35rem;
	color: var(--pp-gris);
}

.pp-recherche {
	margin: 2.4rem 0 0;
}

.pp-recherche-label {
	display: block;
	font-family: "Avant-Garde-Medium", sans-serif;
	font-size: 1.5rem;
	margin: 0 0 0.8rem;
}

.pp-recherche-ligne {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
}

.pp-recherche-champ {
	flex: 1 1 22rem;
	min-width: 0;
	max-width: 100%;
	font-family: "Avant-Garde", sans-serif;
	font-size: 1.6rem;
	line-height: 1.3;
	color: var(--pp-texte);
	background: #ffffff var(--pp-icone-loupe) no-repeat 1.8rem 50% / 2rem 2rem;
	border: 1.5px solid #c6dde2;
	border-radius: 50px;
	padding: 1.3rem 2rem 1.3rem 4.8rem;
	margin: 0;
	transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.pp-recherche-champ:hover {
	border-color: var(--pp-vert);
}

.pp-bibliotheque .pp-recherche-champ:focus {
	outline: none;
	border-color: var(--pp-bleu);
	box-shadow: 0 0 0 4px rgba(45, 129, 177, 0.18);
}

.pp-aide {
	margin: 0.8rem 0 0 2rem;
	font-size: 1.3rem;
	line-height: 1.45;
	color: var(--pp-gris);
}

.pp-bouton {
	display: inline-block;
	font-family: "Avant-Garde-Medium", sans-serif;
	font-size: 1.5rem;
	line-height: 1.2;
	color: var(--pp-texte);
	background: var(--pp-vert);
	border: 1.5px solid var(--pp-vert);
	border-radius: 50px;
	padding: 1.3rem 2.6rem;
	margin: 0;
	cursor: pointer;
	transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.pp-bouton:hover {
	background: #ffffff;
}

/* Déplier et replier : deux commandes discrètes, en texte. */
.pp-outils {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 2.4rem;
	margin: 2rem 0 0;
}

.pp-outils .pp-bouton--clair {
	background: none;
	border: 0;
	border-radius: 0;
	padding: 0.2rem 0;
	font-size: 1.4rem;
	color: var(--pp-bleu-texte);
	text-decoration: underline;
	text-decoration-color: rgba(45, 129, 177, 0.35);
	text-underline-offset: 0.3em;
}

.pp-outils .pp-bouton--clair:hover {
	background: none;
	color: var(--pp-texte);
	text-decoration-color: currentColor;
}

.pp-statut {
	margin: 1.6rem 0 0;
	font-family: "Avant-Garde-Medium", sans-serif;
}

.pp-statut:empty {
	margin: 0;
}

/* ---------- Focus visible ---------- */

.pp-bibliotheque a:focus,
.pp-bibliotheque button:focus,
.pp-bibliotheque summary:focus,
.pp-bibliotheque input:focus {
	outline: 3px solid var(--pp-texte);
	outline-offset: 2px;
}

.pp-bibliotheque a:focus:not(:focus-visible),
.pp-bibliotheque button:focus:not(:focus-visible),
.pp-bibliotheque summary:focus:not(:focus-visible) {
	outline: none;
}

/* ---------- Listes ---------- */

.pp-bibliotheque .pp-liste {
	list-style: none;
	margin: 0;
	padding: 0;
}

.pp-bibliotheque .pp-liste .pp-liste {
	margin: 0 0 1.2rem 2.3rem;
	padding: 0.2rem 0 0.2rem 1.2rem;
	border-left: 1px solid var(--pp-trait);
}

@media only screen and (min-width: 600px) {
	.pp-bibliotheque .pp-liste .pp-liste {
		margin-left: 2.4rem;
		padding-left: 1.8rem;
	}
}

.pp-bibliotheque .pp-liste > li {
	list-style: none;
	margin: 0;
	padding: 0;
}

.pp-bibliotheque .pp-liste > li::before {
	content: none;
}

/* ---------- Dossiers ---------- */

.pp-liste--racine > .pp-dossier {
	border-bottom: 1px solid var(--pp-trait);
}

.pp-liste--racine > .pp-dossier:first-child {
	border-top: 1px solid var(--pp-trait);
}

.pp-liste--racine > .pp-dossier > .pp-details > .pp-liste {
	margin-top: 0.4rem;
	margin-bottom: 2rem;
}

.pp-details {
	scroll-margin-top: 2rem;
}

@media only screen and (min-width: 960px) {
	.pp-details {
		scroll-margin-top: 11rem;
	}
}

.pp-summary {
	display: flex;
	align-items: center;
	gap: 1.2rem;
	list-style: none;
	cursor: pointer;
	padding: 1.6rem 1.2rem;
	border-radius: 10px;
	font-family: "Avant-Garde-Medium", sans-serif;
	font-size: 1.6rem;
	line-height: 1.35;
	color: var(--pp-texte);
	transition: background-color 0.15s ease-in-out;
}

.pp-liste .pp-liste .pp-summary {
	padding-top: 1.1rem;
	padding-bottom: 1.1rem;
	font-size: 1.5rem;
}

.pp-summary::-webkit-details-marker {
	display: none;
}

.pp-summary::marker {
	content: "";
}

/* Icône de dossier, à gauche. */
.pp-summary::before {
	content: "";
	flex: 0 0 auto;
	width: 2.2rem;
	height: 2.2rem;
	background-color: var(--pp-vert);
	-webkit-mask: var(--pp-icone-dossier) no-repeat center / contain;
	mask: var(--pp-icone-dossier) no-repeat center / contain;
}

.pp-details[open] > .pp-summary::before {
	background-color: var(--pp-bleu);
}

/* Flèche, à droite : vers le bas fermé, vers le haut ouvert. */
.pp-summary::after {
	content: "";
	flex: 0 0 auto;
	width: 0.8rem;
	height: 0.8rem;
	margin: 0 0.6rem 0.4rem 0.4rem;
	border: solid var(--pp-bleu);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
	transition: transform 0.2s ease-out, margin 0.2s ease-out;
}

.pp-details[open] > .pp-summary::after {
	transform: rotate(-135deg);
	margin-bottom: -0.4rem;
}

.pp-summary:hover {
	background: var(--pp-fond);
}

.pp-details[open] > .pp-summary .pp-dossier-nom {
	font-family: "Avant-Garde-Bold", sans-serif;
}

.pp-details:target > .pp-summary,
.pp-details.pp-cible > .pp-summary {
	background: #fff6e2;
	box-shadow: inset 3px 0 0 var(--pp-jaune);
}

.pp-dossier-nom {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.pp-dossier-nb {
	flex: 0 0 auto;
	font-family: "Avant-Garde", sans-serif;
	font-size: 1.3rem;
	line-height: 1.4;
	white-space: nowrap;
	color: var(--pp-gris);
}

.pp-vide {
	margin: 0.4rem 0 1.2rem 1.2rem;
	color: var(--pp-gris);
	font-style: italic;
}

/* ---------- Fichiers ---------- */

.pp-bibliotheque .pp-liste > .pp-fichier {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.8rem 1.4rem;
	padding: 1.2rem 1.2rem;
	border-radius: 10px;
	transition: background-color 0.15s ease-in-out;
}

.pp-bibliotheque .pp-liste > .pp-dossier + .pp-fichier {
	margin-top: 1rem;
}

.pp-fichier:hover {
	background: var(--pp-fond);
}

.pp-icone {
	position: relative;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: flex-end;
	justify-content: center;
	width: 3.2rem;
	height: 3.9rem;
	padding: 0 0 0.6rem;
	background: #e6f1f7;
	color: var(--pp-bleu-texte);
	font-family: "Avant-Garde-Bold", sans-serif;
	font-size: 0.95rem;
	line-height: 1;
	letter-spacing: 0.05em;
	border-radius: 4px;
	clip-path: polygon(0 0, 68% 0, 100% 26%, 100% 100%, 0 100%);
}

.pp-icone::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	width: 32%;
	height: 26%;
	background: #c3dceb;
	clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.pp-fichier-texte {
	flex: 1 1 12rem;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
}

.pp-fichier-nom {
	font-family: "Avant-Garde-Medium", sans-serif;
	line-height: 1.4;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.pp-fichier-poids,
.pp-chemin {
	font-size: 1.25rem;
	line-height: 1.45;
	color: var(--pp-gris);
}

.pp-fichier-poids {
	white-space: nowrap;
}

.pp-chemin {
	overflow-wrap: anywhere;
	word-break: break-word;
}

.pp-fichier-liens {
	flex: 0 1 auto;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
}

.pp-lien {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	font-family: "Avant-Garde-Medium", sans-serif;
	font-size: 1.35rem;
	line-height: 1.2;
	color: var(--pp-texte);
	text-decoration: none;
	border: 0;
	border-radius: 50px;
	padding: 0.8rem 1.4rem;
	transition: background-color 0.2s ease-in-out;
}

.pp-lien--consulter {
	background: var(--pp-vert-clair);
}

.pp-lien--consulter:hover {
	background: var(--pp-vert);
	color: var(--pp-texte);
}

.pp-lien--telecharger {
	background: transparent;
	color: var(--pp-bleu-texte);
}

.pp-lien--telecharger::before {
	content: "";
	flex: 0 0 auto;
	width: 1.5rem;
	height: 1.5rem;
	background-color: currentColor;
	-webkit-mask: var(--pp-icone-telecharger) no-repeat center / contain;
	mask: var(--pp-icone-telecharger) no-repeat center / contain;
}

.pp-lien--telecharger:hover {
	background: var(--pp-vert-clair);
	color: var(--pp-texte);
}

.pp-lien-simple {
	color: var(--pp-bleu-texte);
	text-decoration: underline;
	text-underline-offset: 0.3em;
}

@media only screen and (max-width: 600px) {
	.pp-bibliotheque .pp-liste > .pp-fichier {
		align-items: flex-start;
		padding: 1.2rem 0.8rem;
	}

	.pp-fichier-liens {
		flex-basis: 100%;
		margin: -0.2rem 0 0 4.6rem;
	}

	.pp-lien {
		padding: 0.7rem 1.2rem;
	}

	.pp-lien--telecharger {
		padding-left: 0.6rem;
	}

	/* Nom du dossier sur toute la largeur, nombre de documents dessous. */
	.pp-summary,
	.pp-liste .pp-liste .pp-summary {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr) auto;
		column-gap: 1.2rem;
		row-gap: 0.1rem;
		padding: 1.3rem 0.8rem;
	}

	.pp-summary::before {
		grid-column: 1;
		grid-row: 1 / span 2;
	}

	.pp-dossier-nom {
		grid-column: 2;
		grid-row: 1;
	}

	.pp-dossier-nb {
		grid-column: 2;
		grid-row: 2;
		font-size: 1.2rem;
	}

	.pp-summary::after {
		grid-column: 3;
		grid-row: 1 / span 2;
	}

	.pp-bibliotheque .pp-liste .pp-liste {
		margin-left: 1.8rem;
		padding-left: 0.8rem;
	}

	/* Dossiers profonds (3e niveau et plus) : retrait réduit pour que les liens tiennent à 320 px, 18/11/2026. */
	.pp-bibliotheque .pp-liste .pp-liste .pp-liste .pp-liste {
		margin-left: 1rem;
		padding-left: 0.6rem;
	}
}

/* ---------- Résultats de recherche ---------- */

.pp-resultats {
	margin: 0 0 2rem;
}

.pp-bibliotheque .pp-titre {
	font-family: "Avant-Garde-Bold", sans-serif;
	font-size: 1.9rem;
	line-height: 1.3;
	color: var(--pp-texte);
	margin: 0 0 1.2rem;
}

.pp-effacer {
	margin: 2rem 0 0;
}

.pp-aucun {
	margin: 0 0 1rem;
	color: var(--pp-texte);
}

@media (prefers-reduced-motion: reduce) {
	.pp-bibliotheque *,
	.pp-bibliotheque *::before,
	.pp-bibliotheque *::after {
		transition: none !important;
	}
}

@media print {
	.pp-recherche,
	.pp-outils,
	.pp-fichier-liens {
		display: none !important;
	}
}
