/*
==========================================================
  CSTW - MODULE BLOG (UI + FILTRES + LISTE + PAGINATION)
  Objectif : mise en forme du module blog filtrable
==========================================================
*/

/*----------------------------------------------------------
  1) CONTENEUR GLOBAL DU MODULE
  - largeur max + centrage + padding
----------------------------------------------------------*/
.cstw-blog {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

/* Zone top : recherche + catégories (stack vertical) */
.cstw-blog__top {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/*----------------------------------------------------------
  2) BARRE DE RECHERCHE
  - input full width
  - icône positionnée à droite dans l'input
----------------------------------------------------------*/
.cstw-blog__search {
  position: relative; /* nécessaire pour positionner l’icône en absolute */
}

.cstw-blog__search-input {
  width: 50vw;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  outline: none;
  display: block;
  margin: auto;
}

 

/*----------------------------------------------------------
  3) LISTE DES CATÉGORIES (NAV)
  - boutons en ligne, wrap si manque de place
  - état actif souligné
----------------------------------------------------------*/
.cstw-blog__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin: auto;
}

/* Bouton catégorie (par défaut) */
.cstw-cat {
  background: transparent;
  border: 0;
  padding: 8px 6px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .5px;
}

/* État actif : couleur + trait en dessous */
.cstw-cat.is-active {
  color: #ff2d9a;
  position: relative;
}

.cstw-cat.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 2px;
  background: currentColor; /* reprend la couleur du texte */
}

/*----------------------------------------------------------
  4) ZONE DES RÉSULTATS
  - marge au-dessus de la grille d’articles
----------------------------------------------------------*/
.cstw-blog__results {
  margin-top: 18px;
}

/*----------------------------------------------------------
  5) GRILLE DES ARTICLES
  - 3 colonnes desktop
  - 2 colonnes tablette
  - 1 colonne mobile
----------------------------------------------------------*/
.cstw-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* Tablette */
@media (max-width: 900px) {
  .cstw-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile */
@media (max-width: 640px) {
  .cstw-grid {
    grid-template-columns: 1fr;
  }
}

/*----------------------------------------------------------
  CARD (lambda) - style mock
----------------------------------------------------------*/
.cstw-card{
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
article.cstw-card:hover {
    bottom: 3%;
    position: relative;
}

.cstw-card__link{
  display:block;
  text-decoration:none;
  color:inherit;
}

/* Media (image + badge overlay) */
.cstw-card__media{
  position: relative;
  aspect-ratio: 16 / 10;
  background: #f3f3f3;
}

.cstw-card__img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.cstw-card__img--placeholder{
  width:100%;
  height:100%;
  background: linear-gradient(135deg,#f0f0f0,#fafafa);
}

/* Badge catégorie */
.cstw-card__badge{
  position:absolute;
  top: 14px;
  left: 14px;
  background:#ff2d9a;
  color:#fff;
  font-weight:700;
  font-size:13px;
  padding: 6px 10px;
  border-radius: 4px;
}

/* Contenu */
.cstw-card__content{
  padding: 16px 16px 14px;
}

.cstw-card__title {
  margin: 0 0 8px 0;
  font-size: 1.2em;
  line-height: 1.15;
  font-weight: 800;
}

.cstw-card__excerpt{
  margin: 0 0 14px 0;
  font-size: 13px;
  line-height: 1.35;
  opacity: .85;
  max-width: 92%;
}

/* Footer (avatar + dates + logo en bas droite) */
.cstw-card__footer{
  position: relative;
  display:flex;
  align-items:center;
  gap: 10px;
  padding-right: 48px; /* place pour le logo à droite */
}

.cstw-card__avatar{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  display:block;
}

.cstw-card__dates{
  font-size: 13px;
  opacity: .85;
  line-height: 1.2;
}

.cstw-card__brand { 
  width: 2vw; 
}


/*----------------------------------------------------------
  7) ÉTATS (CHARGEMENT / AUCUN RÉSULTAT)
  - bloc “placeholder” lors de l’AJAX ou si aucun article
----------------------------------------------------------*/
.cstw-loading,
.cstw-empty {
  padding: 16px;
  border: 1px dashed #ddd;
  border-radius: 10px;
  opacity: .85;
}

/*----------------------------------------------------------
  8) PAGINATION
  - boutons numérotés
  - état actif visuellement différencié
----------------------------------------------------------*/
.cstw-pagination {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.cstw-page {
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

/* Page active */
.cstw-page.is-active {
  border-color: #000;
  font-weight: 700;
}

/*==========================================================
  FEATURED CARD (style screenshot)
==========================================================*/
.cstw-featured {
  margin-top: 5vh;
  border-radius: 10px;
  overflow: hidden;
  background: #111;
  margin-bottom: 5vh;
}

.cstw-featured__link {
  position: relative;
  display: block;
  min-height: 320px;
  text-decoration: none;
  color: #fff;
}

/* Image en fond */
.cstw-featured__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.cstw-featured__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cstw-featured__img--placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #2a2a2a, #111);
}

/* Overlay sombre (plus dense à gauche comme le screenshot) */
.cstw-featured__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(0,0,0,.70) 0%, rgba(0,0,0,.35) 55%, rgba(0,0,0,.15) 100%);
}

/* Contenu */
.cstw-featured__content {
  position: relative;
  z-index: 2;
  padding: 5%;
  max-width: 860px;
}

/* Badge catégorie */
.cstw-featured__badge {
  display: inline-block;
  background: #ff2d9a;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: 14px;
}

/* Gros titre (responsive) */
.cstw-featured__title {
  margin: 0 0 14px 0;
  font-weight: 800;
  line-height: 1.05;
  font-size: clamp(30px, 4.2vw, 52px);
  color: white;
}

/* Extrait */
.cstw-featured__excerpt {
  margin: 0;
  max-width: 740px;
  opacity: .92;
  font-size: 14px;
  line-height: 1.35;
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
}

/* Flèche à droite */
.cstw-featured__arrow {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  color: #fff;
  opacity: .95;
}

.cstw-featured__link:hover .cstw-featured__arrow {
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
  transition: transform .15s ease, opacity .15s ease;
}

/* Mobile */
@media (max-width: 700px) {
  .cstw-featured__link { min-height: 260px; }
  .cstw-featured__content { padding: 18px 62px 18px 18px; }
  .cstw-featured__arrow { right: 16px; }
}
