/* Paper motion (docs/MOTION_LANGUAGE.md): the arrivals every page shares. A piece carries data-pm="<kind>"; pmotion.js adds
   .pm-in when it is seen and CSS plays the arrival: it falls or slides along an eased path, lands with a short squash, settles
   on a spring and ends at its own resting tilt. Transform and opacity only. fill-mode backwards: the piece's own rotate,
   translate and scale properties and its own transform are never overwritten after the arrival. */
:root {
  --pm-quick: 240ms; --pm-settle: 700ms; --pm-slow: 1300ms;
  --pm-fall: cubic-bezier(.55, 0, .9, .55);
  --pm-glide: cubic-bezier(.16, .8, .3, 1);
  /* damped springs sampled as linear(): soft 4% overshoot, pop 15%, wobble 27% (hanging things) */
  --pm-spring: linear(0, .056, .187, .348, .51, .657, .778, .873, .942, .989, 1.017, 1.033, 1.038, 1.037, 1.033, 1.027, 1.021, 1.015, 1.01, 1.006, 1.003, 1.001, 1);
  --pm-pop: linear(0, .059, .203, .39, .584, .763, .912, 1.023, 1.096, 1.136, 1.148, 1.14, 1.119, 1.091, 1.062, 1.036, 1.014, .997, .986, .98, .978, .979, .982, .986, .991, .995, .998, 1);
  --pm-wobble: linear(0, .059, .21, .414, .635, .844, 1.021, 1.153, 1.236, 1.272, 1.269, 1.237, 1.185, 1.125, 1.065, 1.013, .971, .943, .928, .924, .931, .943, .959, .975, .991, 1.004, 1.013, 1.019, 1.021, 1.02, 1.017, 1.013, 1.009, 1.004, 1);
}

@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  /* pre-states: held until pmotion.js has run (html.pm-ready); a failsafe shows the piece if it never does */
  html:not(.pm-ready):not(.rm) [data-pm] { opacity: 0; animation: pm-failsafe 1ms 2.8s forwards; }
  html.pm-ready:not(.rm) [data-pm]:not(.pm-in) { opacity: 0; }
  html.pm-ready:not(.rm) [data-pm].pm-in {
    animation-name: var(--pm-anim, pm-drop); animation-duration: var(--pm-d, var(--pm-settle));
    animation-delay: var(--pm-at, 0ms); animation-fill-mode: backwards; animation-timing-function: var(--pm-spring); }
  [data-pm="drop"]  { --pm-anim: pm-drop; }
  [data-pm="rise"]  { --pm-anim: pm-rise; --pm-d: 640ms; }
  [data-pm="stamp"] { --pm-anim: pm-stamp; --pm-d: 600ms; transform-origin: 50% 50%; }
  [data-pm="pin"]   { --pm-anim: pm-pin; --pm-d: 900ms; transform-origin: 50% 8px; }
  [data-pm="deal"]  { --pm-anim: pm-deal; --pm-d: 780ms; }
  [data-pm="slide"] { --pm-anim: pm-slide; --pm-d: 700ms; }
  [data-pm="peek"]  { --pm-anim: pm-peek; --pm-d: 760ms; transform-origin: 50% 100%; }
  [data-pm="leaf"]  { --pm-anim: pm-leaf; --pm-d: 1000ms; transform-origin: 0 50%; }
  [data-pm="glow"]  { --pm-anim: pm-glow; --pm-d: 1200ms; }
  [data-pm="book"]  { --pm-anim: pm-book; --pm-d: 760ms; transform-origin: 50% 100%; }
  [data-pm="grow"]  { --pm-anim: pm-grow; --pm-d: 700ms; transform-origin: 50% 100%; }
  [data-pm="tick"]  { --pm-anim: pm-tick; --pm-d: var(--pm-quick); }
  [data-pm="pop"]   { --pm-anim: pm-pop; --pm-d: 420ms; }
  [data-pm="unfold"] { --pm-anim: pm-unfold; --pm-d: 640ms; transform-origin: 50% 0; }
  [data-pm="part-l"] { --pm-anim: pm-part-l; --pm-d: 1400ms; --pm-spring: cubic-bezier(.65, .05, 0, 1); }
  [data-pm="part-r"] { --pm-anim: pm-part-r; --pm-d: 1400ms; --pm-spring: cubic-bezier(.65, .05, 0, 1); }
  [data-pm="settle"] { --pm-anim: pm-settle; --pm-d: 1200ms; --pm-spring: cubic-bezier(.625, .05, 0, 1); }
}
@keyframes pm-failsafe { to { opacity: 1; } }

