/* LH Product Media Slider */
.lhms {
	--lhms-ratio: 4 / 5;          /* format du cadre : 4/5 portrait (1 / 1 = carré) */
	--lhms-bg: #f5f5f5;
	--lhms-accent: #2e7d32;
	--lhms-radius: 10px;
	position: relative;
	width: 100%;
	max-width: 100%;
	margin-bottom: 2em;
}

/* Intégration au thème LH CBD : même fond que la page, cadre centré */
.lhms.lhms--theme {
	--lhms-bg: transparent;
	--lhms-accent: #f5c518;
	max-width: 480px;            /* ajusté par le script à la place libre de la colonne */
	margin: 0 auto 1em;
}
/* thème : marges identiques (fond de la page) pour photos et vidéos, vignettes centrées */
.lhms--theme .lhms-slide--video { background: transparent; }
.lhms--theme .lhms-slide img, .lhms--theme .lhms-slide video { border-radius: var(--lhms-radius); }
.lhms--theme .lhms-thumbs { justify-content: center; }
/* la colonne photo du thème : le slideshow se cale sous les encarts du haut */
.lhms-parent { justify-content: flex-start !important; }
@media (max-width: 767px) {
	/* sur mobile, le fil d'Ariane du thème est posé en haut de la zone photo : on laisse sa place */
	.lhms.lhms--theme { max-width: 100% !important; margin-top: 58px !important; margin-bottom: 0; }
	/* la colonne photo du thème a une hauteur fixe : on la libère pour le format 4:5 */
	.lhms-parent { height: auto !important; min-height: 0 !important; justify-content: flex-start !important; }
}

.lhms-main {
	position: relative;
	border-radius: var(--lhms-radius);
	overflow: hidden;
	background: var(--lhms-bg);
}

.lhms-track {
	position: relative;
	display: flex;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	overscroll-behavior-x: contain;
	aspect-ratio: var(--lhms-ratio);
	outline: none;
}
.lhms-track::-webkit-scrollbar { display: none; }
.lhms-track:focus-visible { box-shadow: inset 0 0 0 3px var(--lhms-accent); }

