/* --- BASE & COULEURS DU SITE --- */
.body-portfolio {
  background-color: #D6D9E0 !important;
  color: #2A281D !important;
  font-family: 'Open Sans', sans-serif;
  margin: 0;
  padding: 0;
}

/* --- FIXATION ET STABILISATION DU MENU --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2000;
  background-color: #D6D9E0;
  box-sizing: border-box;
  transition: none;
}

/* --- LOGIQUE DES FILTRES ALIGNÉS À GAUCHE --- */
.filter-wrapper {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  box-sizing: border-box;
}

.filter-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 40px;
}

.filter-item {
  font-family: 'Open Sans', sans-serif;
  font-size: 1.1em;
  font-weight: 300;
  text-transform: uppercase;
  color: #2A281D;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  margin-right: 40px;
  position: relative;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  white-space: nowrap;
}

/* --- NORMALISATION VISUELLE DE TOUS LES CHIFFRES ET NUMÉROS --- */
.custom-num {
  font-family: 'Open Sans', sans-serif;
  font-weight: 300 !important;
  font-size: 0.75em !important;
  opacity: 0.7;
  vertical-align: middle;
  margin-left: 4px;
  display: inline-block;
}

/* Ajustement spécifique pour le numéro de la vidéo */
.video-id.custom-num {
  font-size: 0.85em !important;
  margin-left: 0;
  margin-right: 12px;
  margin-top: 0;
  opacity: 0.6;
  line-height: 1;
}

/* --- ALTERNANCE BILINGUE SANS DÉCALAGE (STRUCTURE DE GRILLE) --- */
.filter-item-text-container,
.video-loc {
  position: relative;
  display: inline-grid !important;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.filter-item .word-fr, .filter-item .word-cat,
.video-loc .word-fr, .video-loc .word-cat {
  grid-column: 1;
  grid-row: 1;
  white-space: nowrap;
  display: inline-block;
  transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
}

.word-fr { animation: alternateLangFR 8s infinite ease-in-out; }
.word-cat { animation: alternateLangCAT 8s infinite ease-in-out; }

@keyframes alternateLangFR {
  0%, 45% { opacity: 1; visibility: visible; }
  50%, 95% { opacity: 0; visibility: hidden; }
  100% { opacity: 1; visibility: visible; }
}

@keyframes alternateLangCAT {
  0%, 45% { opacity: 0; visibility: hidden; }
  50%, 95% { opacity: 1; visibility: visible; }
  100% { opacity: 0; visibility: hidden; }
}

/* --- CROIX DE FILTRE CENTRÉE --- */
.filter-all {
  width: auto;
  margin-right: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
}

.filter-cross {
  position: relative;
  width: 14px;
  height: 14px;
  display: block;
}

.filter-cross::before, .filter-cross::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 1px;
  background-color: #2A281D;
}

.filter-cross::before { transform: translate(-50%, -50%) rotate(45deg); }
.filter-cross::after { transform: translate(-50%, -50%) rotate(-45deg); }

.filter-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background-color: #2A281D;
  transition: width 0.2s ease;
}

.filter-item:hover::after, 
.filter-item.active::after {
  width: 100%;
}

/* --- CARTES VIDÉOS --- */
.video-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: #2A281D;
  width: 100%;
  box-sizing: border-box;
}

.thumb-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #2A281D;
  overflow: hidden;
}

.thumb-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.video-card:hover .thumb-container img {
  opacity: 0.85; 
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(42, 40, 29, 0.85);
  color: #D6D9E0;
  font-size: 0.8em;
  padding: 2px 6px;
  font-weight: 300;
}

.video-meta {
  display: flex;
  margin-top: 3px; /* Rapproché de la vidéo (passé de 8px à 3px) */
  align-items: baseline;
}

.video-details {
  display: flex;
  flex-direction: column;
}

.video-title {
  font-weight: 600;
  font-size: 1em;
  margin: 0;
  line-height: 1.1; /* Léger ajustement pour réduire l'espace au-dessus des lettres */
}

.video-loc {
  font-weight: 300;
  font-size: 0.9em;
  margin: 0;
  opacity: 0.8;
}

/* ==========================================================================
   BREAKPOINTS RESPONSIVES (IDENTIQUES ET STABLES)
   ========================================================================== */
.filter-wrapper {
  margin-top: 75px;
  padding-left: 30px;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 20px;
  padding: 20px 30px 30px 30px;
  box-sizing: border-box;
}

@media (min-width: 768px) and (max-width: 1023px) {
  .filter-wrapper {
    margin-top: 85px;
    padding-left: 40px;
  }
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 20px 40px 40px 40px;
  }
}

@media (min-width: 1024px) and (max-width: 1439px) {
  .filter-wrapper {
    margin-top: 90px;
    padding-left: 12px;
  }
  .portfolio-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 20px 12px 12px 12px;
  }
}

@media (min-width: 1440px) {
  .filter-wrapper {
    margin-top: 100px;
    padding-left: 44px;
  }
  .portfolio-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 20px 44px 44px 44px;
  }
}
@media screen and (max-width: 768px) {
    /* 1. Conteneur principal des filtres aligné aux bordures des images */
    .filter-container,
    .video-filters,
    .filters-nav {
        display: flex !important;
        flex-direction: row !important;
        justify-content: flex-start !important; /* Calé à partir de la gauche */
        align-items: flex-end !important;       /* Aligne TOUS les bas d'éléments sur la même ligne */
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;             /* Aligne le premier élément (X) sur le bord exact de l'image */
        padding-right: 0 !important;
        gap: 0.4rem !important;                 /* Espacement encore plus réduit entre les mots */
        box-sizing: border-box !important;
    }

    /* 2. Styles communs pour harmoniser TOUS les éléments (Mots + X) */
    .filter-btn,
    .filter-item,
    .filter-link,
    .reset-btn,
    .close-btn {
        display: inline-flex !important;
        align-items: flex-end !important;
        justify-content: center !important;
        padding: 0 0.15rem 0.2rem 0.15rem !important; /* Padding très faible pour resserrer et coller au bas */
        margin: 0 !important;
        font-size: 0.85rem !important;
        line-height: 1 !important;                   /* Standardise la hauteur de ligne pour caler les bordures */
        height: auto !important;
        box-sizing: border-box !important;
    }

    /* 3. Soulignements (border-bottom) moins larges */
    /* On applique la bordure uniquement sur le texte/contenu et non sur tout le bloc */
    .filter-btn.active,
    .filter-item.active,
    .filter-link.active,
    .reset-btn,
    .close-btn {
        border-bottom: 1.5px solid currentColor !important; /* Soulignement plus discret */
        display: inline-block !important;                   /* Réduit la largeur du soulignement à la taille exacte du texte */
    }

    /* 4. Alignement strict du "X" à gauche et sur la même ligne de bas */
    .reset-btn,
    .close-btn,
    .filter-btn-reset {
        margin-left: 0 !important;           /* Colle le X complètement à gauche (aligné sur les images) */
        padding-left: 0 !important;          /* Supprime le retrait gauche du X */
        vertical-align: bottom !important;   /* Force l'alignement de la bordure basse avec les mots */
    }
}