/* Motion for the finished dishes on the recipe cards (js/scenes-dish.js). Slow, eased, a little uneven, the way
   hands move: a slice lifted and set down, a knife pressed in, a loaf sawn, soup ladled, salad tossed. */
.sc-dish [class^="d-"], .sc-dish [class*=" d-"] { transform-box: fill-box; transform-origin: center; }

/* a slice (or a square) lifted on its server and set down again */
.sc-dish .d-lift { animation: dLift 5s cubic-bezier(.45, 0, .3, 1) infinite; }
@keyframes dLift { 0%, 18%, 100% { transform: translate(0, 0) rotate(0); } 42% { transform: translate(-3px, -9px) rotate(-2deg); } 58% { transform: translate(-3px, -8px) rotate(-1.6deg); } 80% { transform: translate(0, 1px) rotate(.4deg); } 86% { transform: translate(0, 0) rotate(0); } }
.sc-dish .d-lift2 { animation: dLift2 4.6s cubic-bezier(.45, 0, .3, 1) infinite; }
@keyframes dLift2 { 0%, 100% { transform: translate(0, 0) rotate(0); } 45%, 60% { transform: translate(4px, -10px) rotate(-3deg); } }

/* the knife pressed down through the cake, eased out again */
.sc-dish .d-knife { animation: dKnife 4.4s cubic-bezier(.5, 0, .3, 1) infinite; transform-origin: 30% 70%; }
@keyframes dKnife { 0%, 100% { transform: translate(0, -8px); } 40% { transform: translate(0, 10px); } 55% { transform: translate(0, 11px); } 85% { transform: translate(0, -8px); } }

