/* InvitoGO assistant widget — styles. All classes are prefixed with .ia- */
.ia-root {
  --ia-paper: #fffaf1;
  --ia-paper-2: #fbf3e2;
  --ia-ink: #21182a;
  --ia-muted: #6b5d78;
  --ia-line: #ecdcb8;
  --ia-gold-ink: #8a6420;
  --ia-plum: #241a2e;
  --ia-gold: linear-gradient(135deg, #f6e4b4 0%, #dcb96b 42%, #b98d3c 100%);
  --ia-ok: #2f9e64;
  --ia-h: 260px;                       /* full-body mascot box height (width = 3/4 of it) */
  position: fixed; inset: 0; pointer-events: none; z-index: 2147483000;
  font-family: Onest, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ia-ink);
}
.ia-root * { box-sizing: border-box; }
.ia-root button { font: inherit; }

/* ---------- full-body mascot (walks along the bottom of the page) ---------- */
.ia-mascot {
  position: absolute; left: 0; top: 0; width: calc(var(--ia-h) * .75); height: var(--ia-h);
  padding: 0; border: 0; background: none; cursor: grab; touch-action: none; pointer-events: auto;
  -webkit-tap-highlight-color: transparent; will-change: transform;
}
.ia-mascot:focus-visible { outline: 2px solid #b98d3c; outline-offset: 4px; border-radius: 12px; }
.ia-mascot.is-dragging { cursor: grabbing; }
.ia-tilt { position: absolute; inset: 0; transition: transform .12s linear; }
.ia-flip { position: absolute; inset: 0; }
.ia-sprite, .ia-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ia-sprite { background-repeat: no-repeat; }
.ia-frame { object-fit: contain; object-position: bottom; }
.ia-shadow {
  position: absolute; top: 0; left: 0; width: calc(var(--ia-h) * .46); height: 12px; border-radius: 50%;
  background: var(--ia-ink); opacity: .16; pointer-events: none; will-change: transform, opacity;
}
.ia-breathe { animation: ia-breathe 4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes ia-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.012); } }
.ia-land { animation: ia-land .5s ease-out; transform-origin: 50% 100%; }
@keyframes ia-land { 0% { transform: scale(1.04,.94); } 100% { transform: none; } }

.ia-bubble {
  position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: none;
  background: #fff; border: 1px solid var(--ia-line); border-radius: 16px; padding: 8px 13px; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 12px 24px -16px rgba(33,24,42,.45); animation: ia-pop .25s ease-out;
}
@keyframes ia-pop { from { opacity: 0; } to { opacity: 1; } }

.ia-hide {
  position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--ia-line); background: #fff; color: var(--ia-muted);
  display: none; align-items: center; justify-content: center; cursor: pointer; pointer-events: auto; padding: 0;
}
.ia-root.is-hover .ia-hide { display: flex; }
.ia-hide svg { width: 12px; height: 12px; }

/* collapsed pill shown after the user hides the mascot */
.ia-pill {
  position: absolute; right: 16px; bottom: calc(16px + var(--ia-floor, 0px)); display: none; align-items: center; gap: 10px; min-height: 52px; padding: 0 18px 0 6px;
  border: 0; border-radius: 999px; background: var(--ia-plum); color: #fbf3e0; font-weight: 600; font-size: 14px; cursor: pointer;
  pointer-events: auto; box-shadow: 0 16px 30px -14px rgba(33,24,42,.6);
}
.ia-pill img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #fbecc9; }
.ia-root.is-hidden .ia-pill { display: inline-flex; }
.ia-root.is-hidden .ia-mascot, .ia-root.is-hidden .ia-shadow, .ia-root.is-hidden .ia-bubble { display: none; }

/* ---------- chat panel ---------- */
.ia-panel {
  position: absolute; right: 16px; bottom: 16px; width: 380px; height: min(640px, calc(100vh - 32px));
  display: none; flex-direction: column; background: var(--ia-paper); border: 1px solid rgba(33,24,42,.08); border-radius: 24px; overflow: hidden;
  box-shadow: 0 40px 80px -36px rgba(33,24,42,.45), 0 2px 6px rgba(33,24,42,.06); pointer-events: auto; animation: ia-in .3s ease-out;
}
.ia-root.is-chat .ia-panel { display: flex; }
.ia-root.is-chat .ia-mascot, .ia-root.is-chat .ia-shadow, .ia-root.is-chat .ia-bubble, .ia-root.is-chat .ia-pill { display: none; }
@keyframes ia-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.ia-half { position: absolute; right: 404px; bottom: 0; width: 210px; height: 280px; display: none; pointer-events: none; }
.ia-root.is-chat .ia-half { display: block; }
.ia-half img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom; opacity: 0; }
.ia-half img.is-on { opacity: 1; }
.ia-half .ia-half-sprite { position: absolute; inset: 0; background-repeat: no-repeat; opacity: 0; }
.ia-half .ia-half-sprite.is-on { opacity: 1; }
.ia-half .is-fade { z-index: 2; transition: opacity .3s ease; }

