/**
 * Blocs promo Amazon — shortcode [offer].
 *
 * Reprend les variables du thème (--orange-*, --gray-*) avec un repli local :
 * le module reste présentable si la feuille principale n'est pas chargée.
 */

.lokan-offers,
.lokan-offer {
	--lo-brand: var(--orange-600, #f54900);
	--lo-brand-strong: var(--orange-700, #cc3402);
	--lo-deal: #c92a2a;
	--lo-good: #17803d;
	--lo-text: var(--gray-950, #313135);
	--lo-muted: var(--gray-800, #65646f);
	--lo-faint: var(--gray-600, #8f8e9d);
	--lo-border: var(--gray-200, #e0e1e5);
	--lo-surface: #fff;
	--lo-surface-alt: var(--gray-050, #f6f6f7);
	--lo-radius: 14px;
	--lo-shadow: 0 1px 2px rgba(17, 17, 20, 0.05), 0 8px 24px -12px rgba(17, 17, 20, 0.18);
}

/* --------------------------------------------------------------------- */
/* Conteneurs                                                             */
/* --------------------------------------------------------------------- */

.lokan-offers {
	margin: 2rem 0;
}

.lokan-offers__heading {
	margin: 0 0 0.85rem;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--lo-muted);
}

.lokan-offers--grid .lokan-offers__items {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(var(--lokan-offers-columns, 3), minmax(0, 1fr));
}

@media (max-width: 900px) {
	.lokan-offers--grid .lokan-offers__items {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 560px) {
	.lokan-offers--grid .lokan-offers__items {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* --------------------------------------------------------------------- */
/* Carte                                                                  */
/* --------------------------------------------------------------------- */

.lokan-offer {
	position: relative;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	background: var(--lo-surface);
	border: 1px solid var(--lo-border);
	border-radius: var(--lo-radius);
	color: var(--lo-text);
	overflow: hidden;
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.lokan-offer--card:hover,
.lokan-offer--card:focus-within {
	transform: translateY(-2px);
	box-shadow: var(--lo-shadow);
	border-color: var(--gray-300, #cdced4);
}

.lokan-offer.is-deal {
	border-color: color-mix(in srgb, var(--lo-deal) 35%, var(--lo-border));
}

.lokan-offer__media {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	background: var(--lo-surface-alt);
	aspect-ratio: 4 / 3;
}

.lokan-offer__media img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	mix-blend-mode: multiply;
}

.lokan-offer__media.is-empty {
	background: repeating-linear-gradient(45deg, var(--lo-surface-alt), var(--lo-surface-alt) 10px, var(--lo-border) 10px, var(--lo-border) 11px);
}

.lokan-offer__media--small {
	flex: 0 0 84px;
	width: 84px;
	aspect-ratio: 1;
	padding: 0.5rem;
	border-radius: 10px;
}

.lokan-offer__content {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	padding: 1rem 1.1rem 1.1rem;
}

.lokan-offer__brand {
	margin: 0;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--lo-faint);
}

.lokan-offer__title {
	margin: 0;
	font-size: 1rem;
	line-height: 1.35;
	font-weight: 600;
	/* Les titres Amazon sont interminables : on en montre l'essentiel. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.lokan-offer__title a {
	color: inherit;
	text-decoration: none;
}

.lokan-offer__title a:hover {
	text-decoration: underline;
}

/* --------------------------------------------------------------------- */
/* Prix                                                                   */
/* --------------------------------------------------------------------- */

.lokan-offer__price {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0.25rem 0 0;
}

.lokan-offer__amount {
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.1;
}

.is-deal .lokan-offer__amount {
	color: var(--lo-deal);
}

.lokan-offer__was {
	font-size: 0.9375rem;
	color: var(--lo-faint);
	text-decoration: line-through;
}

.lokan-offer__badge {
	padding: 0.15em 0.5em;
	border-radius: 999px;
	background: var(--lo-deal);
	color: #fff;
	font-size: 0.8125rem;
	font-weight: 700;
	line-height: 1.5;
	white-space: nowrap;
}

.lokan-offer__price--unavailable {
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--lo-muted);
}

/* --------------------------------------------------------------------- */
/* Signaux issus de l'historique                                          */
/* --------------------------------------------------------------------- */

.lokan-offer__signals {
	margin: 0.15rem 0 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	font-size: 0.8125rem;
	color: var(--lo-muted);
}

.lokan-offer__signals li {
	position: relative;
	padding-left: 1.1rem;
	line-height: 1.4;
}

.lokan-offer__signals li::before {
	position: absolute;
	left: 0;
	top: 0;
}

.lokan-offer__signals .is-lowest {
	color: var(--lo-good);
	font-weight: 600;
}

.lokan-offer__signals .is-lowest::before {
	content: "↓";
	font-weight: 700;
}

.lokan-offer__signals .is-reference::before {
	content: "≈";
}

.lokan-offer__spark {
	color: var(--lo-faint);
	display: block;
}

/* --------------------------------------------------------------------- */
/* Appel à l'action                                                       */
/* --------------------------------------------------------------------- */

.lokan-offer__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: 0.6rem;
	padding: 0.65rem 1.1rem;
	border-radius: 999px;
	background: var(--lo-brand);
	color: #fff;
	font-size: 0.9375rem;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.lokan-offer__cta:hover,
.lokan-offer__cta:focus-visible {
	background: var(--lo-brand-strong);
	color: #fff;
	text-decoration: none;
}

.lokan-offer__cta--small {
	margin-top: 0.35rem;
	padding: 0.4rem 0.9rem;
	font-size: 0.875rem;
}

.lokan-offer__footnote {
	margin: 0.55rem 0 0;
	font-size: 0.6875rem;
	line-height: 1.45;
	color: var(--lo-faint);
}

/* --------------------------------------------------------------------- */
/* Layout « bestOffer »                                                   */
/* --------------------------------------------------------------------- */

.lokan-offer--best {
	margin: 2rem 0;
	border-width: 2px;
	border-color: color-mix(in srgb, var(--lo-brand) 30%, var(--lo-border));
	box-shadow: var(--lo-shadow);
}

.lokan-offer--best .lokan-offer__kicker {
	margin: 0;
	padding: 0.6rem 1.1rem;
	background: var(--lo-brand);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.lokan-offer--best .lokan-offer__body {
	display: flex;
	gap: 0.5rem;
	align-items: stretch;
}

.lokan-offer--best .lokan-offer__media {
	flex: 0 0 40%;
	max-width: 260px;
	aspect-ratio: auto;
	background: transparent;
}

.lokan-offer--best .lokan-offer__content {
	flex: 1 1 auto;
	justify-content: center;
	padding: 1.25rem 1.35rem;
}

.lokan-offer--best .lokan-offer__title {
	font-size: 1.15rem;
	-webkit-line-clamp: 3;
}

.lokan-offer--best .lokan-offer__amount {
	font-size: 2rem;
}

.lokan-offer--best .lokan-offer__cta {
	align-self: flex-start;
}

@media (max-width: 620px) {
	.lokan-offer--best .lokan-offer__body {
		flex-direction: column;
	}

	.lokan-offer--best .lokan-offer__media {
		flex-basis: auto;
		max-width: none;
		aspect-ratio: 16 / 9;
	}

	.lokan-offer--best .lokan-offer__cta {
		align-self: stretch;
	}
}

/* --------------------------------------------------------------------- */
/* Layout liste                                                           */
/* --------------------------------------------------------------------- */

.lokan-offers--list .lokan-offer--row {
	flex-direction: row;
	align-items: center;
	gap: 0.9rem;
	padding: 0.75rem;
	margin-bottom: 0.6rem;
}

.lokan-offers--list .lokan-offer__content {
	flex: 1 1 auto;
	padding: 0;
	gap: 0.25rem;
	min-width: 0;
}

.lokan-offers--list .lokan-offer__title {
	font-size: 0.9375rem;
	-webkit-line-clamp: 2;
}

.lokan-offers--list .lokan-offer__aside {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	text-align: right;
}

.lokan-offers--list .lokan-offer__amount {
	font-size: 1.15rem;
}

.lokan-offers--list .lokan-offer__price {
	justify-content: flex-end;
	gap: 0.35rem;
}

@media (max-width: 520px) {
	.lokan-offers--list .lokan-offer--row {
		flex-wrap: wrap;
	}

	.lokan-offers--list .lokan-offer__aside {
		flex-basis: 100%;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
}

/* --------------------------------------------------------------------- */
/* Message d'erreur (admin uniquement)                                    */
/* --------------------------------------------------------------------- */

.lokan-offer-notice {
	padding: 0.6rem 0.85rem;
	border: 1px dashed #d0842a;
	border-radius: 8px;
	background: #fff8ec;
	color: #8a5a12;
	font-size: 0.875rem;
}

/* --------------------------------------------------------------------- */
/* Blindage dans le contenu d'article                                     */
/* --------------------------------------------------------------------- */

/*
 * Le thème impose ses styles à tous les liens du contenu :
 *   .content-article a { color: … !important; text-decoration: underline
 *                        !important; font-size: 16px !important; }
 * Contre du !important, la spécificité ne suffit pas : ces déclarations sont
 * les seules du module à en porter, et uniquement sur les propriétés
 * réellement écrasées.
 */

/*
 * Le thème dimensionne aussi les images du contenu :
 *   .content-article img { max-width: 682px; border-radius: 20px; … }
 * À spécificité égale, ces règles l'emportaient et faisaient déborder le
 * visuel hors de sa colonne — l'image passait à 658 px dans un conteneur de
 * 260 px, et recouvrait le texte.
 */

.lokan-offer .lokan-offer__media img {
	width: auto !important;
	height: auto !important;
	max-width: 100% !important;
	max-height: 100% !important;
	margin: 0 !important;
	border-radius: 0 !important;
}

/* Le bloc « meilleure offre » n'impose pas de ratio : on borne la hauteur du
   visuel pour qu'une image très verticale n'étire pas la carte. */
.lokan-offer--best .lokan-offer__media img {
	max-height: 260px !important;
}

.lokan-offer a,
.lokan-offers a {
	text-decoration: none !important;
	font-family: inherit !important;
}

.lokan-offer a.lokan-offer__cta,
.lokan-offer a.lokan-offer__cta:hover,
.lokan-offer a.lokan-offer__cta:focus-visible {
	color: #fff !important;
	font-size: 0.9375rem !important;
	font-weight: 600 !important;
	text-decoration: none !important;
}

.lokan-offer a.lokan-offer__cta--small {
	font-size: 0.875rem !important;
}

.lokan-offer .lokan-offer__title a {
	color: inherit !important;
	font-size: inherit !important;
	font-weight: 600 !important;
}

.lokan-offer .lokan-offer__title a:hover {
	text-decoration: underline !important;
}

/* --------------------------------------------------------------------- */
/* Centrage en colonne d'article                                          */
/* --------------------------------------------------------------------- */

/*
 * Les blocs à produit unique sont bornés puis centrés : en pleine largeur de
 * colonne, une carte isolée paraît étirée. Grille et liste, elles, gardent
 * toute la largeur disponible.
 */

.lokan-offer--best,
.lokan-offers--single {
	max-width: 640px;
	margin-left: auto;
	margin-right: auto;
}

.lokan-offers--single .lokan-offer__media {
	aspect-ratio: 16 / 10;
}

/* --------------------------------------------------------------------- */
/* Largeur étendue — width="wide" et width="full"                         */
/* --------------------------------------------------------------------- */

/*
 * Au-delà de 1400 px, un bloc « wide » déborde de la colonne de lecture pour
 * atteindre la largeur des images d'article (jusqu'à 1280 px), centré.
 *
 * On ne peut pas s'appuyer sur « margin: auto » : dès que le bloc est plus
 * large que sa colonne, les marges automatiques restent à zéro (jamais
 * négatives) et le bloc déborde vers la droite. Le centrage est donc explicite :
 * margin-left:50% pousse le bord gauche au centre de la colonne, translateX
 * le ramène d'une demi-largeur — le bloc reste centré quelle que soit sa taille.
 *
 * Le double sélecteur (avec .lokan-offer--best) neutralise le plafond de
 * 640 px du produit unique lorsqu'on demande le rendu large.
 */
@media (min-width: 1400px) {
	.lokan-offers--wide,
	.lokan-offer--best.lokan-offers--wide {
		width: min(1280px, 92vw);
		max-width: none;
		margin-left: 50%;
		margin-right: 0;
		transform: translateX(-50%);
	}
}

/*
 * Pleine largeur d'écran (full-bleed) : le bloc s'affranchit de la colonne
 * quelle que soit la taille d'écran. La marge négative ramène le bord gauche
 * au bord du viewport ; à combiner avec un conteneur sans overflow caché.
 */
.lokan-offers--full,
.lokan-offer--best.lokan-offers--full {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	border-radius: 0;
}

@media (prefers-reduced-motion: reduce) {
	.lokan-offer {
		transition: none;
	}

	.lokan-offer--card:hover,
	.lokan-offer--card:focus-within {
		transform: none;
	}
}
