/* Trimidi Filter Grid — front. Tout est préfixé .tfg pour ne pas entrer en conflit avec le thème (Divi, etc.). */
.tfg {
	--tfg-primary: #0b5ed7; --tfg-card-bg: #fff; --tfg-text: #1f2933; --tfg-muted: #6b7280; --tfg-filter-bg: #f1f4f8;
	--tfg-radius: 12px; --tfg-gap: 24px; --tfg-cols: 3; --tfg-cols-t: 2; --tfg-cols-m: 1; --tfg-ratio: 16/9; --tfg-scale: 1;
	--tfg-border: color-mix(in srgb, var(--tfg-text) 12%, transparent);
	color: var(--tfg-text);
	font-size: calc(16px * var(--tfg-scale));
	line-height: 1.5;
	box-sizing: border-box;
}
.tfg *, .tfg *::before, .tfg *::after { box-sizing: border-box; }
.tfg .tfg-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Disposition générale ---------- */
.tfg.tfg-filters-sidebar { display: grid; grid-template-columns: minmax(200px, 22%) 1fr; gap: calc(var(--tfg-gap) * 1.25); align-items: start; }
.tfg-main { min-width: 0; }

/* ---------- Contrôles ---------- */
.tfg .tfg-controls { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; margin: 0 0 calc(var(--tfg-gap) * .9); padding: 0; }
.tfg.tfg-align-center .tfg-controls { justify-content: center; }
.tfg.tfg-align-right .tfg-controls { justify-content: flex-end; }
.tfg.tfg-filters-sidebar .tfg-controls { flex-direction: column; align-items: stretch; flex-wrap: nowrap; margin: 0; position: sticky; top: 24px; }

.tfg .tfg-search { position: relative; flex: 1 1 240px; max-width: 420px; }
.tfg.tfg-filters-sidebar .tfg-search { max-width: none; flex: none; }
.tfg .tfg-search-icon { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--tfg-muted); pointer-events: none; }
.tfg .tfg-search-input {
	width: 100%; margin: 0; height: 48px; padding: 0 16px 0 42px !important;
	border: 1px solid var(--tfg-border); border-radius: var(--tfg-radius); background: var(--tfg-filter-bg);
	color: var(--tfg-text); font: inherit; font-size: 1em; box-shadow: none; -webkit-appearance: none; appearance: none;
}
.tfg .tfg-search-input::-webkit-search-cancel-button { cursor: pointer; }
.tfg .tfg-search-input:focus { outline: 2px solid var(--tfg-primary); outline-offset: 1px; background: #fff; }

.tfg .tfg-filter { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.tfg .tfg-filter-label { font-size: .8em; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--tfg-muted); padding: 0; }
.tfg .tfg-filter-buttons { flex-direction: row; flex-wrap: wrap; gap: 8px; }

.tfg .tfg-chip {
	display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 16px; min-height: 40px;
	border: 1px solid var(--tfg-border); border-radius: 999px; background: var(--tfg-filter-bg);
	color: var(--tfg-text); font: inherit; font-size: .9em; line-height: 1.2; cursor: pointer; text-transform: none;
	transition: background .2s, color .2s, border-color .2s;
}
.tfg .tfg-chip:hover { border-color: var(--tfg-primary); color: var(--tfg-primary); }
.tfg .tfg-chip.is-active { background: var(--tfg-primary); border-color: var(--tfg-primary); color: #fff; }
.tfg .tfg-chip:focus-visible, .tfg .tfg-page:focus-visible, .tfg .tfg-load-more:focus-visible, .tfg .tfg-reset:focus-visible { outline: 2px solid var(--tfg-primary); outline-offset: 2px; }
.tfg .tfg-term-count { font-size: .8em; opacity: .7; }

/* Liste verticale (façon menu latéral) */
.tfg .tfg-filter-list { gap: 0; border: 1px solid var(--tfg-border); border-radius: var(--tfg-radius); overflow: hidden; background: var(--tfg-card-bg); }
.tfg.tfg-filters-top .tfg-filter-list { flex-direction: row; flex-wrap: wrap; }
.tfg .tfg-filter-list .tfg-chip {
	justify-content: center; width: 100%; border: 0; border-bottom: 1px solid var(--tfg-border); border-radius: 0;
	background: var(--tfg-filter-bg); min-height: 52px; font-size: 1em; color: var(--tfg-text);
}
.tfg.tfg-filters-top .tfg-filter-list .tfg-chip { width: auto; flex: 1 1 auto; border-bottom: 0; border-right: 1px solid var(--tfg-border); }
.tfg .tfg-filter-list .tfg-chip:last-child { border-bottom: 0; border-right: 0; }
.tfg .tfg-filter-list .tfg-chip:hover { background: var(--tfg-card-bg); color: var(--tfg-primary); }
.tfg .tfg-filter-list .tfg-chip.is-active { background: var(--tfg-card-bg); color: var(--tfg-primary); font-weight: 600; box-shadow: inset 3px 0 0 var(--tfg-primary); }

.tfg .tfg-select {
	margin: 0; height: 44px; min-width: 180px; padding: 0 36px 0 14px; border: 1px solid var(--tfg-border); border-radius: var(--tfg-radius);
	background: var(--tfg-filter-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center;
	color: var(--tfg-text); font: inherit; font-size: .95em; -webkit-appearance: none; appearance: none;
}
.tfg .tfg-checks { display: flex; flex-direction: column; gap: 6px; }
.tfg.tfg-filters-top .tfg-checks { flex-direction: row; flex-wrap: wrap; gap: 6px 16px; }
.tfg .tfg-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .95em; }
.tfg .tfg-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--tfg-primary); }

