/* Site assistant: floating button and chat window. Uses the site's tokens, so light/dark follow the theme. */
.asst-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 60; min-height: 56px; padding: 0 20px 0 10px; border: 0; border-radius: 999px; display: flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); font: 600 15px/1 var(--font); cursor: pointer; box-shadow: var(--shadow-lg);
}
.asst-fab:hover { background: var(--accent-strong); }
.asst-fab-hidden { display: none; }
.asst-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 61; display: flex; flex-direction: column; width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100dvh - 32px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; font-family: var(--font);
}
.asst-panel[hidden] { display: none; }
.asst-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.asst-title { margin: 0; font-size: 16px; line-height: 1.2; }
.asst-close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: 26px; line-height: 1; cursor: pointer; }
.asst-close:hover, .asst-voice:hover { background: var(--accent-soft); }
.asst-voice { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
.asst-voice[aria-pressed="true"] { background: var(--accent-soft); }
.asst-listen { align-self: flex-start; margin: -6px 0 0 4px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font: 600 12px/1 var(--font); cursor: pointer; }
.asst-listen:hover, .asst-listen[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); }
.asst-log { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.asst-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.asst-msg p { margin: 0 0 8px; white-space: normal; }
.asst-assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.asst-user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.asst-pending { color: var(--muted); font-style: italic; }
.asst-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.asst-yes, .asst-no, .asst-handoff, .asst-send {
  min-height: 44px; padding: 0 16px; border-radius: 999px; font: 600 14px/1 var(--font); cursor: pointer; border: 1px solid var(--accent);
}
.asst-yes, .asst-send { background: var(--accent); color: var(--accent-ink); }
.asst-no, .asst-handoff { background: var(--surface); color: var(--ink); }
.asst-handoff { margin: 4px 14px 0; align-self: stretch; border-color: var(--accent); }
.asst-handoff[hidden] { display: none; }
.asst-yes:hover, .asst-send:hover { background: var(--accent-strong); }
.asst-no:hover, .asst-handoff:hover { background: var(--accent-soft); }
.asst-panel button:disabled { opacity: .55; cursor: default; }
.asst-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px 6px; }
.asst-input {
  flex: 1; min-height: 44px; max-height: 120px; padding: 11px 12px; resize: none; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: 15px/1.3 var(--font);
}
.asst-note { margin: 0; padding: 0 14px 12px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.asst-fab:focus-visible, .asst-panel :focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
/* the card being shown: a static ring; the pulse only when motion is allowed */
.asst-highlight { outline: 3px solid var(--accent); outline-offset: 6px; border-radius: var(--radius); box-shadow: 0 0 0 8px var(--accent-soft); }
@media (prefers-reduced-motion: no-preference) {
  .asst-highlight { animation: asst-pulse 1.4s ease-in-out 3; }
  @keyframes asst-pulse { 50% { box-shadow: 0 0 0 16px transparent; } }
}
@media (max-width: 520px) {
  .asst-panel { right: 8px; left: 8px; bottom: 8px; width: auto; height: min(78dvh, 620px); }
  .asst-fab { right: 12px; bottom: 12px; }
  .asst-msg { max-width: 94%; }
}

/* avatar looks (assistant-avatars.js): colours come from the theme tokens plus a few fixed natural tones */
.asst-av { --av-fur: #d9822b; --av-fur2: #f3b36b; --av-owl: #8a6a4a; --av-owl2: #cdb08a; --av-hair: #3b2a22; --av-tone: #f0c8a0; --av-ink: #1b2b27; }
.asst-av { width: 44px; height: 44px; flex: none; overflow: visible; --av-skin: color-mix(in srgb, var(--surface) 88%, var(--accent) 12%); }
.asst-fab .asst-av { width: 62px; height: 62px; margin: -12px 0 -6px; padding: 3px; box-sizing: border-box; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 3px var(--accent-ink); }
.asst-head .asst-av { width: 54px; height: 54px; padding: 3px; box-sizing: border-box; border-radius: 50%; background: var(--accent-soft); }
.asst-head { justify-content: flex-start; }
.asst-head .asst-title { flex: 1; }
.asst-av .av-shirt { fill: var(--accent); }
.asst-av .av-collar { fill: none; stroke: var(--accent-ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.asst-av .av-sleeve { fill: none; stroke: var(--accent); stroke-width: 11; stroke-linecap: round; }
.asst-av .av-armL, .asst-av .av-armR { opacity: 0; transform: translateY(40px); }
.asst-av .av-face { fill: var(--av-skin); stroke: var(--accent-strong); stroke-width: 3; }
.asst-av .av-ear { fill: var(--accent-2, var(--accent)); }
.asst-av .av-visor { fill: color-mix(in srgb, var(--accent-strong) 78%, #04100d); }
.asst-av .av-eye { fill: var(--accent-ink); }
.asst-av .av-eye, .asst-av .av-eyes { transform-box: fill-box; transform-origin: center; }
.asst-av .av-cheek { fill: var(--warm, #f0a65a); opacity: .45; }
.asst-av .av-mouth { fill: none; stroke: var(--accent-strong); stroke-width: 3; stroke-linecap: round; transform-box: fill-box; transform-origin: center; }
.asst-av .av-ant { stroke: var(--accent-strong); stroke-width: 3; stroke-linecap: round; fill: none; }
.asst-av .av-bulb { fill: var(--warm, #f0a65a); }
.asst-av .av-dots { fill: var(--accent-strong); opacity: 0; }
.asst-av .av-head, .asst-av .av-armL, .asst-av .av-armR, .asst-av .av-body { transform-box: view-box; }
.asst-av .av-armR { transform-origin: 100px 100px; }
.asst-av .av-armL { transform-origin: 20px 100px; }
.asst-av .av-head { transform-origin: 60px 82px; }
@media (prefers-reduced-motion: no-preference) {
  .asst-av .av-eyes { animation: av-blink 5.2s infinite; }
  .asst-av .av-body { animation: av-breathe 4s ease-in-out infinite; transform-origin: 60px 120px; }
  .asst-av .av-bulb { animation: av-pulse 2.6s ease-in-out infinite; }
    .asst-av[data-mood="wave"] .av-armR { animation: av-raise 2.6s ease-in-out 1 both; opacity: 1; }
  .asst-av[data-mood="wave"] .av-head { animation: av-tilt 2.2s ease-in-out 1; }
  .asst-av[data-mood="nod"] .av-head { animation: av-nod .55s ease-in-out 2; }
  .asst-av[data-mood="think"] .av-head { transform: rotate(-7deg); transition: transform .3s; }
  .asst-av[data-mood="think"] .av-dots { opacity: 1; animation: av-dots 1.2s steps(3) infinite; }
  .asst-av[data-mood="think"] .av-eyes { transform: translate(-2px, -3px); transition: transform .3s; }
  .asst-av[data-mood="talk"] .av-mouth { animation: av-talk .28s ease-in-out infinite alternate; }
  .asst-av[data-mood="talk"] .av-head { animation: av-bob 1.2s ease-in-out infinite; }
    .asst-av[data-mood="present"] .av-armL { animation: av-open 2.4s ease-in-out 1 both; opacity: 1; }
  .asst-av[data-mood="present"] .av-head { animation: av-nod .55s ease-in-out 1; }
}
@keyframes av-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes av-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(1.6px); } }
@keyframes av-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes av-raise { 0% { transform: translateY(40px); } 16% { transform: translateY(0) rotate(0); } 26%, 50%, 74% { transform: translateY(0) rotate(-15deg); } 38%, 62%, 86% { transform: translateY(0) rotate(13deg); } 92% { transform: translateY(0) rotate(0); } 100% { transform: translateY(40px); } }
@keyframes av-tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(5deg); } 70% { transform: rotate(-3deg); } }
@keyframes av-nod { 0%, 100% { transform: rotate(0) translateY(0); } 50% { transform: rotate(0) translateY(5px); } }
@keyframes av-dots { 0% { clip-path: inset(0 100% 0 0); } 100% { clip-path: inset(0 0 0 0); } }
@keyframes av-talk { from { transform: scaleY(1); } to { transform: scaleY(1.9) scaleX(.9); } }
@keyframes av-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px) rotate(1.5deg); } }
@keyframes av-open { 0% { transform: translateY(40px); } 22%, 78% { transform: translateY(2px) rotate(16deg); } 100% { transform: translateY(40px); } }

.asst-av .av-skin { fill: var(--av-tone); stroke: none; }
.asst-av .av-outline { stroke: var(--accent-strong); stroke-width: 2; }
.asst-av .av-hair { fill: var(--av-hair); }
.asst-av .av-dark { fill: var(--av-ink); }
.asst-av .av-glasses { fill: none; stroke: var(--accent-strong); stroke-width: 2.6; }
.asst-av .av-fur { fill: var(--av-fur); stroke: none; }
.asst-av .av-fur-s { stroke: var(--av-fur); }
.asst-av .av-fur2 { fill: var(--av-fur2); stroke: var(--av-fur); stroke-width: 2; }
.asst-av .av-fur-in { fill: var(--av-fur2); }
.asst-av .av-muzzle { fill: #fff6ea; }
.asst-av .av-scarf { fill: var(--accent); }
.asst-av .av-belly { fill: var(--av-owl2); }
.asst-av .av-eyewhite { fill: #fff; }
.asst-av .av-beak { fill: var(--warm, #f0a65a); }
.asst-av .av-orb { fill: var(--accent); }
.asst-av .av-gloss { fill: #fff; opacity: .35; }
.asst-av .av-orb-h { fill: var(--accent-soft); stroke: var(--accent-strong); stroke-width: 2; }
.asst-av .av-mouth-light { stroke: var(--accent-ink); }
.asst-av .av-sleeve.av-fur-s { stroke: var(--av-fur); }
.asst-av .av-owlc { fill: var(--av-owl); stroke: none; }
.asst-av .av-owl-s { stroke: var(--av-owl); }
.asst-av .av-owl2c { fill: var(--av-owl2); stroke: var(--av-owl); stroke-width: 2; }
.asst-av g.av-mouth { stroke: none; fill: none; }

/* the owner's own picture as avatar: one image per mood, moved by CSS only */
.asst-custom { display: inline-block; overflow: hidden; border-radius: 50%; position: relative; --m-open: 0; }
/* a picture of a person reads better in a larger rounded square than in a small circle (the drawn avatars stay round) */
.asst-fab .asst-custom, .asst-head .asst-custom { box-sizing: border-box; padding: 0; border-radius: 20px; background: linear-gradient(150deg, #eaf9f4, #b9e1d8); }   /* a light tile in both themes: the portraits wear dark jackets */
.asst-fab .asst-custom { width: 80px; height: 80px; margin: -18px 0 -8px -2px; box-shadow: 0 0 0 3px var(--accent-ink), var(--shadow-lg); }
.asst-head .asst-custom { width: 72px; height: 72px; margin: -8px 0; border-radius: 18px; box-shadow: 0 0 0 2px var(--accent); }
/* the frame never moves and the person is not shaken: the poses themselves carry the gestures. The portrait is shown close, down to the shoulders (the zoom box also carries the mouth layer) */
.asst-custom .asst-zoom { position: absolute; inset: 0; transform: scale(1.5); transform-origin: 54% 15%; }      /* the head sits ~4% right of the middle of these portraits */
.asst-custom img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* the open-mouth picture of a custom pack (position measured on the 256 px portraits of the Pro pack; the women's pack sits a hair differently) */
.asst-custom .asst-mouth { position: absolute; left: 39.1%; top: 43.7%; width: 25.8%; height: 15.6%; object-fit: fill; opacity: var(--m-open); transform: scaleY(calc(.65 + var(--m-open) * .5)); transform-origin: 50% 40%; transition: opacity .075s linear; pointer-events: none; }
.asst-custom[data-mouth="female"] .asst-mouth { left: 39.45%; top: 44%; }