/* sawing: back and forth along the blade, sinking a little each stroke */
.sc-dish .d-saw { animation: dSaw 1.5s ease-in-out infinite; }
@keyframes dSaw { 0%, 100% { transform: translate(-7px, -5px); } 50% { transform: translate(7px, 5px); } }
.sc-dish .d-fall { animation: dFall 3s ease-in-out infinite; transform-origin: 0% 100%; }
@keyframes dFall { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(2deg); } }
.sc-dish .d-crumbs { animation: dCrumbs 1.5s ease-in infinite; }
@keyframes dCrumbs { 0% { opacity: 0; transform: translateY(-6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(8px); } }

/* ladling soup: dipped, lifted out full (drops fall back), tipped to pour, dipped again. 5.2 s */
.sc-dish .d-ld { animation: dLd 5.2s infinite; }
@keyframes dLd {
  0%, 8% { transform: translate(0, 22px) rotate(-4deg); animation-timing-function: cubic-bezier(.35, 0, .2, 1); }
  24% { transform: translate(1px, -2px) rotate(-1deg); animation-timing-function: ease-in-out; }
  30%, 38% { transform: translate(0, 0) rotate(0); animation-timing-function: cubic-bezier(.45, 0, .3, 1); }
  46% { transform: translate(-2px, 1px) rotate(34deg); animation-timing-function: ease-in-out; }
  66% { transform: translate(-2px, 1px) rotate(40deg); animation-timing-function: cubic-bezier(.45, 0, .3, 1); }
  76% { transform: translate(0, 0) rotate(0); animation-timing-function: cubic-bezier(.5, 0, .7, .4); }
  90%, 100% { transform: translate(0, 22px) rotate(-4deg); }
}
.sc-dish .d-lsoup { animation: dLsoup 5.2s infinite; }
@keyframes dLsoup { 0%, 44% { opacity: 1; } 66%, 86% { opacity: 0; } 92%, 100% { opacity: 1; } }
.sc-dish .d-lpour { opacity: 0; animation: dLpour 5.2s infinite linear; }
@keyframes dLpour { 0%, 45% { opacity: 0; } 47%, 64% { opacity: 1; } 67%, 100% { opacity: 0; } }
.sc-dish .d-lpour.d-sheen { animation: dLpour 5.2s infinite linear, dSheen .9s linear infinite; }
.sc-dish .d-ldrip { opacity: 0; animation: dLdrip 5.2s infinite; }
.sc-dish .d-ldrip1 { animation-name: dLdrip1; } .sc-dish .d-ldrip2 { animation-name: dLdrip2; }
@keyframes dLdrip { 0%, 25% { opacity: 0; transform: translateY(0) scale(.6); } 26% { opacity: 1; transform: translateY(0) scale(.8, 1.2); animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 31%, 100% { opacity: 1; transform: translateY(14px) scale(.8, 1.3); } }
@keyframes dLdrip1 { 0%, 29% { opacity: 0; transform: translateY(0) scale(.6); } 30% { opacity: 1; transform: translateY(0) scale(.8, 1.2); animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 35%, 100% { opacity: 1; transform: translateY(14px) scale(.8, 1.3); } }
@keyframes dLdrip2 { 0%, 33% { opacity: 0; transform: translateY(0) scale(.5); } 34% { opacity: 1; transform: translateY(0) scale(.7, 1.1); animation-timing-function: cubic-bezier(.5, 0, .9, .6); } 39%, 100% { opacity: 1; transform: translateY(14px) scale(.7, 1.2); } }
.sc-dish .d-lring1, .sc-dish .d-lring2 { opacity: 0; }
.sc-dish .d-lring1 { animation: dLring1 5.2s infinite ease-out; }
@keyframes dLring1 { 0%, 14% { opacity: 0; transform: scale(.4); } 16% { opacity: .8; transform: scale(.5); } 30% { opacity: 0; transform: scale(1.8); } 31%, 100% { opacity: 0; transform: scale(.4); } }
.sc-dish .d-lring2 { animation: dLring2 1s infinite ease-out; }
@keyframes dLring2 { 0% { opacity: 0; transform: scale(.4); } 10% { opacity: .7; } 100% { opacity: 0; transform: scale(2); } }
.sc-dish .d-lring2 { animation: dLring2b 5.2s infinite ease-out; }
@keyframes dLring2b { 0%, 48% { opacity: 0; transform: scale(.4); } 50% { opacity: .8; transform: scale(.5); } 57% { opacity: 0; transform: scale(1.8); } 57.1% { opacity: 0; transform: scale(.4); } 58% { opacity: .7; transform: scale(.5); } 65% { opacity: 0; transform: scale(1.8); } 100% { opacity: 0; } }
.sc-dish .d-ring { animation: dRing 1.6s ease-out infinite; }
@keyframes dRing { 0% { opacity: .8; transform: scale(.3); } 100% { opacity: 0; transform: scale(2); } }

/* a pour is one unbroken stream; a long, soft highlight slides down it so it reads as moving */
.sc-dish .d-pour { animation: dPourW 1.3s ease-in-out infinite; }
@keyframes dPourW { 0%, 100% { opacity: 1; } 50% { opacity: .9; } }
.sc-dish .d-sheen { stroke-dasharray: 18 40; animation: dSheen .9s linear infinite; }
@keyframes dSheen { to { stroke-dashoffset: -58; } }
.sc-dish .d-drip { stroke-dasharray: 30 40; animation: dDrip 3.2s ease-in infinite; }
@keyframes dDrip { 0% { stroke-dashoffset: 30; } 60%, 100% { stroke-dashoffset: 0; } }
.sc-dish .d-ring { animation: dRing 1.6s ease-out infinite; }
@keyframes dRing { 0% { opacity: .8; transform: scale(.3); } 100% { opacity: 0; transform: scale(2); } }

/* tossing a salad: the servers lift and turn, the leaves hop */
.sc-dish .d-servers { animation: dServers 3.2s cubic-bezier(.45, 0, .3, 1) infinite; transform-origin: 50% 0%; }
@keyframes dServers { 0%, 50%, 100% { transform: translate(0, 0) rotate(0); } 66% { transform: translate(0, -6px) rotate(-1.5deg); } 78% { transform: translate(0, 1px) rotate(.6deg); } }
.sc-dish .d-toss { animation: dToss 3.2s cubic-bezier(.3, 0, .4, 1) infinite; animation-delay: calc(var(--d, 0) * -1s); }
@keyframes dToss { 0%, 58%, 100% { transform: translateY(0) rotate(0); } 70% { transform: translateY(-6px) rotate(18deg); } 84% { transform: translateY(0) rotate(4deg); } }

/* the tzimmes spoon nudged as if someone's about to serve */
.sc-dish .d-spoonrest { animation: dSpoonRest 4.4s ease-in-out infinite; }
@keyframes dSpoonRest { 0%, 60%, 100% { transform: translate(0, 0) rotate(0); } 75% { transform: translate(2px, -5px) rotate(-3deg); } }

/* a twirl of noodles lifted on the fork and lowered */
.sc-dish .d-twirl { animation: dTwirl 3.8s ease-in-out infinite; }
@keyframes dTwirl { 0%, 100% { transform: translate(0, 4px) rotate(-3deg); } 50% { transform: translate(0, -8px) rotate(4deg); } }

/* a cookie lifted, a bite taken, crumbs falling */
.sc-dish .d-bite { animation: dBite 4s ease-in-out infinite; }
@keyframes dBite { 0%, 30%, 100% { transform: translate(0, 0) rotate(0); } 55%, 70% { transform: translate(4px, -10px) rotate(-3deg); } }

/* sour cream: the spoon tips, the dollop drops and settles */
.sc-dish .d-spoon { animation: dSpoon 3.6s ease-in-out infinite; transform-origin: 90% 10%; }
@keyframes dSpoon { 0%, 100% { transform: rotate(0); } 35%, 50% { transform: rotate(12deg); } }
.sc-dish .d-dollop { animation: dDollop 3.6s cubic-bezier(.5, 0, .7, .4) infinite; }
@keyframes dDollop { 0%, 38% { opacity: 0; transform: translateY(-34px) scale(.6); } 40% { opacity: 1; transform: translateY(-30px) scale(.7, .9); } 56% { opacity: 1; transform: translateY(0) scale(1.18, .78); } 64%, 92% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(0) scale(1); } }

/* a mousse that wobbles on its platter */
.sc-dish .d-wobble { animation: dWobble 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes dWobble { 0%, 60%, 100% { transform: scale(1, 1); } 66% { transform: scale(1.03, .96) skewX(1.5deg); } 74% { transform: scale(.98, 1.03) skewX(-1.2deg); } 82% { transform: scale(1.01, .99) skewX(.5deg); } 90% { transform: scale(1, 1); } }

/* rolling the dough out: the pin rolls across, the disc spreads a little, flour puffs */
.sc-dish .d-roll { animation: dRoll 3.4s ease-in-out infinite alternate; }
@keyframes dRoll { from { transform: translate(0, -2px) scale(.95); } to { transform: translate(0, 24px) scale(1.05); } }
.sc-dish .d-press { animation: dPress 6.8s ease-in-out infinite; }
@keyframes dPress { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.06, 1.03); } }
.sc-dish .d-puff { animation: dPuff 3.4s ease-out infinite; }
@keyframes dPuff { 0%, 70% { opacity: 0; transform: scale(.5); } 78% { opacity: .8; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.8) translateY(-6px); } }

