/*
 * The WP Smart Gallery Slider — v1.2
 * Aligné sur le design system Tunisie Travail :
 * Navy #163A6A | Blue #3F5DA3 | Red #D80000 | Border #E2E8F0 | Muted #64748B
 * Surfaces plates (bordure 1px), rayons 5–8px, transitions .15s.
 */
.twpsgs {
	--twpsgs-accent: #3F5DA3;
	--twpsgs-accent2: #D80000;
	--twpsgs-navy: #163A6A;
	--twpsgs-border: #E2E8F0;
	--twpsgs-ratio: 16 / 9;
	--twpsgs-radius: 8px;
	--twpsgs-btn: 40px;
	--twpsgs-btn-radius: 6px;
	--twpsgs-thumb-w: 92px;
	--twpsgs-thumb-h: 62px;
	--twpsgs-speed: 650ms;
	--twpsgs-ease: cubic-bezier(.22, .61, .36, 1);
	position: relative;
	width: 100%;
	max-width: var(--twpsgs-maxw, 100%);
	margin: 18px 0;
	font-family: inherit;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}
.twpsgs *, .twpsgs *::before, .twpsgs *::after { box-sizing: border-box; }
.twpsgs.twpsgs--align-center { margin-left: auto; margin-right: auto; }
.twpsgs.twpsgs--align-right { margin-left: auto; margin-right: 0; }
.twpsgs.twpsgs--align-left { margin-left: 0; margin-right: auto; }

/* ---------- Scène ---------- */
.twpsgs .twpsgs-stage {
	position: relative;
	aspect-ratio: var(--twpsgs-ratio);
	overflow: hidden;
	border: 1px solid var(--twpsgs-border);
	border-radius: var(--twpsgs-radius);
	background: #0f2747;
	box-shadow: 0 8px 24px -10px rgba(22, 58, 106, .35);
	touch-action: pan-y;
	user-select: none;
	-webkit-user-select: none;
	isolation: isolate;
	transition: border-color .15s;
}
.twpsgs.twpsgs--noshadow .twpsgs-stage { box-shadow: none; }
.twpsgs.twpsgs--fixed-h .twpsgs-stage { aspect-ratio: auto; height: var(--twpsgs-height); }
.twpsgs.twpsgs--lb .twpsgs-stage { cursor: zoom-in; }
.twpsgs.is-dragging .twpsgs-stage { cursor: grabbing; }
.twpsgs:focus-visible .twpsgs-stage { outline: 2px solid var(--twpsgs-accent); outline-offset: 2px; }

/* ---------- Slides ---------- */
.twpsgs .twpsgs-slide {
	position: absolute;
	inset: 0;
	margin: 0;
	padding: 0;
	overflow: hidden;
	visibility: hidden;
}
.twpsgs .twpsgs-slide.is-active,
.twpsgs .twpsgs-slide.is-visible { visibility: visible; }
.twpsgs.is-dragging .twpsgs-slide,
.twpsgs .twpsgs-slide.is-visible { will-change: transform; }

.twpsgs.twpsgs--fade .twpsgs-slide {
	visibility: visible;
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--twpsgs-speed) ease;
}
.twpsgs.twpsgs--fade .twpsgs-slide.is-active { opacity: 1; z-index: 1; pointer-events: auto; }

.twpsgs .twpsgs-slide .twpsgs-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
	object-position: center;
	pointer-events: none;
	transform: scale(1);
	transition: transform 1.2s ease;
}
.twpsgs.twpsgs--fit-contain .twpsgs-slide .twpsgs-img { object-fit: contain; }
.twpsgs.twpsgs--kb .twpsgs-slide.is-active .twpsgs-img {
	transform: scale(1.06);
	transition: transform 8s ease-out;
}

/* ---------- Légende ---------- */
.twpsgs .twpsgs-caption {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	margin: 0;
	padding: 44px 16px 14px;
	color: #fff;
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.5;
	text-align: left;
	background: linear-gradient(to top, rgba(15, 39, 71, .88), rgba(15, 39, 71, 0));
	opacity: 0;
	transform: translateY(8px);
	transition: opacity .3s ease, transform .3s var(--twpsgs-ease);
}
.twpsgs .twpsgs-slide.is-active .twpsgs-caption { opacity: 1; transform: none; transition-delay: .2s; }

