/**
 * Grille « Nos projets » — charte Fondation (cartes claires).
 */

.ff-projets {
	--ff-primary: #003399;
	--ff-link: #009899;
	--ff-secondary: #ffcc00;
	--ff-sky: #21b4e3;
	--ff-bg: #eaf7ff;
	--ff-card-bg: #ffffff;
	--ff-text-muted: #5a6a8a;
	--ff-border: #d4e8f5;
	--ff-card-accent: var(--ff-primary);
	--ff-projets-max: 100%;
	position: relative;
	z-index: 1;
	clear: both;
	/* 80 % de la page entière (pas du module Divi parent) */
	width: 80vw;
	max-width: 80vw;
	margin-left: calc(50% - 40vw);
	margin-right: calc(50% - 40vw);
	font-family: "Quicksand", var(--et_global_body_font, sans-serif);
	color: var(--ff-primary);
	line-height: 1.6;
	padding: 0 0 3rem;
	box-sizing: border-box;
}

/* Neutralise les puces / points médians injectés par le thème (Divi). */
.ff-projets ul,
.ff-projets li {
	list-style: none !important;
}

.ff-projets li::before,
.ff-projets li::after {
	content: none !important;
	display: none !important;
}

/* —— Barre de filtres (déroulants alignés à gauche) —— */
.ff-projets-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 1.5rem;
	max-width: var(--ff-projets-max);
	margin: 0 auto;
	padding: 1.25rem 0 1.25rem;
	border-bottom: 1px solid var(--ff-border);
}

.ff-projets-toolbar--filters-only {
	justify-content: flex-start;
}

/* —— Déroulants (axe / programme / pays) —— */
.ff-projets-selects {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem;
}

.ff-projets-select {
	position: relative;
	display: inline-flex;
}

.ff-projets-select__label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ff-projets-select__field {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--ff-primary);
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23009899' stroke-width='2' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.85rem center;
	border: 1px solid var(--ff-border);
	border-radius: 999px;
	padding: 0.45rem 2.2rem 0.45rem 1rem;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ff-projets-select__field:hover {
	border-color: var(--ff-link);
}

.ff-projets-select__field:focus-visible {
	outline: none;
	border-color: var(--ff-link);
	box-shadow: 0 0 0 3px rgba(0, 152, 153, 0.18);
}

.ff-projet-card.is-filtered-out {
	display: none;
}

/* —— Grille —— */
.ff-projets-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	align-items: stretch;
	gap: 1.25rem;
	max-width: var(--ff-projets-max);
	margin: 1.75rem auto 0;
}

/* Quand une carte est ouverte, les autres reprennent leur hauteur naturelle
   (état fermé) au lieu d’être étirées → plus de fond blanc résiduel. */
.ff-projets-grid--row-expanded {
	align-items: start;
}

.ff-projets-empty {
	max-width: var(--ff-projets-max);
	margin: 2rem auto;
	text-align: center;
	color: var(--ff-text-muted);
	font-style: italic;
}

/* —— Carte —— */
.ff-projet-card {
	display: flex;
	flex-direction: column;
	margin: 0;
}

.ff-projet-card__inner {
	box-sizing: border-box;
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 100%;
	background: var(--ff-card-bg);
	border-radius: 12px;
	border-top: 4px solid var(--ff-card-accent, var(--ff-secondary));
	box-shadow: 0 4px 24px rgba(0, 51, 153, 0.08);
	overflow: hidden;
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.ff-projet-card[data-ff-has-panel="1"] .ff-projet-card__inner:hover {
	box-shadow: 0 8px 28px rgba(0, 51, 153, 0.12);
}

.ff-projet-card__toggle {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	text-align: left;
	cursor: pointer;
	font: inherit;
}

.ff-projet-card__toggle:disabled {
	cursor: default;
}

.ff-projet-card__toggle:focus-visible {
	outline: 2px solid var(--ff-link);
	outline-offset: 2px;
}

.ff-projet-card[data-ff-has-panel="1"] .ff-projet-card__toggle {
	cursor: pointer;
}

.ff-projet-card__media {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
}

.ff-projet-card__media--accordion {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
}

.ff-projet-card__visual {
	position: relative;
	flex: 0 0 auto;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--ff-bg);
}

.ff-projet-card__media--no-cover .ff-projet-card__visual {
	background: linear-gradient(135deg, var(--ff-bg) 0%, #d4eef8 100%);
}

.ff-projet-card__cover {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.ff-projet-card__body {
	position: relative;
	flex: 1 0 auto;
	padding: 1rem 1.1rem 1.15rem;
	box-sizing: border-box;
}

.ff-projet-card[data-ff-has-panel="1"] .ff-projet-card__body {
	padding-bottom: 2.75rem;
}

.ff-projet-card__lieu {
	margin: 0;
	flex: 1 1 auto;
	min-width: 0;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--ff-text-muted);
}

.ff-projet-card__lieu--empty {
	visibility: hidden;
}

.ff-projet-card__meta-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.65rem;
	min-height: 2.5rem;
	margin-bottom: 0.3rem;
}

