/* Pages offres : tout est préfixé .cc-offres pour ne pas entrer en conflit avec Divi. */

.cc-offres {
	--cc-creme: #fefcf4;
	--cc-sable: #f0ebd8;
	--cc-sable-clair: rgba(240, 235, 216, 0.5);
	--cc-orange: #f9b565;
	--cc-bleu: #7088ac;
	--cc-bleu-texte: #5a7194;
	--cc-bleu-titre: #5ca6dc;
	--cc-encre: #202858;
	--cc-ombre: 0 8px 30px rgba(32, 40, 88, 0.07);
	--cc-rayon: 20px;

	color: var(--cc-encre);
	font-family: "CC Basier", Helvetica, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.4;
}

/* L'identifiant est nécessaire : Divi met #main-content sur fond blanc */
#main-content.cc-offres {
	background: var(--cc-creme);
}

.cc-offres *,
.cc-offres *::before,
.cc-offres *::after {
	box-sizing: border-box;
}

.cc-offres [hidden] {
	display: none !important;
}

.cc-offres button {
	color: inherit;
	cursor: pointer;
	font: inherit;
}

.cc-offres a:focus-visible,
.cc-offres button:focus-visible,
.cc-offres input:focus-visible {
	outline: 3px solid var(--cc-bleu);
	outline-offset: 2px;
}

.cc-offres__contenu {
	margin: 0 auto;
	max-width: 1600px;
	padding: 56px 40px 96px;
}

/* Titre */

.cc-offres .cc-offres__titre {
	color: var(--cc-bleu-titre);
	font-family: "CC Gilbert", Helvetica, Arial, sans-serif;
	font-size: 45px;
	font-weight: 700;
	line-height: 1.15;
	margin: 0 0 16px;
	padding: 0;
	text-align: center;
}

.cc-offres__titre-contour {
	-webkit-text-stroke: 1.5px var(--cc-bleu-titre);
	color: var(--cc-creme);
	font-size: 50px;
}

/* Recherche */

.cc-offres-recherche {
	display: block;
	margin: 0 auto 20px;
	max-width: 560px;
	position: relative;
}

