/**
 * Atelier 18 Slider — Layout split image / texte
 * Inspiré des maquettes Atelier 18
 */

.a18-slider {
	--a18-font-heading: "Cormorant", Georgia, "Times New Roman", serif;
	--a18-font-body: "Manrope", "Helvetica Neue", Arial, sans-serif;
	--a18-split-ratio: 50%;
	--a18-panel-padding: clamp(32px, 5vw, 72px);
	--a18-arrow-size: 44px;
}

/* Wrapper + titre H2 */
.a18-slider-wrapper {
	width: 100%;
}

.a18-slider__heading {
	font-family: var(--a18-font-heading);
	font-size: clamp(1.5rem, 3vw, 2.25rem);
	font-weight: 600;
	line-height: 1.2;
	color: #1c3632;
	margin: 0 0 clamp(20px, 3vw, 36px);
	padding: 0;
	letter-spacing: -0.01em;
}

/* Conteneur */
.a18-slider {
	position: relative;
	width: 100%;
	height: var(--a18-height, auto);
	min-height: var(--a18-min-height, 70vh);
	overflow: hidden;
	background-color: #f5f2eb;
	font-family: var(--a18-font-body);
	box-sizing: border-box;
	isolation: isolate;
}

.a18-slider[style*="--a18-height: 100%"],
.a18-slider[style*="--a18-height:100%"] {
	height: 100%;
}

.a18-slider *,
.a18-slider *::before,
.a18-slider *::after {
	box-sizing: border-box;
}

.a18-slider__viewport {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	touch-action: pan-y pinch-zoom;
}

/* Drag */
.a18-slider {
	cursor: grab;
}

.a18-slider.is-dragging {
	cursor: grabbing;
	user-select: none;
	-webkit-user-select: none;
}

.a18-slider.is-dragging .a18-slider__track {
	transition: none !important;
}

.a18-slider.is-dragging .a18-slider__panel-inner a {
	pointer-events: none;
}

/* ── Slides ── */
.a18-slider__slide {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--a18-transition-speed, 800ms) ease,
		visibility var(--a18-transition-speed, 800ms) ease;
	z-index: 1;
}

.a18-slider__slide.is-active {
	opacity: 1 !important;
	visibility: visible !important;
	z-index: 2;
}

/* Mode slide — track */
.a18-slider--slide .a18-slider__track {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	position: relative;
	inset: auto;
	height: 100%;
	transition: transform var(--a18-transition-speed, 800ms) ease;
	will-change: transform;
}

.a18-slider--slide .a18-slider__slide {
	position: relative;
	inset: auto;
	flex: 0 0 100%;
	width: 100%;
	min-width: 100%;
	height: 100%;
	opacity: 1 !important;
	visibility: visible !important;
}

.a18-slider--fade .a18-slider__track {
	position: absolute;
	inset: 0;
}

/* ── Split layout ── */
.a18-slider__split {
	display: flex;
	flex-direction: row;
	width: 100%;
	height: 100%;
	min-height: inherit;
}

/* Image à droite → texte à gauche (défaut) */
.a18-slider__slide--image-right .a18-slider__split {
	flex-direction: row;
}

/* Image à gauche → texte à droite */
.a18-slider__slide--image-left .a18-slider__split {
	flex-direction: row-reverse;
}

/* ── Image ── */
.a18-slider__media {
	flex: 0 0 var(--a18-split-ratio);
	width: var(--a18-split-ratio);
	height: 100%;
	overflow: hidden;
	background-color: #e8e4dc;
}

.a18-slider__media img {
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	display: block;
}

.a18-slider__media--cover img {
	object-fit: cover !important;
	object-position: center;
}

.a18-slider__media--contain img {
	object-fit: contain !important;
	object-position: center;
}

.a18-slider__media--contain {
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #e8e4dc;
}

/* ── Panneau texte ── */
.a18-slider__panel {
	flex: 1 1 auto;
	width: calc(100% - var(--a18-split-ratio));
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	padding: var(--a18-panel-padding);
	overflow-y: auto;
}

.a18-slider__panel-inner {
	width: 100%;
	max-width: 560px;
}

.a18-slider__slide--image-only .a18-slider__media {
	flex: 0 0 100%;
	width: 100%;
}

.a18-slider__slide--image-only .a18-slider__split {
	flex-direction: row !important;
}

/* ── Typographie ── */
.a18-slider__surtitre {
	font-family: var(--a18-font-body);
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	line-height: 1.4;
	margin: 0 0 1.25rem;
}

.a18-slider__title {
	font-family: var(--a18-font-heading);
	font-size: clamp(1.75rem, 3.5vw, 2.75rem);
	font-weight: 600;
	line-height: 1.15;
	margin: 0 0 1.5rem;
	letter-spacing: -0.01em;
}

