/* ============================================================
   Ambre au téléphone, depuis le site (2026-11-03) : js/ambre.js
   Fenêtre d'appel (plein écran sur téléphone ; bulle verticale 9/16 si l'écran est plus large),
   boutons « Appeler » / « Écrire » (pastille, barre du bas, cartes formules). Sur ordinateur, Ambre n'est pas proposée :
   le bouton d'appel fixe garde le numéro de Léo (choix de Léo, 2026-11-03).
   ============================================================ */

/* ── Fenêtre d'appel ── */
.amb { --amb-niveau:0; position:fixed; z-index:1000; right:22px; bottom:22px;
  width:min(360px, calc(100vw - 32px)); aspect-ratio:9/16; max-height:calc(100vh - 44px);
  display:flex; flex-direction:column; overflow:hidden; border-radius:30px; color:#fff;
  background:radial-gradient(120% 70% at 50% 0%, #3d1a66 0%, #1e1229 58%, #120d18 100%);
  box-shadow:0 30px 80px rgba(22,19,17,.45), inset 0 0 0 1px rgba(255,255,255,.07);
  opacity:0; visibility:hidden; transform:translateY(18px) scale(.96); transform-origin:bottom right;
  transition:opacity .25s ease, transform .35s cubic-bezier(.16,1,.3,1), visibility 0s linear .35s; }
.amb.is-ouvert { opacity:1; visibility:visible; transform:none;
  transition:opacity .25s ease, transform .35s cubic-bezier(.16,1,.3,1); }
.amb *, .amb *::before, .amb *::after { box-sizing:border-box; }
.amb-picto { width:20px; height:20px; flex:0 0 auto; fill:none; stroke:currentColor; stroke-width:1.75;
  stroke-linecap:round; stroke-linejoin:round; }
.amb-fermer { position:absolute; top:14px; right:14px; z-index:2; width:36px; height:36px; display:flex;
  align-items:center; justify-content:center; border:0; border-radius:50%; background:rgba(255,255,255,.1);
  color:#fff; cursor:pointer; }
.amb-fermer:hover { background:rgba(255,255,255,.18); }

/* En-tête : Ambre, IA, statut */
.amb-haut { padding:34px 22px 6px; text-align:center; flex:0 0 auto; }
.amb-avatar { position:relative; width:104px; height:104px; margin:0 auto 14px; }
.amb-lettre { position:relative; z-index:1; display:flex; align-items:center; justify-content:center;
  width:100%; height:100%; border-radius:50%; font-size:44px; font-weight:800; letter-spacing:-.02em;
  background:linear-gradient(135deg, #FF9A22 0%, #F08000 35%, #C21E8E 70%, #7B18C8 100%);
  box-shadow:0 10px 30px rgba(123,24,200,.45); }
.amb-ia { position:absolute; z-index:2; right:-2px; bottom:4px; padding:3px 8px; border-radius:999px;
  background:#fff; color:#7B18C8; font-size:11px; font-weight:800; letter-spacing:.06em;
  box-shadow:0 3px 10px rgba(0,0,0,.25); }
.amb-onde { position:absolute; inset:0; border-radius:50%; background:rgba(240,128,0,.28);
  transform:scale(calc(1 + var(--amb-niveau) * .5)); opacity:calc(.25 + var(--amb-niveau) * .6);
  transition:transform .08s linear, opacity .08s linear; }
.amb-onde2 { background:rgba(123,24,200,.22); transform:scale(calc(1 + var(--amb-niveau) * .9)); }
/* avant l'appel et pendant la connexion : une sonnerie qui pulse */
.amb[data-etat="accueil"] .amb-onde, .amb[data-etat="connexion"] .amb-onde { animation:amb-sonne 1.6s ease-out infinite; }
.amb[data-etat="accueil"] .amb-onde2, .amb[data-etat="connexion"] .amb-onde2 { animation-delay:.8s; }
@keyframes amb-sonne { 0% { transform:scale(1); opacity:.55; } 100% { transform:scale(1.65); opacity:0; } }
.amb-nom { font-size:24px; font-weight:800; letter-spacing:-.01em; }
.amb-role { font-size:13px; opacity:.72; margin-top:2px; }
.amb-statut { margin-top:10px; font-size:13.5px; font-weight:700; color:#FFD070; min-height:18px; }
.amb-chrono { margin-top:2px; font-size:14px; font-variant-numeric:tabular-nums; opacity:.75; min-height:18px; }
.amb:not([data-etat="appel"]) .amb-chrono { display:none; }
.amb-passer { display:none; }

/* En-tête réduit à une ligne (échange écrit, clavier ouvert pendant l'appel) : la place va aux messages,
   et « Appeler » reste à portée de pouce en haut */
.amb.is-compact .amb-haut { display:flex; align-items:center; gap:11px; padding:12px 58px 11px 16px; text-align:left;
  border-bottom:1px solid rgba(255,255,255,.08); }
.amb.is-compact .amb-avatar { width:42px; height:42px; margin:0; flex:0 0 auto; }
.amb.is-compact .amb-lettre { font-size:19px; box-shadow:none; }
.amb.is-compact .amb-ia { right:-8px; bottom:-3px; padding:1px 5px; font-size:9px; }
.amb.is-compact .amb-onde, .amb.is-compact .amb-statut, .amb.is-compact .amb-chrono { display:none; }
.amb.is-compact .amb-ident { flex:1 1 auto; min-width:0; }
.amb.is-compact .amb-nom { font-size:17px; line-height:1.2; }
.amb.is-compact .amb-role { font-size:12px; line-height:1.3; margin-top:1px; }
.amb.is-compact[data-etat="ecrit"] .amb-passer { display:inline-flex; align-items:center; gap:6px; flex:0 0 auto;
  padding:9px 14px; border:0; border-radius:999px; background:#22C55E; color:#fff; font:inherit; font-size:14px;
  font-weight:700; cursor:pointer; box-shadow:0 6px 16px rgba(34,197,94,.3); }
.amb-passer .amb-picto { width:16px; height:16px; }
.amb-passer:focus-visible { outline:2px solid #FFD070; outline-offset:2px; }
.amb.is-compact .amb-milieu { padding:4px 14px 12px; }

/* Milieu : présentation, sous-titres, échange écrit, message de fin */
.amb-milieu { flex:1 1 auto; min-height:0; overflow:auto; padding:6px 22px; display:flex; flex-direction:column; }
.amb-milieu > * { display:none; }
.amb[data-etat="accueil"] .amb-accueil { display:block; }
.amb-titre { font-size:16.5px; font-weight:800; line-height:1.3; margin:8px 0 8px; text-align:center; color:#fff; }
.amb-lead { font-size:14.5px; line-height:1.55; margin:0 0 10px; text-align:center; opacity:.92; }
.amb-lead strong { color:#FFD070; font-weight:700; }
.amb-note { font-size:12px; line-height:1.5; opacity:.66; text-align:center; margin:0; }
.amb-note a { color:#FFD070; }
/* le sous-titre (la dernière phrase d'Ambre) seulement pendant l'appel, clavier fermé */
.amb[data-etat="appel"]:not(.is-clavier) .amb-soustitre { display:-webkit-box; }
.amb-soustitre { margin:auto 0; padding:8px 4px; font-size:15px; line-height:1.5; text-align:center; opacity:.9;
  -webkit-line-clamp:5; -webkit-box-orient:vertical; overflow:hidden; }
.amb[data-etat="ecrit"] .amb-fil, .amb.is-clavier[data-etat="appel"] .amb-fil,
.amb[data-mode="texte"][data-etat="connexion"] .amb-fil { display:flex; }
.amb[data-etat="ecrit"] .amb-saisie, .amb.is-clavier[data-etat="appel"] .amb-saisie { display:flex; }
.amb-fil { flex:1 1 auto; flex-direction:column; gap:8px; overflow-y:auto; padding:6px 0; }
.amb-fil[data-attente]::after { content:attr(data-attente); font-size:12.5px; opacity:.65; padding:2px 4px; }
.amb-bulle { margin:0; max-width:86%; padding:9px 13px; border-radius:16px; font-size:14px; line-height:1.45; }
.amb-ambre { align-self:flex-start; background:rgba(255,255,255,.1); border-bottom-left-radius:5px; }
.amb-client { align-self:flex-end; background:linear-gradient(135deg,#FF9A22,#F08000); border-bottom-right-radius:5px; }
.amb-saisie { flex:0 0 auto; gap:8px; padding:8px 0 2px; }
.amb-champ { flex:1; min-width:0; padding:12px 14px; border-radius:999px; border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.08); color:#fff; font:inherit; font-size:16px; }
.amb-champ::placeholder { color:rgba(255,255,255,.55); }
.amb-champ:focus { outline:2px solid #FFD070; outline-offset:1px; }
.amb-envoyer { flex:0 0 auto; width:46px; height:46px; display:flex; align-items:center; justify-content:center;
  border:0; border-radius:50%; background:#F08000; color:#fff; cursor:pointer; }
.amb[data-etat="fin"] .amb-message, .amb[data-etat="erreur"] .amb-message { display:block; }
.amb-message { margin:auto 0; font-size:14.5px; line-height:1.55; text-align:center; opacity:.92; }

/* Bas : boutons */
.amb-bas { flex:0 0 auto; padding:12px 22px 22px; display:flex; flex-direction:column; gap:9px; align-items:stretch; }
.amb-bas:empty { display:none; }
.amb-btn { display:flex; align-items:center; justify-content:center; gap:9px; width:100%; padding:13px 18px;
  border:0; border-radius:999px; font:inherit; font-size:15px; font-weight:700; color:#fff !important;
  background:rgba(255,255,255,.12); text-decoration:none; cursor:pointer; transition:filter .2s, transform .2s, background .2s; }
.amb-btn:hover { filter:brightness(1.08); }
.amb-btn:active { transform:scale(.98); }
.amb-btn:focus-visible, .amb-fermer:focus-visible { outline:2px solid #FFD070; outline-offset:2px; }
.amb-vert { background:#22C55E; box-shadow:0 8px 22px rgba(34,197,94,.35); }
.amb-large { padding:16px 18px; font-size:16px; }
.amb-rouge { background:#EF4444; box-shadow:0 8px 22px rgba(239,68,68,.35); }
.amb-discret { background:rgba(255,255,255,.08); font-weight:600; font-size:14px; }
/* « Écrire un message » : un vrai second choix, sous l'appel (Léo : on ne voyait pas qu'on peut écrire) */
.amb-blanc { background:#fff; color:#1e1229 !important; }
.amb-blanc .amb-picto { color:#7B18C8; }
.amb-rangee { display:flex; justify-content:center; gap:22px; }
.amb-rangee .amb-btn:not(.amb-rond) { flex:1; }
.amb-rond { width:62px; height:62px; padding:0; border-radius:50%; flex:0 0 auto; }
.amb-rond .amb-picto { width:26px; height:26px; }
.amb-rond span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.amb-clair { background:rgba(255,255,255,.14); }
.amb-clair.is-on { background:#fff; color:#1e1229 !important; }
.amb.is-clavier .amb-clair[data-act="clavier"] { background:#fff; color:#1e1229 !important; }
/* Léo en direct : [Appeler Léo | Écrire à Léo], le numéro centré sous les deux moitiés, dans le même bouton */
.amb-leo { margin-top:3px; border:1px solid rgba(255,255,255,.2); border-radius:18px; background:rgba(255,255,255,.06); overflow:hidden; }
.amb-leo-rang { display:flex; }
.amb-leo-rang a { flex:1 1 0; min-width:0; display:flex; align-items:center; justify-content:center; gap:7px; padding:12px 8px 5px;
  color:#fff !important; font-size:14px; font-weight:700; text-decoration:none; }
.amb-leo-rang a + a { border-left:1px solid rgba(255,255,255,.16); }
.amb-leo-rang a:active { background:rgba(255,255,255,.08); }
.amb-leo-rang a:focus-visible { outline:2px solid #FFD070; outline-offset:-3px; border-radius:14px; }
.amb-leo-rang .amb-picto { width:17px; height:17px; }
.amb-leo-num { display:block; padding:2px 0 10px; text-align:center; font-size:13px; font-weight:600; letter-spacing:.02em;
  color:rgba(255,255,255,.72); font-variant-numeric:tabular-nums; }

/* Téléphone : plein écran. js/ambre.js cale top et height sur la zone visible (clavier ouvert compris) */
@media (max-width:640px) {
  .amb { inset:0 0 auto 0; width:100%; height:100%; height:100dvh; max-height:none; aspect-ratio:auto; border-radius:0;
    padding:env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); transform-origin:center bottom; }
  .amb.is-clavier-ouvert { padding-bottom:0; }
  html.amb-ouverte, html.amb-ouverte body { overflow:hidden; }
  .amb-haut { padding-top:48px; }
  .amb-avatar { width:120px; height:120px; }
}
/* petit iPhone (SE, 8) : tout l'accueil tient sans défiler, bouton de Léo compris */
@media (max-width:640px) and (max-height:700px) {
  .amb-haut { padding-top:38px; }
  .amb-avatar { width:92px; height:92px; margin-bottom:10px; }
  .amb-lettre { font-size:38px; }
}
@media (prefers-reduced-motion:reduce) {
  .amb, .amb.is-ouvert, .amb-onde { transition:none; }
  .amb[data-etat] .amb-onde { animation:none; }
}

/* ── Ambre, deux choix côte à côte : appeler ou écrire (téléphone) ──
   Léo, 2026-11-03 : il faut comprendre d'un coup d'œil « je peux faire les deux ». Pastille flottante
   à côté de « Réserver », et pleine largeur dans la barre du bas dépliée (.amb-duo-barre). */
.amb-duo { position:relative; display:inline-flex; align-items:stretch; flex:0 0 auto; gap:2px; padding:3px;
  pointer-events:auto; border-radius:999px; border:1.5px solid transparent;
  background:linear-gradient(#fff,#fff) padding-box, linear-gradient(135deg, #F08000, #B94AC8 55%, #7B18C8) border-box;
  box-shadow:0 6px 18px rgba(22,19,17,.18); }
.amb-duo-nom { position:absolute; z-index:1; top:-10px; left:50%; transform:translateX(-50%); padding:2px 7px; border-radius:999px; background:#7B18C8;
  color:#fff; font-size:10px; font-weight:800; letter-spacing:.03em; line-height:1.3; white-space:nowrap; pointer-events:none; }
.amb-duo-btn, .mobile-cta-bar .amb-duo-btn { display:inline-flex; align-items:center; justify-content:center; gap:5px;
  width:auto; padding:9px 12px; border-radius:999px; background:none; box-shadow:none; color:#161311 !important;
  font-size:13.5px; font-weight:700; line-height:1.2; text-decoration:none; white-space:nowrap; }
.amb-duo-btn + .amb-duo-btn { position:relative; }
.amb-duo-btn + .amb-duo-btn::before { content:''; position:absolute; left:-2px; top:22%; bottom:22%; width:1px; background:#E7E0D8; }
.amb-duo-btn .amb-picto { width:16px; height:16px; flex:0 0 auto; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.amb-duo-btn[data-ambre="appel"] .amb-picto { stroke:#16A34A; }
.amb-duo-btn[data-ambre="message"] .amb-picto { stroke:#7B18C8; }
.amb-duo-btn:active { background:#F4F1EC; transform:scale(.97); }
.amb-duo-btn:focus-visible { outline:2px solid #7B18C8; outline-offset:1px; }
/* barre du bas dépliée : la pastille prend toute la largeur, au-dessus de « Réserver un créneau » */
.amb-duo.amb-duo-barre { display:flex; margin:10px 0 8px; border-radius:14px; }   /* l'étiquette centrée ne touche pas la flèche ▾ */
.mobile-cta-bar .amb-duo-barre .amb-duo-btn { flex:1 1 0; padding:11px 8px; border-radius:11px; font-size:14px; }
@media (max-width:359px) { .amb-duo-btn, .mobile-cta-bar .amb-duo-btn { padding:9px 9px; font-size:12.5px; } }

/* ── Cartes formules : « ou réservez avec Ambre » + [Par téléphone] [Par message], sur téléphone seulement ──
   (l'accueil la cache par défaut : sans cette feuille, elle ne s'affiche pas) */
.f-ambre { width:100%; margin-top:12px; text-align:center; }
.f-ambre-t { margin:0 0 7px; font-size:12.5px; font-weight:600; line-height:1.35; color:#6B6460; }
.f-ambre-btns { display:flex; gap:8px; }
.f-ambre-btn { flex:1 1 0; display:flex; align-items:center; justify-content:center; gap:6px; min-width:0; padding:10px 8px;
  border-radius:12px; border:1.5px solid var(--f-accent, #7B18C8); background:#fff; font:inherit; font-size:13.5px;
  font-weight:700; line-height:1.2; color:var(--f-accent, #7B18C8) !important; cursor:pointer; }
.f-ambre-btn:active { transform:scale(.98); background:var(--f-soft, #F4F1EC); }
.f-ambre-btn .amb-picto { width:16px; height:16px; stroke-width:2; }
@media (max-width:900px) { .f-ambre { display:block; } }