.cc-offres-recherche__label {
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

.cc-offres-recherche input {
	appearance: none;
	background: #fff;
	border: 1px solid var(--cc-sable);
	border-radius: 100px;
	box-shadow: var(--cc-ombre);
	color: var(--cc-encre);
	font: inherit;
	padding: 15px 22px 15px 52px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
	width: 100%;
}

.cc-offres-recherche:hover input,
.cc-offres-recherche input:focus {
	border-color: var(--cc-orange);
	box-shadow: 0 12px 34px rgba(32, 40, 88, 0.13);
	transform: translateY(-2px);
}

.cc-offres-recherche__loupe {
	fill: none;
	left: 22px;
	pointer-events: none;
	position: absolute;
	stroke: var(--cc-bleu);
	stroke-linecap: round;
	stroke-width: 2;
	top: 50%;
	transform: translateY(-50%);
	transition: margin-top 0.2s ease;
	z-index: 1;
}

.cc-offres-recherche__amorce {
	align-items: center;
	color: var(--cc-bleu-texte);
	display: flex;
	gap: 0.3em;
	inset: 0 22px 0 52px;
	line-height: 1.4;
	pointer-events: none;
	position: absolute;
	transition: margin-top 0.2s ease;
}

.cc-offres-recherche:hover .cc-offres-recherche__loupe,
.cc-offres-recherche:hover .cc-offres-recherche__amorce,
.cc-offres-recherche:focus-within .cc-offres-recherche__loupe,
.cc-offres-recherche:focus-within .cc-offres-recherche__amorce {
	margin-top: -2px;
}

/* L'amorce disparaît dès qu'on tape : le placeholder vide indique que le champ est rempli */
.cc-offres-recherche input:not(:placeholder-shown) ~ .cc-offres-recherche__amorce {
	display: none;
}

.cc-offres-recherche__mots {
	color: var(--cc-encre);
	flex: 1;
	font-weight: 500;
	height: 1.4em;
	overflow: hidden;
	position: relative;
}

.cc-offres-recherche__mots span {
	left: 0;
	opacity: 0;
	position: absolute;
	top: 0;
	transform: translateY(100%);
	white-space: nowrap;
}

.cc-offres-recherche__mots .est-visible,
.cc-offres-recherche__mots .est-sorti {
	transition: transform 0.45s cubic-bezier(0.33, 1, 0.68, 1), opacity 0.3s ease;
}

.cc-offres-recherche__mots .est-visible {
	opacity: 1;
	transform: translateY(0);
}

.cc-offres-recherche__mots .est-sorti {
	opacity: 0;
	transform: translateY(-100%);
}

/* Filtres */

.cc-offres-filtres {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
	position: relative;

	--cc-glisseur-fond: var(--cc-sable-clair);
	--cc-glisseur-rayon: 14px;
}

.cc-offres-filtre {
	align-items: center;
	background: transparent;
	border: 0;
	border-radius: 14px;
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	font-weight: 500;
	gap: 6px;
	padding: 10px 16px;
	position: relative;
	z-index: 1;
}

/* Sans JS, pas de fond glissant : le filtre actif garde un fond fixe */
.cc-offres-filtres:not(.a-glisseur) .cc-offres-filtre[aria-pressed="true"] {
	background: var(--cc-sable-clair);
}

.cc-offres-filtre img {
	display: block;
	height: 22px;
	object-fit: contain;
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
	width: 22px;
}

.cc-offres-filtre[aria-pressed="true"] img {
	transform: scale(1.3) rotate(-12deg);
}

.cc-offres-sous-filtres {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
	margin-top: 16px;
}

.cc-offres-sous-filtre {
	background: transparent;
	border: 1px solid var(--cc-bleu);
	border-radius: 100px;
	align-items: center;
	color: var(--cc-bleu-texte);
	display: flex;
	flex: 0 0 auto;
	font-size: 14px;
	gap: 10px;
	min-height: 46px;
	padding: 5px 16px 5px 10px;
	transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.cc-offres-sous-filtre:hover {
	background: #fff;
	box-shadow: 0 8px 20px rgba(32, 40, 88, 0.12);
	color: var(--cc-encre);
	transform: translateY(-2px);
}

/* Fond clair : les logos, souvent bleus, resteraient illisibles sur le bleu Compass */
.cc-offres-sous-filtre[aria-pressed="true"] {
	background: var(--cc-sable);
	border-color: var(--cc-encre);
	color: var(--cc-encre);
}

.cc-offres-sous-filtre img {
	display: block;
	flex: 0 0 auto;
	height: 34px;
	object-fit: contain;
	width: 34px;
}

.cc-offres__compteur {
	color: var(--cc-bleu-texte);
	margin: 20px 0 32px;
	padding: 0;
	text-align: center;
}

/* Grille et cartes */

.cc-offres-grille {
	display: grid;
	gap: 32px 28px;
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cc-offres-carte {
	background: var(--cc-creme);
	border-radius: var(--cc-rayon);
	box-shadow: var(--cc-ombre);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cc-offres-carte:hover {
	box-shadow: 0 14px 34px rgba(32, 40, 88, 0.12);
	transform: translateY(-3px);
}

.cc-offres-carte__lien {
	border-radius: var(--cc-rayon);
	color: inherit;
	display: flex;
	flex-direction: column;
	height: 100%;
	text-decoration: none;
}

.cc-offres-carte__media {
	aspect-ratio: 5 / 2;
	background: var(--cc-sable);
	border-radius: var(--cc-rayon);
	overflow: hidden;
	position: relative;
}

.cc-offres-carte__media img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

/* L'identifiant est nécessaire : Divi retire le padding bas du dernier paragraphe, ce qui décentrait le texte */
#main-content .cc-offres-carte__bandeau {
	background: var(--cc-orange);
	align-items: center;
	border-radius: 0 100px 100px 0;
	color: #fff;
	display: flex;
	font-size: 14px;
	font-weight: 600;
	gap: 6px;
	left: 0;
	line-height: 1.2;
	margin: 0;
	max-width: calc(100% - 16px);
	padding: 6px 14px 6px 10px;
	position: absolute;
	top: 14px;
}

/* Emoji cadeau, de travers et débordant un peu du bandeau */
.cc-offres-carte__bandeau span:first-child {
	display: block;
	flex: 0 0 auto;
	font-size: 20px;
	line-height: 1;
	margin: -4px 0;
	transform: rotate(-14deg);
}

.cc-offres-carte__corps {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: 18px 20px 22px;
}

.cc-offres .cc-offres-carte__nom {
	color: var(--cc-encre);
	font-family: "CC Basier", Helvetica, Arial, sans-serif;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	margin: 0;
	padding: 0;
}

.cc-offres .cc-offres-carte__categorie {
	color: var(--cc-bleu-texte);
	font-size: 14px;
	margin: 4px 0 14px;
	padding: 0;
}

/* L'identifiant est nécessaire : Divi retire le padding bas du dernier paragraphe de #main-content */
#main-content .cc-offres-carte__permanente {
	background: var(--cc-sable-clair);
	border-radius: 10px;
	font-size: 14px;
	line-height: 1.35;
	margin: auto 0 0;
	padding: 8px 10px;
}

/* Sur l'élément interne : avec un padding, une troisième ligne resterait visible */
.cc-offres-carte__permanente-texte {
	-webkit-box-orient: vertical;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}

.cc-offres-carte__permanente-texte > span {
	margin-right: 4px;
}

/* États et boutons */

.cc-offres-vide {
	padding: 48px 16px;
	text-align: center;
}

.cc-offres .cc-offres-vide__titre {
	font-family: "CC Gilbert", Helvetica, Arial, sans-serif;
	font-size: 26px;
	font-weight: 700;
	margin: 0 0 8px;
}

.cc-offres-plus {
	margin-top: 48px;
	text-align: center;
}

.cc-offres-bouton {
	background: var(--cc-creme);
	border: 0;
	border-radius: 40px;
	box-shadow: 0 6px 30px rgba(32, 40, 88, 0.12);
	font-weight: 500;
	margin-top: 8px;
	padding: 18px 36px;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* Au survol, le bouton grossit légèrement, comme celui du header */
.cc-offres-bouton:hover {
	box-shadow: 0 10px 34px rgba(32, 40, 88, 0.18);
	transform: scale(1.05);
}

@media (max-width: 1180px) {
	.cc-offres-grille {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 980px) {
	.cc-offres__contenu {
		padding: 40px 32px 80px;
	}

	.cc-offres-grille {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	/* Marges latérales resserrées pour élargir les cartes */
	.cc-offres {
		--cc-marge: 18px;
	}

	.cc-offres__contenu {
		padding: 24px 0 72px;
	}

	.cc-offres .cc-offres__titre,
	.cc-offres-recherche,
	.cc-offres__compteur,
	.cc-offres-grille,
	.cc-offres-plus {
		margin-left: var(--cc-marge);
		margin-right: var(--cc-marge);
	}

	/* Titre sur une seule ligne : taille calculée d'après son nombre de lettres */
	.cc-offres .cc-offres__titre {
		font-size: min(34px, calc((100vw - 2 * var(--cc-marge)) / (var(--cc-titre-lettres, 22) * 0.43)));
		margin-bottom: 20px;
		white-space: nowrap;
	}

	.cc-offres__titre-contour {
		-webkit-text-stroke-width: 1px;
		font-size: 1em;
	}

	.cc-offres-recherche {
		margin-bottom: 24px;
		max-width: none;
		width: auto;
	}

	/* Filtres en slider horizontal au doigt */
	.cc-offres-filtres,
	.cc-offres-sous-filtres {
		flex-wrap: nowrap;
		justify-content: flex-start;
		overflow-x: auto;
		padding: 0 var(--cc-marge);
		scroll-padding: 0 var(--cc-marge);
		scroll-snap-type: x proximity;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.cc-offres-filtres::-webkit-scrollbar,
	.cc-offres-sous-filtres::-webkit-scrollbar {
		display: none;
	}

	.cc-offres-filtre,
	.cc-offres-sous-filtre {
		scroll-snap-align: start;
	}

	.cc-offres-filtres {
		gap: 2px;
	}

	/* 4 filtres et demi à l'écran : le suivant est toujours coupé, on comprend qu'on peut défiler */
	.cc-offres-filtre {
		flex-basis: calc((100vw - var(--cc-marge)) / 4.5);
		font-size: clamp(12px, 3.5vw, 13px);
		gap: 4px;
		line-height: 1.15;
		padding: 8px 2px;
		text-align: center;
	}

	.cc-offres-filtre img {
		height: 20px;
		width: 20px;
	}

	.cc-offres-grille {
		gap: 28px;
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cc-offres *,
	.cc-offres *::before,
	.cc-offres *::after {
		scroll-behavior: auto !important;
		transition: none !important;
	}

	.cc-offres-carte:hover {
		transform: none;
	}
}
