/* ==========================================================================
   PB CRÉATION SONORE : LECTEUR
   La police et la couleur du texte viennent du thème. Seules les deux
   couleurs des Réglages sont posées, en variables.
   ========================================================================== */
.pbcs {
	/* Couleurs dérivées des deux réglages. Elles sont calculées en PHP
	   (Pbcs_Shortcode::couleurs) et posées sur le lecteur : pas de color-mix(),
	   que Chrome 109 et plus ancien ignorent. Voir WORKFLOW.md.
	   Les valeurs ci-dessous ne servent qu'en secours : or et brique. */
	--pbcs-visibles: 3;
	--pbcs-a: #b59f49;
	--pbcs-b: #8c3e3e;
	--pbcs-titres: #554e30;
	--pbcs-discret: #938962;
	--pbcs-filet: rgba(181, 159, 73, .3);
	--pbcs-survol: rgba(181, 159, 73, .07);
	--pbcs-selection: rgba(181, 159, 73, .12);
	--pbcs-barre: rgba(181, 159, 73, .28);
	--pbcs-barre-haute: rgba(181, 159, 73, .45);
	--pbcs-chapeau: #917f3a;
	--pbcs-defile: rgba(181, 159, 73, .5);
	--pbcs-bord: #cdc5ab;
	--pbcs-ligne: 54px;

	position: relative;
	box-sizing: border-box;
	width: 100%;
	line-height: 1.5;
}

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

/* --- Apparences --- */
.pbcs.pbcs-apparence-clair {
	padding: 14px;
	background: #fff;
	border: 1px solid var(--pbcs-bord);
	border-radius: 6px;
}

.pbcs.pbcs-apparence-sombre {
	padding: 14px;
	background: #161616;
	border: 1px solid #333;
	border-radius: 6px;
	color: #e8e6e1;
}

/* --- Remise à zéro des styles du thème --- */
.pbcs h4,
.pbcs p,
.pbcs ul,
.pbcs li {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	list-style: none;
	text-transform: none;
	letter-spacing: normal;
}

.pbcs li:before,
.pbcs li:after {
	content: none;
}

.pbcs button.pbcs-btn,
.pbcs button.pbcs-cat {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	width: auto;
	height: auto;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	font: inherit;
	line-height: 1;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	transition: color .3s ease;
}

.pbcs button.pbcs-btn:hover,
.pbcs button.pbcs-btn:focus,
.pbcs button.pbcs-cat:hover,
.pbcs button.pbcs-cat:focus {
	background: none;
	box-shadow: none;
}

.pbcs button:focus-visible,
.pbcs .pbcs-morceau:focus-visible,
.pbcs .pbcs-progression:focus-visible,
.pbcs a:focus-visible {
	outline: 2px solid var(--pbcs-a);
	outline-offset: 2px;
}

.pbcs [hidden] {
	display: none !important;
}

/* --- Icônes : fichiers SVG en masque, colorés par la couleur du texte --- */
.pbcs-icone {
	display: inline-block;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	background-color: currentColor;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}

.pbcs-icone-lecture {
	-webkit-mask-image: url('icones/lecture.svg');
	mask-image: url('icones/lecture.svg');
}

.pbcs-icone-pause {
	-webkit-mask-image: url('icones/pause.svg');
	mask-image: url('icones/pause.svg');
}

.pbcs-icone-precedent {
	-webkit-mask-image: url('icones/precedent.svg');
	mask-image: url('icones/precedent.svg');
}

.pbcs-icone-suivant {
	-webkit-mask-image: url('icones/suivant.svg');
	mask-image: url('icones/suivant.svg');
}

.pbcs-icone-volume {
	-webkit-mask-image: url('icones/volume.svg');
	mask-image: url('icones/volume.svg');
}

.pbcs-icone-muet {
	-webkit-mask-image: url('icones/muet.svg');
	mask-image: url('icones/muet.svg');
}

.pbcs-icone-document {
	-webkit-mask-image: url('icones/document.svg');
	mask-image: url('icones/document.svg');
}

.pbcs-icone-retour {
	-webkit-mask-image: url('icones/retour.svg');
	mask-image: url('icones/retour.svg');
}

.pbcs-icone-spotify {
	-webkit-mask-image: url('icones/spotify.svg');
	mask-image: url('icones/spotify.svg');
}