.ia-head { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 14px; background: var(--ia-paper-2); border-bottom: 1px solid rgba(33,24,42,.07); }
.ia-ava { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.ia-ava img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: #fbecc9; border: 2px solid #ecd8a6; }
.ia-ava::after { content: ""; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--ia-ok); border: 2px solid var(--ia-paper-2); }
.ia-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ia-name { font-family: "Cormorant Garamond", Georgia, serif; font-size: 24px; font-weight: 700; line-height: 1; }
.ia-status { font-size: 12.5px; color: var(--ia-muted); }
.ia-icon { width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--ia-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ia-icon:hover { background: rgba(33,24,42,.06); }
.ia-icon svg { width: 18px; height: 18px; }

.ia-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 14px; display: flex; flex-direction: column; gap: 12px; }
.ia-welcome { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.ia-welcome img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: #fbecc9; border: 3px solid #fff; box-shadow: 0 10px 24px -12px rgba(33,24,42,.45); }
.ia-welcome h2 { margin: 6px 0 0; font-family: "Cormorant Garamond", Georgia, serif; font-size: 30px; font-weight: 700; line-height: 1.1; }
.ia-welcome p { margin: 0 6px 10px; font-size: 14.5px; line-height: 1.55; color: var(--ia-muted); }
.ia-chips { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ia-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 11px 14px; background: #fff; border: 1px solid var(--ia-line); border-radius: 14px; font-size: 14px; font-weight: 500; color: var(--ia-ink); text-align: left; cursor: pointer; }
.ia-chip:hover { border-color: #dcb96b; background: #fffdf7; }

.ia-msg-user { align-self: flex-end; max-width: 82%; background: var(--ia-plum); color: #fbf3e0; padding: 10px 14px; border-radius: 18px 18px 6px 18px; font-size: 14.5px; line-height: 1.45; white-space: pre-line; animation: ia-in .25s ease-out; }
.ia-msg-bot { display: flex; gap: 8px; align-items: flex-start; max-width: 94%; animation: ia-in .25s ease-out; }
.ia-msg-bot > img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: #fbecc9; flex-shrink: 0; margin-top: 2px; }
.ia-msg-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ia-bubble-bot { background: #fff; border: 1px solid #efe3c8; padding: 11px 14px; border-radius: 6px 18px 18px 18px; font-size: 14.5px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.ia-cta { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; background: var(--ia-gold); color: #2a1c06; font-size: 13.5px; font-weight: 600; text-decoration: none; }
.ia-rate { display: flex; gap: 2px; }
.ia-rate button { width: 32px; height: 32px; border: 0; border-radius: 9px; background: transparent; color: #8b7f97; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ia-rate button[aria-pressed="true"] { background: #fbecc9; color: var(--ia-gold-ink); }
.ia-rate svg { width: 15px; height: 15px; }
.ia-typing { display: flex; gap: 5px; align-items: center; background: #fff; border: 1px solid #efe3c8; padding: 14px 16px; border-radius: 6px 18px 18px 18px; }
.ia-typing span { width: 7px; height: 7px; border-radius: 50%; background: #b98d3c; animation: ia-blink 1.2s infinite ease-in-out; }
.ia-typing span:nth-child(2) { animation-delay: .18s; } .ia-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes ia-blink { 0%,80%,100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

.ia-foot { padding: 10px 12px 8px; border-top: 1px solid rgba(33,24,42,.07); display: flex; flex-direction: column; gap: 6px; }
.ia-compose { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 12px; background: #fff; border: 1.5px solid #dcb96b; border-radius: 18px; }
.ia-compose textarea { flex: 1; resize: none; border: 0; outline: none; background: transparent; font: 400 14.5px/1.45 Onest, system-ui, sans-serif; color: var(--ia-ink); max-height: 120px; }
.ia-compose textarea::placeholder { color: #8b7f97; }
.ia-send { width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 12px; background: var(--ia-gold); color: #2a1c06; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ia-send:disabled { opacity: .5; cursor: default; }
.ia-send svg { width: 18px; height: 18px; }
.ia-note { margin: 0; text-align: center; font-size: 11.5px; color: var(--ia-muted); }
.ia-note a { color: var(--ia-gold-ink); }
.ia-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- small screens: smaller mascot, chat as bottom sheet ---------- */
@media (min-width: 601px) and (max-width: 899px) { .ia-half { display: none !important; } }
.ia-shade { display: none; }
@media (max-width: 600px) {
  .ia-root { --ia-h: 170px; --ia-sheet: min(64vh, 540px); }
  @supports (height: 1dvh) { .ia-root { --ia-sheet: min(64dvh, 540px); } }
  /* chat = bottom sheet over ~2/3 of the screen; the waist-up character peeks out above it, the page behind is dimmed */
  .ia-panel { left: 0; right: 0; bottom: 0; width: 100%; height: var(--ia-sheet); border-radius: 24px 24px 0 0; }
  .ia-root.is-chat .ia-shade { display: block; position: absolute; inset: 0; background: rgba(33, 24, 42, .38); pointer-events: auto; animation: ia-pop .2s ease-out; }
  .ia-half { right: 6px; bottom: calc(var(--ia-sheet) - 34px); width: 156px; height: 208px; }
  .ia-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 600px) and (max-height: 560px) { .ia-half { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  .ia-breathe, .ia-land, .ia-typing span, .ia-panel, .ia-bubble { animation: none !important; }
}

/* ---------- a fresh answer is written word by word ---------- */
.ia-bubble-bot.is-typing::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: -0.15em; background: var(--ia-gold-ink); animation: ia-caret .8s steps(1) infinite; }
@keyframes ia-caret { 50% { opacity: 0; } }
.ia-reveal { animation: ia-in .25s ease-out; }
@media (prefers-reduced-motion: reduce) { .ia-bubble-bot.is-typing::after, .ia-reveal { animation: none !important; } }
