/* PIPSTER PRO · SaaS — prise en main du terminal.
   ═══════════════════════════════════════════════════════════════════════════

   Composant NEUF : il ne redéfinit aucun jeton et ne surcharge aucune règle
   du terminal. Il n'écrit que sous ses propres classes `pob-*`, et les deux
   thèmes sortent des jetons existants — donc la peau ogilio, la peau lux et
   le mode clair le suivent sans qu'une seule valeur soit répétée ici.

   ÉTAGES. `--og-tip` est à 1000, la pile de messages à 950, Atlas à 900, les
   fenêtres à 220. La visite recouvre TOUT cela (8000) parce qu'elle est
   modale ; la checklist passe SOUS Atlas (880), parce qu'Atlas ouvre sur le
   même bord et doit garder son côté. L'écran de compte requis (9500) et les
   fenêtres d'abonnement (9000) restent au-dessus de la visite : ce sont des
   portes, et une porte gagne toujours. */

/* ═══ 1. LA VISITE ═════════════════════════════════════════════════════ */

.pob-veil {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: transparent;   /* le trou est peint par l'anneau, pas par le voile */
  cursor: default;
}

/* ─── LE PLACEMENT N'EST JAMAIS ANIMÉ ─────────────────────────────────────
   L'anneau et la bulle sont posés en `top`/`left`, et SEULE l'opacité est en
   transition. C'est une règle, pas une préférence : tant que la position
   voyageait dans un `transform` animé, elle n'arrivait qu'à la fin de
   l'animation — et une animation peut ne jamais avancer. Mesuré sur le banc,
   dans un onglet non rendu : l'horloge d'animation est gelée, la bulle est
   restée au coin supérieur gauche avec son texte juste et sa place fausse.
   Un mouvement raté doit coûter un mouvement, pas une position. */

/* L'ANNEAU EST LE VOILE. Son ombre portée déborde de 9999 px : c'est elle qui
   assombrit l'écran, et le rectangle de l'anneau reste clair. Un vrai trou,
   sans quatre rectangles à tenir alignés. */
.pob-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 8001;
  border-radius: 10px;
  pointer-events: none;
  box-shadow:
    0 0 0 2px var(--accent),
    0 0 0 9999px rgb(var(--shade, 0 0 0) / .66);
  opacity: 0;
  transition: opacity .18s ease;
}
.pob-ring.on { opacity: 1; }

.pob-bubble {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 8002;
  width: min(340px, calc(100vw - 32px));
  padding: 14px 16px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgb(var(--shade, 0 0 0) / .45);
  color: var(--text);
  opacity: 0;
  /* L'entrée se joue sur un décalage de 4 px RELATIF à la place déjà tenue :
     le `transform` ne porte plus la position, il ne porte que le mouvement. */
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s cubic-bezier(.2, .8, .2, 1);
}
.pob-bubble.on { opacity: 1; transform: translateY(0); }

.pob-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.pob-count {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-3);
  /* « 1 / 7 » se lit « 7 / 1 » en arabe sans cette ligne : deux nombres et un
     séparateur neutre, c'est le cas d'école du réordonnancement bidi. */
  unicode-bidi: plaintext;
}

.pob-x {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}
.pob-x:hover { background: rgb(var(--veil) / .08); color: var(--text); }
.pob-x svg { width: 15px; height: 15px; }
.pob-x.small svg { width: 13px; height: 13px; }

.pob-h {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--text);
}
.pob-p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2);
}

.pob-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}
.pob-dots { display: flex; gap: 5px; }
.pob-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background .2s ease, width .2s ease;
}
.pob-dot.past { background: var(--text-3); }
.pob-dot.on { width: 14px; border-radius: 3px; background: var(--accent); }

.pob-acts { display: flex; gap: 8px; }
.pob-btn {
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.pob-btn:hover { filter: brightness(1.08); }
.pob-btn.ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-2);
}
.pob-btn.ghost:hover { background: rgb(var(--veil) / .06); color: var(--text); }
.pob-btn:focus-visible,
.pob-x:focus-visible,
.pob-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Pendant la visite, rien d'autre ne se survole : le curseur ne doit pas
   promettre une commande que le voile intercepte. */