/* a card or cut-out: falls, lands with a squash, settles */
@keyframes pm-drop {
  0% { opacity: 0; transform: translateY(-26px) rotate(var(--pm-r, -2.2deg)) scale(1.03); animation-timing-function: var(--pm-fall); }
  24% { opacity: 1; }
  44% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1.045, .94); animation-timing-function: var(--pm-spring); }
}
/* copy and captions: a sheet lifted into place */
@keyframes pm-rise {
  0% { opacity: 0; transform: translateY(22px) rotate(var(--pm-r, .8deg)); animation-timing-function: var(--pm-glide); }
  30% { opacity: 1; }
  58% { opacity: 1; transform: translateY(-2px) rotate(0deg) scale(1, .994); animation-timing-function: var(--pm-spring); }
}
/* a rubber stamp: big and turned, slapped flat */
@keyframes pm-stamp {
  0% { opacity: 0; transform: scale(1.7) rotate(var(--pm-r, -9deg)); animation-timing-function: cubic-bezier(.5, 0, 1, .6); }
  26% { opacity: 1; }
  38% { opacity: 1; transform: scale(.9, .86) rotate(1.4deg); animation-timing-function: var(--pm-pop); }
}
/* a note pinned at the top: drops, the pin catches, it swings and hangs */
@keyframes pm-pin {
  0% { opacity: 0; transform: translateY(-22px) rotate(-12deg) scale(1.05); animation-timing-function: var(--pm-fall); }
  22% { opacity: 1; }
  30% { opacity: 1; transform: translateY(0) rotate(6.5deg) scale(1.02, .96); animation-timing-function: var(--pm-wobble); }
}
/* a playing card dealt from the left */
@keyframes pm-deal {
  0% { opacity: 0; transform: translate(var(--pm-dx, -120px), -34px) rotate(var(--pm-r, -16deg)) scale(.92); animation-timing-function: var(--pm-glide); }
  20% { opacity: 1; }
  58% { opacity: 1; transform: translate(0, 0) rotate(1.8deg) scale(1.02, .975); animation-timing-function: var(--pm-spring); }
}
/* a card slid in from the right, then settled */
@keyframes pm-slide {
  0% { opacity: 0; transform: translateX(var(--pm-dx, 64px)) rotate(var(--pm-r, 5deg)); animation-timing-function: var(--pm-glide); }
  22% { opacity: 1; }
  56% { opacity: 1; transform: translateX(0) rotate(-1.2deg) scale(1.025, .97); animation-timing-function: var(--pm-spring); }
}
/* a character peeking up from behind a sill (the window clips it) */
@keyframes pm-peek {
  0% { opacity: 1; transform: translateY(104%); animation-timing-function: var(--pm-glide); }
  60% { opacity: 1; transform: translateY(-6%) scale(1, 1.03); animation-timing-function: var(--pm-spring); }
}
/* a door leaf swings open a few degrees on its hinge, then closes with a small rebound */
@keyframes pm-leaf {
  0% { transform: perspective(900px) rotateY(0deg); animation-timing-function: cubic-bezier(.25, .8, .3, 1); }
  38% { transform: perspective(900px) rotateY(22deg); animation-timing-function: var(--pm-pop); }
  100% { transform: perspective(900px) rotateY(0deg); }
}
/* the light behind the arch comes up, then eases to its resting glow */
@keyframes pm-glow {
  0% { opacity: 0; transform: scale(.94); animation-timing-function: var(--pm-glide); }
  40% { opacity: 1; transform: scale(1.04); }
}
/* a book pulled off the shelf: up from its slot, tilted with the fan, lands flat with a squash */
@keyframes pm-book {
  0% { opacity: 0; transform: translateY(40px) rotate(var(--pm-fan, -5deg)) scale(.97); animation-timing-function: var(--pm-glide); }
  26% { opacity: 1; }
  54% { opacity: 1; transform: translateY(0) rotate(calc(var(--pm-fan, -5deg) * -.28)) scale(1.03, .975); animation-timing-function: var(--pm-spring); }
}
/* a bar grows from the floor and settles */
@keyframes pm-grow {
  0% { opacity: 1; transform: scaleY(0); animation-timing-function: var(--pm-glide); }
  62% { opacity: 1; transform: scaleY(1.08); animation-timing-function: var(--pm-spring); }
}
/* a row ticks in */
@keyframes pm-tick {
  0% { opacity: 0; transform: translateX(-12px); animation-timing-function: var(--pm-glide); }
  55% { opacity: 1; transform: translateX(1.5px); animation-timing-function: var(--pm-spring); }
}
@keyframes pm-pop {
  0% { opacity: 0; transform: scale(.6) rotate(var(--pm-r, -6deg)); animation-timing-function: var(--pm-pop); }
  30% { opacity: 1; }
}
/* paper unfolding from its top fold */
@keyframes pm-unfold {
  0% { opacity: 0; transform: perspective(700px) rotateX(-82deg); animation-timing-function: var(--pm-glide); }
  30% { opacity: 1; }
  62% { opacity: 1; transform: perspective(700px) rotateX(7deg); animation-timing-function: var(--pm-spring); }
}
/* theatre drapes drawn back to the sides */
@keyframes pm-part-l { 0% { opacity: 1; transform: translateX(330%); } }
@keyframes pm-part-r { 0% { opacity: 1; transform: translateX(-330%) scaleX(-1); } 100% { transform: scaleX(-1); } }
/* sky and scenery: a slow glide into place */
@keyframes pm-settle { 0% { opacity: 0; transform: translateY(28px) scale(.985); } 40% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  [data-pm] { opacity: 1 !important; animation: none !important; }
}
html.rm [data-pm] { opacity: 1 !important; animation: none !important; }