.tfg .tfg-reset { align-self: flex-end; background: none; border: 0; padding: 8px 4px; margin: 0; color: var(--tfg-primary); font: inherit; font-size: .9em; text-decoration: underline; cursor: pointer; }
.tfg.tfg-filters-sidebar .tfg-reset { align-self: flex-start; }
.tfg .tfg-reset[hidden] { display: none; }

.tfg .tfg-status { min-height: 1.5em; margin-bottom: 12px; font-size: .9em; color: var(--tfg-muted); }
.tfg .tfg-error { color: #b42318; }

/* ---------- Grille ---------- */
.tfg .tfg-items { display: grid; grid-template-columns: repeat(var(--tfg-cols), minmax(0, 1fr)); gap: var(--tfg-gap); transition: opacity .2s; }
.tfg.is-loading .tfg-items { opacity: .45; pointer-events: none; }
.tfg.tfg-layout-masonry .tfg-items { display: block; columns: var(--tfg-cols); column-gap: var(--tfg-gap); }
.tfg.tfg-layout-masonry .tfg-card { break-inside: avoid; margin-bottom: var(--tfg-gap); }
.tfg.tfg-layout-masonry { --tfg-ratio: auto; }
.tfg.tfg-layout-list .tfg-items { grid-template-columns: 1fr; }
.tfg .tfg-empty { grid-column: 1 / -1; padding: 40px 20px; text-align: center; color: var(--tfg-muted); background: var(--tfg-filter-bg); border-radius: var(--tfg-radius); margin: 0; }

/* ---------- Carte ---------- */
.tfg .tfg-card { position: relative; display: flex; flex-direction: column; background: var(--tfg-card-bg); border-radius: var(--tfg-radius); overflow: hidden; transition: transform .25s ease, box-shadow .25s ease; }
.tfg.tfg-card-bordered .tfg-card { border: 1px solid var(--tfg-border); }
.tfg.tfg-card-minimal .tfg-card { background: transparent; box-shadow: none !important; }
.tfg.tfg-shadow-soft:not(.tfg-card-minimal) .tfg-card { box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 4px 14px rgba(16,24,40,.06); }
.tfg.tfg-shadow-strong:not(.tfg-card-minimal) .tfg-card { box-shadow: 0 10px 30px rgba(16,24,40,.16); }

.tfg .tfg-card-media { position: relative; overflow: hidden; aspect-ratio: var(--tfg-ratio); background: var(--tfg-filter-bg); }
.tfg.tfg-card-minimal .tfg-card-media { border-radius: var(--tfg-radius); }
.tfg .tfg-card-media img, .tfg .tfg-card-img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; margin: 0; transition: transform .5s ease; }
.tfg .tfg-card-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 160px; font-size: 3em; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--tfg-primary), color-mix(in srgb, var(--tfg-primary) 55%, #000)); }

.tfg .tfg-card-body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 18px 20px 22px; }
.tfg.tfg-card-minimal .tfg-card-body { padding: 14px 2px 4px; }
.tfg .tfg-card-title { margin: 0 !important; padding: 0 !important; font-size: 1.2em; line-height: 1.25; font-weight: 600; color: var(--tfg-text); }
.tfg.tfg-title-upper .tfg-card-title { text-transform: uppercase; }
.tfg .tfg-card-title a { color: inherit; text-decoration: none; }
.tfg .tfg-card-title a:hover { color: var(--tfg-primary); }
.tfg .tfg-card-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: .85em; color: var(--tfg-muted); }
.tfg .tfg-card-excerpt { margin: 0; padding: 0; font-size: .95em; color: var(--tfg-muted); }
.tfg .tfg-card-terms { display: flex; flex-wrap: wrap; gap: 6px; }
.tfg .tfg-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75em; font-weight: 600; background: color-mix(in srgb, var(--tfg-primary) 12%, transparent); color: var(--tfg-primary); }
.tfg .tfg-terms-text { display: block; color: var(--tfg-primary); font-size: .95em; }

