/*
 * La lecture à voix haute des articles (thème 0.9.100, inc/voix.php, assets/js/voix.js).
 * Hors de Vite, comme les dons et l'Avent : chargée par le bloc « btv-voix » des seuls articles qui peuvent se lire.
 * DA « Nuit de match » (habillage B) : les jetons du site, surfaces pleines (ni verre ni flou), rouge pour l'action.
 * Toutes les cibles font 44 px au moins. Un élément masqué par [hidden] le reste malgré un display posé ici.
 */
.btv-voix { margin: 18px 0 4px; }
.btv-voix [hidden] { display: none !important; }

.btv-voix__ecouter {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	max-width: 420px;
	min-height: 50px;
	padding: 0 16px;
	border: 0;
	border-radius: var(--btv-radius-sm, 8px);
	background: var(--btv-surface-2, #012052);
	box-shadow: inset 0 0 0 1px var(--btv-line-strong, rgba(255,255,255,.16));
	color: var(--btv-text, #EDF1F7);
	font: 800 0.95rem/1.1 var(--btv-display, system-ui, sans-serif);
	text-align: left;
	cursor: pointer;
}
.btv-voix__ecouter:hover { background: var(--btv-surface, #002866); }
.btv-voix__ecouter[aria-expanded="true"] { box-shadow: inset 0 0 0 1.5px var(--btv-accent, #f70d28); }
.btv-voix__casque { flex: none; color: var(--btv-accent, #f70d28); }
.btv-voix__libelle { flex: 1; }
.btv-voix__mention {
	margin: 7px 2px 0;
	font-size: 0.78rem;
	line-height: 1.35;
	color: var(--btv-muted, #90a5c6);
}

.btv-voix__ecouter:focus-visible,
.btv-voix__bouton:focus-visible,
.btv-voix__vitesse:focus-visible,
.btv-voix__piste:focus-visible {
	outline: 2px solid var(--btv-focus, #C8A24B);
	outline-offset: 2px;
}

/* Le lecteur : fixé en bas de l'écran, sous le bandeau des cookies et le tiroir des commentaires (z-index 1000). */
.btv-voix__lecteur {
	position: fixed;
	left: 50%;
	bottom: max(12px, env(safe-area-inset-bottom));
	z-index: 900;
	box-sizing: border-box;
	width: min(760px, calc(100% - 24px));
	transform: translateX(-50%);
	padding: 8px 10px 10px;
	border: 1px solid var(--btv-line-strong, rgba(255,255,255,.16));
	border-radius: 12px;
	background: var(--btv-surface-2, #012052);
	color: var(--btv-text, #EDF1F7);
	box-shadow: 0 14px 40px -16px rgba(0,0,0,.75);
}
.btv-voix__haut { display: flex; align-items: center; gap: 10px; min-width: 0; }
.btv-voix__textes { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.btv-voix__titre {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	font: 700 0.88rem/1.2 var(--btv-display, system-ui, sans-serif);
}
.btv-voix__etat { font-size: 0.78rem; line-height: 1.3; color: var(--btv-muted, #90a5c6); }
.btv-voix__lecteur.est-erreur .btv-voix__etat { color: var(--btv-accent-text, #fa5e70); }

.btv-voix__bouton {
	position: relative;
	flex: none;
	display: inline-grid;
	place-items: center;
	min-width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--btv-text, #EDF1F7);
	cursor: pointer;
}
.btv-voix__bouton > svg { pointer-events: none; }
.btv-voix__lp { width: 48px; height: 48px; background: var(--btv-accent-fill, #ea0822); color: #fff; }
.btv-voix__lp:hover { background: var(--btv-accent-fill-hover, #d0071e); }
.btv-voix__ico--pause, .btv-voix__lecteur.est-lecture .btv-voix__ico--lire { display: none; }
.btv-voix__lecteur.est-lecture .btv-voix__ico--pause { display: block; }
.btv-voix__fermer { color: var(--btv-muted, #90a5c6); }
.btv-voix__fermer:hover { color: var(--btv-text, #EDF1F7); }
.btv-voix__reessayer {
	padding: 0 14px;
	border-radius: var(--btv-radius-sm, 8px);
	background: var(--btv-surface, #002866);
	font: 700 0.8rem/1 var(--btv-display, system-ui, sans-serif);
}

/* L'anneau d'attente, sur le bouton de lecture pendant la préparation d'un morceau. */
.btv-voix__anneau {
	position: absolute;
	inset: -3px;
	border-radius: 50%;
	border: 2.5px solid transparent;
	border-top-color: var(--btv-text, #EDF1F7);
	opacity: 0;
	pointer-events: none;
}
.btv-voix__lecteur.est-attente .btv-voix__anneau { opacity: 1; animation: btv-voix-tourne .9s linear infinite; }
@keyframes btv-voix-tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
	.btv-voix__lecteur.est-attente .btv-voix__anneau { animation: none; border-color: var(--btv-text, #EDF1F7); opacity: .45; }
}

.btv-voix__bas { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.btv-voix__position { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.btv-voix__temps {
	flex: none;
	min-width: 3.4em;
	font: 500 0.74rem/1 var(--btv-mono, ui-monospace, monospace);
	font-variant-numeric: tabular-nums;
	color: var(--btv-muted, #90a5c6);
	text-align: center;
}

/* La piste : 44 px de haut pour le doigt, 4 px de rail dessiné. */
.btv-voix__piste {
	--btv-voix-p: 0%;
	flex: 1;
	min-width: 0;
	height: 44px;
	margin: 0;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}
.btv-voix__piste::-webkit-slider-runnable-track {
	height: 4px;
	border-radius: 2px;
	background: linear-gradient(to right, var(--btv-accent, #f70d28) var(--btv-voix-p), rgba(255,255,255,.18) var(--btv-voix-p));
}
.btv-voix__piste::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,.18); }
.btv-voix__piste::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--btv-accent, #f70d28); }
.btv-voix__piste::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 14px;
	height: 14px;
	margin-top: -5px;
	border: 0;
	border-radius: 50%;
	background: var(--btv-text, #EDF1F7);
}
.btv-voix__piste::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--btv-text, #EDF1F7); }

/* Les cinq vitesses : cinq boutons de MÊME largeur (comme l'app), jamais à la ligne. */
.btv-voix__vitesses { flex: none; display: grid; grid-template-columns: repeat(5, 48px); gap: 4px; }
.btv-voix__vitesse {
	min-width: 0;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: var(--btv-surface, #002866);
	color: var(--btv-text-soft, #c3d2ea);
	font: 600 0.74rem/1 var(--btv-mono, ui-monospace, monospace);
	cursor: pointer;
}
.btv-voix__vitesse[aria-pressed="true"] { background: var(--btv-accent-fill, #ea0822); color: #fff; }

/* Téléphone : la piste sur toute la largeur, les vitesses en dessous, à parts égales. */
@media (max-width: 640px) {
	.btv-voix__ecouter { max-width: none; }
	.btv-voix__lecteur { bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100% - 16px); padding: 8px 8px 8px; }
	.btv-voix__bas { flex-direction: column; align-items: stretch; gap: 2px; margin-top: 2px; }
	.btv-voix__vitesses { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* Le lecteur ouvert ne cache pas la fin de l'article. */
body.btv-voix-ouvert { padding-bottom: 150px; }
@media (max-width: 640px) { body.btv-voix-ouvert { padding-bottom: 190px; } }
