/*
 * Tabula — grilles de projets et d'articles (widgets « Grille de projets » et « Grille d'articles »).
 * Les cartes reprennent la charte : variables de couleurs, polices et arrondis du site.
 */

.tb-grid {
	--tb-cols: 3;
	display: flex;
	flex-direction: column;
	gap: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
	width: 100%;
}
.tb-grid[data-cols="1"] { --tb-cols: 1; }
.tb-grid[data-cols="2"] { --tb-cols: 2; }
.tb-grid[data-cols="4"] { --tb-cols: 4; }
@media (max-width: 1024px) {
	.tb-grid[data-cols="3"],
	.tb-grid[data-cols="4"] { --tb-cols: 2; }
}
@media (max-width: 767px) {
	.tb-grid[data-cols] { --tb-cols: 1; }
}

.tb-grid-items {
	display: grid;
	grid-template-columns: repeat(var(--tb-cols), minmax(0, 1fr));
	gap: 24px 20px;
	width: 100%;
}

/* Carte */
.tb-gcard {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	/* --tbf-* : couleurs du contexte (carte sombre dans une section sombre, tabula.css). */
	background-color: var(--tbf-card, var(--tb-card, var(--ast-global-color-4, #FFFFFF)));
	color: var(--tbf-ink, var(--tb-ink, var(--ast-global-color-2, #0D0D0F)));
	border: 1px solid var(--tbf-line, var(--tb-line, rgba(127, 127, 127, 0.2)));
	border-radius: var(--tb-r-md, 22px);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 36px -24px rgba(0, 0, 0, 0.24);
	overflow: hidden;
	transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.tb-gcard[hidden] {
	display: none;
}
.tb-gcard:hover {
	transform: translateY(-4px);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 30px 60px -30px rgba(0, 0, 0, 0.32);
}
.tb-gcard:focus-within {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}
.tb-gcard-media {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background-color: rgba(127, 127, 127, 0.12);
}
.tb-grid--articles .tb-gcard-media {
	aspect-ratio: 16 / 9;
}
.tb-gcard-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 0.6s ease;
}
.tb-gcard:hover .tb-gcard-img {
	transform: scale(1.04);
}
.tb-gcard-body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 10px;
	padding: clamp(1.25rem, 1rem + 0.8vw, 1.75rem);
}
.tb-gcard .tb-gcard-meta {
	margin: 0;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: color-mix(in srgb, currentColor 60%, transparent);
}
/* Touche de couleur : catégorie et « Lire l'article » à la couleur de marque. */
.tb-gcard .tb-gcard-cat {
	color: var(--tb-accent-text, currentColor);
}
.tb-bg-contrast .tb-grid--simple .tb-gcard-cat {
	color: var(--tb-accent-dark-text, currentColor);
}
.tb-gcard .tb-gcard-title {
	margin: 0;
	padding: 0;
	font-size: calc(clamp(1.1rem, 1.02rem + 0.32vw, 1.3rem) * var(--tb-h-scale, 1));
	font-weight: var(--tb-h-weight, 600);
	line-height: 1.25;
	letter-spacing: var(--tb-h-ls, -0.01em);
	text-transform: var(--tb-h-case, none);
	color: inherit;
}
/* Titres et résumés limités à 3 lignes (points de suspension au-delà). */
.tb-gcard .tb-gcard-title,
.tb-gcard .tb-gcard-text {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}
.tb-gcard .tb-gcard-title a {
	color: inherit;
	text-decoration: none;
	outline: 0;
}
/* Toute la carte est cliquable. */
.tb-gcard .tb-gcard-title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}
.tb-gcard .tb-gcard-text {
	margin: 0;
	font-size: 15px;
	line-height: 1.6;
	opacity: 0.72;
}
.tb-gcard-more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: auto;
	padding-top: 6px;
	font-size: 14px;
	font-weight: 600;
	color: var(--tb-accent-text, currentColor);
}
.tb-gcard-more::after {
	content: "\2192";
	transition: transform 0.3s ease;
}
.tb-gcard:hover .tb-gcard-more::after {
	transform: translateX(4px);
}
.elementor .tb-gcard-title {
	font-family: var(--tb-font-heading);
}
.elementor .tb-gcard-text,
.elementor .tb-gcard-more,
.elementor .tb-grid-filters button,
.elementor .tb-grid-btn {
	font-family: var(--tb-font-body);
}
.elementor .tb-gcard-meta {
	font-family: var(--tb-font-label);
}

/* Présentation épurée : image arrondie, texte dessous, sans carte. */
.tb-grid--simple .tb-gcard {
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	overflow: visible;
	color: inherit;
}
.tb-grid--simple .tb-gcard:hover {
	transform: none;
	box-shadow: none;
}
.tb-grid--simple .tb-grid-items {
	row-gap: clamp(2rem, 1.5rem + 1.5vw, 3rem);
}
.tb-grid--simple .tb-gcard-media {
	border-radius: var(--tb-r-md, 22px);
}
.tb-grid--simple .tb-gcard-body {
	padding: 18px 0 0;
}
.tb-grid--simple .tb-gcard-more {
	display: none;
}

/* Filtres */
.tb-grid-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.tb-grid-filters button {
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	color: inherit;
	background: transparent;
	border: 1px solid rgba(127, 127, 127, 0.34);
	border-radius: var(--tb-r-btn, 999px);
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.tb-grid-filters button:hover {
	background-color: rgba(127, 127, 127, 0.1);
}
.tb-grid-filters button.is-on {
	color: var(--tb-accent-ink, #FFFFFF);
	background-color: var(--tb-accent, #0D0D0F);
	border-color: var(--tb-accent, #0D0D0F);
}

/* Chargement (filtres, « Voir plus ») */
.tb-grid.is-loading .tb-grid-items {
	opacity: 0.55;
	transition: opacity 0.2s ease;
}
.tb-gcard.is-new {
	animation: tb-gcard-in 0.5s ease both;
}
@keyframes tb-gcard-in {
	from { opacity: 0; transform: translateY(14px); }
	to { opacity: 1; transform: none; }
}
.tb-grid-none {
	grid-column: 1 / -1;
	margin: 0;
	padding: 32px 0;
	text-align: center;
	opacity: 0.7;
}
.tb-grid-foot[hidden] {
	display: none;
}
button.tb-grid-btn {
	font: inherit;
	background: transparent;
	cursor: pointer;
}

/* Bouton « Voir plus » */
.tb-grid-foot {
	display: flex;
	justify-content: center;
}
.tb-grid .tb-grid-btn {
	display: inline-flex;
	align-items: center;
	padding: 16px 26px;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	color: inherit;
	text-decoration: none;
	border: 1px solid rgba(127, 127, 127, 0.34);
	border-radius: var(--tb-r-btn, 999px);
	transition: background-color 0.2s ease, border-color 0.2s ease;
}
.tb-grid .tb-grid-btn:hover {
	color: inherit;
	background-color: rgba(127, 127, 127, 0.1);
	border-color: rgba(127, 127, 127, 0.5);
}

/* Éditeur : grille encore vide */
.tb-grid-empty {
	width: 100%;
	padding: 28px;
	font-size: 15px;
	text-align: center;
	border: 1px dashed rgba(127, 127, 127, 0.45);
	border-radius: var(--tb-r-md, 22px);
}
.tb-grid-empty a {
	color: inherit;
	text-decoration: underline;
}

/* Page d'un projet : autres projets */
.tb-single-more {
	margin-top: clamp(3rem, 2rem + 3vw, 5rem);
	padding-top: clamp(2rem, 1.5rem + 2vw, 3rem);
	border-top: 1px solid rgba(127, 127, 127, 0.2);
}
.tb-single-more .tb-single-more-title {
	margin: 0 0 24px;
	font-size: clamp(1.5rem, 1.3rem + 0.8vw, 2rem);
}

@media (prefers-reduced-motion: reduce) {
	.tb-gcard.is-new {
		animation: none;
	}
	.tb-gcard,
	.tb-gcard-img,
	.tb-gcard-more::after {
		transition: none;
	}
	.tb-gcard:hover,
	.tb-gcard:hover .tb-gcard-img {
		transform: none;
	}
}