/* Carte entièrement cliquable : le lien du titre couvre la carte. */
.tfg .tfg-card-clickable .tfg-card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.tfg .tfg-card-clickable:focus-within { outline: 2px solid var(--tfg-primary); outline-offset: 2px; }

/* Boutons */
.tfg .tfg-card-button { position: relative; z-index: 2; display: inline-flex; align-items: center; justify-content: center; gap: 6px; align-self: flex-start; margin-top: 4px; font-weight: 600; font-size: .95em; text-decoration: none; line-height: 1.2; transition: background .2s, color .2s, gap .2s, transform .2s; }
.tfg .tfg-card-clickable .tfg-card-button { z-index: 0; }
.tfg.tfg-btn-link .tfg-card-button { color: var(--tfg-primary); }
.tfg.tfg-btn-link .tfg-card:hover .tfg-card-button { gap: 10px; }
.tfg.tfg-btn-pill .tfg-card-button, .tfg.tfg-btn-square .tfg-card-button { padding: 12px 26px; background: var(--tfg-primary); color: #fff; border-radius: 999px; font-size: 1.15em; font-weight: 500; }
.tfg.tfg-btn-square .tfg-card-button { border-radius: calc(var(--tfg-radius) / 2); font-size: 1em; }
.tfg.tfg-btn-pill .tfg-card-button:hover, .tfg.tfg-btn-square .tfg-card-button:hover { background: color-mix(in srgb, var(--tfg-primary) 85%, #000); }
.tfg.tfg-btn-pill .tfg-arrow, .tfg.tfg-btn-square .tfg-arrow { display: none; }
.tfg.tfg-btn-outline .tfg-card-button { padding: 10px 22px; border: 2px solid var(--tfg-primary); color: var(--tfg-primary); border-radius: 999px; }
.tfg.tfg-btn-outline .tfg-card-button:hover { background: var(--tfg-primary); color: #fff; }
.tfg.tfg-btn-align-center .tfg-card-button { align-self: center; }
.tfg.tfg-btn-align-right .tfg-card-button { align-self: flex-end; }
.tfg.tfg-btn-align-stretch .tfg-card-button { align-self: stretch; }
.tfg.tfg-btn-bottom .tfg-card-button { margin-top: auto; }

/* Survol */
.tfg.tfg-hover-lift .tfg-card:hover, .tfg.tfg-hover-both .tfg-card:hover { transform: translateY(-4px); }
.tfg.tfg-hover-lift.tfg-shadow-soft .tfg-card:hover, .tfg.tfg-hover-both.tfg-shadow-soft .tfg-card:hover { box-shadow: 0 12px 28px rgba(16,24,40,.14); }
.tfg.tfg-hover-zoom .tfg-card:hover .tfg-card-media img, .tfg.tfg-hover-both .tfg-card:hover .tfg-card-media img { transform: scale(1.06); }

/* Style « texte sur l'image » */
.tfg.tfg-card-overlay .tfg-card { min-height: 280px; color: #fff; }
.tfg.tfg-card-overlay .tfg-card-media { position: absolute; inset: 0; aspect-ratio: auto; }
.tfg.tfg-card-overlay .tfg-card-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.82) 0%, rgba(0,0,0,.35) 50%, rgba(0,0,0,.05) 100%); }
.tfg.tfg-card-overlay .tfg-card-body { position: relative; justify-content: flex-end; }
.tfg.tfg-layout-grid.tfg-card-overlay .tfg-card { aspect-ratio: var(--tfg-ratio); min-height: 240px; }
.tfg.tfg-card-overlay .tfg-card-title, .tfg.tfg-card-overlay .tfg-card-excerpt, .tfg.tfg-card-overlay .tfg-card-meta { color: #fff; }
.tfg.tfg-card-overlay .tfg-card-excerpt, .tfg.tfg-card-overlay .tfg-card-meta { opacity: .88; }
.tfg.tfg-card-overlay .tfg-badge { background: var(--tfg-primary); color: #fff; }
.tfg.tfg-card-overlay .tfg-terms-text { color: #fff; }
.tfg.tfg-card-overlay.tfg-btn-link .tfg-card-button { color: #fff; }

/* Disposition liste */
.tfg.tfg-layout-list .tfg-card { flex-direction: row; }
.tfg.tfg-layout-list .tfg-card-media { flex: 0 0 34%; max-width: 360px; }
.tfg.tfg-layout-list .tfg-card-body { justify-content: center; }

/* ---------- Pagination ---------- */
.tfg .tfg-pagination { margin-top: calc(var(--tfg-gap) * 1.25); text-align: center; }
.tfg .tfg-pages { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.tfg .tfg-page { min-width: 42px; height: 42px; margin: 0; padding: 0 10px; border: 1px solid var(--tfg-border); border-radius: calc(var(--tfg-radius) / 1.5); background: var(--tfg-card-bg); color: var(--tfg-text); font: inherit; cursor: pointer; }
.tfg .tfg-page:hover:not([disabled]) { border-color: var(--tfg-primary); color: var(--tfg-primary); }
.tfg .tfg-page.is-current { background: var(--tfg-primary); border-color: var(--tfg-primary); color: #fff; }
.tfg .tfg-page[disabled] { opacity: .4; cursor: default; }
.tfg .tfg-page-gap { padding: 0 4px; color: var(--tfg-muted); }
.tfg .tfg-load-more { margin: 0; padding: 12px 30px; border: 0; border-radius: 999px; background: var(--tfg-primary); color: #fff; font: inherit; font-weight: 600; cursor: pointer; transition: transform .2s, background .2s; }
.tfg .tfg-load-more:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--tfg-primary) 85%, #000); }
.tfg .tfg-sentinel { height: 1px; }

/* ---------- Animation ---------- */
@keyframes tfg-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.tfg.tfg-animate .tfg-card { animation: tfg-in .45s ease both; }
.tfg.tfg-animate .tfg-card:nth-child(2) { animation-delay: .04s; }
.tfg.tfg-animate .tfg-card:nth-child(3) { animation-delay: .08s; }
.tfg.tfg-animate .tfg-card:nth-child(4) { animation-delay: .12s; }
.tfg.tfg-animate .tfg-card:nth-child(n+5) { animation-delay: .16s; }
@media (prefers-reduced-motion: reduce) {
	.tfg .tfg-card, .tfg .tfg-card-media img { animation: none !important; transition: none !important; transform: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
	.tfg .tfg-items { grid-template-columns: repeat(var(--tfg-cols-t), minmax(0, 1fr)); }
	.tfg.tfg-layout-masonry .tfg-items { columns: var(--tfg-cols-t); }
	.tfg.tfg-filters-sidebar { grid-template-columns: 1fr; }
	.tfg.tfg-filters-sidebar .tfg-controls { position: static; }
	.tfg.tfg-filters-sidebar .tfg-filter-list { flex-direction: row; flex-wrap: wrap; }
	.tfg.tfg-filters-sidebar .tfg-filter-list .tfg-chip { width: auto; flex: 1 1 auto; min-height: 44px; border-bottom: 0; border-right: 1px solid var(--tfg-border); }
	.tfg .tfg-filter-list .tfg-chip.is-active { box-shadow: inset 0 -3px 0 var(--tfg-primary); }
}
@media (max-width: 600px) {
	.tfg .tfg-items { grid-template-columns: repeat(var(--tfg-cols-m), minmax(0, 1fr)); }
	.tfg.tfg-layout-masonry .tfg-items { columns: var(--tfg-cols-m); }
	.tfg.tfg-layout-list .tfg-card { flex-direction: column; }
	.tfg.tfg-layout-list .tfg-card-media { flex: none; max-width: none; }
	.tfg .tfg-search { max-width: none; flex-basis: 100%; }
	.tfg .tfg-filter-buttons { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
	.tfg .tfg-chip { flex: 0 0 auto; }
	.tfg .tfg-select { width: 100%; }
	.tfg .tfg-filter { width: 100%; }
}
