/* =============================================
   KM Posts Grid
   ============================================= */

.km-posts-grid {
	--pg-cols: 3;
	--pg-gap: 20px;
	--pg-img-height: 200px;
	--pg-img-opacity: 0.7;
	--pg-img-hover-opacity: 1;
	--pg-img-hover-scale: 1;
	--pg-radius: 10px;
	width: 100%;
}

/* =============================================
   Filterable Tabs
   ============================================= */

/* Wrapper avec flèches */
.km-posts-grid__filters-wrap {
	position: relative;
	margin-bottom: 30px;
}

.km-posts-grid__filters-arrow {
	display: none;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 3;
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 50%;
	background: rgba(200, 200, 200, 0.7);
	cursor: pointer;
	align-items: center;
	justify-content: center;
	color: #494949;
	transition: opacity 0.2s ease;
}

.km-posts-grid__filters-arrow svg {
	display: block;
	width: 21px;
	height: 21px;
	flex-shrink: 0;
}

.km-posts-grid__filters-arrow--prev {
	left: 2px;
}

.km-posts-grid__filters-arrow--next {
	right: 2px;
}

.km-posts-grid__filters-arrow:hover {
	background: rgba(200, 200, 200, 0.7);
}

.km-posts-grid__filters-arrow--hidden {
	opacity: 0;
	pointer-events: none;
}

.km-posts-grid__filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0;
	padding: 12px 0;
	border-top: 1px solid #000;
	border-bottom: 1px solid #000;
}

.km-posts-grid__filter {
	background: none;
	border: none;
	padding: 8px 20px;
	font-family: 'Arca Majora 3', Lato, sans-serif;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #666;
	cursor: pointer;
	transition: color 0.2s ease;
	position: relative;
}

.km-posts-grid__filter:hover,
.km-posts-grid__filter--active {
	color: #262626;
}

.km-posts-grid__filter--active::after {
	content: '';
	position: absolute;
	bottom: -1px;
	left: 0;
	right: 0;
	height: 2px;
	background: #BE9E66;
}

/* =============================================
   Grid
   ============================================= */

.km-posts-grid__grid {
	display: grid;
	grid-template-columns: repeat(var(--pg-cols), 1fr);
	gap: var(--pg-gap);
}