.ff-projet-card__title {
	margin: 0 0 0.35rem;
	font-family: inherit;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.35;
	color: var(--ff-primary);
}

/* Étiquette(s) programme, en surimpression sur l’image */
.ff-projet-card__tags {
	position: absolute;
	top: 0.6rem;
	left: 0.6rem;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	max-width: calc(100% - 1.2rem);
	pointer-events: none;
}

.ff-projet-card__tag {
	display: inline-block;
	padding: 0.25rem 0.65rem;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	color: #fff;
	background: rgba(0, 51, 153, 0.88);
	border-radius: 999px;
}

/* Étiquette logo programme (PNG médiathèque) — fond clair semi-transparent */
.ff-projet-card__tag--logo {
	padding: 0.35rem 0.65rem;
	background: rgba(255, 255, 255, 0.9);
	box-shadow: 0 2px 8px rgba(0, 51, 153, 0.1);
}

.ff-projet-card__tag--logo.ff-projet-card__tag--boost,
.ff-projet-card__tag--logo.ff-projet-card__tag--tremplin {
	background: rgba(255, 255, 255, 0.9);
}

.ff-projet-card__tag--logo img {
	display: block;
	width: auto;
	height: 18px;
	max-width: 88px;
	object-fit: contain;
	object-position: left center;
}

.ff-projet-card__hint {
	position: absolute;
	right: 1.1rem;
	bottom: 1rem;
	z-index: 2;
	width: 1.5rem;
	height: 1.5rem;
	border-radius: 50%;
	background: var(--ff-bg);
	border: 1px solid var(--ff-border);
}

.ff-projet-card__hint::before,
.ff-projet-card__hint::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	background: var(--ff-link);
	transform: translate(-50%, -50%);
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.ff-projet-card__hint::before {
	width: 0.6rem;
	height: 2px;
}

.ff-projet-card__hint::after {
	width: 2px;
	height: 0.6rem;
}

.ff-projet-card.is-open .ff-projet-card__hint::after {
	transform: translate(-50%, -50%) rotate(90deg);
	opacity: 0;
}

.ff-projet-card__panel {
	flex: 0 0 auto;
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.4s ease;
	background: #fff;
	border-top: 1px solid transparent;
}

.ff-projet-card.is-open .ff-projet-card__panel {
	max-height: 48rem;
	border-top-color: var(--ff-border);
}

.ff-projet-card__excerpt {
	margin: 0;
	padding: 1.2rem 1.15rem 0.5rem;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.75;
	color: var(--ff-primary);
}

.ff-projet-card__site {
	margin: 0;
	padding: 0.65rem 1.15rem 4.5rem;
	text-align: right;
}

.ff-projet-card__panel > .ff-projet-card__site:first-child {
	padding-top: 1.35rem;
	padding-bottom: 4.5rem;
}

.ff-projet-card__site-link {
	font-size: 15px;
	font-weight: 400;
	line-height: 1.75;
	color: var(--ff-link);
	text-decoration: none;
}

.ff-projet-card__site-link:hover {
	text-decoration: underline;
}

/* Logo association — en face du pays, zone texte carte */
.ff-projet-card__logo-badge {
	flex: 0 0 auto;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 51, 153, 0.14);
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.25rem;
	pointer-events: none;
}

.ff-projet-card__logo-badge img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Accents par thématique (fallback si pas de programme reconnu) */
.ff-projet-card--solidarite-humaine-et-sociale,
.ff-projet-card--solidarite {
	--ff-card-accent: #c80078;
}

.ff-projet-card--education-sensibilisation,
.ff-projet-card--education {
	--ff-card-accent: var(--ff-sky);
}

.ff-projet-card--preservation-de-la-nature,
.ff-projet-card--nature {
	--ff-card-accent: var(--ff-link);
}

.ff-projet-card--preservation-du-vivant,
.ff-projet-card--vivant {
	--ff-card-accent: var(--ff-secondary);
}

.ff-projet-card--default {
	--ff-card-accent: var(--ff-primary);
}

/* Programme prioritaire sur le liseré (couleurs des logos Boost / Tremplin) */
.ff-projet-card--programme-boost {
	--ff-card-accent: #c80078;
}

.ff-projet-card--programme-tremplin {
	--ff-card-accent: #009899;
}

/* —— Responsive —— */
@media (max-width: 1200px) {
	.ff-projets-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 900px) {
	.ff-projets-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 1rem;
	}
}

@media (max-width: 700px) {
	.ff-projets {
		width: 100%;
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
	}

	.ff-projets-toolbar--filters-only {
		justify-content: stretch;
	}

	.ff-projets-toolbar {
		align-items: stretch;
	}

	.ff-projets-toolbar--filters-only .ff-projets-selects {
		width: 100%;
	}

	.ff-projets-selects {
		width: 100%;
	}

	.ff-projets-select {
		flex: 1 1 45%;
	}

	.ff-projets-select__field {
		width: 100%;
	}
}

@media (max-width: 520px) {
	.ff-projets-grid {
		grid-template-columns: 1fr;
	}

	.ff-projets-select {
		flex: 1 1 100%;
	}
}
