/* Perspective Studios mascot (mascot.js). The tile is the site's raised neumorphic surface (nbtn.css); the ring is Claudia's
   iridescent line; the core is the Prugna accent (ps-tokens.css). Light by default; dark when the page is dark
   (html[data-theme="dark"]) or when placed on a dark panel (.pnl.dark, .ps-dark). */
.ps-mascot {
  --psm-tile: #F3F4F5; --psm-sh: #CCCDCF; --psm-hi: #FBFCFC; --psm-well: #E9EAEC; --psm-core: #5B3563; --psm-core-hi: #846389; --psm-dot: #846389;
  --psm-r: 32%;
  position: relative; display: inline-grid; place-items: center; flex: 0 0 auto;
  width: var(--psm-size, 64px); height: var(--psm-size, 64px); border-radius: var(--psm-r); background: var(--psm-tile);
  box-shadow: calc(var(--psm-size, 64px) * .09) calc(var(--psm-size, 64px) * .09) calc(var(--psm-size, 64px) * .2) var(--psm-sh),
              calc(var(--psm-size, 64px) * -.09) calc(var(--psm-size, 64px) * -.09) calc(var(--psm-size, 64px) * .2) var(--psm-hi);
  transition: border-radius .6s cubic-bezier(.2,.7,.1,1), transform .6s cubic-bezier(.2,.7,.1,1);
}
html[data-theme="dark"] .ps-mascot, .pnl.dark .ps-mascot, .ps-dark .ps-mascot {
  --psm-tile: #353536; --psm-sh: rgba(26,15,30,.75); --psm-hi: #49494B; --psm-well: #2C2C2D; --psm-core: #E9E1EA; --psm-core-hi: #FBFCFC; --psm-dot: #E9E1EA;
}
.ps-mascot svg { width: 100%; height: 100%; overflow: visible; }
.ps-mascot__well { fill: var(--psm-well); }
.ps-mascot__ring { fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 72 26; transform-origin: 32px 32px; animation: psm-spin 9s linear infinite; }
.ps-mascot__core { transform-origin: 32px 32px; transform-box: view-box; animation: psm-breathe 3.6s ease-in-out infinite; transition: transform .4s; }
.ps-mascot__glint { fill: #FFFFFF; opacity: .75; }
.ps-mascot__orbit { transform-origin: 32px 32px; opacity: 0; transition: opacity .3s; }
.ps-mascot__dot { fill: var(--psm-dot); transform-origin: 32px 32px; transform: rotate(calc(var(--i) * 120deg)); }

/* thinking: dots orbit the lens, the ring speeds up */
.ps-mascot[data-state="thinking"] .ps-mascot__orbit { opacity: 1; animation: psm-spin 1.8s linear infinite; }
.ps-mascot[data-state="thinking"] .ps-mascot__ring { animation-duration: 2.4s; stroke-dasharray: 40 16; }
/* talking: the core pulses as if speaking */
.ps-mascot[data-state="talking"] .ps-mascot__core { animation: psm-talk .32s ease-in-out infinite alternate; }
.ps-mascot[data-state="talking"] .ps-mascot__ring { animation-duration: 4s; }
/* happy: the tile rounds into a circle, the ring closes */
.ps-mascot[data-state="happy"] { --psm-r: 50%; }
.ps-mascot[data-state="happy"] .ps-mascot__ring { stroke-dasharray: 100 0; }
.ps-mascot[data-state="happy"] .ps-mascot__core { transform: scale(1.12); animation: none; }
/* concerned: the tile squares up and leans a little, the core drops */
.ps-mascot[data-state="concerned"] { --psm-r: 18%; transform: rotate(-4deg); }
.ps-mascot[data-state="concerned"] .ps-mascot__core { transform: translateY(2.5px) scale(.9); animation: none; }
.ps-mascot[data-state="concerned"] .ps-mascot__ring { stroke-dasharray: 20 10; animation-duration: 14s; }

@keyframes psm-spin { to { transform: rotate(360deg); } }
@keyframes psm-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes psm-talk { from { transform: scale(.82); } to { transform: scale(1.22); } }

@media (prefers-reduced-motion: reduce) {
  .ps-mascot, .ps-mascot * { animation: none !important; transition: none !important; }
  .ps-mascot[data-state="thinking"] .ps-mascot__orbit { opacity: 1; }
}
