/* Lyrge — assistant « Une question ? » des pages intérieures (l’accueil a le sien dans v4.css).
   Bulle en bas à droite (lien WhatsApp sans JavaScript), panneau de conversation, plein écran sur téléphone.
   Comportement : /components/assistant.js. Réponses : /api/ia/question (api/src/ia.php). */
.ask, .assist { --ink-2: rgb(8 18 15 / .66); --ink-3: rgb(8 18 15 / .5); --line: rgb(8 18 15 / .09); --line-2: rgb(8 18 15 / .14); }
.ask {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 40;
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .35rem 1.1rem .35rem .35rem;
  border-radius: 999px;
  background: var(--green);
  color: var(--ivory);
  font-size: .9375rem; font-weight: 600;
  box-shadow: 0 14px 30px -10px rgb(5 42 31 / .6);
  transition: transform .3s var(--ease-out), background-color .2s;
}
.ask:hover { transform: translateY(-2px); background: var(--green-hover); }
.ask.is-hidden { opacity: 0; transform: translateY(1rem); pointer-events: none; }
.ask { transition: transform .3s var(--ease-out), background-color .2s, opacity .3s; }
.ask__face { position: relative; }
.ask__face img { width: 2.4rem; height: 2.4rem; border-radius: 50%; object-fit: cover; border: 2px solid var(--mint); }
.ask__face::after { content: ""; position: absolute; right: 0; bottom: 0; width: .65rem; height: .65rem; border-radius: 50%; background: #4ade80; border: 2px solid var(--green); }
html.assist-open .ask { opacity: 0; transform: translateY(1rem); pointer-events: none; }
.assist {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 60;
  display: flex; flex-direction: column;
  width: min(23.5rem, calc(100vw - 2.5rem));
  height: min(36rem, calc(100vh - 6rem));
  border-radius: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgb(7 61 45 / .08), 0 40px 90px -30px rgb(7 61 45 / .55);
  overflow: hidden;
  animation: assist-in .35s var(--ease-out);
}
.assist__head { display: flex; align-items: center; gap: .7rem; padding: .85rem .9rem; border-bottom: 1px solid var(--line); background: var(--ivory-raised); }
.assist__head .ask__face::after { border-color: var(--ivory-raised); }
.assist__who { min-width: 0; }
.assist__who strong { display: block; font-size: .9375rem; }
.assist__who small { display: block; font-size: .75rem; color: var(--ink-3); }
.assist__close { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; margin-left: auto; border-radius: 50%; color: var(--ink-2); transition: background-color .2s; }
.assist__close:hover { background: rgb(7 61 45 / .06); }
.assist__log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; padding: 1rem .9rem; overscroll-behavior: contain; }
.msg { max-width: 88%; font-size: .875rem; line-height: 1.55; }
.msg p { white-space: pre-line; }
.msg--ai { align-self: flex-start; padding: .65rem .85rem; border-radius: 4px 16px 16px 16px; background: var(--ivory); }
.msg--me { align-self: flex-end; padding: .55rem .8rem; border-radius: 16px 16px 4px 16px; background: var(--green); color: var(--ivory); }
.msg.is-writing p:empty::before { content: "L’assistant écrit"; color: var(--ink-3); }
.assist__chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 .9rem .75rem; }
.assist__chips button { padding: .4rem .7rem; border-radius: 999px; font-size: .8125rem; background: var(--mint-soft); color: var(--green-ink); transition: background-color .2s; }
.assist__chips button:hover { background: #cdeedd; }
.assist__form { display: flex; align-items: flex-end; gap: .5rem; margin: 0 .75rem; padding: .45rem .45rem .45rem .8rem; border-radius: 16px; border: 1px solid var(--line-2); background: var(--paper); }
.assist__form:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgb(47 143 104 / .15); }
.assist__form textarea { flex: 1; min-height: 1.5rem; max-height: 120px; padding: .3rem 0; border: 0; resize: none; font: inherit; font-size: .9375rem; line-height: 1.45; background: transparent; color: var(--ink); }
.assist__form textarea:focus { outline: none; }
.assist__send { display: grid; place-items: center; flex: none; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--green); color: var(--mint); transition: background-color .2s, opacity .2s; }
.assist__send:hover { background: var(--green-hover); }
.assist__send:disabled { opacity: .5; cursor: progress; }
.assist__send .icon { width: 1rem; height: 1rem; stroke-width: 2.25; }
.assist__foot { padding: .6rem .9rem .8rem; font-size: .6875rem; line-height: 1.5; color: var(--ink-3); }
.assist__foot a { color: var(--green-ink); text-decoration: underline; text-underline-offset: 2px; }
.msg.is-writing p::after { content: ""; display: inline-block; width: .45em; height: .95em; margin-left: 2px; vertical-align: -.1em; border-radius: 2px; background: #2f8f68; animation: assist-caret 1s steps(1) infinite; }
.ask .icon, .assist .icon { width: 1.125rem; height: 1.125rem; }
.sticky-cta__icon[data-assist-open][hidden] { display: none; }
@media (max-width: 640px) {
  .ask { display: none; }
  .assist { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; padding-bottom: env(safe-area-inset-bottom); }
  html.assist-open .sticky-cta { display: none; }
}
@keyframes assist-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes assist-caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .assist, .msg.is-writing p::after { animation: none; } }
