/* MediaElement Médias (plugin SPIP) */
.mejs-spip-wrapper {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 1em auto;
	/* Lecteur puis titre, l'un sous l'autre, même si le thème ou SPIP mettent
	   .spip_document en ligne (flex, inline-block, flottant…) */
	display: flex !important;
	flex-direction: column !important;
	flex-wrap: nowrap !important;
	align-items: stretch !important;
	float: none !important;
}
.mejs-spip-wrapper > * {
	flex: 0 0 auto !important;
	width: 100% !important;
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}
.mejs-spip-wrapper > .mejs-spip-titre {
	display: block !important;
	float: none !important;
	clear: both;
}
.mejs-spip-wrapper video,
.mejs-spip-wrapper audio {
	max-width: 100%;
}
.mejs-spip-wrapper .mejs__container {
	max-width: 100%;
	margin: 0 auto;
}

/* Portfolio de vidéos : lecteur au-dessus, vignettes en dessous */
.mejs-portfolio {
	--mejs-vignette: 200px;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	margin: 1.5em 0;
}
.mejs-portfolio-lecteur,
.mejs-spip-video {
	--mejs-ratio: 16 / 9;
	max-width: 100%;
	margin: 0 auto 0.75em;
}
/* Lecteur adaptatif dès le premier affichage : MediaElement.js fixe des dimensions en pixels
   avant de connaître la largeur disponible ; on impose la largeur et le rapport (hors plein écran) */
.mejs-portfolio-lecteur .mejs__container:not(.mejs__container-fullscreen),
.mejs-spip-video .mejs__container:not(.mejs__container-fullscreen) {
	width: 100% !important;
	height: auto !important;
	aspect-ratio: var(--mejs-ratio);
}
.mejs-portfolio-lecteur .mejs__container:not(.mejs__container-fullscreen) .mejs__inner,
.mejs-spip-video .mejs__container:not(.mejs__container-fullscreen) .mejs__inner,
.mejs-portfolio-lecteur .mejs__container:not(.mejs__container-fullscreen) .mejs__mediaelement,
.mejs-spip-video .mejs__container:not(.mejs__container-fullscreen) .mejs__mediaelement,
.mejs-portfolio-lecteur .mejs__container:not(.mejs__container-fullscreen) .mejs__layers,
.mejs-spip-video .mejs__container:not(.mejs__container-fullscreen) .mejs__layers,
.mejs-portfolio-lecteur .mejs__container:not(.mejs__container-fullscreen) video,
.mejs-spip-video .mejs__container:not(.mejs__container-fullscreen) video {
	width: 100% !important;
	height: 100% !important;
}
.mejs-portfolio-lecteur .mejs__container:not(.mejs__container-fullscreen) video,
.mejs-spip-video .mejs__container:not(.mejs__container-fullscreen) video {
	object-fit: contain;
}
.mejs-portfolio-lecteur .mejs__container,
.mejs-spip-video .mejs__container {
	max-width: 100%;
	background: #000;
}
/* Les couches du lecteur (bouton lecture, affiche…) occupent la zone vidéo, au-dessus de la barre de contrôle */
.mejs-portfolio-lecteur .mejs__container:not(.mejs__container-fullscreen) .mejs__layer,
.mejs-spip-video .mejs__container:not(.mejs__container-fullscreen) .mejs__layer {
	width: 100% !important;
	height: calc(100% - 40px) !important;
}
.mejs-portfolio-titre,
.mejs-spip-titre {
	margin: 0.5em 0 0;
	text-align: left;
}
.mejs-portfolio-titre:empty,
.mejs-spip-titre:empty {
	display: none;
}
.mejs-portfolio-descriptif,
.mejs-spip-descriptif {
	opacity: 0.8;
}
.mejs-portfolio-descriptif {
	opacity: 0.8;
}
.mejs-portfolio-vignettes {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(var(--mejs-vignette), 100%), 1fr));
	gap: 0.75em;
	margin: 0;
	padding: 0;
	list-style: none;
}
.mejs-portfolio-item {
	margin: 0;
	padding: 0;
}
.mejs-vignette {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 16 / 9;
	background: #222;
	border: 3px solid transparent;
	border-radius: 4px;
	color: #fff;
	text-decoration: none;
	cursor: pointer;
}
.mejs-vignette img,
.mejs-vignette .mejs-vignette-video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}
.mejs-vignette:hover,
.mejs-vignette:focus-visible {
	border-color: rgba(255, 255, 255, 0.6);
	outline: none;
}
.mejs-portfolio-item.on .mejs-vignette {
	border-color: #e5392b;
}
/* Icône « lecture » */
.mejs-vignette-play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 2.6em;
	height: 2.6em;
	margin: -1.3em 0 0 -1.3em;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
}
.mejs-vignette-play::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -0.55em 0 0 -0.3em;
	border-style: solid;
	border-width: 0.55em 0 0.55em 0.9em;
	border-color: transparent transparent transparent #fff;
}
.mejs-vignette-duree {
	position: absolute;
	top: 0.3em;
	right: 0.3em;
	padding: 0 0.4em;
	border-radius: 3px;
	background: rgba(0, 0, 0, 0.7);
	font-size: 0.8em;
}
.mejs-vignette-legende {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	padding: 0.3em 0.5em;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
	font-size: 0.85em;
	line-height: 1.25;
	text-align: left;
}

