/* The welcome agent on the site (v8/greeter.js): a plush teammate who walks onto the screen once, waves, and then
   stays put on top of a slim chat card. Calm by design: one walk-in, no roaming.
   Never in the way (dan, 2026-11-11): the pet stands above the card so the whole thing is one narrow column hugging
   the right edge, and on wide screens the page makes room for it (html.gr-dock). On smaller screens it steps aside
   to its pill when the visitor scrolls to read. */
.gr { --gr-c: #7C3AED; --gr-bg: rgba(255,255,255,.42); --gr-line: rgba(15,23,42,.14); --gr-text: #0f172a; --gr-text2: #475569; --gr-text3: #94a3b8; --gr-me: #0f172a; --gr-me-text: #fff; --gr-them: rgba(15,23,42,.08);
  position: fixed; right: 20px; bottom: 20px; z-index: 900; display: flex; flex-direction: column; align-items: flex-end; gap: 0; max-width: calc(100vw - 24px); font-family: Inter, system-ui, -apple-system, sans-serif; color: var(--gr-text); pointer-events: none; opacity: 0; }
@media (prefers-color-scheme: dark) { .gr { --gr-bg: rgba(22,24,31,.42); --gr-line: rgba(255,255,255,.14); --gr-text: #f1f5f9; --gr-text2: #cbd5e1; --gr-text3: #64748b; --gr-me: #f1f5f9; --gr-me-text: #0f172a; --gr-them: rgba(255,255,255,.1); } }
.gr > * { pointer-events: auto; }
.gr.gr-arrive, .gr.gr-walk { opacity: 1; }

/* Card — glass, not a solid card: low-opacity background plus a strong blur so the page keeps showing through
   (dan asked twice, 2026-11-25: the old .86 opacity read as a flat white block covering stats behind it). */
.gr-card { width: 300px; max-width: 100%; order: 2; max-height: min(560px, calc(100dvh - 130px)); display: flex; flex-direction: column; border-radius: 22px; background: var(--gr-bg); backdrop-filter: blur(28px) saturate(1.7); -webkit-backdrop-filter: blur(28px) saturate(1.7); border: 1px solid var(--gr-line);
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 24px 60px -24px color-mix(in srgb, var(--gr-c) 45%, rgba(0,0,0,.35)); overflow: hidden; transform-origin: bottom right; }
.gr.gr-walk .gr-card { opacity: 0; transform: translateY(10px) scale(.96); }
.gr.gr-arrive .gr-card { animation: grCard .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes grCard { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.gr-h { display: flex; align-items: center; gap: 10px; padding: 14px 12px 10px 16px; }
.gr-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--gr-me); color: var(--gr-me-text); display: grid; place-items: center; flex-shrink: 0; }
.gr-mark svg { width: 15px; height: 15px; }
.gr-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.gr-who b { font-size: 14px; font-weight: 650; }
.gr-who span { font-size: 11.5px; color: var(--gr-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-x { width: 28px; height: 28px; border-radius: 50%; border: none; background: transparent; color: var(--gr-text2); font-size: 20px; line-height: 1; cursor: pointer; }
.gr-x:hover { background: var(--gr-them); color: var(--gr-text); }
.gr-log { flex: 1; min-height: 60px; max-height: 300px; overflow-y: auto; padding: 2px 14px 8px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.gr-m { max-width: 88%; padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; animation: grIn .25s ease-out; }
@keyframes grIn { from { opacity: 0; transform: translateY(4px); } }
.gr-a { align-self: flex-start; background: var(--gr-them); border-bottom-left-radius: 6px; }
.gr-u { align-self: flex-end; background: var(--gr-me); color: var(--gr-me-text); border-bottom-right-radius: 6px; }
.gr-note { background: transparent; color: var(--gr-text2); font-size: 12.5px; padding: 2px 4px; }
.gr-typing { width: 46px; height: 32px; position: relative; }
.gr-typing::after { content: ''; position: absolute; inset: 0; margin: auto; width: 26px; height: 6px; background: radial-gradient(circle, var(--gr-text3) 2.6px, transparent 3px) 0 0 / 10px 6px repeat-x; animation: grDots 1s steps(4) infinite; clip-path: inset(0 100% 0 0); }
@keyframes grDots { to { clip-path: inset(0 0 0 0); } }
.gr-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.gr-chips:empty { display: none; }
.gr-chips button { border: 1px solid var(--gr-line); background: transparent; color: var(--gr-text); font: inherit; font-size: 12.5px; font-weight: 550; padding: 6px 11px; border-radius: 999px; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.gr-chips button:first-child { background: var(--gr-me); color: var(--gr-me-text); border-color: transparent; }
.gr-chips button:hover { border-color: color-mix(in srgb, var(--gr-c) 60%, var(--gr-line)); transform: translateY(-1px); }
.gr-f { display: flex; align-items: center; gap: 6px; margin: 4px 10px 10px; padding: 5px 5px 5px 14px; border-radius: 999px; border: 1px solid var(--gr-line); background: color-mix(in srgb, var(--gr-bg) 60%, transparent); transition: border-color .2s, box-shadow .2s; }
.gr-f:focus-within { border-color: color-mix(in srgb, var(--gr-c) 55%, var(--gr-line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gr-c) 14%, transparent); }
.gr-in { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--gr-text); font: inherit; font-size: 14px; padding: 7px 0; }
.gr-in::placeholder { color: var(--gr-text3); }
.gr-mic, .gr-send { width: 34px; height: 34px; border-radius: 50%; border: none; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: transform .15s, opacity .2s, background .2s; }
.gr-mic svg, .gr-send svg { width: 17px; height: 17px; }
.gr-mic { background: var(--gr-them); color: var(--gr-text); }
.gr-mic:hover { color: var(--gr-c); transform: scale(1.06); }
.gr-send { background: var(--gr-me); color: var(--gr-me-text); }
.gr-send:disabled { opacity: .22; cursor: default; }

/* Live voice: the ocean orb takes the stage while the agent talks. */
.gr-stage { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0 10px; }
.gr-stage[hidden] { display: none; }
.gr-orb { width: 132px; height: 132px; }
.gr-cs { font-size: 12.5px; color: var(--gr-text2); }
.gr-end { border: 1px solid var(--gr-line); background: transparent; color: var(--gr-text); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.gr-end:hover { border-color: #ef4444; color: #ef4444; }
.gr.gr-calling .gr-log { max-height: 150px; }

/* The plush agent, standing beside the card. */
.gr-pet { position: relative; order: 1; z-index: 1; width: 96px; height: 100px; flex-shrink: 0; margin: 0 52px -16px 0; }
.gr-body { position: absolute; left: 0; bottom: 8px; width: 96px; height: 96px; transform-origin: 50% 100%; }
.gr-body > svg, .gr-body > img { display: block; width: 96px; height: 96px; }
.gr-shadow { position: absolute; left: 22px; right: 22px; bottom: 4px; height: 10px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.22), transparent); }
/* Brand on every agent (dan, 2026-11-04): a Cognitive name tag pinned to the plush. */
.gr-tag { position: absolute; left: 14px; bottom: 16px; width: 24px; height: 24px; border-radius: 8px; background: #0f172a; color: #fff; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.25), 0 0 0 2px #fff; transform: rotate(-8deg); }
.gr-tag svg { width: 14px; height: 14px; }

/* The walk-in: steps in from the edge with a soft gait, then settles and waves. Played once per visit. */
.gr.gr-walk .gr-pet { animation: grWalk 1.8s cubic-bezier(.25,.7,.3,1) both; }
.gr.gr-walk .gr-body { animation: grStep .3s ease-in-out 6 alternate; }
.gr.gr-walk .gr-shadow { animation: grShadow .3s ease-in-out 6 alternate; }
.gr.gr-walk.gr-walk-short .gr-pet { animation-duration: .85s; }
.gr.gr-walk.gr-walk-short .gr-body, .gr.gr-walk.gr-walk-short .gr-shadow { animation-iteration-count: 3; }
@keyframes grWalk { from { transform: translateX(calc(100% + 40px)); } }
@keyframes grStep { from { transform: translateY(0) rotate(-3deg); } to { transform: translateY(-7px) rotate(3deg); } }
@keyframes grShadow { from { transform: scaleX(1); opacity: 1; } to { transform: scaleX(.82); opacity: .7; } }
.gr-body.gr-out { transition: transform .5s cubic-bezier(.5,0,.75,0), opacity .5s; transform: translateX(140px) rotate(6deg); opacity: 0; }

/* Closed: a small pill keeps the agent one tap away. */
.gr-pill { display: none; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 999px; border: 1px solid var(--gr-line); background: var(--gr-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); color: var(--gr-text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: 0 10px 30px -14px rgba(0,0,0,.35); }
.gr-pill-face { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: color-mix(in srgb, var(--gr-c) 18%, transparent); }
.gr.gr-min .gr-card, .gr.gr-min .gr-pet { display: none; }
.gr.gr-min .gr-pill { display: inline-flex; }
.gr.gr-min { opacity: 1; }

/* The page makes room for the open card on screens wide enough to spare a column, so nothing sits under it. */
@media (min-width: 1024px) {
  html.gr-dock body { padding-right: 336px; }
  html.gr-dock body .gr { right: 18px; }
}
html.gr-ready body { transition: padding-right .28s cubic-bezier(.2, .8, .2, 1); }
@media (prefers-reduced-motion: reduce) { body { transition: none; } }

@media (max-width: 560px) {
  .gr { right: 12px; left: 12px; bottom: 12px; }
  .gr-card { width: 100%; max-height: min(56vh, 460px); }
  .gr-pet, .gr-body, .gr-body > svg, .gr-body > img { width: 76px; height: 76px; }
  .gr-pet { height: 80px; margin: 0 56px -14px 0; }
  .gr-tag { left: 8px; bottom: 10px; width: 20px; height: 20px; }
  .gr-log { max-height: 34vh; }
  .gr.gr-min { left: auto; align-items: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  .gr.gr-walk .gr-pet, .gr.gr-walk .gr-body, .gr.gr-walk .gr-shadow, .gr.gr-arrive .gr-card, .gr-m { animation: none; }
  .gr-body.gr-out { transition: none; }
}
@media print { .gr { display: none; } }
.gr .gr-in, .gr .gr-in:focus, .gr .gr-in:focus-visible { border: none; outline: none; box-shadow: none; background: transparent; border-radius: 0; height: auto; }
/* Inside the app the Agent Assistant button owns the bottom-right corner, so the helper sits just above it. */
.gr.gr-app { bottom: calc(76px + env(safe-area-inset-bottom)); }
@media (max-width: 560px) { .gr.gr-app { bottom: calc(68px + env(safe-area-inset-bottom)); } }
/* Pages with their own chat box (data-greeter="quiet"): the pill sits clear of their composer. */
.gr.gr-quiet { bottom: calc(96px + env(safe-area-inset-bottom)); }

/* Phones and tablets (no spare column): a first visit gets a friendly hello pill that rises in once, and the page
   keeps a strip at its foot so the pill never sits on top of the last lines or the footer links. */
@media (max-width: 1023px) { html.gr-pad body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); } }
.gr.gr-hello .gr-pill { animation: grHello .6s cubic-bezier(.2, .8, .2, 1) both; border-color: color-mix(in srgb, var(--gr-c) 35%, var(--gr-line)); }
@keyframes grHello { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .gr.gr-hello .gr-pill { animation: none; } }
/* In the app on a phone the helper shrinks to just its face, so it covers as little of the screen as possible. */
@media (max-width: 560px) { .gr.gr-app.gr-min .gr-pill > span { display: none; } .gr.gr-app.gr-min .gr-pill { padding: 4px; } }

/* First-time microphone step (a real tap gets the browser's full Allow pop-up). */
.gr-cs .gr-allow { margin: 4px 0 6px; border: none; border-radius: 999px; padding: 9px 16px; font-size: 13.5px; font-weight: 650; cursor: pointer; color: #fff; background: #2563eb; }