.a18-slider__text {
	font-family: var(--a18-font-body);
	font-size: clamp(0.9rem, 1.4vw, 1.05rem);
	line-height: 1.75;
	margin-bottom: 1.75rem;
}

.a18-slider__text p {
	margin: 0 0 0.85rem;
}

.a18-slider__text p:last-child {
	margin-bottom: 0;
}

.a18-slider__text em,
.a18-slider__text i {
	font-family: var(--a18-font-heading);
	font-style: italic;
	font-size: 1.05em;
}

/* ── Thèmes ── */

/* Crème */
.a18-slider__panel--theme-cream {
	background-color: #f5f2eb;
	color: #1c3632;
}

.a18-slider__panel--theme-cream .a18-slider__surtitre {
	color: #1c3632;
}

.a18-slider__panel--theme-cream .a18-slider__title {
	color: #1c3632;
}

.a18-slider__panel--theme-cream .a18-slider__text {
	color: rgba(28, 54, 50, 0.82);
}

/* Blanc */
.a18-slider__panel--theme-white {
	background-color: #ffffff;
	color: #1c3632;
}

.a18-slider__panel--theme-white .a18-slider__surtitre {
	color: #6b9891;
}

.a18-slider__panel--theme-white .a18-slider__title {
	color: #1c3632;
}

.a18-slider__panel--theme-white .a18-slider__text {
	color: rgba(28, 54, 50, 0.8);
}

/* Gris */
.a18-slider__panel--theme-gray {
	background-color: #9a9a9a;
	color: #f5f2eb;
}

.a18-slider__panel--theme-gray .a18-slider__surtitre {
	color: #f5f2eb;
}

.a18-slider__panel--theme-gray .a18-slider__title {
	color: #f5f2eb;
}

.a18-slider__panel--theme-gray .a18-slider__text {
	color: rgba(245, 242, 235, 0.9);
}

/* Vert foncé */
.a18-slider__panel--theme-dark {
	background-color: #1c3632;
	color: #ffffff;
}

.a18-slider__panel--theme-dark .a18-slider__surtitre {
	color: #7ebec5;
}

.a18-slider__panel--theme-dark .a18-slider__title {
	color: #ffffff;
}

.a18-slider__panel--theme-dark .a18-slider__text {
	color: rgba(255, 255, 255, 0.88);
}

/* Anthracite */
.a18-slider__panel--theme-charcoal {
	background-color: #2c2c2c;
	color: #f5f2eb;
}

.a18-slider__panel--theme-charcoal .a18-slider__surtitre {
	color: #b0b0b0;
}

.a18-slider__panel--theme-charcoal .a18-slider__title {
	color: #f5f2eb;
}

.a18-slider__panel--theme-charcoal .a18-slider__text {
	color: rgba(245, 242, 235, 0.85);
}

/* Personnalisé */
.a18-slider__panel--theme-custom {
	color: #1c3632;
}

.a18-slider__panel--theme-custom .a18-slider__surtitre {
	color: #6b9891;
}

.a18-slider__panel--theme-custom .a18-slider__title {
	color: #1c3632;
}

.a18-slider__panel--theme-custom .a18-slider__text {
	color: rgba(28, 54, 50, 0.82);
}

/* ── CTA ── */
.a18-slider__cta {
	display: inline-flex;
	align-items: center;
	padding: 12px 28px;
	font-family: var(--a18-font-body);
	font-size: 0.8rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	color: #ffffff;
	background-color: #6b9891;
	border: 2px solid #6b9891;
	transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.a18-slider__cta:hover,
.a18-slider__cta:focus {
	background-color: #1c3632;
	border-color: #1c3632;
	color: #ffffff;
	outline: none;
}

.a18-slider__panel--theme-gray .a18-slider__cta,
.a18-slider__panel--theme-charcoal .a18-slider__cta {
	background-color: transparent;
	border-color: #f5f2eb;
	color: #f5f2eb;
}

.a18-slider__panel--theme-gray .a18-slider__cta:hover,
.a18-slider__panel--theme-charcoal .a18-slider__cta:hover {
	background-color: #f5f2eb;
	color: #1c3632;
}

/* ── Navigation ── */
.a18-slider__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: var(--a18-arrow-size);
	height: var(--a18-arrow-size);
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(28, 54, 50, 0.55);
	border: none;
	color: #ffffff;
	cursor: pointer;
	transition: background-color 0.3s ease;
	padding: 0;
}

.a18-slider__arrow:hover,
.a18-slider__arrow:focus {
	background: #6b9891;
	outline: none;
}

.a18-slider__arrow--prev { left: 12px; }
.a18-slider__arrow--next { right: 12px; }

.a18-slider__dots {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	display: flex;
	gap: 8px;
}

.a18-slider__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	border: 2px solid rgba(28, 54, 50, 0.4);
	background: transparent;
	padding: 0;
	cursor: pointer;
	transition: background-color 0.3s ease, transform 0.3s ease;
}

