/* Separating an egg (js/scenes-egg.js), 9 s loop. Tap and crack (0–13 %), pull apart over the whites bowl while the
   loose white pours out (13–20 %), four passes shell to shell (20–64 %), carry the yolk over and tip it in (66–86 %).
   The drawing's own pose (halves apart, yolk in the left one) is the base and reduced-motion frame; the method
   list's still is 2.2 s in (24 %), the yolk in mid-air on its first pass. Positions come from --vars on .eg. */
.scene [class^="eg-"], .scene [class*=" eg-"] { transform-box: fill-box; transform-origin: center; }
.eg-str path { stroke-dasharray: 100 120; stroke-dashoffset: 101; }
.eg-rip, .eg-ripY, .eg-chips, .eg-tail { opacity: 0; }
.eg-crk { stroke-dasharray: 100 120; stroke-dashoffset: 101; }

/* the whole egg: in, wind up, knock on the rim, back over the bowl, and apart */
.eg-whole { animation: egWhole 9s infinite; }
@keyframes egWhole {
  0% { opacity: 0; transform: translate(0, -8px) rotate(0); animation-timing-function: ease-out; }
  4% { opacity: 1; transform: translate(0, 0) rotate(0); animation-timing-function: ease-in-out; }
  7% { opacity: 1; transform: translate(2px, -7px) rotate(-6deg); animation-timing-function: cubic-bezier(.6, 0, .9, .5); }
  9% { opacity: 1; transform: translate(var(--tx), var(--ty)) rotate(-16deg); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  10.2% { opacity: 1; transform: translate(calc(var(--tx) * .9), calc(var(--ty) * .9 - 3px)) rotate(-12deg); animation-timing-function: ease-in-out; }
  12.8% { opacity: 1; transform: translate(var(--ex), var(--ey)) rotate(0); }
  13.4% { opacity: 1; transform: translate(var(--ex), var(--ey)) rotate(0); }
  13.6%, 100% { opacity: 0; transform: translate(var(--ex), var(--ey)) rotate(0); }
}
.eg-crk { animation: egCrk 9s infinite; }
@keyframes egCrk { 0%, 9% { stroke-dashoffset: 101; } 10.6%, 100% { stroke-dashoffset: 0; } }
.eg-chips { animation: egChips 9s infinite; }
@keyframes egChips { 0%, 8.9% { opacity: 0; transform: translate(0, 0) rotate(0); } 9% { opacity: 1; transform: translate(0, 0) rotate(0); animation-timing-function: cubic-bezier(.4, 0, .9, .5); } 11.8% { opacity: 1; transform: translate(-5px, 20px) rotate(200deg); } 12%, 100% { opacity: 0; transform: translate(-5px, 20px) rotate(200deg); } }

/* the halves: open from the whole egg, then give and catch in turn (A gives on passes 1 and 3, B on 2 and 4) */
.eg-A { animation: egA 9s infinite; }
@keyframes egA {
  0%, 12.9% { opacity: 0; transform: translate(var(--ax), var(--ay)) rotate(90deg); }
  13% { opacity: 1; transform: translate(var(--ax), var(--ay)) rotate(90deg); animation-timing-function: cubic-bezier(.3, 0, .2, 1); }
  17.5% { transform: translate(0, 0) rotate(0); animation-timing-function: ease-in-out; }
  20% { transform: translate(0, 0) rotate(6deg); animation-timing-function: cubic-bezier(.5, 0, .3, 1); }
  22.5% { transform: translate(1px, -1px) rotate(38deg); animation-timing-function: ease-in-out; }
  26% { transform: translate(0, 0) rotate(8deg); animation-timing-function: ease-in-out; }
  29% { transform: translate(0, 0) rotate(0); animation-timing-function: ease-in-out; }
  34% { transform: translate(2px, -3px) rotate(-12deg); animation-timing-function: cubic-bezier(.3, .6, .4, 1); }
  38% { transform: translate(0, 1.6px) rotate(-3deg); animation-timing-function: ease-in-out; }
  41%, 43.5% { transform: translate(0, 0) rotate(0); animation-timing-function: cubic-bezier(.5, 0, .3, 1); }
  46.5% { transform: translate(1px, -1px) rotate(38deg); animation-timing-function: ease-in-out; }
  50% { transform: translate(0, 0) rotate(8deg); animation-timing-function: ease-in-out; }
  53% { transform: translate(0, 0) rotate(0); animation-timing-function: ease-in-out; }
  58% { transform: translate(2px, -3px) rotate(-12deg); animation-timing-function: cubic-bezier(.3, .6, .4, 1); }
  62% { transform: translate(0, 1.6px) rotate(-3deg); animation-timing-function: ease-in-out; }
  65% { transform: translate(0, 0) rotate(0); animation-timing-function: cubic-bezier(.45, 0, .3, 1); }
  74%, 76% { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(-4deg); animation-timing-function: cubic-bezier(.4, 0, .3, 1); }
  80% { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(-108deg); animation-timing-function: ease-in-out; }
  84% { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(-100deg); animation-timing-function: cubic-bezier(.5, 0, .9, .5); }
  90% { opacity: 0; transform: translate(calc(var(--dx) - 18px), calc(var(--dy) - 26px)) rotate(-150deg); }
  90.1%, 100% { opacity: 0; transform: translate(var(--ax), var(--ay)) rotate(90deg); }
}
.eg-B { animation: egB 9s infinite; }
@keyframes egB {
  0%, 12.9% { opacity: 0; transform: translate(var(--bx), var(--by)) rotate(-90deg); }
  13% { opacity: 1; transform: translate(var(--bx), var(--by)) rotate(-90deg); animation-timing-function: cubic-bezier(.3, 0, .2, 1); }
  17.5% { transform: translate(0, 0) rotate(0); animation-timing-function: ease-in-out; }
  21% { transform: translate(-2px, -3px) rotate(12deg); animation-timing-function: cubic-bezier(.3, .6, .4, 1); }
  26% { transform: translate(0, 1.6px) rotate(3deg); animation-timing-function: ease-in-out; }
  29%, 31.5% { transform: translate(0, 0) rotate(0); animation-timing-function: cubic-bezier(.5, 0, .3, 1); }
  34.5% { transform: translate(-1px, -1px) rotate(-38deg); animation-timing-function: ease-in-out; }
  38% { transform: translate(0, 0) rotate(-8deg); animation-timing-function: ease-in-out; }
  41% { transform: translate(0, 0) rotate(0); animation-timing-function: ease-in-out; }
  45% { transform: translate(-2px, -3px) rotate(12deg); animation-timing-function: cubic-bezier(.3, .6, .4, 1); }
  50% { transform: translate(0, 1.6px) rotate(3deg); animation-timing-function: ease-in-out; }
  53%, 55.5% { transform: translate(0, 0) rotate(0); animation-timing-function: cubic-bezier(.5, 0, .3, 1); }
  58.5% { transform: translate(-1px, -1px) rotate(-38deg); animation-timing-function: ease-in-out; }
  62% { transform: translate(0, 0) rotate(-8deg); animation-timing-function: ease-in-out; }
  65% { opacity: 1; transform: translate(0, 0) rotate(0); animation-timing-function: cubic-bezier(.5, 0, .9, .5); }
  74% { opacity: 0; transform: translate(16px, -26px) rotate(40deg); }
  74.1%, 100% { opacity: 0; transform: translate(var(--bx), var(--by)) rotate(-90deg); }
}
/* the white left in each half thins as it's poured off */
.eg-pudA { animation: egPudA 9s infinite; }
@keyframes egPudA { 0%, 17.5% { opacity: 1; } 24% { opacity: .55; } 40% { opacity: .5; } 48% { opacity: .25; } 64%, 100% { opacity: .2; } }
.eg-pudB { animation: egPudB 9s infinite; }
@keyframes egPudB { 0%, 17.5% { opacity: .9; } 28% { opacity: .9; } 36% { opacity: .45; } 52% { opacity: .35; } 60%, 100% { opacity: .12; } }

/* the yolk: out of the shell with the egg, four arcs shell to shell (a squash as it's caught), then into its bowl */
.eg-yolk { animation: egYolk 9s infinite; }
@keyframes egYolk {
  0%, 13.4% { opacity: 0; transform: translate(var(--yx), var(--yy)) scale(1); }
  13.5% { opacity: 1; transform: translate(var(--yx), var(--yy)) scale(1); animation-timing-function: cubic-bezier(.3, 0, .2, 1); }
  17.5%, 21% { transform: translate(0, 0) scale(1); animation-timing-function: cubic-bezier(.3, .2, .5, 1); }
  23.5% { transform: translate(calc(var(--px) * .5), calc(var(--py) * .5 - 13px)) scale(.95, 1.07); animation-timing-function: cubic-bezier(.5, 0, .8, .6); }
  26% { transform: translate(var(--px), var(--py)) scale(1.12, .86); animation-timing-function: ease-out; }
  27.5%, 34% { transform: translate(var(--px), var(--py)) scale(1); animation-timing-function: cubic-bezier(.3, .2, .5, 1); }
  36% { transform: translate(calc(var(--px) * .5), calc(var(--py) * .5 - 14px)) scale(.95, 1.07); animation-timing-function: cubic-bezier(.5, 0, .8, .6); }
  38% { transform: translate(0, 0) scale(1.12, .86); animation-timing-function: ease-out; }
  39.5%, 46% { transform: translate(0, 0) scale(1); animation-timing-function: cubic-bezier(.3, .2, .5, 1); }
  48% { transform: translate(calc(var(--px) * .5), calc(var(--py) * .5 - 12px)) scale(.95, 1.07); animation-timing-function: cubic-bezier(.5, 0, .8, .6); }
  50% { transform: translate(var(--px), var(--py)) scale(1.12, .86); animation-timing-function: ease-out; }
  51.5%, 58% { transform: translate(var(--px), var(--py)) scale(1); animation-timing-function: cubic-bezier(.3, .2, .5, 1); }
  60% { transform: translate(calc(var(--px) * .5), calc(var(--py) * .5 - 11px)) scale(.95, 1.07); animation-timing-function: cubic-bezier(.5, 0, .8, .6); }
  62% { transform: translate(0, 0) scale(1.12, .86); animation-timing-function: ease-out; }
  63.5%, 65% { transform: translate(0, 0) scale(1); animation-timing-function: cubic-bezier(.45, 0, .3, 1); }
  74%, 76% { transform: translate(var(--dx), var(--dy)) scale(1); animation-timing-function: ease-in; }
  80% { transform: translate(var(--sx), var(--sy)) scale(.96, 1.04); animation-timing-function: cubic-bezier(.5, 0, .9, .55); }
  83% { transform: translate(var(--lx), var(--ly)) scale(1.28, .66); animation-timing-function: ease-out; }
  84.6% { transform: translate(var(--lx), var(--ly)) scale(.96, .8); animation-timing-function: ease-in-out; }
  86%, 95% { opacity: 1; transform: translate(var(--lx), var(--ly)) scale(1.04, .72); }
  98%, 100% { opacity: 0; transform: translate(var(--lx), var(--ly)) scale(1.04, .72); }
}
.eg-cling { animation: egCling 9s infinite; }
@keyframes egCling { 0%, 17.5% { opacity: .9; transform: scale(1); } 27% { opacity: .65; transform: scale(.92); } 39% { opacity: .45; transform: scale(.86); } 51% { opacity: .25; transform: scale(.8); } 63%, 100% { opacity: 0; transform: scale(.75); } }
.eg-tail { animation: egTail 9s infinite; transform-origin: 50% 0; }
@keyframes egTail {
  0%, 21.5% { opacity: 0; transform: scale(.4); } 23.5% { opacity: .9; transform: scale(1); } 25.5%, 34.5% { opacity: 0; transform: scale(1.2, .3); }
  36% { opacity: .7; transform: scale(.9); } 37.6%, 80.5% { opacity: 0; transform: scale(1.2, .3); }
  81.5% { opacity: .8; transform: scale(1); } 83%, 100% { opacity: 0; transform: scale(1.2, .3); }
}

/* white falling into the bowl: a thick pour when the egg opens, then a stretchy strand on every pass, thinner each time */
.eg-s0 path { animation: egS0 9s infinite; }
@keyframes egS0 { 0%, 13.5% { stroke-dashoffset: 101; animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 16% { stroke-dashoffset: 0; } 19.5% { stroke-dashoffset: 0; animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 22.5%, 100% { stroke-dashoffset: -101; } }
.eg-s1 path { animation: egS1 9s infinite; }
@keyframes egS1 { 0%, 22% { stroke-dashoffset: 101; animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 24.8% { stroke-dashoffset: 0; } 27% { stroke-dashoffset: 0; animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 30%, 100% { stroke-dashoffset: -101; } }
.eg-s2 path { animation: egS2 9s infinite; }
@keyframes egS2 { 0%, 34.5% { stroke-dashoffset: 101; animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 37.2% { stroke-dashoffset: 0; } 39.5% { stroke-dashoffset: 0; animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 42.5%, 100% { stroke-dashoffset: -101; } }
.eg-s3 path { animation: egS3 9s infinite; }
@keyframes egS3 { 0%, 46.5% { stroke-dashoffset: 101; animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 49.2% { stroke-dashoffset: 0; } 51% { stroke-dashoffset: 0; animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 54%, 100% { stroke-dashoffset: -101; } }
.eg-s4 path { animation: egS4 9s infinite; }
@keyframes egS4 { 0%, 58.5% { stroke-dashoffset: 101; animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 61% { stroke-dashoffset: 0; } 62.2% { stroke-dashoffset: 0; animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 65%, 100% { stroke-dashoffset: -101; } }

/* rings where the white lands, and where the yolk drops into its bowl */
.eg-rip0 { animation: egRip0 9s infinite; }
@keyframes egRip0 { 0%, 15.8% { opacity: 0; transform: scale(.3); } 16% { opacity: .9; transform: scale(.4); animation-timing-function: cubic-bezier(.2, .6, .4, 1); } 23%, 100% { opacity: 0; transform: scale(2.4); } }
.eg-rip1 { animation: egRip1 9s infinite; }
@keyframes egRip1 { 0%, 24.6% { opacity: 0; transform: scale(.3); } 24.8% { opacity: .85; transform: scale(.4); animation-timing-function: cubic-bezier(.2, .6, .4, 1); } 31%, 48.9% { opacity: 0; transform: scale(2.2); } 49% { opacity: .7; transform: scale(.4); animation-timing-function: cubic-bezier(.2, .6, .4, 1); } 55%, 100% { opacity: 0; transform: scale(2); } }
.eg-rip2 { animation: egRip2 9s infinite; }
@keyframes egRip2 { 0%, 37% { opacity: 0; transform: scale(.3); } 37.2% { opacity: .8; transform: scale(.4); animation-timing-function: cubic-bezier(.2, .6, .4, 1); } 43%, 60.8% { opacity: 0; transform: scale(2.1); } 61% { opacity: .6; transform: scale(.4); animation-timing-function: cubic-bezier(.2, .6, .4, 1); } 66%, 100% { opacity: 0; transform: scale(1.8); } }
.eg-ripY { animation: egRipY 9s infinite; }
@keyframes egRipY { 0%, 82.8% { opacity: 0; transform: scale(.3); } 83% { opacity: .9; transform: scale(.5); animation-timing-function: cubic-bezier(.2, .6, .4, 1); } 90%, 100% { opacity: 0; transform: scale(2); } }

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