/* EZ Neon: the shared Neon character (EZNEON v1). Goes with neon.js in this folder; needs no other stylesheet.
 * Owner: EZ Talks (prefix ENG). How-to: ez-docs _shared/ "EZ Neon — Shared Character Component How-To".
 * A page may set on .neon:  width (or the classes neon-sm / md / lg / xl), and --ez-neon-font for the text in his bubble. */
.neon { --nz-ready: 1; --nz-ink: #1b1240; --nz-spring: cubic-bezier(.34, 1.7, .5, 1); --nz-t: 1; --nz-a: 1; --ex: 0; --ey: 0; }
.neon[data-mood=calm] { --nz-t: 1.5; --nz-a: .6; } .neon[data-mood=excited] { --nz-t: .65; --nz-a: 1.35; }
.neon { --nz: #3cf2d0; --lvl: 0; position: relative; display: block; width: 132px; aspect-ratio: 200 / 232; isolation: isolate; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; flex: none; }
.neon::before { content: ""; position: absolute; inset: 6% -8% 6%; border-radius: 50%; z-index: -1; pointer-events: none; background: radial-gradient(closest-side, var(--nz), transparent);
  opacity: calc(.24 + var(--lvl) * .5); transform: scale(calc(.94 + var(--lvl) * .35)); transition: opacity .12s, transform .12s; animation: nz-aura calc(3.2s * var(--nz-t)) ease-in-out infinite; }
.neon.is-flash::before { opacity: .5; }
.neon-sm { width: 104px; } .neon-md { width: 124px; } .neon-lg { width: 150px; } .neon-xl { width: 178px; }
.neon > .nz { width: 100%; height: 100%; display: block !important; overflow: visible; }   /* the script draws him hidden; only this file shows him */
.nz-body, .nz-arm ellipse, .nz-hand ellipse, .nz-bub-o { fill: var(--nz); transition: fill .35s; }
.nz-stalk { fill: none; stroke: var(--nz); stroke-width: 5; stroke-linecap: round; transition: stroke .35s; }
@supports (fill: color-mix(in srgb, red, blue)) { .nz-arm ellipse, .nz-hand ellipse { fill: color-mix(in srgb, var(--nz) 78%, #2a1470); } .nz-stalk { stroke: color-mix(in srgb, var(--nz) 80%, #2a1470); } }
.nz-pool { fill: var(--nz); opacity: .16; }
.nz-ring { fill: none; stroke: var(--nz); stroke-width: 5; transition: stroke .35s; } .nz-ring-glow { fill: none; stroke: var(--nz); stroke-width: 14; opacity: .26; }
.nz-hover { transform-box: fill-box; transform-origin: center; animation: nz-ringf calc(3.2s * var(--nz-t)) ease-in-out infinite; }
.nz-all { transform-origin: 100px 200px; animation: nz-bob calc(3.2s * var(--nz-t)) ease-in-out infinite; }
.nz-rim { fill: none; stroke: #fff; stroke-opacity: .55; stroke-width: 4; stroke-linecap: round; }
.nz-core { fill: #fff; opacity: calc(.2 + var(--lvl) * .6); transform-box: fill-box; transform-origin: center; transform: scale(calc(1 + var(--lvl) * .3)); transition: opacity .1s, transform .1s; }
.nz-cheeks ellipse { fill: #ff5fa2; opacity: .55; }
.nz-eye ellipse { fill: var(--nz-ink); } .nz-hl { fill: #fff; }
.nz-eye { transform-box: fill-box; transform-origin: center; animation: nz-blink 4.6s infinite; }
.nz-brows path { fill: none; stroke: var(--nz-ink); stroke-width: 4.5; stroke-linecap: round; } .nz-brows { display: none; }
.nz-eyes-happy path, .zm-smile, .zm-flat { fill: none; stroke: var(--nz-ink); stroke-linecap: round; } .nz-eyes-happy path { stroke-width: 6; } .zm-smile, .zm-flat { stroke-width: 5; }
.nz-eyes-star path { fill: #ffe14d; stroke: var(--nz-ink); stroke-width: 2.5; stroke-linejoin: round; }
.zm ellipse { fill: var(--nz-ink); } .zm .zm-tongue { fill: #ff6f91; }
.nz-eyes-happy, .nz-eyes-star, .nz-sparks, .zm { display: none; } .zm-smile { display: inline; }
.nz-sparks path { fill: #ffe14d; }
.nz-bub { fill: #fff; } .nz-bubble { transform-box: fill-box; transform-origin: 10% 100%; }
.nz-e { display: none; fill: var(--nz-ink); font: 700 24px var(--ez-neon-font, "Fredoka", "Varela Round", system-ui, sans-serif); }
.nz text { direction: ltr; unicode-bidi: isolate; }   /* "hi!" stays "hi!" in Hebrew and Arabic */
.nz-e-spark { fill: #8a63ff; transform-box: fill-box; transform-origin: center; animation: nz-twinkle 2.4s ease-in-out infinite; }
.nz-e-heart { fill: #ff3d8b; transform-box: fill-box; transform-origin: center; animation: nz-beat .9s ease-in-out infinite; }
.nz-e-star { fill: #ffb400; transform-box: fill-box; transform-origin: center; animation: nz-spin 1.8s linear infinite; }
.nz-e-hi { font-size: 19px; } .nz-e-q, .nz-e-bang { font-size: 27px; } .nz-e-note { font-size: 25px; fill: #8a63ff; }
.nz-e-dots circle { transform-box: fill-box; transform-origin: center; animation: nz-dot .9s ease-in-out infinite; }
.nz-e-dots circle:nth-child(2) { animation-delay: .15s; } .nz-e-dots circle:nth-child(3) { animation-delay: .3s; }
.nz-e-bars rect { fill: var(--nz-ink); transform-box: fill-box; transform-origin: center; transform: scaleY(calc(.28 + var(--lvl) * 1.1)); transition: transform .08s linear; }
.nz-e-bars rect:nth-child(2), .nz-e-bars rect:nth-child(4) { transform: scaleY(calc(.4 + var(--lvl) * .9)); fill: #8a63ff; }
.nz-e-bars rect:nth-child(3) { transform: scaleY(calc(.5 + var(--lvl) * .6)); }
.neon[data-emote=spark] .nz-e-spark, .neon[data-emote=dots] .nz-e-dots, .neon[data-emote=bars] .nz-e-bars, .neon[data-emote=heart] .nz-e-heart, .neon[data-emote=star] .nz-e-star,
.neon[data-emote=q] .nz-e-q, .neon[data-emote=bang] .nz-e-bang, .neon[data-emote=hi] .nz-e-hi, .neon[data-emote=note] .nz-e-note { display: inline; }
.neon.is-emo .nz-bubble { animation: nz-pop .38s var(--nz-spring); }
.neon[data-mouth] .zm-smile { display: none; }
.neon[data-mouth=a] .zm-a, .neon[data-mouth=b] .zm-b, .neon[data-mouth=o] .zm-o, .neon[data-mouth=smile] .zm-smile { display: inline; }
/* a raised hand is drawn in front of the body (an arm swung up would hide behind it) */
.nz-hand { display: none; } .nz-hand-l { transform-origin: 38px 124px; } .nz-hand-r { transform-origin: 162px 124px; }
.neon[data-state=wave] .nz-arm-r { display: none; } .neon[data-state=wave] .nz-hand-r { display: inline; animation: nz-wave .4s ease-in-out 6 alternate; }
.neon[data-state=listening] .nz-all { animation: none; transform: translateY(-4px) scale(1.03); }
.neon[data-state=listening] .nz-eye { scale: 1.08; } .neon[data-state=listening] .nz-hover { animation-duration: 1s; }
.neon[data-state=talking] .nz-all { animation-duration: 1.1s; }
.neon[data-state=happy] .nz-eyes, .neon[data-state=celebrate] .nz-eyes { display: none; }
.neon[data-state=happy] .nz-eyes-happy, .neon[data-state=celebrate] .nz-eyes-star { display: inline; }
.neon[data-state=happy] .zm-smile, .neon[data-state=celebrate] .zm-smile { display: none; } .neon[data-state=happy] .zm-b, .neon[data-state=celebrate] .zm-b { display: inline; }
.neon[data-state=happy] .nz-all { animation: nz-hop .5s ease-out 2; }
.neon[data-state=celebrate] .nz-all { animation: nz-hop .6s ease-out infinite; }
.neon[data-state=celebrate] .nz-sparks { display: inline; } .neon[data-state=celebrate] .nz-sparks path { transform-box: fill-box; transform-origin: center; animation: nz-twinkle 1.1s ease-in-out infinite; }
.neon[data-state=celebrate] .nz-arm { display: none; } .neon[data-state=celebrate] .nz-hand { display: inline; animation: nz-cheer .45s ease-in-out infinite alternate; }
.neon[data-state=puzzled] .nz-all { animation: none; transform: rotate(7deg); }
.neon[data-state=puzzled] .nz-brows { display: inline; } .neon[data-state=puzzled] .nz-brow-l { transform-box: fill-box; transform-origin: center; transform: translateY(-6px) rotate(-10deg); }
.neon[data-state=puzzled] .zm-smile { display: none; } .neon[data-state=puzzled] .zm-flat { display: inline; }
.neon.is-poke .nz-all { animation: nz-squish .6s ease-out; }
@keyframes nz-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(calc(-7px * var(--nz-a))); } }
@keyframes nz-ringf { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.9); opacity: .7; } }
@keyframes nz-aura { 0%, 100% { scale: 1; } 50% { scale: 1.07; } }
@keyframes nz-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.08); } }
@keyframes nz-hop { 0%, 100% { transform: translateY(0) scale(1, 1); } 40% { transform: translateY(calc(-18px * var(--nz-a))) scale(.96, 1.05); } 70% { transform: translateY(0) scale(1.05, .95); } }
@keyframes nz-wave { from { transform: rotate(-14deg); } to { transform: rotate(18deg); } }
@keyframes nz-cheer { from { transform: rotate(-10deg); } to { transform: rotate(10deg); } }
@keyframes nz-squish { 0% { transform: scale(1, 1); } 22% { transform: scale(1.17, .82); } 48% { transform: translateY(-10px) scale(.9, 1.12); } 72% { transform: scale(1.05, .96); } 100% { transform: scale(1, 1); } }
@keyframes nz-pop { 0% { transform: scale(.4); } 100% { transform: scale(1); } }
@keyframes nz-twinkle { 0%, 100% { transform: scale(.85) rotate(0); opacity: .75; } 50% { transform: scale(1.12) rotate(18deg); opacity: 1; } }
@keyframes nz-beat { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.2); } 60% { transform: scale(.95); } }
@keyframes nz-dot { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-5px); } }

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

/* --- eyes that follow (script sets --ex / --ey) */
.nz-eyes { transform: translate(calc(var(--ex) * 1px), calc(var(--ey) * 1px)); transition: transform .18s ease-out; }

/* --- small moves on his own while resting */
.neon.is-fid-look .nz-eyes { animation: nz-look 1.6s ease-in-out; }
.neon.is-fid-stretch .nz-all { animation: nz-stretch 1.1s ease-in-out; }
.neon.is-fid-hop .nz-all { animation: nz-hop .5s ease-out 1; }
.neon.is-fid-tilt .nz-all { animation: nz-tilt 1.2s ease-in-out; }
.neon.is-fid-hum .nz-all { animation: nz-sway 1.4s ease-in-out; }
@keyframes nz-look { 0%, 100% { transform: translate(0, 0); } 22%, 42% { transform: translate(-6px, 1px); } 62%, 82% { transform: translate(6px, -1px); } }
@keyframes nz-stretch { 0%, 100% { transform: scale(1, 1); } 35% { transform: translateY(-4px) scale(.93, 1.12); } 68% { transform: scale(1.06, .95); } }
@keyframes nz-tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-8deg); } 70% { transform: rotate(8deg); } }
@keyframes nz-sway { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-5px) rotate(-4deg); } 75% { transform: translateX(5px) rotate(4deg); } }

/* --- a yawn, then asleep */
.nz-eyes-sleep { display: none; } .nz-eyes-sleep path { fill: none; stroke: var(--nz-ink); stroke-width: 6; stroke-linecap: round; }
.neon[data-state=sleeping] .nz-eyes, .neon.is-yawn .nz-eyes { display: none; }
.neon[data-state=sleeping] .nz-eyes-sleep, .neon.is-yawn .nz-eyes-sleep { display: inline; }
.neon.is-yawn .zm-smile { display: none; } .neon.is-yawn .zm-b { display: inline; }
.neon.is-yawn .nz-all { animation: nz-stretch 1.3s ease-in-out; }
.neon[data-state=sleeping] .zm-smile { display: none; } .neon[data-state=sleeping] .zm-o { display: inline; transform-box: fill-box; transform-origin: center; transform: scale(.6); }
.neon[data-state=sleeping] .nz-all { animation-duration: calc(5.6s * var(--nz-t)); }
.neon[data-state=sleeping] .nz-hover, .neon[data-state=sleeping]::before { animation-duration: calc(5.6s * var(--nz-t)); }
.neon[data-state=sleeping]::before { opacity: .12; }
.neon[data-state=sleeping] .nz-core { opacity: .08; }
.nz-e-zzz { font-size: 19px; fill: #8a63ff; transform-box: fill-box; transform-origin: center; animation: nz-beat 2.6s ease-in-out infinite; }
.neon[data-emote=zzz] .nz-e-zzz { display: inline; }

/* --- arriving and leaving */
.neon.is-in-pop > .nz { animation: nz-in-pop .55s var(--nz-spring) both; }
.neon.is-in-float > .nz { animation: nz-in-float .8s ease-out both; }
.neon.is-in-beam > .nz { animation: nz-in-beam .7s ease-out both; }
.neon.is-out > .nz { animation: nz-out .4s ease-in both; }
.neon.is-gone > .nz, .neon.is-gone::before { visibility: hidden; }
@keyframes nz-in-pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes nz-in-float { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes nz-in-beam { from { transform: translateY(-70px) scale(.2, 1.7); opacity: 0; filter: brightness(3); } 60% { opacity: 1; } to { transform: translateY(0) scale(1, 1); opacity: 1; filter: none; } }
@keyframes nz-out { from { transform: scale(1); opacity: 1; } to { transform: scale(0); opacity: 0; } }

/* --- on a light background (data-on="light"): he was drawn for the dark, so give him a soft shadow and a stronger glow */
.neon[data-on=light]::before { opacity: calc(.5 + var(--lvl) * .4); }
.neon[data-on=light] > .nz { filter: drop-shadow(0 3px 5px rgba(27, 18, 64, .32)); }
.neon[data-on=light] .nz-pool { opacity: .34; } .neon[data-on=light] .nz-rim { stroke-opacity: .8; }

@media (prefers-reduced-motion: reduce) {
  .neon, .neon *, .neon::before { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .neon.is-poke > .nz { filter: brightness(1.35); }
}
