#custom-toc-container {
  max-height: 290px;
  overflow-y: auto;
}

#custom-toc {
  position: relative;
  background: #fff;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  width: 250px;
  max-width: 100%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

h3#custom-toc-title {
  position: sticky;
  top: 0;
  background: white;
  padding: 5px 4px;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  z-index: 2;
}

ul#custom-toc-list {
  list-style: none;
  padding: 6px !important;
}

.toc-list li {
  padding: 5px 0;
}

#custom-toc-title {
  font-size: 18px;
}

.toc-link {
  text-decoration: none;
  color: #333;
  transition: color 0.3s;
  display: inline-block; /* permet le truncation */
  max-width: 100%; /* ajuste la largeur selon ton design */
  white-space: nowrap; /* force le texte à rester sur une seule ligne */
  overflow: hidden; /* masque le reste */
  text-overflow: ellipsis; /* ajoute ... à la fin si c'est tronqué */
}

.toc-link:hover,
.toc-link.active {
  color: var(--e-global-color-secondary);
  text-decoration: underline;
}

.toc-toggle {
  color: white;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.toc-toggle:hover {
  background: #005f7f;
}

/* Affiche les numéros à chaque H2 */
/* 1️⃣ Initialisation du compteur sur l’élément parent */
#custom-toc-list {
  counter-reset: global-counter; /* Réinitialise le compteur */
}

/* 2️⃣ Incrémentation et affichage du compteur pour chaque .toc-h2 */
.toc-h2::before {
  counter-increment: global-counter; /* Incrémente à chaque occurrence */
  content: counter(global-counter) ". "; /* Affiche la valeur */
  color: var(--e-global-color-secondary);
}

li.toc-h2 {
  display: flex;
  gap: 5px;
}

.toc-h3,
.toc-h4,
.toc-h5,
.toc-h6 {
  padding-left: 20px;
  display: flex;
  gap: 5px;
}

.toc-h3:before,
.toc-h4:before,
.toc-h5:before,
.toc-h6:before {
  content: " - ";
}
/**/

.noneToc {
  display: none !important;
}

.rotateIcon {
  transform: rotate(180deg);
}

.custom-toc-container:after {
  content: "";
  height: 100px;
  width: calc(100% - 18px); /* moins la taille de la barre de scroll */
  background: linear-gradient(
    0deg,
    rgba(255, 255, 255, 1) 18%,
    rgba(255, 255, 255, 0) 88%
  );
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  pointer-events: none;
  user-select: none;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  opacity: 1; /* Visible par défaut */
}

/* Masque le dégradé */
.hide-gradient:after {
  opacity: 0; /* On masque l'effet de dégradé */
}

#custom-toc-container.hide-gradient::after {
  display: none;
}