.lhms-slide {
	position: relative;
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.lhms-slide--image { cursor: zoom-in; }
.lhms-slide--video { background: #000; }

.lhms .lhms-slide img,
.lhms .lhms-slide video {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	object-fit: contain;
	margin: 0 !important;
	border-radius: 0;
	box-shadow: none;
}

/* Flèches */
.lhms button.lhms-nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92);
	color: #222;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	transition: opacity .2s, transform .2s, background .2s;
	line-height: 1;
}
@media (hover: hover) and (pointer: fine) { .lhms button.lhms-nav:hover { background: #fff; transform: translateY(-50%) scale(1.06); } }
.lhms .lhms-prev { left: 12px; }
.lhms .lhms-next { right: 12px; }
.lhms:hover button.lhms-nav,
.lhms button.lhms-nav:focus-visible { opacity: 1; }
@media (hover: none), (pointer: coarse), (max-width: 767px) {
	/* écrans tactiles et mobiles : flèches toujours visibles, un peu plus petites */
	.lhms button.lhms-nav { display: flex !important; opacity: 1 !important; visibility: visible !important; width: 34px; height: 34px; }
	.lhms button.lhms-nav svg { width: 20px; height: 20px; }
	.lhms .lhms-prev { left: 8px; }
	.lhms .lhms-next { right: 8px; }
}

/* Compteur */
.lhms-counter {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	padding: 3px 10px;
	border-radius: 20px;
	background: rgba(0, 0, 0, .55);
	color: #fff;
	font-size: 12px;
	line-height: 1.5;
	pointer-events: none;
}

/* Vignettes */
.lhms-thumbs {
	position: relative;
	display: flex;
	gap: 8px;
	margin-top: 10px;
	padding-bottom: 4px;
	overflow-x: auto;
	scrollbar-width: thin;
}
.lhms button.lhms-thumb {
	position: relative;
	flex: 0 0 72px;
	width: 72px;
	height: 72px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 8px;
	overflow: hidden;
	background: var(--lhms-bg);
	cursor: pointer;
	opacity: .6;
	transition: opacity .2s, border-color .2s;
}
.lhms button.lhms-thumb:hover { opacity: .9; }
.lhms button.lhms-thumb.is-active { opacity: 1; border-color: var(--lhms-accent); }
.lhms .lhms-thumb img,
.lhms .lhms-thumb video {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
	margin: 0 !important;
	pointer-events: none;
}
.lhms-thumb--video { background: #000 !important; }
.lhms-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: rgba(0, 0, 0, .6);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	padding-left: 2px;
	box-sizing: border-box;
}

@media (max-width: 600px) {
	.lhms button.lhms-thumb { flex-basis: 56px; width: 56px; height: 56px; }
	.lhms { --lhms-radius: 6px; }
}

/* Lightbox (zoom plein écran) */
html.lhms-lock { overflow: hidden; }
.lhms-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(10, 10, 10, .94);
	display: flex;
	align-items: center;
	justify-content: center;
	touch-action: pan-y pinch-zoom;
}
.lhms-lb[hidden] { display: none; }
.lhms-lb-img {
	max-width: 94vw;
	max-height: 88vh;
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
}
.lhms-lb button {
	position: absolute;
	margin: 0;
	padding: 0;
	min-height: 0;
	border: 0;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	width: 48px;
	height: 48px;
	line-height: 1;
}
.lhms-lb button:hover { background: rgba(255, 255, 255, .25); }
.lhms-lb .lhms-lb-close { top: 16px; right: 16px; font-size: 30px; }
.lhms-lb .lhms-lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lhms-lb .lhms-lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lhms-lb .lhms-lb-prev[hidden], .lhms-lb .lhms-lb-next[hidden] { display: none; }
.lhms-lb-count {
	position: absolute;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	color: #ddd;
	font-size: 13px;
}
@media (max-width: 600px) {
	.lhms-lb .lhms-lb-prev, .lhms-lb .lhms-lb-next { display: none; }
}

/* Vidéos toujours sans son : bouton son et volume masqués (Chrome, Safari, Edge) */
.lhms video[data-lhms-muted]::-webkit-media-controls-mute-button,
.lhms video[data-lhms-muted]::-webkit-media-controls-volume-slider,
.lhms video[data-lhms-muted]::-webkit-media-controls-volume-control-container { display: none !important; }
.lhms-crop { position: relative; overflow: hidden; flex: none; margin: auto; border-radius: var(--lhms-radius, 0); cursor: pointer; }

.lhms-crop video { cursor: pointer; }
.lhms-cbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 18px 10px 8px; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); opacity: 0; transition: opacity .2s; }
.lhms-crop:hover .lhms-cbar, .lhms-crop.is-paused .lhms-cbar, .lhms-cbar:focus-within { opacity: 1; }
@media (hover: none) { .lhms-cbar { opacity: 1; } }
.lhms-cbar button { flex: none; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .9); color: #111; cursor: pointer; }
.lhms-cbar button svg { width: 16px; height: 16px; fill: currentColor; }
.lhms-cbar__seek { flex: 1; min-width: 0; height: 4px; accent-color: #f5c518; cursor: pointer; }

/* Ordinateur (thème) : grand format, vignettes en colonne à gauche */
@media (min-width: 768px) {
	.lhms.lhms--wide { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 0; }
	.lhms--wide .lhms-main { flex: 1 1 auto; min-width: 0; order: 2; }
	.lhms--wide .lhms-track { aspect-ratio: auto; height: var(--lhms-h, 520px); }
	.lhms--wide .lhms-thumbs { order: 1; flex: 0 0 auto; flex-direction: column; margin-top: 0; padding: 0 4px 0 0; max-height: var(--lhms-h, 520px); overflow-x: hidden; overflow-y: auto; justify-content: flex-start; }
	.lhms--wide .lhms-thumbs:only-child { display: none; }
	.lhms--wide button.lhms-thumb { flex: 0 0 auto; width: 64px; height: 64px; }
}
/* Mobile : cadre un peu plus haut (3:4) pour profiter de toute la largeur de l'écran */
@media (max-width: 767px) {
	.lhms.lhms--theme { --lhms-ratio: 3 / 4; }
}

/* Flèches : jaune au survol et au clic, avec la même petite animation que sur les cartes */
.lhms button.lhms-nav { transition: opacity .2s, background .2s, transform .15s ease, box-shadow .15s; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) and (pointer: fine) { .lhms button.lhms-nav:hover { background: #f5c518; color: #111; } }
.lhms button.lhms-nav:focus:not(:focus-visible) { outline: none; }
.lhms button.lhms-nav.is-pressed { background: #f5c518; color: #111; transform: translateY(-50%) scale(.85); box-shadow: 0 0 0 7px rgba(245, 197, 24, .3); }
.lhms button.lhms-prev.is-pressed svg { animation: lhms-nudge-l .3s ease; }
.lhms button.lhms-next.is-pressed svg { animation: lhms-nudge-r .3s ease; }
@keyframes lhms-nudge-l { 50% { transform: translateX(-4px); } }
@keyframes lhms-nudge-r { 50% { transform: translateX(4px); } }
/* Lecteur vidéo : boutons jaunes au survol */
.lhms-cbar button { transition: background .2s, transform .15s; }
@media (hover: hover) and (pointer: fine) { .lhms-cbar button:hover { background: #f5c518; } }
.lhms-cbar button:focus-visible { background: #f5c518; }
.lhms-cbar button.is-pressed { transform: scale(.88); background: #f5c518; }

/* Sticker jaune sur la vignette de la vidéo (fiche produit) */
.lhms button.lhms-thumb { overflow: visible; }
.lhms .lhms-thumb > img, .lhms .lhms-thumb > video { border-radius: 6px; }
.lhms-thumb-badge { position: absolute; left: 50%; bottom: 4px; z-index: 2; transform: translateX(-50%) rotate(-4deg); padding: 3px 6px; border-radius: 5px; background: #f5c518; color: #111; font: 800 9px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 2px 5px rgba(0, 0, 0, .2); pointer-events: none; }
.lhms--wide .lhms-thumbs { padding-bottom: 8px; }
.lhms-thumbs { padding-bottom: 8px; }

/* Ordinateur : chaque photo / vidéo est calée en bas du cadre (le script règle l'espace au-dessus) */
@media (min-width: 768px) {
	.lhms--wide .lhms-slide { box-sizing: border-box; align-items: center; }
	.lhms--wide .lhms-counter { transition: top .2s, right .2s; }
}
