/*
 * Bannière de consentement cookies — maison (markup .md-cc*, voir
 * inc/cookie-consent.php et assets/js/cookie-consent.js).
 *
 * Remplace le reskin de CookieYes qui vivait ici. Deux exigences de forme :
 *  - le bandeau se pose en BAS mais n'occupe pas l'écran en permanence : il
 *    disparaît dès qu'un choix est fait, et il n'y a pas de bouton flottant
 *    résiduel (la réouverture est un lien dans le pied de page) — c'est ce qui
 *    rend le bas de l'écran à la barre sticky du tunnel ;
 *  - « Tout refuser » et « Tout accepter » sont visuellement à égalité côté
 *    lisibilité (CNIL) : le bouton plein sert seulement à désigner l'action par
 *    défaut attendue, jamais à rendre le refus discret. Les deux ont la même
 *    taille, le même contraste de texte, la même zone cliquable.
 *
 * Charte median-events-design : indigo de marque, DM Sans, tokens --md-*. Mode
 * clair (site vitrine) : pas de vert signal, réservé à la borne.
 */

.md-cc[hidden] {
	display: none;
}

/* ── Bandeau court ────────────────────────────────────────────────────────── */

.md-cc__bar {
	position: fixed;
	left: 16px;
	right: 16px;
	bottom: 16px;
	z-index: 2147483000; /* au-dessus du contenu et des barres sticky, sous rien */
	display: flex;
	align-items: center;
	gap: 20px;
	max-width: 1104px;
	margin: 0 auto;
	padding: 20px 24px;
	background: var(--md-ink);
	color: var(--md-white);
	border-radius: var(--md-radius-card);
	box-shadow: 0 12px 40px rgba(14, 13, 31, 0.28);
	font-family: var(--md-font);
}

.md-cc__bar[hidden] {
	display: none;
}

.md-cc__bar-text {
	flex: 1 1 auto;
	min-width: 0;
}

.md-cc__title {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 700;
}

.md-cc__desc {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.82);
}

.md-cc__desc a {
	color: var(--md-white);
	text-decoration: underline;
}

/* Colonnes égales : les trois boutons ont exactement la même taille (N2). */
.md-cc__bar-actions {
	flex: 0 0 auto;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
}

/* ── Boutons (partagés bandeau + panneau) ─────────────────────────────────── */

.md-cc__btn {
	font-family: var(--md-font);
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	padding: 12px 20px;
	min-height: 44px; /* zone tactile charte */
	border-radius: var(--md-radius-btn);
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 150ms cubic-bezier(0.2, 0.8, 0.2, 1),
		color 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* « Tout accepter », « Tout refuser », « Personnaliser » (et « Enregistrer mes
   choix » dans le panneau) sont mis en évidence de manière identique
   (recommandation CNIL « cookies », 2026-09-25) : un seul style, --ghost,
   aucun choix poussé visuellement. */

/* Ghost sur fond sombre (bandeau) : contour clair, texte blanc plein contraste */
.md-cc__bar .md-cc__btn--ghost {
	background: transparent;
	color: var(--md-white);
	border: 1px solid rgba(255, 255, 255, 0.55);
}

.md-cc__bar .md-cc__btn--ghost:hover {
	background: rgba(255, 255, 255, 0.12);
}

/* ── Panneau de préférences (modale claire) ───────────────────────────────── */

.md-cc__modal {
	position: fixed;
	inset: 0;
	z-index: 2147483001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(14, 13, 31, 0.55);
}

.md-cc__modal[hidden] {
	display: none;
}

.md-cc__modal-inner {
	width: 100%;
	max-width: 560px;
	max-height: 85vh;
	overflow-y: auto;
	background: var(--md-white);
	color: var(--md-ink);
	border-radius: var(--md-radius-card);
	font-family: var(--md-font);
}

.md-cc__modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 24px 24px 12px;
}

.md-cc__modal-title {
	margin: 0;
	font-size: 20px;
	font-weight: 800;
}

.md-cc__close {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	font-size: 26px;
	line-height: 1;
	background: transparent;
	border: none;
	color: var(--md-ink);
	cursor: pointer;
	border-radius: var(--md-radius-btn);
}

.md-cc__close:hover {
	background: var(--md-cream);
}

.md-cc__modal-body {
	padding: 8px 24px 4px;
}

.md-cc__cat {
	padding: 16px 0;
	border-top: 1px solid var(--md-line);
}

.md-cc__cat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.md-cc__cat-title {
	font-size: 15px;
	font-weight: 700;
}

.md-cc__cat-lock {
	font-size: 12px;
	font-weight: 600;
	color: var(--md-indigo);
}

.md-cc__cat-desc {
	margin: 8px 0 0;
	font-size: 13.5px;
	line-height: 1.5;
	color: #5a6178;
}

/* Interrupteur */
.md-cc__switch {
	position: relative;
	flex: 0 0 auto;
	display: inline-block;
	width: 44px;
	height: 24px;
}