/* ---------- a card lifts at most 4 px under a pointer (a card, not a jump); nothing tilts or pushes */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .pm-lift { transition: translate 240ms var(--pm-glide); }
  .pm-lift:hover { translate: 0 -4px; }
}

/* ---------- no hover reactions on the paper pages: a pointer over a person, a door or a card moves nothing but the 4 px card lift above */
@media (hover: hover) {
  main .who__link:hover .who__art img { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pr__toggle::before { transition: none; }
  .pm-lift, .ks__book { transition: none; }
}
@media (hover: hover) and (pointer: fine) {
  main .fm__poster:hover .fm__btn { transform: none; }
  main .fm__poster:hover .fm__btn::before { transform: none; }
  main .fm__ch:hover { transform: none; }
  .ft__back:hover img { transform: none; }
}

/* ---------- Pricing's month / year switch (added here, not in the pricing section's files): the blue thumb is one piece of paper that
   slides between the two choices on a spring (transform only; both choices are the same width) */
.pr .pr__toggle { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; }
.pr .pr__toggle::before { content: ""; position: absolute; left: 5px; top: 5px; bottom: 5px; width: calc((100% - 14px) / 2); border-radius: 999px; background: var(--blue); box-shadow: var(--sh-blue);
  transition: transform 560ms var(--pm-spring, ease-out); }
.pr[data-per="year"] .pr__toggle::before { transform: translateX(calc(100% + 4px)); }
.pr .pr__tg { position: relative; z-index: 1; justify-content: center; transition: color 240ms var(--pm-glide, ease-out); }
.pr .pr__tg.is-on { background: transparent; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .pr .pr__toggle::before { transition: none; } }
