/* ─── Ampoule d'aide « Comprendre cet outil » ────────────────────────────────
   Bouton rond en haut à droite de l'en-tête d'un outil, qui reprend l'ampoule
   du tableau de bord. Au clic, il ouvre un encart d'explication : le texte qui
   figurait auparavant sous le titre pour présenter l'outil.

   Balisage attendu :
     <main class="… tool-has-help">
       <button type="button" class="help-bulb" aria-label="Comprendre cet outil">…svg ampoule…</button>
       … eyebrow / titre …
       <div class="help-pop" hidden>
         <div class="help-pop__label">…svg ampoule… Comprendre cet outil</div>
         <p>… explication …</p>
       </div>
   Le comportement (ouverture/fermeture) est géré par help-bulb.js. */

.tool-has-help { position: relative; }

.help-bulb {
  position: absolute; top: 20px; right: 24px; z-index: 12;
  width: 40px; height: 40px; display: grid; place-items: center; padding: 0;
  border-radius: 50%; background: #000; border: 1.5px solid rgba(255, 255, 255, 0.7);
  color: #fff; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, transform .12s;
}
.help-bulb:hover { border-color: #fff; background: #1a1a1a; }
.help-bulb:focus-visible { outline: none; border-color: #fff; }
.help-bulb:active { transform: scale(.94); }
.help-bulb.is-open { border-color: #fde68a; color: #fde68a; background: #1a1a1a; }
.help-bulb svg {
  width: 20px; height: 20px; display: block; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; pointer-events: none;
}

.help-pop {
  position: absolute; top: 68px; right: 24px; z-index: 30;
  width: min(380px, calc(100vw - 40px));
  background: var(--t-elevated); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 16px;
  padding: 16px 20px 18px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.82); font-size: 14px; line-height: 1.6;
  animation: helpPopIn .16s ease;
}
.help-pop[hidden] { display: none; }
.help-pop p { margin: 0; }
.help-pop p + p { margin-top: 10px; }
.help-pop b, .help-pop strong { color: #fff; }
.help-pop__label {
  font-family: 'Archivo', sans-serif; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.5);
  margin-bottom: 10px; display: flex; align-items: center; gap: 7px;
}
.help-pop__label svg {
  width: 15px; height: 15px; display: block; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}

/* En mode clair, reprendre exactement le traitement de l'outil Avocat :
   ampoule posée sur le papier, icône sombre et panneau d'aide clair. Les
   styles sombres ci-dessus restent la référence en data-theme="dark". */
:root[data-theme="paper"] .help-bulb {
  background: var(--t-bg);
  border-color: rgba(0, 0, 0, 0.5);
  color: #141414;
}
:root[data-theme="paper"] .help-bulb:hover,
:root[data-theme="paper"] .help-bulb:focus-visible,
:root[data-theme="paper"] .help-bulb.is-open {
  border-color: #141414;
  color: #141414;
  background: #efece6;
}
:root[data-theme="paper"] .help-pop {
  background: var(--t-card);
  border-color: var(--t-divider);
  color: var(--t-on-bg-80);
  box-shadow: var(--t-elevated-shadow);
}
:root[data-theme="paper"] .help-pop b,
:root[data-theme="paper"] .help-pop strong { color: var(--t-on-bg); }
:root[data-theme="paper"] .help-pop__label { color: var(--t-on-bg-faint); }

/* ─── Variante en ligne, posée à côté d'un titre de carte ────────────────────
   Ampoule plus petite, dans le flux du titre, et encart qui pousse le contenu
   au lieu de le survoler — pour une aide qui vit à l'intérieur d'une carte.

   Balisage attendu :
     <div class="help-bulb-row">
       <h3 …>…</h3>
       <button type="button" class="help-bulb help-bulb--inline"
               data-help-target="#help-x" aria-label="…">…svg…</button>
     </div>
     <div class="help-pop help-pop--inline" id="help-x" hidden> … </div>

   Les cartes restent blanches dans les deux thèmes (--t-card vaut #fff partout),
   donc cette variante garde un traitement clair quel que soit le thème. D'où le
   préfixe :root[data-theme] : sans lui, le bloc « paper » ci-dessus, plus
   spécifique, reprendrait la main en mode clair. */
.help-bulb-row { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.help-bulb-row > :first-child { margin: 0; }

:root[data-theme] .help-bulb--inline {
  position: static; flex: none; width: 26px; height: 26px;
  background: #fff; border-color: rgba(8, 9, 12, 0.22); color: #08090c;
}
:root[data-theme] .help-bulb--inline:hover,
:root[data-theme] .help-bulb--inline:focus-visible,
:root[data-theme] .help-bulb--inline.is-open {
  background: #f4f2ee; border-color: #08090c; color: #08090c;
}
:root[data-theme] .help-bulb--inline svg { width: 15px; height: 15px; }

:root[data-theme] .help-pop--inline {
  position: static; width: auto; margin: 14px 0 0; padding: 15px 18px 17px;
  background: #f4f2ee; border: 1px solid rgba(8, 9, 12, 0.1); border-radius: 12px;
  box-shadow: none; color: #4b4b57;
}
:root[data-theme] .help-pop--inline .help-pop__label { color: #6b6b78; }
:root[data-theme] .help-pop--inline b,
:root[data-theme] .help-pop--inline strong { color: #08090c; }

/* Étapes numérotées de l'encart. */
.help-steps { margin: 0; padding: 0; list-style: none; counter-reset: help-step; }
.help-steps li {
  counter-increment: help-step; position: relative; padding-left: 30px;
}
.help-steps li + li { margin-top: 11px; }
.help-steps li::before {
  content: counter(help-step);
  position: absolute; left: 0; top: 1px;
  width: 20px; height: 20px; display: grid; place-items: center;
  border-radius: 50%; background: #08090c; color: #fff;
  font-family: 'Archivo', sans-serif; font-size: 11px; font-weight: 700; line-height: 1;
}
.help-pop__note {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(8, 9, 12, 0.1);
  font-size: 13px; line-height: 1.55;
}

@keyframes helpPopIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .help-bulb { top: 16px; right: 14px; width: 36px; height: 36px; }
  .help-bulb svg { width: 18px; height: 18px; }
  .help-pop { top: 60px; right: 14px; }
}