/* Playlist audio : titre en cours, lecteur, liste des titres */
.mejs-playlist {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 1.5em 0;
}
.mejs-playlist-titre {
	margin: 0 0 0.4em;
}
.mejs-playlist-lecteur {
	display: flex;
	align-items: center;
	gap: 0.4em;
}
.mejs-playlist-lecteur .mejs__container {
	flex: 1 1 auto;
	width: auto !important;
	min-width: 0;
	max-width: 100%;
}
.mejs-playlist-lecteur > audio {
	flex: 1 1 auto;
	width: 100%;
}
.mejs-playlist-nav {
	display: flex;
	flex: 0 0 auto;
	gap: 0.25em;
}
.mejs-playlist-nav button {
	width: 2.5em;
	height: 2.5em;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: #222;
	color: #fff;
	font-size: 0.9em;
	line-height: 1;
	cursor: pointer;
}
.mejs-playlist-nav button:hover,
.mejs-playlist-nav button:focus-visible {
	background: #e5392b;
	outline: none;
}
.mejs-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.mejs-playlist-pistes {
	margin: 0.6em 0 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid rgba(128, 128, 128, 0.3);
}
.mejs-playlist-piste {
	margin: 0;
	padding: 0;
	border-bottom: 1px solid rgba(128, 128, 128, 0.3);
}
.mejs-piste {
	display: flex;
	align-items: baseline;
	gap: 0.75em;
	padding: 0.5em 0.6em;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}
.mejs-piste:hover,
.mejs-piste:focus-visible {
	background: rgba(128, 128, 128, 0.12);
	outline: none;
}
.mejs-piste-num {
	flex: 0 0 1.6rem;
	text-align: right;
	opacity: 0.6;
	font-variant-numeric: tabular-nums;
}
.mejs-piste-texte {
	flex: 1 1 auto;
	min-width: 0;
}
.mejs-piste-titre {
	display: block;
}
.mejs-piste-descriptif {
	display: block;
	font-size: 0.85em;
	opacity: 0.7;
}
.mejs-piste-duree {
	flex: 0 0 auto;
	opacity: 0.7;
	font-size: 0.9em;
	font-variant-numeric: tabular-nums;
}
.mejs-playlist-piste.on .mejs-piste {
	box-shadow: inset 3px 0 0 #e5392b;
	font-weight: bold;
}
.mejs-playlist-piste.on .mejs-piste-num {
	color: #e5392b;
	opacity: 1;
}
/* Titre en cours de lecture : petit indicateur animé à la place du numéro */
.mejs-playlist.en-lecture .mejs-playlist-piste.on .mejs-piste-num {
	font-size: 0;
}
.mejs-playlist.en-lecture .mejs-playlist-piste.on .mejs-piste-num::before {
	content: "\25B6";
	font-size: 0.8rem;
}
