/*
 * YT Shorts Player - styles front-office
 */

.ytsp {
	--ytsp-height: 640px;
	--ytsp-radius: 18px;
	--ytsp-bg: #0b0b0f;
	--ytsp-fg: #ffffff;
	/* Fond sombre : les boutons restent lisibles meme sur une video claire. */
	--ytsp-btn-bg: rgba(0, 0, 0, 0.5);
	--ytsp-btn-bg-hover: rgba(0, 0, 0, 0.72);
	--ytsp-btn-fg: #ffffff;
	--ytsp-accent: #ff0033;
	--ytsp-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);

	display: flex;
	margin: 1.5em 0;
	max-width: 100%;
	font-family: inherit;
}

.ytsp--light {
	--ytsp-bg: #ececf0;
	--ytsp-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.ytsp--align-center {
	justify-content: center;
}

.ytsp--align-left {
	justify-content: flex-start;
}

.ytsp--align-right {
	justify-content: flex-end;
}

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

/* --------------------------------------------------------------------- */
/* Scene                                                                  */
/* --------------------------------------------------------------------- */

.ytsp__stage {
	position: relative;
	height: var(--ytsp-height);
	max-height: 88vh;
	aspect-ratio: 9 / 16;
	width: auto;
	max-width: 100%;
	overflow: hidden;
	border-radius: var(--ytsp-radius);
	background: var(--ytsp-bg);
	box-shadow: var(--ytsp-shadow);
	color: var(--ytsp-fg);
	outline: none;
	touch-action: pan-x;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
}

/* Repli pour les navigateurs sans aspect-ratio. */
@supports not (aspect-ratio: 9 / 16) {
	.ytsp__stage {
		width: calc(var(--ytsp-height) * 9 / 16);
	}
}

.ytsp__stage:focus-visible {
	box-shadow: var(--ytsp-shadow), 0 0 0 3px var(--ytsp-accent);
}

/* --------------------------------------------------------------------- */
/* Lecteur                                                                */
/* --------------------------------------------------------------------- */

.ytsp__host {
	position: absolute;
	inset: 0;
	transition: transform 0.18s ease-out, opacity 0.2s ease;
	will-change: transform;
}

.ytsp.is-dragging .ytsp__host {
	transition: none;
}

.ytsp__frame,
.ytsp__host iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Voile de transition entre deux videos. */
.ytsp__cover {
	position: absolute;
	inset: 0;
	z-index: 3;
	background-color: #000;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	opacity: 0;
	visibility: hidden;
	transform: translateY(0);
	transition: opacity 0.28s ease;
	pointer-events: none;
}

.ytsp__cover::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.ytsp__cover.is-visible {
	opacity: 1;
	visibility: visible;
}

.ytsp__cover.is-enter-up {
	transform: translateY(100%);
}

.ytsp__cover.is-enter-down {
	transform: translateY(-100%);
}

.ytsp__cover.is-sliding {
	transform: translateY(0);
	transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.28s ease;
}

/* Couche qui capte molette, swipe et clic (l'iframe ne les laisse pas passer). */
.ytsp__gesture {
	position: absolute;
	inset: 0;
	z-index: 5;
	cursor: pointer;
}

/* Petit flash "play/pause" au clic. */
.ytsp__blink {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 6;
	width: 74px;
	height: 74px;
	margin: -37px 0 0 -37px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	opacity: 0;
	transform: scale(0.7);
	pointer-events: none;
}

.ytsp__blink::before {
	content: "";
	position: absolute;
	inset: 0;
	background: no-repeat center / 34px 34px
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M7 5h3.5v14H7zM13.5 5H17v14h-3.5z'/%3E%3C/svg%3E");
}

.ytsp.is-paused .ytsp__blink::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8 5v14l11-7L8 5z'/%3E%3C/svg%3E");
}

.ytsp__blink.is-on {
	animation: ytsp-blink 0.5s ease-out;
}

