/* Nutfira — Badami, the shopping companion. Loaded after first paint (layout/theme.liquid).
   Moods (which eyes/mouth show) live in theme.css so the empty-bag illustration shares them. */

.mascot { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; pointer-events: none; opacity: 0; transform: translateY(24px); transition: opacity .5s ease, transform .6s cubic-bezier(.2,.9,.25,1.2); }
.mascot.is-in { opacity: 1; transform: none; }
.mascot--left { left: 16px; }
.mascot--right { right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); align-items: flex-end; }
.mascot > * { pointer-events: auto; }

.mascot__figure { width: 74px; height: 92px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 40% 40% 46% 46%; filter: drop-shadow(0 10px 14px rgba(43, 29, 26, .18)); transition: transform .45s cubic-bezier(.2,.9,.25,1.1); }
.mascot__figure:hover { transform: translateY(-3px); }
/* Resting: while the page scrolls and he has nothing to say, he leans back against the edge so
   he never covers a price or a button; hovering, focusing or a new message brings him out. */
.mascot--left.is-resting .mascot__figure { transform: translateX(calc(-50% - 16px)) rotate(14deg); }
.mascot--right.is-resting .mascot__figure { transform: translateX(calc(50% + 16px)) rotate(-14deg); }
@media (max-width: 749px) {
  .mascot--left.is-resting .mascot__figure { transform: translateX(calc(-66% - 16px)) rotate(16deg); }
  .mascot--right.is-resting .mascot__figure { transform: translateX(calc(66% + 16px)) rotate(-16deg); }
}
.mascot__figure:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 4px; }
.mascot__svg { width: 100%; height: 100%; overflow: visible; }

/* Idle life: a slow breath and the sprig moving in a breeze. */
.mascot__svg .m-body { transform-origin: 60px 136px; animation: m-breathe 4.2s ease-in-out infinite; }
.mascot__svg .m-sprig { transform-origin: 60px 15px; animation: m-sway 5.6s ease-in-out infinite; }
@keyframes m-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.03); } }
@keyframes m-sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }

/* Blink: the open eyes close for a moment. */
.mascot.is-blinking .mascot__svg[data-mood="idle"] .m-eyes--open { display: none; }
.mascot.is-blinking .mascot__svg[data-mood="idle"] .m-eyes--closed { display: inline; }

/* Reactions. */
.mascot.is-hop .mascot__svg { animation: m-hop .6s cubic-bezier(.3,.7,.4,1); }
.mascot.is-jump .mascot__svg { animation: m-jump .9s cubic-bezier(.3,.7,.4,1); }
.mascot.is-wave .mascot__svg .m-arm--r { animation: m-wave 1.3s ease-in-out; }
@keyframes m-hop { 0% { transform: none; } 40% { transform: translateY(-12px) scale(.98, 1.03); } 70% { transform: translateY(0) scale(1.04, .96); } 100% { transform: none; } }
@keyframes m-jump { 0% { transform: none; } 30% { transform: translateY(-26px) rotate(-6deg); } 55% { transform: translateY(-26px) rotate(6deg); } 80% { transform: translateY(0) scale(1.05, .94); } 100% { transform: none; } }
@keyframes m-wave { 0%, 100% { transform: rotate(0); } 20%, 60% { transform: rotate(-115deg); } 40%, 80% { transform: rotate(-85deg); } }
.mascot__svg .m-arm--r, .mascot__svg .m-arm--l { transform-box: view-box; }
.mascot__svg .m-arm--r { transform-origin: 92px 96px; }
.mascot__svg .m-arm--l { transform-origin: 28px 96px; }
.mascot__svg[data-mood="celebrate"] .m-arm--r { transform: rotate(-120deg); }
.mascot__svg[data-mood="celebrate"] .m-arm--l { transform: rotate(120deg); }
.mascot__svg[data-mood="celebrate"] .m-sparkles { animation: m-twinkle .9s ease-in-out infinite alternate; }
@keyframes m-twinkle { from { opacity: .35; } to { opacity: 1; } }
.mascot__svg[data-mood="sleepy"] .m-zzz { animation: m-float 2.4s ease-in-out infinite; }
@keyframes m-float { 0% { transform: translateY(4px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-8px); opacity: 0; } }

