/* ─────────────────────────────────────────────────────────────────────────
   mascot.css — Sanjal, the chat widget's mascot (docs/mascot-prompts.md).
   The drawing and motion are in mascot.js; this file places Sanjal in the
   launcher, the chat header and the welcome screen, animates its props, and
   styles the tip bubble and the "talk to a person" nudge.

   Every placement keeps the original icon in the markup and only hides it
   once a mascot is mounted (.has-mascot), so the widget still looks right if
   the mascot scripts fail to load.
   ───────────────────────────────────────────────────────────────────────── */

.mascot {
  display: block;
  overflow: visible;
}

/* ═══ Launcher: Sanjal is the button while the chat is closed ══════════════ */

.chat-fab__mascot {
  display: none;
  pointer-events: none;
}

.chat-fab.has-mascot:not(.open) {
  width: 84px;
  height: 84px;
  background: transparent;
  box-shadow: none;
}

.chat-fab.has-mascot:not(.open):hover {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.chat-fab.has-mascot:not(.open) .chat-fab__open {
  display: none;
}

.chat-fab.has-mascot:not(.open) .chat-fab__mascot {
  display: block;
}

.chat-fab.has-mascot:focus-visible {
  outline: 3px solid var(--color-primary, #C25E26);
  outline-offset: 2px;
}

.chat-fab .chat-fab__mascot .mascot {
  width: 84px;
  height: 84px;
  /* A thin light edge keeps the dark antenna readable over dark heroes. */
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.95)) drop-shadow(0 8px 12px rgba(23, 20, 18, 0.25));
}

/* ═══ Chat header ════════════════════════════════════════════════════════ */

.chat-panel__avatar.has-mascot {
  overflow: visible;
  cursor: pointer;
}

.chat-panel__avatar.has-mascot > svg {
  display: none;
}

.chat-panel__avatar .chat-panel__mascot .mascot {
  width: 42px;
  height: 42px;
  margin-top: -6px;
}

/* ═══ Welcome screen ═════════════════════════════════════════════════════ */

.chat-welcome-icon.has-mascot {
  width: 104px;
  height: 104px;
  background: transparent;
  border: none;
  box-shadow: none;
  margin-bottom: 8px;
}

.chat-welcome-icon.has-mascot > svg {
  display: none;
}

.chat-welcome-icon .mascot {
  width: 104px;
  height: 104px;
}

/* ═══ Widget login screen ════════════════════════════════════════════════ */

.chat-login__icon-circle.has-mascot {
  width: 80px;
  height: 80px;
  background: transparent;
  border: none;
  box-shadow: none;
  margin-bottom: 6px;
}

.chat-login__icon-circle.has-mascot > svg {
  display: none;
}

.chat-login__icon-circle .mascot {
  width: 80px;
  height: 80px;
}

/* ═══ "What can Sanjal do?" ══════════════════════════════════════════════ */