@keyframes ytsp-blink {
	0% {
		opacity: 0.95;
		transform: scale(0.7);
	}
	100% {
		opacity: 0;
		transform: scale(1.25);
	}
}

/* Chargement. */
.ytsp__spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 4;
	width: 42px;
	height: 42px;
	margin: -21px 0 0 -21px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ytsp-spin 0.9s linear infinite;
	pointer-events: none;
}

.ytsp.is-ready .ytsp__spinner {
	display: none;
}

@keyframes ytsp-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Message d'erreur. */
.ytsp__message {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 8;
	width: 82%;
	margin: 0;
	padding: 16px 18px;
	transform: translate(-50%, -50%);
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.78);
	color: #fff;
	font-size: 14px;
	line-height: 1.45;
	text-align: center;
}

.ytsp__message[hidden] {
	display: none;
}

/* --------------------------------------------------------------------- */
/* Habillage                                                              */
/* --------------------------------------------------------------------- */

.ytsp__topbar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 6;
	padding: 12px 14px;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
	pointer-events: none;
}

.ytsp__counter {
	display: inline-block;
	padding: 3px 9px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.ytsp__counter:empty {
	display: none;
}

.ytsp__bottom {
	position: absolute;
	left: 0;
	right: 76px;
	bottom: 0;
	z-index: 6;
	padding: 42px 14px 18px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
	pointer-events: none;
}

.ytsp__title {
	margin: 0 0 4px;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ytsp__link {
	color: rgba(255, 255, 255, 0.82);
	font-size: 12px;
	text-decoration: none;
	pointer-events: auto;
}

.ytsp__link:hover,
.ytsp__link:focus {
	color: #fff;
	text-decoration: underline;
}

/* Barre de progression. */
.ytsp__progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 7;
	height: 3px;
	background: rgba(255, 255, 255, 0.22);
}

.ytsp__progress-bar {
	display: block;
	width: 0;
	height: 100%;
	background: var(--ytsp-accent);
	transition: width 0.25s linear;
}

/* --------------------------------------------------------------------- */
/* Boutons                                                                */
/* --------------------------------------------------------------------- */

.ytsp__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ytsp-btn-bg);
	color: var(--ytsp-btn-fg);
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.ytsp__btn:hover,
.ytsp__btn:focus-visible {
	background: var(--ytsp-btn-bg-hover);
	transform: scale(1.06);
	outline: none;
}

.ytsp__btn:active {
	transform: scale(0.94);
}

.ytsp__btn[disabled] {
	opacity: 0.35;
	cursor: default;
	transform: none;
}

.ytsp__btn svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
	pointer-events: none;
}

.ytsp__nav {
	position: absolute;
	top: 50%;
	right: 12px;
	z-index: 7;
	display: flex;
	flex-direction: column;
	gap: 10px;
	transform: translateY(-50%);
}

