/* Lantern's orb, shared by the avatar window and the panel. Markup and palettes: lib/sprite.js. */
/* ---- the orb ----
   A glass sphere with three lights drifting inside it. Colour and speed follow Lantern's state (lib/sprite.js
   sets --a/--b/--c/--glow/--spin); @property lets the colours glide from one state to the next. */
@property --a { syntax: '<color>'; inherits: true; initial-value: #ffd479; }
@property --b { syntax: '<color>'; inherits: true; initial-value: #ff9f43; }
@property --c { syntax: '<color>'; inherits: true; initial-value: #ff6b6b; }
@property --glow { syntax: '<color>'; inherits: true; initial-value: #ffb347; }

.sprite { --size: 104px; position: relative; width: 150px; height: 150px; flex: none; cursor: pointer;
          display: grid; place-items: center; outline: none;
          transition: --a .9s ease, --b .9s ease, --c .9s ease, --glow .9s ease, transform .35s cubic-bezier(.32, 1.4, .5, 1); }
.sprite:hover { transform: scale(1.05); }
.sprite:active { transform: scale(.96); }
.sprite:focus-visible .sphere { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--b); }

.sprite .halo { position: absolute; width: calc(var(--size) * 1.55); height: calc(var(--size) * 1.55); border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--glow) 55%, transparent) 0%, transparent 62%);
  filter: blur(6px); animation: breathe 5s ease-in-out infinite; pointer-events: none; }

.sprite .sphere { position: relative; width: var(--size); height: var(--size); border-radius: 50%; overflow: hidden;
  isolation: isolate; animation: float 6s ease-in-out infinite;
  background: radial-gradient(circle at 46% 38%, var(--a) 0%, var(--b) 48%, color-mix(in srgb, var(--c) 88%, #3d1650) 100%);
  box-shadow: 0 18px 36px -10px color-mix(in srgb, var(--glow) 70%, transparent),
              0 2px 6px rgba(0, 0, 0, .18); }

/* the light inside: three soft blobs on slow, different orbits, added together like light */
.sprite .flow { position: absolute; inset: -30%; border-radius: 50%; mix-blend-mode: screen; filter: blur(13px) saturate(1.3); }
.sprite .f1 { background: radial-gradient(circle at 30% 35%, var(--a) 0%, transparent 42%);
              animation: swirl var(--spin) linear infinite; }
.sprite .f2 { background: radial-gradient(circle at 68% 60%, var(--b) 0%, transparent 46%);
              animation: swirl calc(var(--spin) * .72) linear infinite reverse; }
.sprite .f3 { background: radial-gradient(circle at 45% 78%, var(--c) 0%, transparent 40%);
              animation: swirl calc(var(--spin) * 1.35) linear infinite; opacity: .9; }

/* the glass: a bright highlight top-left, a darker rim at the bottom, a hairline edge */
.sprite .sheen { position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse 46% 34% at 34% 22%, rgba(255, 255, 255, .78) 0%, rgba(255, 255, 255, .12) 55%, transparent 72%),
              radial-gradient(circle at 50% 120%, rgba(255, 255, 255, .28) 0%, transparent 45%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), inset 0 -14px 26px rgba(10, 4, 24, .38),
              inset 0 8px 18px rgba(255, 255, 255, .22); }

/* rings: a calm pulse while Lantern waits for your OK, a burst when a task is done and checked */
.sprite .ring { position: absolute; width: var(--size); height: var(--size); border-radius: 50%; pointer-events: none;
  border: 2px solid var(--b); opacity: 0; }
.sprite.needs-approval .ring { animation: pulse 2.2s cubic-bezier(.2, .7, .3, 1) infinite; }
.sprite.needs-approval .ring.r2 { animation-delay: 1.1s; }
.sprite.celebrating .ring { animation: burst 1.1s cubic-bezier(.2, .7, .3, 1) 2; }
.sprite.celebrating .ring.r2 { animation-delay: .25s; }

/* more than one task in flight: small lights orbit the sphere */
.sprite .sat { position: absolute; width: 9px; height: 9px; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(circle at 35% 35%, #fff, var(--a) 60%); box-shadow: 0 0 10px var(--glow);
  transition: opacity .5s; }
.sprite.juggling .sat { opacity: 1; animation: orbit 2.4s linear infinite; }
.sprite.juggling .s2 { animation-delay: -.8s; }
.sprite.juggling .s3 { animation-delay: -1.6s; }

/* per-state motion on top of the colours */
.sprite.thinking .sphere, .sprite.juggling .sphere { animation: float 6s ease-in-out infinite, think 1.6s ease-in-out infinite; }
.sprite.thinking .halo, .sprite.juggling .halo { animation-duration: 1.6s; }
.sprite.celebrating .sphere { animation: hop .7s cubic-bezier(.32, 1.4, .5, 1) 2, float 6s ease-in-out 1.4s infinite; }
.sprite.annoyed .sphere { animation: shake .4s ease-in-out 2, float 6s ease-in-out .8s infinite; }
.sprite.smug .sheen { animation: glint 2.8s ease-in-out 1; }
.sprite.sleeping { filter: saturate(.55) brightness(.92); }
.sprite.sleeping .halo { animation-duration: 9s; opacity: .55; }
.sprite.sleeping .sphere { animation-duration: 10s; }
.sprite.healed .ring { animation: burst 1.4s cubic-bezier(.2, .7, .3, 1) 1; }   /* one soft ring: fixed */
.sprite.listening .halo { animation: breathe 1.8s ease-in-out infinite; }       /* calm, attentive pulse */

@keyframes swirl { to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes breathe { 0%, 100% { transform: scale(.92); opacity: .75; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes think { 0%, 100% { scale: 1; } 50% { scale: 1.035; } }
@keyframes pulse { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(1.55); opacity: 0; } }
@keyframes burst { 0% { transform: scale(1); opacity: .95; border-width: 3px; } 100% { transform: scale(1.8); opacity: 0; border-width: 1px; } }
@keyframes orbit { from { transform: rotate(0deg) translateX(var(--orbit, 66px)) rotate(0deg); } to { transform: rotate(360deg) translateX(var(--orbit, 66px)) rotate(-360deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(1); } 35% { transform: translateY(-16px) scale(1.04, .97); } 60% { transform: translateY(0) scale(.97, 1.03); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes glint { 0%, 100% { filter: brightness(1); } 40% { filter: brightness(1.5); } }

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