/* flair: pointer lean + glare (tilt.ts), number roll (countup.ts), chi's face, knob detent. transform / opacity only */

/* glare: a soft chi coloured light that follows the pointer. panels paint it into their chamfered fill, cards and
   tiles get it on ::after (panels keep ::after for their corner brackets) */
.mod.panel[data-tilt]::before {
  background:
    radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), color-mix(in srgb, var(--chi) calc(var(--ga, 0) * 16%), transparent), transparent 60%),
    linear-gradient(180deg, var(--panel-hi), transparent 40%), var(--panel);
}
:is(.card, .tile)[data-tilt]::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  clip-path: var(--cut-shape);
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), color-mix(in srgb, var(--chi) 22%, transparent), transparent 62%);
  opacity: var(--ga, 0);
}
[data-tilt] { will-change: transform; }

/* number roll */
.rolling { font-variant-numeric: tabular-nums; }

/* chi: the picture slides toward the pointer (translate, so her own transform animations keep working) and blinks */
.chix-avatar.hero .chi { translate: var(--ax, 0) var(--ay, 0); transition: filter 300ms, translate 0.35s ease-out; }
.chix-avatar.hero.blink::after {
  content: ""; position: absolute; left: 29%; right: 32%; top: 47%; height: 8%; z-index: 2; pointer-events: none;
  background: #e6fbff; border-radius: 40%; box-shadow: 0 2px 0 -0.5px rgba(14, 54, 84, 0.85);
  transform-origin: 50% 40%; translate: var(--ax, 0) var(--ay, 0);
  animation: chi-blink 170ms ease-in-out 1;
}
@keyframes chi-blink { 0%, 100% { transform: scaleY(0); opacity: 0; } 45% { transform: scaleY(1); opacity: 1; } }

/* the mode knob clicks into each detent with a small overshoot */
.knob-cap { transition: transform 0.38s cubic-bezier(0.34, 1.9, 0.5, 1); }

html.calm .chix-avatar.hero .chi, html.nojuice .chix-avatar.hero .chi { translate: none; }
html.calm .chix-avatar.blink::after, html.nojuice .chix-avatar.blink::after { display: none; }
html.calm .knob-cap, html.nojuice .knob-cap { transition-duration: 0.01ms; }
html.notilt [data-tilt] { transform: none !important; }
html.notilt :is(.card, .tile)[data-tilt]::after { display: none; }
@media (prefers-reduced-motion: reduce) {
  .chix-avatar.hero .chi { translate: none; }
  .chix-avatar.blink::after { display: none; }
  .knob-cap { transition-duration: 0.01ms; }
}