.pob-on { cursor: default; }

/* ═══ 2. LA CHECKLIST ══════════════════════════════════════════════════ */

.pob-cl {
  position: fixed;
  bottom: 16px;
  inset-inline-end: 16px;
  z-index: 880;                /* sous Atlas : il ouvre sur le même bord */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
[dir="rtl"] .pob-cl { align-items: flex-start; }

/* LA PILE DE MESSAGES MONTE D'AUTANT. Les deux occupent le même coin ; la
   pastille est du mobilier permanent, les messages sont de passage — c'est
   donc au passage de se décaler. La règle ne vit que tant que la checklist
   existe, et disparaît avec elle. */
.pob-has-cl body #toastStack,
html.pob-has-cl body #toastStack { bottom: 66px; }

.pob-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 14px 0 7px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(var(--shade, 0 0 0) / .32);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
[dir="rtl"] .pob-pill { padding: 0 7px 0 14px; }
.pob-pill:hover { border-color: var(--accent); }

/* L'avancement se VOIT avant de se lire : un arc, puis le compte au centre. */
.pob-ringp {
  position: relative;
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p, 0) * 360deg), var(--border) 0);
}
.pob-ringp::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--surface);
}
.pob-ringp-n {
  position: relative;
  z-index: 1;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-2);
  unicode-bidi: plaintext;      /* « 2/5 » ne s'inverse pas en arabe */
}

.pob-card {
  width: min(300px, calc(100vw - 32px));
  padding: 14px 14px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgb(var(--shade, 0 0 0) / .42);
  /* La carte s'ouvre AU-DESSUS de la pastille : elle est déclarée avant elle
     dans le flux, l'ordre visuel les remet dans le bon sens. */
  order: -1;
}
.pob-card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.pob-card-p {
  margin: 4px 0 10px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-3);
}

.pob-items { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.pob-item-b {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  text-align: start;
  cursor: pointer;
}
.pob-item-b:hover { background: rgb(var(--veil) / .06); color: var(--text); }
.pob-tick {
  flex: none;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  color: transparent;
}
.pob-tick svg { width: 11px; height: 11px; }
.pob-item.is-done .pob-tick {
  border-color: var(--up);
  background: var(--up);
  color: var(--surface);
}
.pob-item.is-done .pob-item-t {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}

.pob-card-f { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.pob-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.pob-link:hover { text-decoration: underline; }

/* Tout coché : la pastille le DIT le temps de partir. Disparaître sans rien
   dire laisserait croire à une disparition accidentelle. */
.pob-cl.is-complete .pob-pill { border-color: var(--up); color: var(--up); }
.pob-cl.is-complete .pob-ringp { background: var(--up); }
.pob-cl.is-complete .pob-ringp-n { color: var(--up); }

@keyframes pob-pulse {
  0%, 100% { transform: scale(1); }
  40%      { transform: scale(1.06); }
}
.pob-pulse .pob-pill { animation: pob-pulse .9s ease 2; }

/* ═══ 3. CE QUE LES PRÉFÉRENCES SYSTÈME IMPOSENT ═══════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .pob-ring { transition: none; }
  /* On coupe le mouvement, pas la place : le décalage d'entrée est remis à
     zéro ici même, sinon la bulle resterait 4 px plus bas pour toujours. */
  .pob-bubble { transition: none; transform: translateY(0); }
  .pob-pulse .pob-pill { animation: none; }
}

/* Sur un écran étroit la visite ne se joue pas (le script s'en charge), mais
   la checklist reste — repliée sur sa pastille, et sa carte prend la largeur
   disponible plutôt que de déborder. */
@media (max-width: 480px) {
  .pob-cl { bottom: 12px; inset-inline-end: 12px; inset-inline-start: 12px; align-items: stretch; }
  .pob-pill { align-self: flex-end; }
  [dir="rtl"] .pob-pill { align-self: flex-start; }
  .pob-card { width: auto; }
}
