/* ============================================
   LJ Réalisations — Stories
   Format story Instagram-like, plein écran sous le header.
   Beaucoup de !important volontaires : on protège des règles génériques
   du thème / Elementor (ex: img { width: 100% !important; }).
   ============================================ */

.lj-rea-stories {
	--lj-rea-header-h: 80px;       /* override via inline style depuis le shortcode */
	--lj-rea-radius: 18px;
	--lj-rea-bar-h: 3px;
	--lj-rea-text: #fff;
	--lj-rea-orange: 255, 124, 0;  /* #ff7c00 — orange du logo LJ */

	position: relative !important;
	isolation: isolate;
	width: 100%;
	box-sizing: border-box;
	color: var(--lj-rea-text);
	overflow: hidden;

	/* Mobile : on force la section à occuper l'espace restant sous le header. */
	/* svh : taille figée sur le PLUS PETIT viewport (barre URL visible).
	   Quand la barre disparaît au scroll, l'élément ne grandit pas. */
	min-height: calc(100svh - var(--lj-rea-header-h)) !important;

	padding: 2px 4px 4px; /* Mobile : quasi nul pour gagner ~12px de hauteur */
	display: flex;
	flex-direction: column;
	background: #fff;
}

.lj-rea-stories *,
.lj-rea-stories *::before,
.lj-rea-stories *::after {
	box-sizing: border-box;
}

/* ── Wave orange animée — couche dédiée (PC seulement) ────────── */
.lj-rea-stories::before {
	content: "";
	display: none;
}

@media (min-width: 768px) {
	.lj-rea-stories {
		padding: 12px 16px 100px; /* top réduit : titre overlay → on n'a plus besoin d'espace au-dessus */
	}

	/* PC : pas de fond dégradé. */
	.lj-rea-stories::before {
		display: none !important;
	}
}

/* ── Titre : overlay blanc sur l'image, sous la barre de progression ── */
.lj-rea-stories__title {
	position: absolute;
	top: 28px; /* sous la barre de progression (top:12 + h:3 + gap) */
	left: 16px;
	right: 16px;
	z-index: 4;
	margin: 0;
	font-weight: 700;
	letter-spacing: -0.01em;
	text-align: center;
	color: #fff;
	font-size: clamp(1.1rem, 4.8vw, 1.5rem);
	text-shadow:
		0 2px 12px rgba(0, 0, 0, 0.7),
		0 1px 3px rgba(0, 0, 0, 0.6),
		0 0 24px rgba(0, 0, 0, 0.35);
	pointer-events: none;
}

@media (min-width: 768px) {
	.lj-rea-stories__title {
		font-size: clamp(1.4rem, 2vw, 2rem);
		top: 30px;
	}
}

/* ── Viewport ─────────────────────────────────── */
.lj-rea-stories__viewport {
	position: relative !important;
	width: 100%;
	margin: 0 auto;
	background: #000;
	overflow: hidden;
	user-select: none;
	touch-action: pan-y;
	z-index: 1;

	/* Mobile : flex-grow pour remplir tout l'espace restant. */
	flex: 1 1 auto;
	min-height: 360px;
	border-radius: var(--lj-rea-radius);
	box-shadow: none;
}

@media (min-width: 768px) {
	.lj-rea-stories__viewport {
		flex: 0 0 auto;
		width: 100%;
		max-width: 1400px;
		aspect-ratio: 16 / 9;
		max-height: calc(100vh - var(--lj-rea-header-h) - 130px);
		box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
	}
}

/* ── Barre de progression segmentée ───────────── */
.lj-rea-stories__progress {
	position: absolute;
	top: 12px;
	left: 12px;
	right: 12px;
	z-index: 5;
	display: flex;
	gap: 4px;
	pointer-events: none;
}

.lj-rea-stories__bar {
	flex: 1 1 0;
	height: var(--lj-rea-bar-h);
	background: rgba(255, 255, 255, 0.32);
	border-radius: 999px;
	overflow: hidden;
}

.lj-rea-stories__bar > span {
	display: block;
	height: 100%;
	width: 0%;
	background: #fff;
	border-radius: inherit;
	will-change: width;
}

/* ── Slides ────────────────────────────────────── */
.lj-rea-stories__stage {
	position: absolute !important;
	inset: 0;
}

.lj-rea-stories .lj-rea-stories__slide {
	position: absolute !important;
	inset: 0 !important;
	display: block !important;
	text-decoration: none !important;
	color: inherit;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.45s ease;
	z-index: 1;
	margin: 0 !important;
	padding: 0 !important;
}

.lj-rea-stories .lj-rea-stories__slide.is-active {
	opacity: 1;
	visibility: visible;
	z-index: 2;
}

/* Image en cover — !important pour battre les règles génériques img du thème. */
.lj-rea-stories .lj-rea-stories__slide .lj-rea-stories__img {
	position: absolute !important;
	inset: 0 !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	min-width: 0 !important;
	min-height: 0 !important;
	object-fit: cover !important;
	object-position: center !important;
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
}