/* Lecture ou pause selon l'état */
.pbcs .pbcs-icone-pause,
.pbcs.is-playing .pbcs-lecture .pbcs-icone-lecture,
.pbcs.is-playing .pbcs-cadre .pbcs-icone-lecture,
.pbcs.is-playing .pbcs-morceau.is-active .pbcs-icone-lecture {
	display: none;
}

.pbcs.is-playing .pbcs-lecture .pbcs-icone-pause,
.pbcs.is-playing .pbcs-cadre .pbcs-icone-pause,
.pbcs.is-playing .pbcs-morceau.is-active .pbcs-icone-pause {
	display: inline-block;
}

.pbcs .pbcs-icone-muet,
.pbcs.is-muted .pbcs-icone-volume {
	display: none;
}

.pbcs.is-muted .pbcs-icone-muet {
	display: inline-block;
}

/* ==========================================================================
   LECTEUR : VIGNETTE, TITRE, ÉQUALISEUR, TEMPS
   ========================================================================== */
.pbcs-lecteur {
	display: flex;
	gap: 12px;
}

/* Pochette dans un cadre : même emprise de 92 px, image de 72 px.
   Elle sert aussi de bouton lecture et pause. */
.pbcs button.pbcs-cadre {
	-webkit-appearance: none;
	appearance: none;
	display: block;
	width: 92px;
	height: 92px;
	min-width: 0;
	flex-shrink: 0;
	margin: 0;
	padding: 9px;
	border: 1px solid var(--pbcs-filet);
	border-radius: 4px;
	background: var(--pbcs-survol);
	box-shadow: none;
	cursor: pointer;
}

.pbcs button.pbcs-cadre:hover,
.pbcs button.pbcs-cadre:focus {
	background: var(--pbcs-survol);
	box-shadow: none;
}

.pbcs-cadre-image {
	position: relative;
	display: block;
	width: 72px;
	height: 72px;
	overflow: hidden;
	border-radius: 2px;
}

.pbcs-vignette {
	position: absolute;
	inset: 0;
	display: block;
	width: 72px;
	height: 72px;
	object-fit: cover;
	transition: opacity .4s ease;
}

/* Survol : la pochette s'éclaircit et l'icône apparaît, sans mouvement */
.pbcs-cadre-voile {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0);
	color: #fff;
	opacity: 0;
	transition: background-color .3s ease, opacity .3s ease;
}

.pbcs-cadre-voile .pbcs-icone {
	width: 26px;
	height: 26px;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .45));
}

.pbcs button.pbcs-cadre:hover .pbcs-cadre-voile,
.pbcs button.pbcs-cadre:focus-visible .pbcs-cadre-voile {
	background: rgba(255, 255, 255, .18);
	opacity: 1;
}

.pbcs-infos {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.pbcs-ligne-titre {
	display: flex;
	align-items: center;
	gap: 6px;
}

.pbcs h4.pbcs-titre {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--pbcs-titres);
}

/* Texte trop long : aller-retour lent, avec une pause à chaque bout.
   Au repos, le texte est coupé par des points de suspension. */
.pbcs-titre-texte,
.pbcs-sous-titre-texte {
	display: inline;
}

.pbcs .is-defilant > .pbcs-titre-texte {
	display: inline-block;
	animation: pbcsDefile var(--pbcs-duree-defile, 8s) ease-in-out infinite;
}

.pbcs .is-defilant {
	text-overflow: clip;
}

/* Sous-titre trop long : glissé au survol, piloté par lecteur.js */
.pbcs .pbcs-infos p.is-glisse {
	text-overflow: clip;
}

.pbcs .is-glisse > .pbcs-sous-titre-texte {
	display: inline-block;
}

@keyframes pbcsDefile {
	0%, 18%   { transform: translateX(0); }
	50%, 68%  { transform: translateX(var(--pbcs-ecart-defile, 0)); }
	100%      { transform: translateX(0); }
}

.pbcs a.pbcs-spotify {
	display: inline-flex;
	color: var(--pbcs-a);
	text-decoration: none;
	transition: color .3s ease;
}

.pbcs a.pbcs-spotify:hover {
	color: var(--pbcs-b);
}

.pbcs a.pbcs-spotify .pbcs-icone {
	width: 17px;
	height: 17px;
}

