/* ---------------------------------------------------------------------------
   Video widget — floating bottom-right "On t'en parle ?" promo
   --------------------------------------------------------------------------- */

#video-widget {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 9000;
	width: 420px;
	aspect-ratio: 16 / 9;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 12px;
	overflow: hidden;
	background: #000;
	cursor: pointer;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
	transition: width 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
				box-shadow 0.35s ease,
				transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
	transform: translateZ(0);
}
#video-widget:hover,
#video-widget:focus-visible {
	width: 690px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
	outline: none;
}

/* ---------------------------------------------------------------------------
   Home page (body.front): JS moves the widget inside #menu .menu-wrapper so it
   lives between the chapô (.description) and the tile carousel (.common-menu).
   We override the floating positioning to put it in normal flow, 600 px wide,
   centred, with 50 px above and 65 px below — per client spec.
   --------------------------------------------------------------------------- */
body.front #video-widget {
	display: block;          /* avoid the inline-block baseline gap below */
	position: relative;
	top: auto;
	right: auto;
	bottom: auto;
	left: auto;
	z-index: 5;
	width: 600px;
	max-width: 100%;
	/* Client spec: 50 px below the chapô and 65 px above the tiles row. */
	margin: 50px auto 65px;
	transform: none;
	transition: box-shadow 0.35s ease;
}
body.front #video-widget:hover,
body.front #video-widget:focus-visible {
	width: 600px; /* no hover-expand once in flow */
}
/* Neutralise the chapô's bottom margin and any common-menu top spacing so the
   widget's own 50 / 65 px margins define the exact gaps the client asked for
   (rather than colliding with sibling margins). Only applied on the desktop
   layout — on mobile the widget is hidden and the original theme margins
   are preserved. */
@media (min-width: 900px) {
	body.front #menu .menu-wrapper > .description { margin-bottom: 0; }
	body.front #menu .menu-wrapper > .common-menu { margin-top: 0; }
}

/* ----- HOME variant content layout -------------------------------------
   The default widget has the title at the centre and only reveals a play
   button on hover. The home (in-flow 600 px) variant instead pairs a 600 px
   video tile with an EXTERNAL CTA (arrow gif rotated 45° + black "On t'en
   parle" label) sitting on the same line, to the right of the tile. The
   in-widget title and the in-widget arrow are hidden. The play button is
   permanently centred on the video. Vie-chez-leaf widget unchanged. */
.video-widget-external-cta { display: none; }

/* Hide the in-widget title (both states) on the home variant — the visible
   label is the EXTERNAL one to the right. */
body.front #video-widget .video-widget-title-idle,
body.front #video-widget .video-widget-title-hover {
	display: none;
}
/* Hover-content was a centred flex column showing the play on hover — on
   home we want the play centred at all times, so flatten the wrapper. */
body.front #video-widget .video-widget-hover-content {
	position: static;
	display: contents;
	opacity: 1;
	transform: none;
}
/* Play → centred and always visible. */
body.front #video-widget .video-widget-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 78px;
	height: 78px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.18);
	border: 2px solid #ffffff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	z-index: 3;
	transition: background 0.25s ease, transform 0.25s ease;
	pointer-events: none;
}
body.front #video-widget .video-widget-play svg {
	width: 28px;
	height: 28px;
	fill: #ffffff;
	margin-left: 3px;
}
body.front #video-widget:hover .video-widget-play,
body.front #video-widget:focus-visible .video-widget-play {
	background: rgba(255, 255, 255, 0.32);
	transform: translate(-50%, -50%) scale(1.05);
}

/* ----- External CTA (only shown on home) ----- */
/* The row keeps the widget centred on the page (width = widget width, margin
   auto). The CTA hangs off to the right as an absolutely-positioned overlay so
   it never pushes the widget off-centre. */
body.front #video-widget-row {
	position: relative;
	width: 600px;
	max-width: 100%;
	margin: 50px auto 65px;
}
body.front #video-widget-row #video-widget {
	margin: 0;
	width: 100%;
}
body.front .video-widget-external-cta {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	position: absolute;
	left: calc(100% + 24px);
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
}
.video-widget-external-label {
	display: block;
	font-family: 'Poppins', sans-serif;
	font-weight: 700;
	color: #000000;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	line-height: 1.1;
	font-size: clamp(20px, 1.8vw + 8px, 28px);
	white-space: nowrap;
	text-align: center;
}
.video-widget-external-arrow {
	display: block;
	width: 110px;
	height: 110px;
	flex-shrink: 0;
	line-height: 0;
}
.video-widget-external-arrow img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	transform: rotate(45deg);   /* tip of the arrow rotated 45° to the right */
}

#video-widget .video-widget-loop {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none !important;
}
/* Edge/Chrome show hover-overlay media controls on autoplay videos even
   without a `controls` attribute — kill every variant. */
#video-widget .video-widget-loop::-webkit-media-controls,
#video-widget .video-widget-loop::-webkit-media-controls-enclosure,
#video-widget .video-widget-loop::-webkit-media-controls-panel,
#video-widget .video-widget-loop::-webkit-media-controls-overlay-play-button,
#video-widget .video-widget-loop::-webkit-media-controls-start-playback-button,
#video-widget .video-widget-loop::-webkit-media-controls-play-button,
#video-widget .video-widget-loop::-webkit-media-controls-timeline,
#video-widget .video-widget-loop::-webkit-media-controls-current-time-display,
#video-widget .video-widget-loop::-webkit-media-controls-time-remaining-display,
#video-widget .video-widget-loop::-webkit-media-controls-mute-button,
#video-widget .video-widget-loop::-webkit-media-controls-volume-slider,
#video-widget .video-widget-loop::-webkit-media-controls-fullscreen-button,
#video-widget .video-widget-loop::-internal-media-controls-overlay-cast-button,
#video-widget .video-widget-loop::-internal-media-controls-button-panel {
	display: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