.km-posts-grid__grid--loading {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

/* =============================================
   Card
   ============================================= */

.km-posts-grid__card {
	border-radius: var(--pg-radius);
	overflow: hidden;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	transition: box-shadow 0.3s ease;
}

.km-posts-grid__card:hover {
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.km-posts-grid__card-link {
	display: flex;
	flex-direction: column;
	text-decoration: none !important;
	color: inherit !important;
	height: 100%;
}

/* =============================================
   Image
   ============================================= */

.km-posts-grid__card-img {
	position: relative;
	width: 100%;
	height: var(--pg-img-height);
	overflow: visible;
	border-radius: var(--pg-radius) var(--pg-radius) 0 0;
}

.km-posts-grid__card-img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: var(--pg-radius) var(--pg-radius) 0 0;
	opacity: var(--pg-img-opacity);
	transition: opacity 0.3s ease, transform 0.4s ease;
}

.km-posts-grid__card:hover .km-posts-grid__card-img img {
	opacity: var(--pg-img-hover-opacity);
	transform: scale(var(--pg-img-hover-scale));
}

.km-posts-grid__card-img-placeholder {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #e8e0d4, #d4c9b8);
}

/* Badge catégorie — centré en bas de l'image, chevauche le body */
.km-posts-grid__card-badge {
	position: absolute;
	bottom: 0;
	left: 50%;
	transform: translate(-50%, 50%);
	padding: 6px 16px;
	border-radius: 4px;
	font-family: Lato, sans-serif;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #fff;
	background-color: #494949;
	white-space: nowrap;
	z-index: 2;
}

/* =============================================
   Body
   ============================================= */

.km-posts-grid__card-body {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 20px;
	min-height: 162px;
}

.km-posts-grid__card-date {
	font-family: Lato, sans-serif;
	font-size: 12px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-top: 10px;
	margin-bottom: 8px;
}

.km-posts-grid__card-author {
	font-family: Lato, sans-serif;
	font-size: 12px;
	font-weight: 500;
	color: #999;
	margin-bottom: 4px;
}

.km-posts-grid__card-title {
	font-family: 'Arca Majora 3', Lato, sans-serif;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
	margin: 0;
	text-transform: uppercase;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Espace supplémentaire quand le badge est présent */
.km-posts-grid__card-date:first-child {
	margin-top: 20px;
}

.km-posts-grid__card-title:first-child {
	margin-top: 20px;
}

.km-posts-grid__card-excerpt {
	font-family: Lato, sans-serif;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.6;
	margin: 10px 0 0;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* CTA */
.km-posts-grid__card-cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: Lato, sans-serif;
	font-size: 14px;
	font-weight: 600;
	margin-top: auto;
	padding-top: 12px;
	transition: gap 0.2s ease;
}

.km-posts-grid__card:hover .km-posts-grid__card-cta {
	gap: 10px;
}

.km-posts-grid__card-cta svg {
	transition: transform 0.2s ease;
}

.km-posts-grid__card:hover .km-posts-grid__card-cta svg {
	transform: translateX(3px);
}

/* No results */
.km-posts-grid__no-results {
	text-align: center;
	padding: 40px;
	color: #999;
	font-family: Lato, sans-serif;
	grid-column: 1 / -1;
}

/* =============================================
   Pagination — Sentinel (Infinite Scroll)
   ============================================= */

.km-posts-grid__sentinel {
	display: flex;
	justify-content: center;
	padding: 30px 0;
	width: 100%;
}

.km-posts-grid__sentinel--hidden {
	display: none;
}

.km-posts-grid__spinner {
	width: 32px;
	height: 32px;
	border: 3px solid #e0e0e0;
	border-top-color: #494949;
	border-radius: 50%;
	animation: km-pg-spin 0.7s linear infinite;
}

@keyframes km-pg-spin {
	to { transform: rotate(360deg); }
}

/* =============================================
   Pagination — Load More
   ============================================= */

.km-posts-grid__load-more-wrap {
	display: flex;
	justify-content: center;
	padding: 30px 0;
}

.km-posts-grid__load-more-wrap--hidden {
	display: none;
}

.km-posts-grid__load-more {
	padding: 12px 32px;
	border: 2px solid #262626;
	background: transparent;
	font-family: 'Arca Majora 3', Lato, sans-serif;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #262626;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.km-posts-grid__load-more:hover {
	background: #262626;
	color: #fff;
}

.km-posts-grid__load-more--loading {
	pointer-events: none;
	opacity: 0.6;
}

/* =============================================
   Pagination — Numbers
   ============================================= */

.km-posts-grid__pagination {
	display: flex;
	justify-content: center;
	gap: 6px;
	padding: 30px 0;
}

.km-posts-grid__pagination a,
.km-posts-grid__pagination .current {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 4px;
	font-family: Lato, sans-serif;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.km-posts-grid__pagination a {
	color: #262626;
	background: transparent;
}

.km-posts-grid__pagination a:hover {
	background: #f0f0f0;
}

.km-posts-grid__pagination .current {
	background: #262626;
	color: #fff;
	pointer-events: none;
}

.km-posts-grid__pagination .km-pg-ellipsis {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	font-family: Lato, sans-serif;
	font-size: 14px;
	font-weight: 600;
	color: #999;
	pointer-events: none;
}

/* =============================================
   Responsive — Navigation horizontale
   ============================================= */

@media (max-width: 1267px) {
	.km-posts-grid__filters-wrap {
		margin-bottom: 30px;
	}

	.km-posts-grid__filters-arrow {
		display: flex;
	}

	.km-posts-grid__filters {
		flex-wrap: nowrap;
		overflow-x: auto;
		scroll-behavior: smooth;
		scrollbar-width: none;
		padding-left: 28px;
		padding-right: 28px;
	}

	.km-posts-grid__filters::-webkit-scrollbar {
		display: none;
	}

	.km-posts-grid__filter {
		white-space: nowrap;
		flex-shrink: 0;
	}
}

/* =============================================
   Responsive — Tablette
   ============================================= */

@media (max-width: 1024px) {
	.km-posts-grid {
		--pg-cols: 2 !important;
	}

	.km-posts-grid__card-title {
		font-size: 15px;
	}

	.km-posts-grid__filter {
		padding: 8px 14px;
		font-size: 12px;
	}
}

/* =============================================
   Responsive — Mobile
   ============================================= */

@media (max-width: 768px) {
	.km-posts-grid {
		--pg-cols: 1 !important;
		--pg-gap: 16px;
	}

	.km-posts-grid__card-body {
		padding: 16px;
		min-height: auto;
	}

	.km-posts-grid__card-title {
		font-size: 14px;
	}

	.km-posts-grid__card-excerpt {
		font-size: 13px;
	}

	.km-posts-grid__filters-arrow {
		display: none;
	}

	.km-posts-grid__filters {
		padding-left: 0;
		padding-right: 0;
	}
}
