/* Widget Anthony — brehmer.fr. Autonome (aucune dépendance au thème). */
.anthony {
  --a-ink: #1a1a1a;
  --a-ink-soft: #5b5b5b;
  --a-bg: #ffffff;
  --a-bg-soft: #f4f2ef;
  --a-line: #e4e0da;
  --a-accent: #1a1a1a;
  --a-radius: 14px;
  position: fixed;
  right: 20px;
  bottom: 16px;
  z-index: 9990;
  font-family: inherit;
  color: var(--a-ink);
}
.anthony *, .anthony *::before, .anthony *::after { box-sizing: border-box; }
.anthony__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --- Lanceur : Anthony en 3D, en bas à droite --- */
.anthony__launcher {
  display: flex; align-items: flex-end; gap: 8px;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.anthony__figure {
  position: relative; width: 120px; height: 120px; flex: none;
  animation: anthony-float 4.5s ease-in-out infinite;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.22));
  transition: transform .25s ease;
}
.anthony__figure::after { /* ombre au sol */
  content: ""; position: absolute; left: 22%; right: 22%; bottom: -6px; height: 10px;
  background: radial-gradient(closest-side, rgba(0,0,0,.25), transparent);
  animation: anthony-shadow 4.5s ease-in-out infinite;
}
.anthony__avatar { width: 100%; height: 100%; object-fit: contain; display: block; }
.anthony__launcher:hover .anthony__figure,
.anthony__launcher:focus-visible .anthony__figure { transform: scale(1.06) rotate(-2deg); }
.anthony__launcher:focus-visible { outline: 3px solid #b8860b; outline-offset: 4px; border-radius: 12px; }

.anthony__bubble {
  margin-bottom: 70px; padding: 9px 13px; max-width: 190px;
  background: var(--a-bg); border: 1px solid var(--a-line); border-radius: 14px 14px 4px 14px;
  font-size: 14px; line-height: 1.3; font-weight: 600; text-align: left;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
  animation: anthony-pop .4s 1.2s both cubic-bezier(.2,1.4,.4,1);
}
.anthony[data-state="open"] .anthony__bubble,
.anthony[data-bubble="off"] .anthony__bubble { display: none; }

@keyframes anthony-float { 0%,100% { translate: 0 0; } 50% { translate: 0 -7px; } }
@keyframes anthony-shadow { 0%,100% { opacity: 1; scale: 1; } 50% { opacity: .6; scale: .85; } }
@keyframes anthony-pop { from { opacity: 0; transform: translateY(8px) scale(.9); } to { opacity: 1; transform: none; } }

/* --- Fenêtre de discussion --- */
.anthony__panel {
  position: absolute; right: 0; bottom: 132px;
  width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 170px));
  display: flex; flex-direction: column;
  background: var(--a-bg); border: 1px solid var(--a-line); border-radius: var(--a-radius);
  box-shadow: 0 18px 50px rgba(0,0,0,.2);
  overflow: hidden;
  animation: anthony-open .22s ease-out;
}
.anthony__panel[hidden] { display: none; }
@keyframes anthony-open { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.anthony__head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--a-ink); color: #fff;
}
.anthony__head-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: top; background: #fff; }
.anthony__name { margin: 0; font-weight: 700; font-size: 15px; color: #fff; }
.anthony__role { margin: 0; font-size: 12px; opacity: .75; color: #fff; }
.anthony__close { margin-left: auto; background: none; border: 0; color: #fff; cursor: pointer; padding: 6px; border-radius: 8px; display: flex; }
.anthony__close:hover { background: rgba(255,255,255,.12); }

.anthony__log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--a-bg-soft); overscroll-behavior: contain; }
.anthony__msg { max-width: 85%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.anthony__msg--bot { align-self: flex-start; background: var(--a-bg); border: 1px solid var(--a-line); border-bottom-left-radius: 4px; }
.anthony__msg--user { align-self: flex-end; background: var(--a-ink); color: #fff; border-bottom-right-radius: 4px; }
.anthony__msg--error { align-self: center; background: #fff4e5; color: #7a4b00; font-size: 13px; }
.anthony__msg a { color: inherit; text-decoration: underline; font-weight: 600; }
.anthony__typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.anthony__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--a-ink-soft); animation: anthony-dot 1s infinite; }
.anthony__typing i:nth-child(2) { animation-delay: .15s; }
.anthony__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes anthony-dot { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }

.anthony__form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--a-line); background: var(--a-bg); }
.anthony__input {
  flex: 1; resize: none; max-height: 120px; padding: 10px 12px;
  border: 1px solid var(--a-line); border-radius: 8px; font: inherit; font-size: 15px; color: var(--a-ink); background: #fff;
}
.anthony__input:focus { outline: 2px solid var(--a-ink); outline-offset: -1px; }
.anthony__send { width: 44px; flex: none; border: 0; border-radius: 8px; background: var(--a-accent); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.anthony__send:disabled { opacity: .4; cursor: default; }
.anthony__legal { margin: 0; padding: 0 12px 8px; font-size: 11px; color: var(--a-ink-soft); background: var(--a-bg); }
.anthony__legal a { color: inherit; text-decoration: underline; }

@media (max-width: 575px) {
  .anthony { right: 10px; bottom: 10px; }
  .anthony__figure { width: 84px; height: 84px; }
  .anthony__bubble { margin-bottom: 48px; font-size: 13px; }
  .anthony[data-state="open"] { left: 0; right: 0; top: 0; bottom: 0; }
  .anthony[data-state="open"] .anthony__launcher { display: none; }
  .anthony__input { font-size: 16px; } /* < 16 px : iOS zoome sur le champ */
  .anthony__panel { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .anthony__figure, .anthony__figure::after, .anthony__bubble, .anthony__panel, .anthony__typing i { animation: none; }
}