#video-widget .video-widget-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	transition: background 0.35s ease;
	pointer-events: none;
}
#video-widget:hover .video-widget-overlay,
#video-widget:focus-visible .video-widget-overlay {
	background: rgba(0, 0, 0, 0.55);
}

/* Use container queries so the title scales with the widget size, not viewport. */
#video-widget { container-type: inline-size; }

#video-widget .video-widget-content {
	position: absolute;
	inset: 0;
	color: #ffffff;
	text-align: center;
	padding: 12px;
	pointer-events: none;
}

/* Both states are absolutely centered in the content box so they share the same
   visual centre and swap with a fade — no flex flow offset. */
#video-widget .video-widget-title-idle,
#video-widget .video-widget-hover-content {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	width: max-content;
	max-width: calc(100% - 24px);
	transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

#video-widget .video-widget-title {
	font-family: 'Poppins', sans-serif;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	line-height: 1.2;
	font-size: clamp(20px, 3.2cqi + 14px, 38px);
	margin: 0;
}

#video-widget .video-widget-title-hover {
	font-size: clamp(18px, 2.6cqi + 13px, 32px);
}

#video-widget .video-widget-play {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	border: 2px solid #ffffff;
	transition: background 0.25s ease, transform 0.25s ease;
}
#video-widget .video-widget-play svg {
	width: 22px;
	height: 22px;
	fill: #ffffff;
	margin-left: 3px; /* optical centering of the triangle */
}
#video-widget:hover .video-widget-play,
#video-widget:focus-visible .video-widget-play {
	background: rgba(255, 255, 255, 0.28);
	transform: scale(1.05);
}

/* ---- State swapping idle <-> hover ---- */
#video-widget .video-widget-title-idle {
	opacity: 1;
}
#video-widget .video-widget-hover-content {
	opacity: 0;
}
#video-widget:hover .video-widget-title-idle,
#video-widget:focus-visible .video-widget-title-idle {
	opacity: 0;
}
#video-widget:hover .video-widget-hover-content,
#video-widget:focus-visible .video-widget-hover-content {
	opacity: 1;
}

/* ---- Modal ---- */
#video-widget-modal[hidden] { display: none !important; }
#video-widget-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px;
	background: rgba(0, 0, 0, 0.85);
	opacity: 1;
	transition: opacity 0.25s ease;
}

#video-widget-modal .video-widget-modal-frame {
	position: relative;
	width: min(1100px, 92vw);
	aspect-ratio: 16 / 9;
	background: #000;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
	border-radius: 8px;
	overflow: hidden;
}
#video-widget-modal .video-widget-modal-frame iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

#video-widget-modal .video-widget-modal-close {
	position: absolute;
	top: 24px;
	right: 24px;
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 50%;
	color: #ffffff;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}
#video-widget-modal .video-widget-modal-close:hover,
#video-widget-modal .video-widget-modal-close:focus-visible {
	background: rgba(255, 255, 255, 0.25);
	transform: scale(1.05);
	outline: none;
}
#video-widget-modal .video-widget-modal-close svg { width: 18px; height: 18px; }

body.video-widget-modal-open { overflow: hidden; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
	#video-widget {
		right: 16px;
		bottom: 16px;
		width: min(300px, calc(100vw - 32px));
	}
	#video-widget:hover,
	#video-widget:focus-visible {
		width: min(510px, calc(100vw - 32px));
	}
	#video-widget-modal { padding: 16px; }
	#video-widget-modal .video-widget-modal-close { top: 12px; right: 12px; }
}

/* ---------------------------------------------------------------------------
   Mobile (< 900px) on the front page: replace the floating widget with an
   inline card injected at the end of the menu tile list.
   --------------------------------------------------------------------------- */
@media (max-width: 899.99px) {
	body.front #video-widget,
	body.front #video-widget-row,
	body.front .video-widget-external-cta {
		display: none !important;
	}

	/* The injected card inherits .menu-item .swiper-slide styles from the theme
	   for layout (aspect ratio, label position…). These rules tweak the few bits
	   the theme doesn't cover for our use case. */
	#video-widget-mobile-card {
		cursor: pointer;
		text-decoration: none;
		-webkit-tap-highlight-color: transparent;
	}
	#video-widget-mobile-card > .background { background: #000; }
	#video-widget-mobile-card > .background > video {
		width: 100%;
		height: 100%;
		object-fit: cover;
		display: block;
		pointer-events: none;
	}
	#video-widget-mobile-card > .label { color: #ffffff; }
	/* Hide every variant of browser-injected media controls on the looping video. */
	#video-widget-mobile-card video::-webkit-media-controls,
	#video-widget-mobile-card video::-webkit-media-controls-enclosure,
	#video-widget-mobile-card video::-webkit-media-controls-panel,
	#video-widget-mobile-card video::-webkit-media-controls-overlay-play-button,
	#video-widget-mobile-card video::-webkit-media-controls-start-playback-button {
		display: none !important;
		opacity: 0 !important;
		pointer-events: none !important;
	}
}


@media (prefers-reduced-motion: reduce) {
	#video-widget,
	#video-widget *,
	#video-widget-modal,
	#video-widget-modal * { transition: none !important; }
}
