/* Springy animations: Peter's own set, copied from Chalkboard (ui/ui.css, the "springy animations" block) and
   Picture Machines (docs/style.css + app.js). Same curves, same times, same keyframes, same moves:
   things are pulled and stretch, squash and settle. Used here by site.css; the script part is springy.js. */
:root{
  /* two real springs, as linear() curves: a soft one for things that travel (it goes 8% past and settles)
     and a lively one for small things (16% past) */
  --exp-spring:linear(0,0.037,0.131,0.258,0.398,0.539,0.669,0.783,0.878,0.953,1.008,1.047,1.07,1.081,1.083,1.079,1.07,1.06,1.048,1.036,1.025,1.016,1.009,1.003,0.998,0.996,0.994,0.993,0.993,0.994,0.994,0.995,1);
  --exp-spring-pop:linear(0,0.055,0.193,0.374,0.566,0.746,0.899,1.017,1.098,1.145,1.162,1.158,1.138,1.11,1.078,1.048,1.022,1.001,0.987,0.978,0.974,0.974,0.977,0.981,0.986,0.991,0.995,0.999,1.002,1.003,1.004,1.004,1);
  --exp-t:540ms;
  --sp-speed:150ms;
}
/* the keyframes (Picture Machines' names; the same moves as Chalkboard's exp-*) */
@keyframes rise{from{opacity:.2;transform:translateY(34px) scale(.95)}}
@keyframes arrive{from{opacity:.2;transform:translateY(-14px) scale(.7)}}
@keyframes turn{from{transform:scale(.4) rotate(-140deg)}}
@keyframes drip{from{opacity:.25;transform:translateY(-12px) scale(.95)}}
@keyframes draw{from{transform:scaleX(0)}}
@keyframes icopop{from{transform:scale(.55) rotate(-24deg)}}

/* buttons are pulled toward the pointer and stretch the way they are pulled (springy.js sets --mx, --my, --sx, --sy),
   squash under it and spring back */
.sp-btn{transform:translate(var(--mx,0px),var(--my,0px)) scale(var(--sx,1),var(--sy,1));
  transition:background var(--sp-speed) var(--ease),border-color var(--sp-speed) var(--ease),filter var(--sp-speed) var(--ease),transform var(--exp-t) var(--exp-spring-pop)}
.sp-btn:active:not(:disabled){transform:translate(var(--mx,0px),var(--my,0px)) scale(1.07,.82);transition-duration:var(--sp-speed),var(--sp-speed),var(--sp-speed),70ms}

/* a row of choices on one track; the pill behind the chosen one is pulled across to the next (springy.js: it stretches
   over both, thinner, then its back edge lets go and catches up on a spring) */
.sp-seg{position:relative}
.sp-seg button{position:relative;z-index:1;transform:translate(var(--mx,0px),var(--my,0px)) scale(var(--sx,1),var(--sy,1));transition:color var(--sp-speed) var(--ease),transform var(--exp-t) var(--exp-spring-pop)}
.sp-seg button:active{transform:translate(var(--mx,0px),var(--my,0px)) scale(1.06,.82);transition-duration:var(--sp-speed),70ms}
.sp-seg .pill{position:absolute;left:0;top:0;pointer-events:none}

/* cards: they arrive one after another, grow a little under the pointer, give when pressed; the picture in them tilts */
.sp-card{position:relative;z-index:1;transition:color var(--sp-speed) var(--ease),transform var(--exp-t) var(--exp-spring-pop)}
.sp-card:hover:not(.on){transform:scale(1.04)}
.sp-card:active{transform:scale(.92);transition-duration:var(--sp-speed),70ms}
.sp-card .sp-thumb{transition:transform var(--exp-t) var(--exp-spring-pop)}
.sp-card:hover .sp-thumb{transform:scale(1.05) rotate(-2deg)}
/* the chosen card wears the pill. While it travels from one card to another the pill is its own piece (.sp-cardpill,
   moved by springy.js), and the card paints it again when it lands. */
.sp-cardpill{position:absolute;z-index:0;left:0;top:0;pointer-events:none;visibility:hidden}
.gliding > .sp-cardpill{visibility:visible}

/* an icon leans when you point at its card, shrinks when pressed, and pops when it is the one */
.sp-ico{transition:transform var(--exp-t) var(--exp-spring-pop),background var(--sp-speed) var(--ease)}
.sp-head:hover .sp-ico{transform:scale(1.14) rotate(-8deg)}
.sp-head:active .sp-ico{transform:scale(.8);transition-duration:70ms,var(--sp-speed)}
.sp-ico.popped,.popped > .sp-ico{animation:icopop var(--exp-t) var(--exp-spring-pop)}

/* the mark turns in, and leans when you point at it */
.sp-mark{animation:turn calc(var(--exp-t) * 1.3) var(--exp-spring-pop) 80ms backwards;transition:transform var(--exp-t) var(--exp-spring-pop)}
.sp-mark:hover{transform:rotate(-14deg) scale(1.12)}
.sp-mark:active{transform:scale(.8);transition-duration:70ms}

/* panels rise in; the line beside a heading draws itself; what a panel holds drips in, one row after another;
   small things arrive one after another. (A panel below the fold does this when you scroll to it: springy.js adds .in) */
.sp-panel.in{animation:rise var(--exp-t) var(--exp-spring) 80ms backwards}
.sp-line{display:flex;align-items:center;gap:14px}
.sp-line::after{content:"";flex:1;height:1px;background:currentColor;opacity:.18;transform-origin:0 50%}
.sp-panel.in .sp-line::after{animation:draw calc(var(--exp-t) * 1.2) var(--exp-spring) 200ms backwards}
.sp-panel.in .sp-drip{transform-origin:50% 0;animation:drip var(--exp-t) var(--exp-spring) backwards;animation-delay:calc(var(--n,0) * 26ms + 80ms)}
.sp-panel.in .sp-arrive{animation:arrive var(--exp-t) var(--exp-spring-pop) backwards;animation-delay:calc(var(--n,0) * 30ms + 140ms)}
.js .sp-panel:not(.in){visibility:hidden}

/* stillness is the courtesy: with "reduce motion" nothing travels, leans or stretches */
@media (prefers-reduced-motion: reduce){
  :root{--exp-t:1ms}
  main *,main *::before,main *::after{animation-duration:1ms!important;animation-delay:0ms!important}
  .sp-btn,.sp-seg button,.sp-card,.sp-card .sp-thumb,.sp-ico,.sp-mark{transform:none!important}
}
