/* AgencyFix — live Jessica chat styles (v0.11.5).
 * Adds the composer, the "Talk to Jessica" voice button, the user bubble, and the inline-chat
 * container on top of the existing .jdock/.jpanel/.jb design (afx-motion.css). Shared design tokens. */

/* User bubble (assistant .jb-bot already defined in afx-motion.css). */
.afx .jb-user{background:linear-gradient(135deg,var(--ac,#6366f1),var(--ac-d,#4f46e5));color:#fff;align-self:flex-end;border:0;}
.afx .jb a{color:inherit;text-decoration:underline;}

/* Dock panel body becomes a scrolling message list. */
.afx .jdock .jpanel-body{max-height:min(50vh,340px);overflow-y:auto;}

/* "Talk to Jessica" voice button — the explicit VOICE choice, above the text composer. */
.afx .jvoice-btn{display:flex;align-items:center;justify-content:center;gap:.5rem;width:calc(100% - 1.2rem);
  margin:.6rem .6rem 0;padding:.6rem 1rem;border:0;border-radius:999px;cursor:pointer;font-weight:700;font-size:.9rem;
  color:#fff;background:linear-gradient(135deg,var(--ac,#6366f1),var(--ac-d,#4f46e5));}
.afx .jvoice-btn svg{width:18px;height:18px;}
.afx .jvoice-btn.is-live{background:#e5484d;animation:afxJmic 1.1s ease-in-out infinite;}
@keyframes afxJmic{0%,100%{opacity:1;}50%{opacity:.55;}}

/* Text composer (shared by dock + inline). */
.afx .jcompose{display:flex;align-items:center;gap:.4rem;padding:.6rem;background:#fff;border-top:1px solid var(--line,#e7eaf1);}
.afx .jchat-inline .jcompose{border-radius:0 0 14px 14px;}
.afx .jcompose-in{flex:1;min-width:0;border:1px solid var(--line,#e7eaf1);border-radius:999px;padding:.55rem .85rem;
  font-size:.9rem;color:var(--ink,#0a0c10);background:#f7f8fc;outline:none;font-family:inherit;}
.afx .jcompose-in:focus{border-color:var(--ac,#6366f1);background:#fff;}
.afx .jcompose-send{flex:none;display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;
  border-radius:50%;border:0;cursor:pointer;background:linear-gradient(135deg,var(--ac,#6366f1),var(--ac-d,#4f46e5));color:#fff;}
.afx .jcompose-send svg{width:18px;height:18px;}
.afx .jcompose-send:disabled{opacity:.5;cursor:default;}

/* Inline "Meet Jessica" chat card. */
.afx .jchat-inline{padding:0;overflow:hidden;display:flex;flex-direction:column;background:#fff;border:1px solid var(--line,#e7eaf1);}
.afx .jchat-inline-hd{display:flex;align-items:center;gap:.6rem;padding:.8rem 1rem;background:linear-gradient(135deg,#0e1326,#0a0e1a);color:#fff;}
.afx .jchat-inline-msgs{display:flex;flex-direction:column;gap:.55rem;padding:1rem;background:#f7f8fc;
  min-height:180px;max-height:min(46vh,320px);overflow-y:auto;}

@media(prefers-reduced-motion:reduce){.afx .jvoice-btn.is-live{animation:none;}}

/* Hydrated Jessica section — the published on-page card (#jessica, all variants) and any future
 * engine-baked band (#afxjz) are dark panels (.jcard / .chat). Every published page is wrapped in
 * .afx so the base .jcompose/.jvoice-btn/.jb-* rules above apply; these add the dark-panel treatment. */
#afxjz .afxjz-msgs,#jessica .afxjz-msgs{display:flex;flex-direction:column;gap:.55rem;max-height:min(44vh,340px);overflow-y:auto;padding:.2rem 0 .7rem;}
#afxjz .jb-bot,#jessica .jb-bot{background:rgba(255,255,255,.09);border:0;color:#fff;}
#afxjz .jcompose,#jessica .jcompose{background:transparent;border-top:1px solid rgba(255,255,255,.12);padding:.6rem 0 0;}
#afxjz .jcompose-in,#jessica .jcompose-in{background:rgba(255,255,255,.06);border-color:rgba(255,255,255,.16);color:#fff;}
#afxjz .jcompose-in::placeholder,#jessica .jcompose-in::placeholder{color:rgba(255,255,255,.5);}
#afxjz .jvoice-btn,#jessica .jvoice-btn{width:100%;margin:.2rem 0 .6rem;}

/* PREMIUM single-row composer (hydrated #jessica/#afxjz cards): ONE rounded field with a gradient mic
 * (voice) + send inside it — the mockup's good-looking .jinput/.mic treatment, ported onto the control
 * that actually works. The gradient mic is the hero; send is subtler. */
#afxjz .jcompose-pretty,#jessica .jcompose-pretty{display:flex;align-items:center;gap:.4rem;margin-top:.6rem;border-top:0;
  background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.14);border-radius:14px;padding:.35rem .4rem .35rem .9rem;}
#afxjz .jcompose-pretty .jcompose-in,#jessica .jcompose-pretty .jcompose-in{flex:1;min-width:0;background:transparent;border:0;border-radius:0;padding:.5rem 0;color:#fff;font-size:.92rem;}
#afxjz .jcompose-pretty .jcompose-in:focus,#jessica .jcompose-pretty .jcompose-in:focus{background:transparent;}
#afxjz .jcompose-pretty .jcompose-in::placeholder,#jessica .jcompose-pretty .jcompose-in::placeholder{color:rgba(255,255,255,.55);}
/* PREMIUM control — the hero affordance of the card. Ports the homepage .jinput .mic treatment (doc 169
 * deprecated v1 — the design Jared liked): a SUBSTANTIAL rounded-square, cyan->indigo gradient, and the
 * afxPulse expanding-ring GLOW that made it look "animated and cool". The mic (empty field) and the send
 * arrow (has text) get the IDENTICAL treatment — same size, gradient, glow, pulse — so the one-at-a-time
 * toggle reads as a single premium control that just swaps its icon. */
.afx .jcompose-mic,
#afxjz .jcompose-pretty .jcompose-send,#jessica .jcompose-pretty .jcompose-send{
  flex:none;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;border:0;
  border-radius:13px;cursor:pointer;color:#fff;background:linear-gradient(135deg,#36c2ff,#6c5cef);
  box-shadow:0 8px 22px -6px rgba(54,194,255,.6);animation:afxjPulse 2.4s ease infinite;transition:filter .15s,transform .15s;}
.afx .jcompose-mic svg,
#afxjz .jcompose-pretty .jcompose-send svg,#jessica .jcompose-pretty .jcompose-send svg{width:20px;height:20px;}
.afx .jcompose-mic:hover,
#afxjz .jcompose-pretty .jcompose-send:hover,#jessica .jcompose-pretty .jcompose-send:hover{filter:brightness(1.08);transform:translateY(-1px);}
/* The homepage glow: a persistent soft colored under-glow PLUS an outer ring that breathes outward
 * (radar-ping). This is the part that read as premium — a flat gradient square without it looks cheap. */
@keyframes afxjPulse{0%,100%{box-shadow:0 8px 22px -6px rgba(54,194,255,.6),0 0 0 0 rgba(54,194,255,.45);}
  50%{box-shadow:0 10px 26px -6px rgba(54,194,255,.7),0 0 0 12px rgba(54,194,255,0);}}
/* Voice-call active: mic goes red with its own pulse, overriding the idle gradient + ring. */
.afx .jcompose-mic.is-live{background:#e5484d;animation:afxJmic 1.1s ease-in-out infinite;box-shadow:0 0 0 4px rgba(229,72,77,.3);}
/* One trailing control at a time: afx-jessica.js toggles [hidden] on the mic (empty field) vs the send
 * arrow (has text). The class rules above set display:inline-flex, which out-specifies the UA [hidden]
 * rule — so hidden buttons would still render. These win it back so exactly one control shows. */
.afx .jcompose-mic[hidden],.afx .jcompose-send[hidden]{display:none!important;}
/* send styling now lives in the shared PREMIUM control rule above (identical to the mic). */
@media(prefers-reduced-motion:reduce){.afx .jcompose-mic,.afx .jcompose-send,.afx .jcompose-mic.is-live{animation:none;}}

/* The homepage chips are <span class="q"> — not obviously clickable until hydrated. */
#jessica .ask .q{cursor:pointer;}

/* ================================================================================================
 * [afx_jessica] — THE canonical Jessica section (v0.11.20). PLUGIN-OWNED markup + CSS + JS; pages pass
 * COPY only. This CSS ships with the plugin and is enqueued site-wide — it is NEVER inlined per page.
 * (Page-local CSS for a site-wide component was the root cause of every "unstyled Jessica" break.)
 * Ported verbatim from the homepage's canonical .jess/.jcard/.bubble/.wave design; self-contained (own
 * tokens + own keyframes, unique names so nothing collides with a page's leftover inline CSS during the
 * migration). MOBILE-FIRST: single column by default, two columns from 940px up. The one working
 * composer is injected by afx-jessica.js into .jcard and styled by the .jcompose-pretty rules above. */
.afxj{--jac:#6366f1;--jac2:#22d3ee;--jmuted:#aab2c0;}
.afxj *{box-sizing:border-box;margin:0;}
.afxj .jess{background:radial-gradient(820px 420px at 82% 0%,rgba(34,211,238,.16),transparent),linear-gradient(180deg,#0b0e14,#0a0c10);color:#fff;padding:clamp(3rem,8vw,7rem) 0;}
.afxj .jwrap{max-width:1320px;margin:0 auto;padding:0 clamp(1.25rem,4vw,3.25rem);display:grid;gap:2.4rem;align-items:center;}
@media(min-width:940px){.afxj .jwrap{grid-template-columns:1fr 1fr;gap:4rem;}}
.afxj .eyebrow{display:inline-flex;align-items:center;gap:.5rem;font-size:.74rem;letter-spacing:.1em;text-transform:uppercase;font-weight:700;color:var(--jac2);}
.afxj .eyebrow::before{content:"";width:18px;height:2px;background:linear-gradient(90deg,var(--jac),var(--jac2));}
.afxj .jess h2{color:#fff;font-size:clamp(1.85rem,4.4vw,2.75rem);line-height:1.1;letter-spacing:-.025em;font-weight:700;margin:1.1rem 0 0;max-width:none;}
.afxj .jess .sub{color:var(--jmuted);font-size:clamp(1.02rem,1.4vw,1.14rem);line-height:1.6;margin-top:1.1rem;}
.afxj .ask{margin-top:1.5rem;display:flex;flex-wrap:wrap;gap:.55rem;}
.afxj .ask .q{font-size:.86rem;color:#dfe4ee;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.12);border-radius:999px;padding:.45rem .85rem;transition:border-color .15s,background .15s;cursor:pointer;}
.afxj .ask .q:hover{border-color:var(--jac2);background:rgba(34,211,238,.08);}
.afxj .jcard{background:linear-gradient(160deg,#10141d,#0b0e14);border:1px solid rgba(255,255,255,.08);border-radius:20px;padding:1.4rem;box-shadow:0 40px 80px -30px #000;}
.afxj .jcard .bar{display:flex;align-items:center;gap:.5rem;margin-bottom:1rem;}
.afxj .jcard .ja{display:flex;align-items:center;gap:.55rem;font-weight:600;font-size:.92rem;color:#fff;}
.afxj .jcard .ja .av{width:30px;height:30px;border-radius:50%;background:linear-gradient(135deg,var(--jac2),var(--jac));display:flex;align-items:center;justify-content:center;font-size:.8rem;color:#04121a;font-weight:800;flex:0 0 auto;}
.afxj .jcard .live{margin-left:auto;font-size:.68rem;letter-spacing:.06em;text-transform:uppercase;color:#34d399;display:flex;align-items:center;gap:.35rem;}
.afxj .jcard .live i{width:7px;height:7px;border-radius:50%;background:#34d399;animation:afxjBlink 1.4s infinite;}
.afxj .bubble{max-width:88%;padding:.65rem .9rem;border-radius:14px;margin:.5rem 0;font-size:.92rem;line-height:1.45;}
.afxj .bubble.ai{background:#1b212c;color:#e8eaf0;border-top-left-radius:4px;}
.afxj .bubble.me{background:var(--jac);color:#fff;margin-left:auto;border-top-right-radius:4px;}
.afxj .wave{display:flex;align-items:center;justify-content:center;gap:4px;height:40px;margin:.9rem 0 .4rem;}
.afxj .wave i{width:4px;border-radius:3px;background:linear-gradient(180deg,var(--jac2),var(--jac));height:100%;transform-origin:center;animation:afxjWave 1.1s ease-in-out infinite;}
.afxj .wave i:nth-child(2n){animation-duration:.85s;}
.afxj .wave i:nth-child(3n){animation-duration:1.35s;}
@keyframes afxjWave{0%,100%{transform:scaleY(.25);}50%{transform:scaleY(1);}}
@keyframes afxjBlink{50%{opacity:.4;}}
@media(prefers-reduced-motion:reduce){.afxj .wave i,.afxj .jcard .live i{animation:none;}}