.pbcs .pbcs-infos p.pbcs-sous-titre {
	font-size: 12px;
	line-height: 1.4;
	color: var(--pbcs-discret);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* --- Équaliseur --- */
.pbcs-eq,
.pbcs-eq-vide {
	display: flex;
	align-items: flex-end;
	gap: 2px;
	height: 26px;
	margin-top: auto;
	margin-bottom: 3px;
	padding: 0 1px;
}

.pbcs-eq-barre {
	position: relative;
	flex: 1;
	height: 2px;
	border-radius: 1px 1px 0 0;
	background: var(--pbcs-barre);
}

.pbcs-eq-barre.is-haute {
	background: var(--pbcs-barre-haute);
}

.pbcs-eq-chapeau {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 4px;
	height: 2px;
	background: var(--pbcs-chapeau);
	opacity: 0;
}

/* Chargement : une vague discrète parcourt les barres jusqu'aux premières notes */
.pbcs-eq.is-chargement .pbcs-eq-barre {
	background: var(--pbcs-barre);
	animation: pbcsVague 1.1s ease-in-out infinite;
}

.pbcs-eq.is-chargement .pbcs-eq-chapeau {
	opacity: 0 !important;
}

@keyframes pbcsVague {
	0%, 100% { height: 2px; }
	35%      { height: 9px; }
	70%      { height: 2px; }
}

/* --- Progression et temps --- */
.pbcs-progression {
	position: relative;
	height: 3px;
	border-radius: 2px;
	background: var(--pbcs-filet);
	cursor: pointer;
	touch-action: none;
}

/* Zone de clic plus haute que la barre */
.pbcs-progression:before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	top: -6px;
	bottom: -6px;
}

.pbcs-progression-remplie {
	width: 0;
	height: 100%;
	border-radius: 2px;
	background: var(--pbcs-a);
}

