/* Glossaire Tooltips — v1.5.1 */

.gt-term {
  position: relative;
  display: inline-block;
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  color: var(--gt-link-color, #c24047);
}
.gt-term .gt-label { color: inherit; }

.gt-term > .gt-tip {
  position: absolute !important;
  display: inline-block !important;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 9999;

  background: var(--gt-bg-color, #ffffff);
  color: var(--gt-text-color, #c24047); /* base */
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
  padding: 6px 10px;
  border-radius: 6px;

  font-size: 0.95em;
  line-height: 1.35;

  white-space: normal !important;
  width: auto !important;
  max-width: 500px !important;
  word-break: break-word;
  overflow-wrap: normal;

  transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
}

/* Couleur forcée (boîte + descendants) */
.gt-term > .gt-tip,
.gt-term > .gt-tip * {
  color: var(--gt-text-color, #c24047) !important;
}
.gt-term > .gt-tip a { color: inherit !important; text-decoration: underline; }

/* <br> visibles */
.gt-term > .gt-tip br { display: inline !important; }

/* Position */
.gt-term[data-gt-pos="right"]  > .gt-tip { top: 50%; left: 100%; transform: translate(4px, -50%); }
.gt-term[data-gt-pos="left"]   > .gt-tip { top: 50%; right: 100%; transform: translate(-4px, -50%); }
.gt-term[data-gt-pos="top"]    > .gt-tip { bottom: 100%; left: 50%; transform: translate(-50%, -4px); }
.gt-term[data-gt-pos="bottom"] > .gt-tip { top: 100%; left: 50%; transform: translate(-50%, 4px); }

.gt-term:hover > .gt-tip,
.gt-term:focus-within > .gt-tip {
  opacity: 1;
  visibility: visible;
  transition: opacity .15s ease, transform .15s ease, visibility 0s;
}

.gt-term[data-gt-pos="right"]:hover  > .gt-tip,
.gt-term[data-gt-pos="right"]:focus-within  > .gt-tip { transform: translate(8px, -50%); }
.gt-term[data-gt-pos="left"]:hover   > .gt-tip,
.gt-term[data-gt-pos="left"]:focus-within   > .gt-tip { transform: translate(-8px, -50%); }
.gt-term[data-gt-pos="top"]:hover    > .gt-tip,
.gt-term[data-gt-pos="top"]:focus-within    > .gt-tip { transform: translate(-50%, -8px); }
.gt-term[data-gt-pos="bottom"]:hover > .gt-tip,
.gt-term[data-gt-pos="bottom"]:focus-within > .gt-tip { transform: translate(-50%, 8px); }

.gt-term > .gt-tip::after {
  content: "";
  position: absolute;
  border-style: solid;
}
.gt-term[data-gt-pos="right"]  > .gt-tip::after { top:50%; left:-6px;  transform:translateY(-50%); border-width:6px; border-color:transparent var(--gt-bg-color,#fff) transparent transparent; }
.gt-term[data-gt-pos="left"]   > .gt-tip::after { top:50%; right:-6px; transform:translateY(-50%); border-width:6px; border-color:transparent transparent transparent var(--gt-bg-color,#fff); }
.gt-term[data-gt-pos="top"]    > .gt-tip::after { left:50%; bottom:-6px; transform:translateX(-50%); border-width:6px; border-color:var(--gt-bg-color,#fff) transparent transparent transparent; }
.gt-term[data-gt-pos="bottom"] > .gt-tip::after { left:50%; top:-6px;    transform:translateX(-50%); border-width:6px; border-color:transparent transparent var(--gt-bg-color,#fff) transparent; }

/* Anti-conflits hérités */
.gt-term .gt-tip {
  display: inline-block !important;
  white-space: normal !important;
  width: auto !important;
  max-width: 500px !important;
  align-items: normal !important;
  gap: 0 !important;
  flex: none !important;
}
.gt-term .gt-tip br { display: inline !important; }

/* Patch anti-"barre verticale" */
.gt-term > .gt-tip {
  min-width: 220px;                  /* empêche l’écrasement */
  max-width: clamp(280px, 42vw, 520px);
  white-space: normal !important;    /* texte sur lignes normales */
  word-break: normal;                /* ne coupe pas chaque lettre */
  overflow-wrap: anywhere;           /* autorise la césure propre */
  writing-mode: horizontal-tb;       /* anti-héritage vertical */
  display: inline-block !important;  /* garde la boîte correcte */
}

/* Sécurité mobile : prend l’espace utile sans devenir trop étroit */
@media (max-width: 600px) {
  .gt-term > .gt-tip {
    min-width: 60vw;
    max-width: 92vw;
  }
}

/* Couleur blindée pour la boîte et tout son contenu */
.gt-term > .gt-tip,
.gt-term > .gt-tip * {
  color: var(--gt-text-color, #111827) !important;
}

.gt-term > .gt-tip {
  background: var(--gt-bg-color, #ffffff);
  border: 1px solid rgba(0,0,0,.08);
}