.chat-chip--mascot {
  border-color: rgba(194, 94, 38, 0.45);
  background: var(--color-primary-tint, #FDF4ED);
  color: var(--color-primary, #C25E26);
  font-weight: 600;
}

.mascot-caps-row {
  max-width: 100%;
}

.mascot-caps {
  flex: 1;
  min-width: 0;
  padding: 14px;
  background: var(--color-surface, #FFFFFF);
  border: 1px solid var(--color-border, #EAE5DD);
  border-radius: 16px 16px 16px 4px;
}

.mascot-caps__title {
  margin: 0;
  font-family: var(--font-headline, 'Plus Jakarta Sans', sans-serif);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--color-text-primary, #1C1917);
}

.mascot-caps__intro,
.mascot-caps__footer {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--color-text-muted, #78716C);
}

.mascot-caps__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 12px 0 10px;
}

.mascot-cap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--color-border, #EAE5DD);
  border-radius: 10px;
  background: var(--color-bg, #FAF7F2);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mascot-cap:hover {
  border-color: var(--color-primary, #C25E26);
  background: var(--color-primary-tint, #FDF4ED);
}

.mascot-cap:focus-visible {
  outline: 2px solid var(--color-primary, #C25E26);
  outline-offset: 1px;
}

.mascot-cap__icon {
  font-size: 15px;
  line-height: 1.2;
}

.mascot-cap__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mascot-cap__text strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-primary, #1C1917);
  line-height: 1.3;
}

.mascot-cap__text small {
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--color-text-muted, #78716C);
}

/* ═══ Message avatars: a still face ══════════════════════════════════════ */

.msg-avatar:has(.mascot-mini) {
  background: transparent;
  border-color: transparent;
}

.msg-avatar .mascot-mini {
  width: 26px;
  height: 24px;
}

/* ═══ Eyes that become glyphs (love, starstruck, dizzy, oops) ═══════════ */

.mascot .m-g {
  display: none;
}

.mascot[data-glyph="heart"] .m-g-heart,
.mascot[data-glyph="star"] .m-g-star,
.mascot[data-glyph="x"] .m-g-x,
.mascot[data-glyph="spiral"] .m-g-spiral {
  display: inline;
  transform-box: fill-box;
  transform-origin: center;
  animation: mascot-glyph-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mascot[data-glyph="heart"] .m-g-heart {
  animation: mascot-glyph-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), mascot-beat 0.9s 0.25s ease-in-out infinite;
}

.mascot[data-glyph="spiral"] .m-g-spiral {
  animation: mascot-spin 1.2s linear infinite;
}

.mascot .m-shine {
  opacity: 0.26;
}

/* ═══ Antenna signal ═════════════════════════════════════════════════════ */

.mascot .m-arc {
  opacity: 0.14;
  transition: opacity 0.3s ease;
}

.mascot .m-signal.lvl-1 .m-arc1,
.mascot .m-signal.lvl-2 .m-arc1,
.mascot .m-signal.lvl-2 .m-arc2,
.mascot .m-signal.lvl-3 .m-arc {
  opacity: 0.85;
}

.mascot .m-signal.is-off .m-arc {
  opacity: 0;
}

/* Sending: the arcs light up one after another, like a transmission. */
.mascot .m-signal.is-pulse .m-arc {
  animation: mascot-transmit 1.2s ease-in-out infinite;
}

.mascot .m-signal.is-pulse .m-arc2 {
  animation-delay: 0.15s;
}

.mascot .m-signal.is-pulse .m-arc3 {
  animation-delay: 0.3s;
}

/* ═══ Props ══════════════════════════════════════════════════════════════ */

.mascot .m-prop {
  display: none;
}

.mascot .m-prop.is-on {
  display: inline;
}

.mascot .m-anim,
.mascot .m-confetti {
  transform-box: fill-box;
  transform-origin: center;
}

.mascot .is-on .m-z {
  opacity: 0;
  animation: mascot-z 2.4s ease-out infinite;
}

.mascot .is-on .m-z2 {
  animation-delay: 0.8s;
}

.mascot .is-on .m-z3 {
  animation-delay: 1.6s;
}

.mascot .is-on .m-pop {
  animation: mascot-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both, mascot-bob 1.4s 0.45s ease-in-out infinite;
}

.mascot .is-on .m-float {
  animation: mascot-float 1.8s ease-out infinite;
}

.mascot .is-on .m-twinkle {
  animation: mascot-twinkle 1.1s ease-in-out infinite;
}

.mascot .is-on .m-d1 {
  animation-delay: 0.25s;
}

.mascot .is-on .m-d2 {
  animation-delay: 0.5s;
}

.mascot .is-on .m-drip {
  animation: mascot-drip 1.6s ease-in infinite;
}

.mascot .is-on .m-tear {
  animation: mascot-tear 2s ease-in infinite;
}

.mascot .is-on .m-dot {
  animation: mascot-dot 1.2s ease-in-out infinite;
}

.mascot .is-on .m-wave {
  transform-origin: 30% 100%;
  animation: mascot-wave 0.38s ease-in-out infinite alternate;
}

.mascot .is-on .m-confetti {
  animation: mascot-confetti 1.3s cubic-bezier(0.2, 0.7, 0.4, 1) both;
}

@keyframes mascot-glyph-in {
  from { transform: scale(0.2); }
  to { transform: scale(1); }
}

@keyframes mascot-beat {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.18); }
  50% { transform: scale(0.96); }
}

@keyframes mascot-spin {
  to { transform: rotate(360deg); }
}

@keyframes mascot-transmit {
  0%, 100% { opacity: 0.15; }
  40% { opacity: 0.95; }
}

@keyframes mascot-z {
  0% { opacity: 0; transform: translate(0, 4px) scale(0.6); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(6px, -8px) scale(1.1); }
}

@keyframes mascot-pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

@keyframes mascot-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes mascot-float {
  0% { opacity: 0; transform: translateY(4px) scale(0.6); }
  20% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-14px) scale(1.05); }
}

@keyframes mascot-twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.5) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.1) rotate(45deg); }
}