/* a glint on what's glossy */
.sc-dish .d-glint { opacity: 0; animation: dGlint 3.6s ease-in-out infinite; animation-delay: calc(var(--d, 0) * -1s); }
@keyframes dGlint { 0%, 100% { opacity: 0; transform: translateX(-6px) scale(.6, .8); } 35% { opacity: .9; transform: translateX(0) scale(1); } 65% { opacity: 0; transform: translateX(6px) scale(.8, .7); } }

@media (prefers-reduced-motion: reduce) { .sc-dish * { animation: none !important; } .sc-dish .d-lpour, .sc-dish .d-ldrip { opacity: 0 !important; } .sc-dish .d-glint, .sc-dish .d-crumbs, .sc-dish .d-puff { opacity: 0 !important; } .sc-dish .d-dollop { opacity: 1 !important; } }

/* every drawing (step scenes, the cook-along, the recipe cards) sits under a whisper of film grain and a soft
   vignette, so flat fills read more like light on real things */
.scene-box, .rc-img.drawn, .ck-art { position: relative; }
.scene-box::after, .rc-img.drawn::after, .ck-art::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(120% 95% at 45% 38%, transparent 58%, rgba(70, 35, 12, .13) 100%), url("../img/grain.png");
  background-size: auto, 160px 160px; mix-blend-mode: soft-light; opacity: .55;
}
.rc-img.drawn .rc-orig { z-index: 2; }