/* Scrim pour lisibilité du caption */
.lj-rea-stories__slide::after {
	content: "";
	position: absolute;
	inset: auto 0 0 0;
	height: 60%;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.2) 65%, rgba(0, 0, 0, 0) 100%);
	pointer-events: none;
	z-index: 1;
}

/* ── Caption — FORCÉE en bas (battle .lj-glass { position: relative; }) ─ */
.lj-rea-stories .lj-rea-stories__slide .lj-rea-stories__caption,
.lj-rea-stories .lj-rea-stories__slide .lj-rea-stories__caption.lj-glass {
	position: absolute !important;
	left: 16px !important;
	right: 16px !important;
	bottom: 20px !important;
	top: auto !important;
	margin: 0 !important;
	padding: 14px 16px 14px !important;
	border-radius: 14px !important;
	z-index: 3 !important;
	width: auto !important;
	max-width: none !important;
	height: auto !important;
	max-height: none !important;
	transform: none !important;
}

.lj-rea-stories__name {
	margin: 0 !important;
	font-size: clamp(1.05rem, 1.5vw, 1.4rem);
	font-weight: 700;
	line-height: 1.2;
}

.lj-rea-stories__meta {
	margin: 4px 0 0 !important;
	font-size: 0.85rem;
	opacity: 0.9;
	letter-spacing: 0.01em;
}

/* ── CTA "Voir la réalisation" — simple texte + flèche ─────────── */
.lj-rea-stories__cta {
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
	margin-top: 8px !important;
	padding: 0 !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	backdrop-filter: none !important;
	-webkit-backdrop-filter: none !important;
	color: #fff;
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	transition: gap 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.lj-rea-stories__cta svg {
	flex: 0 0 auto;
	transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.lj-rea-stories__slide:hover .lj-rea-stories__cta,
.lj-rea-stories__slide:focus-visible .lj-rea-stories__cta {
	gap: 10px;
}

.lj-rea-stories__slide:hover .lj-rea-stories__cta svg,
.lj-rea-stories__slide:focus-visible .lj-rea-stories__cta svg {
	transform: translateX(3px);
}

/* ── Zones cliquables gauche/droite (invisibles) ─ */
.lj-rea-stories__edge {
	position: absolute !important;
	top: 0 !important;
	bottom: 0 !important;
	width: 28% !important; /* mobile : on garde large pour le tap-to-advance */
	background: transparent !important;
	border: 0 !important;
	padding: 0 !important;
	cursor: pointer;
	z-index: 4;
	-webkit-tap-highlight-color: transparent;
	margin: 0 !important;
}

.lj-rea-stories__edge--prev { left: 0 !important; }
.lj-rea-stories__edge--next { right: 0 !important; }

/* PC : bande étroite alignée sur le chevron, sinon le clic intercepte
   la moitié de l'image et empêche d'interagir avec le contenu central. */
@media (min-width: 768px) {
	.lj-rea-stories__edge {
		width: 72px !important;
	}
}

/* ── Chevrons — ghost minimal : juste l'icône, pas de fond ─────── */
.lj-rea-stories .lj-rea-stories__chevron {
	position: absolute !important;
	top: 50% !important;
	transform: translateY(-50%) !important;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 28px !important;
	height: 28px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	color: #fff !important;
	cursor: pointer;
	z-index: 6 !important;
	opacity: 0.55 !important;
	visibility: visible !important;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7));
	transition: opacity 0.25s ease, transform 0.25s ease;
	-webkit-tap-highlight-color: transparent;
}

.lj-rea-stories .lj-rea-stories__chevron svg {
	width: 22px !important;
	height: 22px !important;
	display: block !important;
}

.lj-rea-stories .lj-rea-stories__chevron:hover,
.lj-rea-stories .lj-rea-stories__chevron:focus-visible {
	opacity: 1 !important;
	background: transparent !important;
	transform: translateY(-50%) scale(1.15) !important;
}

.lj-rea-stories .lj-rea-stories__chevron--prev { left: 8px !important; right: auto !important; }
.lj-rea-stories .lj-rea-stories__chevron--next { right: 8px !important; left: auto !important; }

@media (min-width: 768px) {
	.lj-rea-stories .lj-rea-stories__chevron {
		width: 32px !important;
		height: 32px !important;
	}
	.lj-rea-stories .lj-rea-stories__chevron svg {
		width: 26px !important;
		height: 26px !important;
	}
	.lj-rea-stories .lj-rea-stories__chevron--prev { left: 12px !important; }
	.lj-rea-stories .lj-rea-stories__chevron--next { right: 12px !important; }
}

/* ── Pause visuelle ───────────────────────────── */
.lj-rea-stories.is-paused .lj-rea-stories__bar > span {
	transition: none;
}

/* ── A11y ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.lj-rea-stories .lj-rea-stories__slide,
	.lj-rea-stories__chevron,
	.lj-rea-stories__cta,
	.lj-rea-stories__cta svg {
		transition: none !important;
	}
}