.ytsp__actions {
	position: absolute;
	right: 12px;
	bottom: 16px;
	z-index: 7;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* Bascule des icones. */
.ytsp__ico--pause {
	display: block;
}

.ytsp__ico--play {
	display: none;
}

.ytsp.is-paused .ytsp__ico--pause {
	display: none;
}

.ytsp.is-paused .ytsp__ico--play {
	display: block;
}

.ytsp__ico--sound-on {
	display: block;
}

.ytsp__ico--sound-off {
	display: none;
}

.ytsp.is-muted .ytsp__ico--sound-on {
	display: none;
}

.ytsp.is-muted .ytsp__ico--sound-off {
	display: block;
}

/* Gros bouton "activer le son". */
.ytsp__unmute {
	position: absolute;
	top: 52px;
	left: 50%;
	z-index: 7;
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 9px 16px;
	transform: translateX(-50%);
	border: 0;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.68);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.ytsp__unmute:hover {
	background: rgba(0, 0, 0, 0.85);
}

.ytsp__unmute[hidden] {
	display: none;
}

.ytsp__unmute svg {
	width: 17px;
	height: 17px;
	fill: currentColor;
}

/* Indice d'utilisation, masque apres la premiere interaction. */
.ytsp__hint {
	position: absolute;
	left: 50%;
	bottom: 96px;
	z-index: 6;
	width: max-content;
	max-width: 82%;
	padding: 7px 14px;
	transform: translateX(-50%);
	border-radius: 14px;
	background: rgba(0, 0, 0, 0.62);
	color: #fff;
	font-size: 12px;
	line-height: 1.35;
	text-align: center;
	text-wrap: balance;
	opacity: 1;
	transition: opacity 0.4s ease;
	pointer-events: none;
}

.ytsp.is-touched .ytsp__hint {
	opacity: 0;
}

.ytsp__hint-touch {
	display: none;
}

.ytsp.is-touch .ytsp__hint-desktop {
	display: none;
}

.ytsp.is-touch .ytsp__hint-touch {
	display: inline;
}

/* --------------------------------------------------------------------- */
/* Ecran de consentement (RGPD)                                           */
/* --------------------------------------------------------------------- */

.ytsp__consent {
	position: absolute;
	inset: 0;
	z-index: 9;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 22px;
	background-color: #14141a;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	text-align: center;
}

.ytsp__consent[hidden] {
	display: none;
}

/* Voile pour garder le texte lisible par-dessus une image de couverture. */
.ytsp__consent::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 14, 0.78);
}

.ytsp__consent-inner {
	position: relative;
	max-width: 300px;
}

.ytsp__consent-icon {
	width: 46px;
	height: 46px;
	margin-bottom: 14px;
	fill: rgba(255, 255, 255, 0.9);
}

.ytsp__consent-text {
	margin: 0 0 16px;
	color: #fff;
	font-size: 13.5px;
	line-height: 1.5;
}

.ytsp__consent-btn {
	padding: 11px 22px;
	border: 0;
	border-radius: 999px;
	background: var(--ytsp-accent);
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.15s ease, filter 0.15s ease;
}

.ytsp__consent-btn:hover,
.ytsp__consent-btn:focus-visible {
	filter: brightness(1.12);
	transform: scale(1.04);
	outline: none;
}

.ytsp__consent-btn:active {
	transform: scale(0.97);
}

.ytsp__consent-note {
	margin: 14px 0 0;
	color: rgba(255, 255, 255, 0.62);
	font-size: 11px;
	line-height: 1.45;
}

.ytsp__consent-note a {
	color: rgba(255, 255, 255, 0.82);
	text-decoration: underline;
}

.ytsp__consent-note a:hover {
	color: #fff;
}

/* Tant que le consentement n'est pas donne, rien ne tourne en fond. */
.ytsp.is-gated .ytsp__spinner {
	display: none;
}

/* --------------------------------------------------------------------- */
/* Mobile                                                                 */
/* --------------------------------------------------------------------- */

@media (max-width: 600px) {
	.ytsp {
		margin: 1em 0;
	}

	.ytsp__stage {
		height: min(var(--ytsp-height), 78vh);
		border-radius: 14px;
	}

	.ytsp__btn {
		width: 40px;
		height: 40px;
	}

	.ytsp__nav {
		right: 8px;
	}

	.ytsp__actions {
		right: 8px;
		bottom: 12px;
	}

	.ytsp__bottom {
		right: 62px;
	}
}

/* Ecrans etroits : on garde le cadre entier visible. */
@media (max-width: 430px) {
	.ytsp__stage {
		width: 100%;
		height: auto;
		max-height: none;
	}
}

.ytsp-notice {
	padding: 10px 14px;
	border-left: 4px solid #ff0033;
	background: #fff4f4;
	color: #7a1020;
	font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
	.ytsp__host,
	.ytsp__cover,
	.ytsp__progress-bar,
	.ytsp__btn {
		transition: none;
	}

	.ytsp__blink.is-on {
		animation: none;
	}
}