/* Confetti: leaves, gold flecks and tiny kernels burst from behind him. */
.mascot__confetti { position: absolute; left: 37px; bottom: 60px; width: 0; height: 0; pointer-events: none; }
.mascot--right .mascot__confetti { left: auto; right: 37px; }
.mascot__confetti i { position: absolute; width: 7px; height: 11px; border-radius: 60% 60% 50% 50%; animation: m-burst 1.2s cubic-bezier(.2,.7,.3,1) forwards; transform: rotate(var(--a)) translateY(0); }
.mascot__confetti i.is-leaf { background: #3f6b4d; border-radius: 0 70% 0 70%; }
.mascot__confetti i.is-gold { background: var(--c-gold); width: 6px; height: 6px; border-radius: 50%; }
.mascot__confetti i.is-nut { background: #b9733f; }
@keyframes m-burst { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(.6); } 70% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--d) * -1)) scale(1); } }

/* Speech bubble. */
.mascot__bubble { position: relative; width: min(300px, calc(100vw - 32px)); padding: 16px 18px 14px; background: var(--c-card); color: var(--c-text); border: 1px solid var(--c-line); border-radius: 14px; box-shadow: 0 18px 40px -18px rgba(43, 29, 26, .35), 0 2px 6px rgba(43, 29, 26, .06); opacity: 0; transform: translateY(10px) scale(.96); transform-origin: 20% 100%; transition: opacity .25s ease, transform .3s cubic-bezier(.2,.9,.3,1.1); }
.mascot--right .mascot__bubble { transform-origin: 80% 100%; }
.mascot__bubble.is-open { opacity: 1; transform: none; }
.mascot__bubble::after { content: ""; position: absolute; bottom: -7px; left: 30px; width: 14px; height: 14px; background: var(--c-card); border-right: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); transform: rotate(45deg); }
.mascot--right .mascot__bubble::after { left: auto; right: 30px; }
.mascot__name { margin: 0 0 4px; font: 600 11px/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--c-gold-text); }
.mascot__text { margin: 0; font-size: 14.5px; line-height: 1.5; padding-right: 18px; }
.mascot__close { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; background: none; color: var(--c-muted); border-radius: 50%; cursor: pointer; }
.mascot__close:hover { background: var(--c-soft); color: var(--c-text); }
.mascot__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mascot__actions:empty { display: none; }
.mascot__action { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 12px; border: 1px solid var(--c-line); border-radius: 999px; background: var(--c-bg); color: var(--c-text); font: 500 13px/1.2 var(--font-body); text-decoration: none; cursor: pointer; transition: background-color .2s, border-color .2s, color .2s; }
.mascot__action:hover { border-color: var(--c-brand); color: var(--c-brand); }
.mascot__action.is-primary { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-on-dark); }
.mascot__action.is-primary:hover { background: var(--c-brand-deep); color: var(--c-on-dark); }
.mascot__action:focus-visible, .mascot__close:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 2px; }

/* Tucked away: a little almond peeking from the edge. */
.mascot__peek { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); width: 44px; height: 54px; padding: 0; border: 0; background: none; cursor: pointer; transition: transform .3s ease; }
.mascot--left .mascot__peek { left: -14px; transform: rotate(18deg); }
.mascot--right .mascot__peek { right: -14px; transform: rotate(-18deg); }
.mascot__peek:hover, .mascot__peek:focus-visible { transform: rotate(0) translateX(8px); }
.mascot--right .mascot__peek:hover, .mascot--right .mascot__peek:focus-visible { transform: rotate(0) translateX(-8px); }
.mascot__peek:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 2px; }
.mascot__peek-svg { width: 100%; height: 100%; }

/* Out of the way while a drawer, the search or a dialog is open, and on the mix builder's phone bar. */
body.is-locked .mascot { opacity: 0; pointer-events: none; }
@media (max-width: 749px) {
  .mascot__figure { width: 60px; height: 75px; }
  .template-suffix-mix .mascot { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .mascot, .mascot__bubble, .mascot__figure { transition: none; }
  .mascot__svg .m-body, .mascot__svg .m-sprig, .mascot__svg .m-zzz, .mascot__svg .m-sparkles { animation: none; }
  .mascot.is-hop .mascot__svg, .mascot.is-jump .mascot__svg, .mascot.is-wave .mascot__svg .m-arm--r { animation: none; }
}