.a18-slider__dot.is-active {
	background: #6b9891;
	border-color: #6b9891;
	transform: scale(1.3);
}

/* Animation contenu */
.a18-slider__slide.is-active .a18-slider__panel-inner {
	animation: a18PanelIn 0.7s ease forwards;
}

@keyframes a18PanelIn {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* Erreur admin */
.a18-slider-error {
	padding: 1rem;
	background: #fff3cd;
	border: 1px solid #ffc107;
	color: #856404;
	text-align: center;
}

/* ── Responsive mobile : image en haut, texte en bas ── */
@media (max-width: 900px) {
	.a18-slider {
		--a18-split-ratio: 100%;
		--a18-panel-padding: clamp(24px, 5vw, 40px);
		height: auto !important;
		min-height: 0;
		overflow: visible;
	}

	.a18-slider__viewport {
		position: relative;
		inset: auto;
		width: 100%;
		height: auto;
		min-height: 0;
		overflow: hidden;
	}

	.a18-slider--fade .a18-slider__track {
		position: relative;
		inset: auto;
		height: auto;
	}

	.a18-slider--slide .a18-slider__track {
		height: auto;
		align-items: stretch;
	}

	/* Toujours image au-dessus, texte en dessous */
	.a18-slider__split,
	.a18-slider__slide--image-left .a18-slider__split,
	.a18-slider__slide--image-right .a18-slider__split,
	.a18-slider__slide--image-only .a18-slider__split {
		flex-direction: column !important;
		height: auto;
		min-height: 0;
	}

	.a18-slider__media {
		order: 1;
		flex: 0 0 auto;
		width: 100%;
		height: clamp(240px, 42vh, 420px);
		min-height: 240px;
	}

	.a18-slider__panel {
		order: 2;
		width: 100%;
		height: auto;
		flex: 0 0 auto;
		align-items: flex-start;
		justify-content: flex-start;
		padding: var(--a18-panel-padding);
	}

	.a18-slider__panel-inner {
		max-width: none;
	}

	/* Mode fade : hauteur pilotée par la slide active */
	.a18-slider--fade .a18-slider__slide {
		position: relative;
		inset: auto;
		width: 100%;
		height: auto;
	}

	.a18-slider--fade .a18-slider__slide:not(.is-active) {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		pointer-events: none;
	}

	/* Mode slide : slides empilées verticalement dans chaque panneau */
	.a18-slider--slide .a18-slider__slide {
		height: auto;
		min-height: 0;
		align-self: stretch;
	}

	/* Slide image seule */
	.a18-slider__slide--image-only .a18-slider__media {
		flex: 0 0 auto;
		width: 100%;
		height: clamp(280px, 55vh, 520px);
		min-height: 280px;
	}

	.a18-slider__media img {
		height: 100% !important;
	}

	/* Navigation repositionnée sur la zone image */
	.a18-slider__arrow {
		top: clamp(120px, 21vh, 210px);
		transform: translateY(-50%);
		width: 38px;
		height: 38px;
	}

	.a18-slider__arrow--prev { left: 8px; }
	.a18-slider__arrow--next { right: 8px; }

	.a18-slider__dots {
		bottom: 12px;
	}

	.a18-slider__heading {
		font-size: clamp(1.35rem, 5vw, 1.75rem);
		margin-bottom: clamp(16px, 4vw, 24px);
	}

	.a18-slider__title {
		font-size: clamp(1.5rem, 6vw, 2rem);
		margin-bottom: 1rem;
	}

	.a18-slider__surtitre {
		margin-bottom: 0.75rem;
	}

	.a18-slider__text {
		margin-bottom: 1.25rem;
	}

	/* Divi fullwidth : éviter le débordement horizontal */
	.et_pb_fullwidth_section .a18-slider-wrapper,
	.et_pb_fullwidth_section .a18-slider {
		width: 100%;
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
	}
}

@media (max-width: 480px) {
	.a18-slider__media {
		height: clamp(220px, 38vh, 320px);
		min-height: 220px;
	}

	.a18-slider__panel {
		padding: 20px 18px 28px;
	}

	.a18-slider__arrow {
		top: clamp(110px, 19vh, 160px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.a18-slider__slide,
	.a18-slider__cta,
	.a18-slider__arrow,
	.a18-slider__dot,
	.a18-slider--slide .a18-slider__track {
		transition: none;
	}
	.a18-slider__slide.is-active .a18-slider__panel-inner {
		animation: none;
	}
}

/* Intégration Divi */
.et_pb_section .a18-slider,
.et_pb_code_inner .a18-slider {
	width: 100%;
}

.et_animated .a18-slider,
.a18-slider.et_animated {
	opacity: 1 !important;
	transform: none !important;
	animation: none !important;
}

.et_pb_fullwidth_section .a18-slider {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}

.et_pb_section .a18-slider img {
	height: 100% !important;
	max-height: none !important;
}