@keyframes mascot-drip {
  0% { opacity: 0; transform: translateY(-3px); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateY(9px); }
}

@keyframes mascot-tear {
  0% { opacity: 0; transform: translateY(-2px) scale(0.7); }
  20% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(12px) scale(0.9); }
}

@keyframes mascot-dot {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

@keyframes mascot-wave {
  from { transform: rotate(-22deg); }
  to { transform: rotate(18deg); }
}

@keyframes mascot-confetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 26px)) rotate(var(--r)); }
}

/* ═══ Tip bubble (chat closed) ═══════════════════════════════════════════ */

.mascot-bubble {
  position: fixed;
  right: 24px;
  bottom: 118px;
  z-index: 997;
  width: max-content;
  max-width: 260px;
  padding: 12px 34px 12px 14px;
  background: var(--color-surface, #FFFFFF);
  border: 1px solid var(--color-border, #EAE5DD);
  border-radius: 16px 16px 4px 16px;
  box-shadow: var(--shadow-large, 0 12px 24px -4px rgba(28, 25, 23, 0.08));
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mascot-bubble.is-in {
  opacity: 1;
  transform: none;
}

.mascot-bubble[hidden] {
  display: none;
}

.mascot-bubble__text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--color-text-primary, #1C1917);
}

.mascot-bubble__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.mascot-bubble__ask {
  padding: 5px 12px;
  border: 1px solid var(--color-primary, #C25E26);
  border-radius: 999px;
  background: var(--color-primary-tint, #FDF4ED);
  color: var(--color-primary, #C25E26);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.mascot-bubble__ask:hover {
  background: var(--color-primary, #C25E26);
  color: #FFFFFF;
}


.mascot-bubble__what {
  padding: 5px 4px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary, #57534E);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.mascot-bubble__what:hover {
  color: var(--color-primary, #C25E26);
}

.mascot-bubble__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted, #78716C);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.mascot-bubble__close:hover {
  background: var(--color-surface-hover, #F7F4EE);
}

.mascot-bubble__ask:focus-visible,
.mascot-bubble__what:focus-visible,
.mascot-bubble__close:focus-visible {
  outline: 2px solid var(--color-primary, #C25E26);
  outline-offset: 2px;
}

/* ═══ "Talk to a person" nudge inside the chat ═══════════════════════════ */

.mascot-nudge {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--color-primary-tint, #FDF4ED);
  border: 1px dashed rgba(194, 94, 38, 0.35);
  border-radius: 14px;
  font-size: 13px;
  color: var(--color-text-primary, #1C1917);
}

.mascot-nudge__face .mascot-mini {
  display: block;
  width: 28px;
  height: 26px;
}

.mascot-nudge p {
  flex: 1;
  min-width: 160px;
  margin: 0;
  line-height: 1.4;
}

.mascot-nudge button {
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  background: var(--color-primary, #C25E26);
  color: #FFFFFF;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.mascot-nudge button:hover {
  background: var(--color-primary-hover, #A74E1B);
}

/* ═══ Small screens ══════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  .chat-fab.has-mascot:not(.open),
  .chat-fab .chat-fab__mascot .mascot {
    width: 72px;
    height: 72px;
  }

  .mascot-bubble {
    right: 16px;
    bottom: 96px;
    max-width: calc(100vw - 96px);
  }

  .mascot-caps__grid {
    grid-template-columns: 1fr;
  }
}

/* ═══ Reduced motion: faces still change, nothing moves ══════════════════ */

@media (prefers-reduced-motion: reduce) {
  .mascot *,
  .mascot-bubble {
    animation: none !important;
    transition: none !important;
  }

  .mascot .is-on .m-z,
  .mascot .is-on .m-confetti {
    opacity: 1;
  }

  .mascot .is-on .m-confetti {
    display: none;
  }
}