.md-cc__switch input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
}

.md-cc__slider {
	position: absolute;
	inset: 0;
	background: #c7cad6;
	border-radius: var(--md-radius-pill);
	transition: background-color 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.md-cc__slider::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	background: var(--md-white);
	border-radius: 50%;
	transition: transform 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.md-cc__switch input:checked + .md-cc__slider {
	background: var(--md-indigo);
}

.md-cc__switch input:checked + .md-cc__slider::before {
	transform: translateX(20px);
}

.md-cc__switch input:focus-visible + .md-cc__slider {
	outline: 2px solid var(--md-indigo);
	outline-offset: 2px;
}

/* Empilés à toutes les largeurs : en trois colonnes égales, « Enregistrer mes
   choix » débordait de son bouton à 1280 px (mesuré en 0.79.6). */
.md-cc__modal-actions {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	padding: 16px 24px 24px;
	border-top: 1px solid var(--md-line);
}

.md-cc__modal-actions .md-cc__btn {
	flex: 1 1 auto;
	text-align: center;
}

.md-cc__modal .md-cc__btn--ghost {
	background: transparent;
	color: var(--md-indigo);
	border: 1px solid var(--md-indigo);
}

.md-cc__modal .md-cc__btn--ghost:hover {
	background: var(--md-cream);
}

/* Lien « Gérer les cookies » du pied de page */
.md-footer__cookie-link {
	padding: 0;
	background: none;
	border: none;
	font: inherit;
	color: rgba(255, 255, 255, 0.5);
	text-decoration: underline;
	cursor: pointer;
}

.md-footer__cookie-link:hover {
	color: rgba(255, 255, 255, 0.8);
}

/* ── Mobile : bandeau en colonne, boutons pleine largeur ──────────────────── */

.md-cc__desc-short {
	display: none;
}

@media (max-width: 640px) {
	/* Bandeau compact (audit 19 points, 2026-10-11) : 372 px de haut sur 812 avant, le
	   bouton de réservation de l'accroche était caché à la première visite. Texte court,
	   trois boutons sur UNE ligne, toujours de même taille et de même style (N2, CNIL). */
	.md-cc__bar {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
		left: 8px;
		right: 8px;
		bottom: 8px;
		padding: 14px 14px 12px;
	}

	.md-cc__title {
		display: none;
	}

	.md-cc__desc {
		font-size: 13px;
		line-height: 1.45;
	}

	.md-cc__desc-long {
		display: none;
	}

	.md-cc__desc-short {
		display: inline;
	}

	.md-cc__bar-actions {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 8px;
	}

	.md-cc__bar-actions .md-cc__btn {
		padding: 10px 4px;
		font-size: 13px;
		text-align: center;
		white-space: normal;
	}

	.md-cc__modal-actions {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	.md-cc__btn,
	.md-cc__slider,
	.md-cc__slider::before {
		transition: none;
	}
}

/* ── Contenu tiers chargé au clic (audit S9, 2026-09-23) ──────────────────
   Aperçu posé à la place d'une vidéo YouTube tant que le visiteur ne l'a pas
   lancée (template-parts/youtube-facade.php, data-md-cc-embed). Panneau
   indigo plein, lisible sur fond sombre (pages ville) comme sur fond clair
   (page DJ). Aucune miniature : elle viendrait de i.ytimg.com (Google). */
.md-embed-facade {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: var(--md-radius-card);
	overflow: hidden;
	background: var(--md-indigo);
	color: var(--md-white);
}

.md-embed-facade iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.md-embed-facade[data-md-cc-loaded] {
	background: #000;
}

.md-embed-facade__box {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 10px;
	padding: clamp(16px, 4vw, 32px);
	overflow: auto;
}

.md-embed-facade__title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
}

.md-embed-facade__text {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: var(--md-white);
	max-width: 46ch;
}

.md-embed-facade__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 18px;
	margin-top: 6px;
}

.md-embed-facade__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 20px;
	border: 1px solid var(--md-white);
	border-radius: var(--md-radius-btn);
	background: var(--md-white);
	color: var(--md-indigo);
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
}

.md-embed-facade__btn:hover {
	background: var(--md-blue);
}

.md-embed-facade__btn:focus-visible,
.md-embed-facade__link:focus-visible {
	outline: 2px solid var(--md-white);
	outline-offset: 3px;
}

.md-embed-facade__link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--md-white);
	font-size: 14px;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Très petite largeur : le 16:9 n'offre pas la hauteur du texte, on laisse
   l'aperçu grandir plutôt que de couper le bouton. */
@media (max-width: 420px) {
	.md-embed-facade:not([data-md-cc-loaded]) {
		aspect-ratio: auto;
		min-height: 220px;
	}

	.md-embed-facade:not([data-md-cc-loaded]) .md-embed-facade__box {
		position: static;
	}
}