.pbcs-temps {
	display: flex;
	justify-content: space-between;
	margin-top: 3px;
	font-size: 11px;
	line-height: 1.2;
	color: var(--pbcs-discret);
	font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   COMMANDES
   ========================================================================== */
.pbcs-commandes {
	display: flex;
	align-items: center;
	gap: 18px;
	margin-top: 10px;
	padding-left: 2px;
}

.pbcs button.pbcs-btn {
	color: var(--pbcs-a);
}

.pbcs button.pbcs-btn:hover,
.pbcs button.pbcs-btn[aria-pressed="true"] {
	color: var(--pbcs-b);
}

.pbcs .pbcs-lecture .pbcs-icone {
	width: 30px;
	height: 30px;
}

.pbcs-commandes-droite {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-left: auto;
}

/* ==========================================================================
   ZONE BASSE : CATÉGORIES ET LISTE, OU HISTOIRE
   ========================================================================== */
.pbcs-zone {
	margin-top: 12px;
}

/* --- Catégories --- */
.pbcs button.pbcs-cat {
	flex: 0 0 auto;
	padding: 2px 0;
	font-size: 14px;
	color: inherit;
	white-space: nowrap;
}

.pbcs button.pbcs-cat:hover {
	color: var(--pbcs-a);
}

.pbcs button.pbcs-cat.is-active {
	color: var(--pbcs-b);
	font-weight: 700;
}

.pbcs-rail {
	display: flex;
	gap: 16px;
	margin-top: 4px;
	overflow-x: auto;
	scrollbar-width: none;
	cursor: grab;
	-webkit-overflow-scrolling: touch;
}

.pbcs-rail::-webkit-scrollbar {
	display: none;
}

.pbcs-rail.is-glisse {
	cursor: grabbing;
}

.pbcs-rail.is-glisse .pbcs-cat {
	pointer-events: none;
}

/* Fondu sur le bord qui cache encore des catégories */
.pbcs-rail.is-fondu-d {
	-webkit-mask-image: linear-gradient(90deg, #000 80%, transparent);
	mask-image: linear-gradient(90deg, #000 80%, transparent);
}

.pbcs-rail.is-fondu-g {
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 20%);
	mask-image: linear-gradient(90deg, transparent, #000 20%);
}

.pbcs-rail.is-fondu-g.is-fondu-d {
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
	mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
}

/* --- Liste des morceaux --- */
.pbcs ul.pbcs-liste {
	max-height: calc(var(--pbcs-visibles) * var(--pbcs-ligne) + 8px);
	margin-top: 8px;
	padding-top: 8px;
	padding-right: 6px;
	border-top: 1px solid var(--pbcs-filet);
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--pbcs-defile) transparent;
}

.pbcs-categories + .pbcs-liste {
	margin-top: 8px;
}

.pbcs ul.pbcs-liste::-webkit-scrollbar {
	width: 5px;
}

.pbcs ul.pbcs-liste::-webkit-scrollbar-thumb {
	background: var(--pbcs-defile);
	border-radius: 3px;
}

.pbcs li.pbcs-morceau {
	display: flex;
	align-items: center;
	gap: 10px;
	height: var(--pbcs-ligne);
	padding: 0 6px;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color .3s ease;
}

.pbcs li.pbcs-morceau:hover {
	background: var(--pbcs-survol);
}

.pbcs li.pbcs-morceau.is-active {
	background: var(--pbcs-selection);
}

.pbcs-mini {
	position: relative;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
}

.pbcs-mini img {
	display: block;
	width: 40px;
	height: 40px;
	border-radius: 3px;
	object-fit: cover;
}

.pbcs-mini-voile {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 3px;
	background: rgba(0, 0, 0, .4);
	color: #fff;
	opacity: 0;
	transition: opacity .3s ease;
}

.pbcs-mini-voile .pbcs-icone {
	width: 16px;
	height: 16px;
}

.pbcs-morceau:hover .pbcs-mini-voile,
.pbcs-morceau.is-active .pbcs-mini-voile {
	opacity: 1;
}

.pbcs-morceau-textes {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.pbcs-morceau-titre {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--pbcs-titres);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pbcs-morceau.is-active .pbcs-morceau-titre {
	color: var(--pbcs-b);
}

.pbcs-morceau-sous-titre,
.pbcs-morceau-duree {
	font-size: 12px;
	line-height: 1.4;
	color: var(--pbcs-discret);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pbcs-morceau-duree {
	flex-shrink: 0;
	font-variant-numeric: tabular-nums;
}

/* --- Histoire : même hauteur que catégories et liste --- */
.pbcs-vue-histoire {
	display: flex;
	flex-direction: column;
}

.pbcs-histoire-tete {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-bottom: 6px;
	margin-bottom: 4px;
	border-bottom: 1px solid var(--pbcs-filet);
}

.pbcs h4.pbcs-histoire-titre {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--pbcs-b);
}

.pbcs button.pbcs-retour {
	font-size: 13px;
}

.pbcs button.pbcs-retour .pbcs-icone {
	width: 15px;
	height: 15px;
}

.pbcs-histoire-texte {
	overflow-y: auto;
	padding-right: 6px;
	font-size: 14px;
	line-height: 1.55;
	scrollbar-width: thin;
	scrollbar-color: var(--pbcs-defile) transparent;
}

.pbcs .pbcs-vue-histoire .pbcs-histoire-texte p,
.pbcs .pbcs-vue-histoire .pbcs-histoire-texte li {
	margin: 0 0 8px;
	font-size: 14px;
	line-height: 1.55;
}

.pbcs .pbcs-histoire-texte h4 {
	margin: 10px 0 2px;
	font-size: 13px;
	font-weight: 700;
	color: var(--pbcs-titres);
}

.pbcs .pbcs-histoire-texte h4:first-child {
	margin-top: 4px;
}

.pbcs .pbcs-histoire-texte ul {
	margin: 0 0 8px 18px;
}

.pbcs .pbcs-histoire-texte li {
	list-style: disc;
}

.pbcs .pbcs-histoire-texte a {
	color: var(--pbcs-a);
}

/* ==========================================================================
   MENTION SOUS LE LECTEUR
   Paragraphe saisi dans le widget : <p class="pbcs-mention">…</p>
   ========================================================================== */
p.pbcs-mention,
.custom-html-widget .pbcs ~ p.pbcs-mention,
.textwidget .pbcs ~ p.pbcs-mention {
	margin: 10px 0 0;
	font-size: 12px;
	line-height: 1.4;
	color: #8a8060;
}

/* ==========================================================================
   MOBILE ET MOUVEMENT RÉDUIT
   ========================================================================== */
@media (max-width: 768px) {
	/* Sur téléphone, le volume se règle avec les touches de l'appareil */
	.pbcs button.pbcs-volume {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pbcs-eq.is-chargement .pbcs-eq-barre {
		animation: none;
		height: 5px !important;
	}

	.pbcs .is-defilant > .pbcs-titre-texte {
		display: inline;
		animation: none;
	}

	.pbcs .is-defilant {
		text-overflow: ellipsis;
	}

	.pbcs-vignette,
	.pbcs-cadre-voile {
		transition: none;
	}
}
