/* Off-canvas filter styles */
.off-canvas-filter {
  position: fixed;
  top: 0;
  right: -300px; /* Positionne en dehors de l'écran */
  width: 300px;
  height: 100%;
  background-color: #fff;
  box-shadow: -2px 0 115px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  z-index: 9999;
  padding: 0;
  display: flex;
  align-items: center;
}

.logged-in .off-canvas-filter {
  top: 32px;
}

.off-canvas-filter.active {
  transform: translateX(-300px); /* Slide-in à partir de la droite */
}

.filter-toggle {
  display: inline-block;
  /* margin: 20px; */
  padding: 10px 20px;
  cursor: pointer;
  /* background-color: #fff; */
  color: #000;
  border: none;
  position: fixed !important;
  z-index: 9999;
  top: 50%;
  right: 0;
  transform: rotate(90deg) !important;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 1em;
}

.filter-close {
  display: inline-block;
  margin-bottom: 20px;
  padding: 5px 10px;
  cursor: pointer;
  /* background-color: #333; */
  /* color: #fff; */
  border: none;
}

.filter-close img {
  display: block;
  position: relative;
  width: 32px;
  height: 32px;
  object-fit: contain;
  object-position: center;
}

.projects-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 80px;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  /* flex-direction: column; */
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 0;
}

/* Ensure .project-item covers the entire area */
.project-item {
  position: relative;
  overflow: hidden;
}

/* Ensure the link covers the entire .project-item */
.project-item a {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

/* Titles styling */
h3.title-big,
h4.title-small {
  position: relative;
  overflow: hidden;
  color: #fff;
  opacity: 0; /* Start with opacity 0 */
  transition: opacity 0.5s ease;
  margin: 0;

  z-index: 1; /* Ensure text is above the pseudo-element */
  line-height: 1em;
  text-align: center;
  text-transform: uppercase;
}

h3.title-big {
  padding: 15px 40px 10px;
}

h4.title-small {
  padding: 15px 40px 10px;
}

/* Pseudo-elements for the background */
h3.title-big::before,
h4.title-small::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0%; /* Start with width 0% */
  height: 100%;
  transition: width 0.6s ease-in-out;
  z-index: -1; /* Behind the text */
  pointer-events: none; /* So it doesn't block hover events */
}

h3.title-big::before {
  background-color: #000;
}

h4.title-small::before {
  background-color: #000;
}

/* On hover, expand the background and show the text */
.project-item:hover h3.title-big::before,
.project-item:hover h4.title-small::before {
  width: 100%;
}

.project-item:hover h3.title-big,
.project-item:hover h4.title-small {
  opacity: 1; /* Make text visible */
  text-align: center;
}

/* Ensure overlay doesn't block hover events */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

h3.title-big {
  font-size: 2em;
  font-weight: bold;
}

h4.title-small {
  font-size: 2em;
}

.overlay:hover h3.title-big,
.overlay:hover h4.title-small {
  opacity: 1;
  transition: all 0.6s ease-in-out;
}

.small-big,
.big-big,
.big-small {
  display: flex;
  gap: 220px;
  align-items: center;
}

.media-item.small {
  flex: 1;
}

.media-item.big {
  flex: 1.5;
}

/* template four */

.four.project-thumbnail {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 220px;
}

.four .media-item {
  position: relative;
  /* width: 50%; */

  height: 100%; /* Ajuste la hauteur */
  overflow: hidden;
}

.four .media-item.video {
  position: relative;
  background: transparent; /* Couleur de fond par défaut */
  width: 100%; /* La largeur s'adapte au parent */
  max-width: 900px; /* Largeur maximale */
  aspect-ratio: 16 / 9; /* Respecte le ratio 16:9 */
  margin: 0 auto; /* Centre horizontalement */
  overflow: hidden;
}

.four .media-item.video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Assure que la vidéo remplit tout l'espace */
  pointer-events: none; /* Empêche l'interaction avec la vidéo */
  z-index: 0 !important;
}

.four .media-item.image {
  flex: 1;
}

.four .media-item.video {
  flex: 2;
}

/* category buttons */

/* Style initial du bouton */
button.filter-button {
  position: relative;
  display: inline-block;
  /* padding: 10px 20px; */
  font-size: 14px;
  font-weight: bold;
  color: #000; /* Couleur du texte noir */
  background: transparent; /* Pas de fond initial */
  overflow: hidden; /* Nécessaire pour limiter l'animation à l'intérieur */
  cursor: pointer;
  transition: color 0.3s ease; /* Transition douce pour la couleur du texte */
}

/* Fond animé au survol */
button.filter-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0; /* Départ de la largeur à 0 */
  height: 100%;
  background-color: #000; /* Couleur de fond noir */
  z-index: -1; /* Positionne le fond derrière le texte */
  transition: width 0.4s ease; /* Transition pour l'animation de fond */
}

/* Changement de couleur et animation de fond au survol */
button.filter-button:hover {
  color: #fff; /* Texte devient blanc */
}

button.filter-button:hover::before {
  width: 100%; /* Le fond noir s'étend sur toute la largeur */
}

button.filter-button.active {
  background-color: #000;
  color: #fff;
}

/* Suppression de l'apparence par défaut d'un bouton */
button.filter-button {
  border-radius: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

@media (max-width: 1064px) {
  .projects-list {
    gap: 40px;
  }

  .template .media-item:nth-child(2) {
    display: none;
  }

  .overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  h3.title-big::before,
  h4.title-small::before {
    width: 100%;
  }

  h3.title-big,
  h4.title-small {
    opacity: 1;
    font-size: 1em;
  }
}
