/* ===== Grille principale ===== */
.ApiGrid .cpg-posts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  justify-items: center;
}

/* ===== Cartes ===== */
.ApiGrid .cpg-post {
  display: flex;
  flex-direction: column;
  border: 15px solid #d35400;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  background: #fff;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  width: 100%;
  max-width: 320px; /* largeur max */
  height: auto;
}

/* Inclinaison légère pour effet “jeu de cartes” */
.ApiGrid .cpg-post:nth-child(6n+1) { transform: rotate(-2deg); }
.ApiGrid .cpg-post:nth-child(6n+2) { transform: rotate(1deg); }
.ApiGrid .cpg-post:nth-child(6n+3) { transform: rotate(-1deg); }
.ApiGrid .cpg-post:nth-child(6n+4) { transform: rotate(2deg); }
.ApiGrid .cpg-post:nth-child(6n+5) { transform: rotate(-3deg); }
.ApiGrid .cpg-post:nth-child(6n+6) { transform: rotate(3deg); }

.ApiGrid .cpg-post:hover {
  transform: rotate(0deg) translateY(-6px);
  box-shadow: 0 0 25px rgba(241,196,15,0.7);
}

/* ===== Images ===== */
.ApiGrid .cpg-post img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  max-height: 180px; /* limite la hauteur pour éviter les cartes géantes */
  transition: transform 0.3s ease;
}

.ApiGrid .cpg-post:hover img {
  transform: scale(1.05);
}

/* ===== Titre ===== */
.ApiGrid .cpg-post h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 12px;
  line-height: 1.4;
}

.ApiGrid .cpg-post h3 a {
  text-decoration: none;
  color: #222;
  transition: color 0.2s ease;
}

.ApiGrid .cpg-post h3 a:hover {
  color: #d35400;
}

/* ===== Bouton “Lire la suite” ===== */
.ApiGrid .cpg-post .cpg-cta {
  margin-top: auto;
  display: flex;
  justify-content: center;
  padding: 16px;
}

.ApiGrid .cpg-post .cpg-cta a {
  display: block;
  width: 100%;
  text-align: center;
  background-color: #d35400;
  color: #fff !important;
  text-decoration: none;
  padding: 15px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 1.2rem;
  transform: rotate(-3deg);
  transition: all 0.3s ease;
}

.ApiGrid .cpg-post .cpg-cta a:hover {
  transform: rotate(0deg);
  box-shadow: 0 0 12px rgba(241,196,15,0.7);
}

/* ===== Boutons tags ===== */
.ApiGrid #cpg-filters {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ApiGrid .cpg-tag-btn {
  background-color: #d35400;
  color: #fff !important;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: bold;
  font-size: 1.1rem;
  cursor: pointer;
  transform: rotate(-3deg);
  transition: all 0.3s ease;
}

.ApiGrid .cpg-tag-btn:hover,
.ApiGrid .cpg-tag-btn.active {
  transform: rotate(0deg);
  box-shadow: 0 0 12px rgba(241,196,15,0.7);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .ApiGrid .cpg-posts {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 480px) {
  .ApiGrid .cpg-posts {
    grid-template-columns: 1fr;
  }
  .ApiGrid .cpg-tag-btn,
  .ApiGrid .cpg-post .cpg-cta a {
    padding: 8px 12px;
    font-size: 1rem;
  }
}