/* ---------- Boutons (géométrie commune) ---------- */
.twpsgs button.twpsgs-btn,
.twpsgs-lb button.twpsgs-lb-btn {
	position: absolute;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 1px solid var(--twpsgs-border, #E2E8F0);
	border-radius: var(--twpsgs-btn-radius, 6px);
	background: #fff;
	color: var(--twpsgs-navy, #163A6A);
	font-family: inherit;
	line-height: 1;
	box-shadow: 0 2px 8px rgba(20, 30, 55, .12);
	text-decoration: none;
	cursor: pointer;
	transition: background .15s, color .15s, border-color .15s, opacity .15s, transform .15s;
}
.twpsgs button.twpsgs-btn svg,
.twpsgs-lb button.twpsgs-lb-btn svg { display: block; fill: none; }
.twpsgs button.twpsgs-btn:focus-visible,
.twpsgs-lb button.twpsgs-lb-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 0;
	box-shadow: 0 0 0 4px var(--twpsgs-accent, #3F5DA3);
}

/* Style « Blanc » (par défaut) : survol = bleu plein */
.twpsgs.twpsgs--btn-light button.twpsgs-btn:hover {
	background: var(--twpsgs-accent);
	border-color: var(--twpsgs-accent);
	color: #fff;
}
/* Style « Verre sombre » */
.twpsgs.twpsgs--btn-glass button.twpsgs-btn {
	background: rgba(15, 39, 71, .55);
	border-color: rgba(255, 255, 255, .28);
	color: #fff;
	box-shadow: none;
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}
.twpsgs.twpsgs--btn-glass button.twpsgs-btn:hover { background: rgba(15, 39, 71, .88); border-color: rgba(255, 255, 255, .55); color: #fff; }
/* Style « Couleur d'accent » */
.twpsgs.twpsgs--btn-accent button.twpsgs-btn {
	background: var(--twpsgs-accent);
	border-color: var(--twpsgs-accent);
	color: #fff;
}
.twpsgs.twpsgs--btn-accent button.twpsgs-btn:hover { background: var(--twpsgs-navy); border-color: var(--twpsgs-navy); color: #fff; }

/* Flèches */
.twpsgs button.twpsgs-nav {
	top: 50%;
	width: var(--twpsgs-btn);
	height: var(--twpsgs-btn);
	transform: translateY(-50%);
}
.twpsgs button.twpsgs-nav svg { width: 50%; height: 50%; }
.twpsgs button.twpsgs-prev { left: 12px; }
.twpsgs button.twpsgs-next { right: 12px; }
.twpsgs button.twpsgs-nav:active { transform: translateY(-50%) scale(.94); }
.twpsgs button.twpsgs-zoom { top: 12px; right: 12px; width: 34px; height: 34px; }

@media (hover: hover) {
	.twpsgs.twpsgs--arrows-hover button.twpsgs-nav,
	.twpsgs.twpsgs--arrows-hover button.twpsgs-zoom { opacity: 0; }
	.twpsgs.twpsgs--arrows-hover:hover button.twpsgs-btn,
	.twpsgs.twpsgs--arrows-hover:focus-within button.twpsgs-btn { opacity: 1; }
}

/* ---------- Compteur ---------- */
.twpsgs .twpsgs-counter {
	position: absolute;
	z-index: 3;
	top: 12px;
	left: 12px;
	padding: 5px 10px;
	border-radius: 99px;
	background: rgba(15, 39, 71, .82);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: .5px;
	font-variant-numeric: tabular-nums;
}
.twpsgs .twpsgs-counter .twpsgs-sep { margin: 0 4px; opacity: .55; }

/* ---------- Barre de progression ---------- */
.twpsgs .twpsgs-progress {
	position: absolute;
	z-index: 3;
	left: 0; right: 0; bottom: 0;
	height: 3px;
	background: rgba(255, 255, 255, .2);
}
.twpsgs .twpsgs-progress span {
	display: block;
	height: 100%;
	background: var(--twpsgs-accent2);
	transform: scaleX(0);
	transform-origin: left center;
}

/* ---------- Miniatures ---------- */
.twpsgs .twpsgs-thumbs {
	position: relative;
	display: flex;
	gap: 8px;
	margin: 10px 0 0;
	padding: 3px;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.twpsgs .twpsgs-thumbs::-webkit-scrollbar { display: none; }
.twpsgs button.twpsgs-thumb {
	position: relative;
	flex: 0 0 auto;
	width: var(--twpsgs-thumb-w);
	height: var(--twpsgs-thumb-h);
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 1px solid var(--twpsgs-border);
	border-radius: 5px;
	background: #E8ECF5;
	box-shadow: none;
	overflow: hidden;
	cursor: pointer;
	opacity: .6;
	transition: opacity .15s, border-color .15s, box-shadow .15s;
}
.twpsgs button.twpsgs-thumb:hover { opacity: 1; border-color: var(--twpsgs-accent); }
.twpsgs button.twpsgs-thumb:focus-visible { opacity: 1; outline: none; border-color: var(--twpsgs-accent); box-shadow: 0 0 0 3px rgba(63, 93, 163, .25); }
.twpsgs button.twpsgs-thumb.is-active { opacity: 1; border-color: var(--twpsgs-accent); box-shadow: 0 0 0 2px var(--twpsgs-accent); }
.twpsgs .twpsgs-thumb .twpsgs-thumb-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
	border-radius: 0;
	object-fit: cover;
	pointer-events: none;
}

/* ---------- Lightbox ---------- */
html.twpsgs-lock { overflow: hidden; }
.twpsgs-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 60px 16px;
	background: rgba(10, 24, 46, .95);
	opacity: 0;
	visibility: hidden;
	transition: opacity .2s ease, visibility 0s linear .2s;
	touch-action: none;
}
.twpsgs-lb.is-open { opacity: 1; visibility: visible; transition: opacity .2s ease; }
.twpsgs-lb .twpsgs-lb-fig {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	transform: scale(.97);
	transition: transform .25s cubic-bezier(.22, .61, .36, 1);
}
.twpsgs-lb.is-open .twpsgs-lb-fig { transform: none; }
.twpsgs-lb .twpsgs-lb-img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 160px);
	width: auto;
	height: auto;
	border-radius: 6px;
	background: #0f2747;
	user-select: none;
	-webkit-user-select: none;
	transition: opacity .15s;
}
.twpsgs-lb.is-loading .twpsgs-lb-img { opacity: .3; }
.twpsgs-lb .twpsgs-lb-cap { margin: 12px 0 0; color: rgba(255, 255, 255, .88); font-size: 13px; line-height: 1.5; text-align: center; }
.twpsgs-lb .twpsgs-lb-count {
	position: absolute;
	top: 22px;
	left: 18px;
	color: rgba(255, 255, 255, .8);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .5px;
	font-variant-numeric: tabular-nums;
}
.twpsgs-lb button.twpsgs-lb-btn { box-shadow: none; }
.twpsgs-lb button.twpsgs-lb-btn:hover { background: var(--twpsgs-accent, #3F5DA3); border-color: var(--twpsgs-accent, #3F5DA3); color: #fff; }
.twpsgs-lb button.twpsgs-lb-close { top: 12px; right: 14px; }
.twpsgs-lb button.twpsgs-lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.twpsgs-lb button.twpsgs-lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.twpsgs-lb.is-single button.twpsgs-lb-prev,
.twpsgs-lb.is-single button.twpsgs-lb-next,
.twpsgs-lb.is-single .twpsgs-lb-count { display: none; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
	/* Cible tactile : jamais sous 36px, jamais au-dessus de 44px */
	.twpsgs button.twpsgs-nav { width: clamp(36px, var(--twpsgs-btn), 44px); height: clamp(36px, var(--twpsgs-btn), 44px); }
	.twpsgs button.twpsgs-prev { left: 8px; }
	.twpsgs button.twpsgs-next { right: 8px; }
	.twpsgs button.twpsgs-zoom { top: 8px; right: 8px; width: 36px; height: 36px; }
	.twpsgs .twpsgs-counter { top: 8px; left: 8px; }
	.twpsgs .twpsgs-caption { padding: 36px 12px 12px; font-size: 12px; }
	.twpsgs .twpsgs-thumbs { gap: 6px; margin-top: 8px; }
	.twpsgs button.twpsgs-thumb { width: calc(var(--twpsgs-thumb-w) * .74); height: calc(var(--twpsgs-thumb-h) * .74); }
	.twpsgs.twpsgs--fixed-h .twpsgs-stage { height: min(var(--twpsgs-height), 80vw); }
	.twpsgs.twpsgs--has-mratio .twpsgs-stage { aspect-ratio: var(--twpsgs-ratio-m); height: auto; }
	.twpsgs-lb button.twpsgs-lb-prev, .twpsgs-lb button.twpsgs-lb-next { top: auto; bottom: 10px; transform: none; }
}

/* ---------- Animations réduites ---------- */
@media (prefers-reduced-motion: reduce) {
	.twpsgs .twpsgs-slide .twpsgs-img,
	.twpsgs.twpsgs--kb .twpsgs-slide.is-active .twpsgs-img { transform: none; transition: none; }
	.twpsgs .twpsgs-caption, .twpsgs.twpsgs--fade .twpsgs-slide, .twpsgs-lb, .twpsgs-lb .twpsgs-lb-fig { transition: none; }
	.twpsgs .twpsgs-progress { display: none; }
}
