/* ==========================================================================
   motion.css · 工序动作层
   和面 / 调色 / 炒馅 / 包馅 / 压印 / 上笼 / 出锅
   原则：每个动作都要有"因为所以"——火在锅下，气随料增，拉下去才压得成
   ========================================================================== */

/* ===================== 和面：一直在揉 ===================== */
.knead__ball {
  animation: kneadIdle 3.4s var(--ease-soft) infinite;
  will-change: transform;
}
@keyframes kneadIdle {
  0%   { transform: scale(1, 1)        rotate(0deg); }
  22%  { transform: scale(1.13, .88)   rotate(-1.6deg); }
  45%  { transform: scale(.9, 1.12)    rotate(1deg); }
  70%  { transform: scale(1.09, .94)   rotate(-.8deg); }
  100% { transform: scale(1, 1)        rotate(0deg); }
}
.knead.is-pressing .knead__ball {
  animation-duration: .62s;
  box-shadow:
    inset -14px -16px 26px rgba(130, 100, 66, .38),
    inset 10px 12px 20px rgba(255, 255, 255, .45),
    0 20px 30px -18px rgba(110, 81, 54, .5);
}
.knead.is-done .knead__ball { animation: none; }

/* 手粉：一直有细粉落下 */
.knead__dust { position: absolute; inset: -6% 0 0; pointer-events: none; }
.knead__dust i {
  position: absolute;
  top: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 253, 247, .95);
  box-shadow: 0 0 5px rgba(255, 255, 255, .9);
  opacity: 0;
  animation: dustFall 2.6s linear infinite;
}
@keyframes dustFall {
  0%   { transform: translateY(0) scale(.6);    opacity: 0; }
  12%  { opacity: .85; }
  100% { transform: translateY(74px) scale(.3); opacity: 0; }
}
.knead__dust i:nth-child(1) { left: 34%; animation-delay: 0s; }
.knead__dust i:nth-child(2) { left: 46%; animation-delay: .5s; }
.knead__dust i:nth-child(3) { left: 58%; animation-delay: 1.1s; }
.knead__dust i:nth-child(4) { left: 40%; animation-delay: 1.6s; }
.knead__dust i:nth-child(5) { left: 62%; animation-delay: 2.1s; }
.knead__dust i:nth-child(6) { left: 50%; animation-delay: 2.9s; }

/* ===================== 调色：一勺 = 一次动作 ===================== */
/* 米粒飞入 + 颜色加深 + 涡流转一圈，三件事同时起，不做第二段 */
.tint.is-stirring .tint__swirl {
  opacity: 1;
  animation: swirlSpin 700ms var(--ease-soft) forwards;
}
@keyframes swirlSpin {
  from { transform: rotate(-40deg); opacity: 0; }
  28%  { opacity: .95; }
  100% { transform: rotate(230deg); opacity: 0; }
}

/* 搅拌时的糖色涡流 */
.tint__swirl {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: conic-gradient(from 0deg,
    transparent 0 28%,
    rgba(163, 46, 70, .34) 42%,
    rgba(255, 255, 255, .62) 50%,
    rgba(163, 46, 70, .2) 58%,
    transparent 72% 100%);
  transition: opacity 160ms linear;
}
/* ===================== 炒馅：灶火在锅下 ===================== */
.wok__fire {
  position: absolute;
  left: 50%;
  top: 66%;
  width: 56%;
  height: 30%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
}
/* 灶火的暖光，让火势有存在感 */
.wok__fire::before {
  content: "";
  position: absolute;
  inset: -30% -14%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 82%, rgba(237, 162, 63, .55), transparent 68%);
  filter: blur(7px);
  animation: glowPulse 1.6s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { opacity: .65; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.12); }
}
.wok__fire i {
  position: absolute;
  bottom: 0;
  width: 18%;
  height: 100%;
  border-radius: 50% 50% 42% 42% / 62% 62% 38% 38%;
  transform-origin: 50% 100%;
  background: linear-gradient(to top, #FFE9A3 0%, #F5B04A 34%, #E2693E 68%, rgba(217, 74, 100, 0) 100%);
  animation: flameFlick 720ms ease-in-out infinite;
  opacity: 1;
}
@keyframes flameFlick {
  0%, 100% { transform: scaleY(.66) scaleX(1);    opacity: .75; }
  35%      { transform: scaleY(1.22) scaleX(.84); opacity: 1; }
  60%      { transform: scaleY(.84) scaleX(1.14); opacity: .9; }
}
.wok__fire i:nth-child(1) { left: 8%;  animation-delay: -.1s;  height: 78%; }
.wok__fire i:nth-child(2) { left: 22%; animation-delay: -.35s; height: 104%; }
.wok__fire i:nth-child(3) { left: 36%; animation-delay: -.55s; height: 88%; }
.wok__fire i:nth-child(4) { left: 50%; animation-delay: -.2s;  height: 118%; }
.wok__fire i:nth-child(5) { left: 64%; animation-delay: -.45s; height: 90%; }
.wok__fire i:nth-child(6) { left: 78%; animation-delay: -.7s;  height: 102%; }
.wok__fire i:nth-child(7) { left: 90%; animation-delay: -.25s; height: 76%; }

/* 食材从锅上方掉进去：Q 版图标，落下带一点挤压 */
.wok__drops {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.wok__drop {
  position: absolute;
  left: 50%;
  top: 0;
  width: 26%;
  aspect-ratio: 1 / 1;
  margin-left: -13%;
  animation: dropInto 880ms cubic-bezier(.45, .05, .62, 1) forwards;
  will-change: transform, opacity;
}
.wok__drop svg { display: block; width: 100%; height: 100%; }
@keyframes dropInto {
  0%   { transform: translate(var(--dx, 0), -18%) scale(.85) rotate(-8deg); opacity: 0; }
  12%  { opacity: 1; }
  58%  { transform: translate(calc(var(--dx, 0) * .5), 112%) scale(1) rotate(7deg); opacity: 1; }
  66%  { transform: translate(calc(var(--dx, 0) * .45), 104%) scale(1.18, .78) rotate(0deg); }
  82%  { transform: translate(calc(var(--dx, 0) * .4), 124%) scale(.62); opacity: .75; }
  100% { transform: translate(calc(var(--dx, 0) * .4), 138%) scale(.18); opacity: 0; }
}

/* 锅气：随下料数量变浓 */
.wok__smoke {
  position: absolute;
  left: 50%;
  top: 6%;
  width: 70%;
  height: 58%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 3;
  opacity: calc(var(--n, 0) * .6);
  transition: opacity 520ms var(--ease-soft);
}
.wok__smoke i {
  position: absolute;
  bottom: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(240, 234, 222, .92);
  filter: blur(5px);
  box-shadow: 0 0 8px rgba(150, 120, 90, .25);
  opacity: 0;
  animation: smokeRise 3.2s linear infinite;
}
@keyframes smokeRise {
  0%   { transform: translateY(0) scale(.5);     opacity: 0; }
  18%  { opacity: .9; }
  100% { transform: translateY(-130px) scale(2); opacity: 0; }
}
.wok__smoke i:nth-child(1) { left: 14%; animation-delay: 0s; }
.wok__smoke i:nth-child(2) { left: 32%; animation-delay: .45s; }
.wok__smoke i:nth-child(3) { left: 50%; animation-delay: .9s; }
.wok__smoke i:nth-child(4) { left: 68%; animation-delay: 1.35s; }
.wok__smoke i:nth-child(5) { left: 44%; animation-delay: 1.8s; }
.wok__smoke i:nth-child(6) { left: 24%; animation-delay: 2.2s; }
.wok__smoke i:nth-child(7) { left: 60%; animation-delay: 2.6s; }

/* 下料时锅一沉 */
.wok.is-hit .wok__pan { animation: wokKnock 420ms var(--ease-soft); }
@keyframes wokKnock {
  0%   { transform: translateY(0); }
  35%  { transform: translateY(5px) scale(.995); }
  100% { transform: translateY(0); }
}

/* 锅气来了：一下爆开 */
.wok__burst {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 40%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(.4);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 240, 200, .95), rgba(237, 162, 63, .5) 45%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}
.wok.is-done .wok__burst { animation: wokBurst 900ms var(--ease) forwards; }
@keyframes wokBurst {
  0%   { opacity: .95; transform: translate(-50%, -50%) scale(.35); }
  60%  { opacity: .6;  transform: translate(-50%, -50%) scale(1.15); }
  100% { opacity: 0;   transform: translate(-50%, -50%) scale(1.5); }
}
.wok.is-done .wok__smoke { opacity: .78; }
.wok.is-done .wok__fire i { animation-duration: 420ms; }

/* ===================== 包馅：照真包法走一遍 ===================== */
/* 真实的包法：皮摊开 → 馅坐进去 → 虎口往上收 → 收口捏合 → 翻过来朝下成团 */
.wrap__pinch {
  position: absolute;
  left: 50%;
  bottom: 64%;
  width: 40%;
  aspect-ratio: 1 / .5;
  transform: translate(-50%, 14px) scale(1.5);
  border-radius: 50%;
  border: 2px solid rgba(255, 253, 247, .95);
  box-shadow: 0 0 12px rgba(255, 253, 247, .75);
  opacity: 0;
  pointer-events: none;
}

/* 第 1 拍：皮摊开、馅往下坐 */
.wrap.is-folding .wrap__fill { animation: fillSink 520ms var(--ease) forwards; }
@keyframes fillSink {
  0%   { transform: translateY(0) scale(1);      opacity: 1; }
  55%  { transform: translateY(14px) scale(.82); opacity: .9; }
  100% { transform: translateY(20px) scale(.5);  opacity: 0; }
}
.wrap.is-folding .wrap__skin { animation: skinSpread 520ms var(--ease); }
@keyframes skinSpread {
  0%   { transform: scale(1, 1); }
  50%  { transform: scale(1.1, .92); }
  100% { transform: scale(1, 1); }
}

/* 第 2 拍：虎口往上收 */
.wrap.is-pinching .wrap__pinch { animation: pinchGather 700ms var(--ease) forwards; }
@keyframes pinchGather {
  0%   { opacity: 0;   transform: translate(-50%, 14px) scale(1.5); }
  20%  { opacity: 1; }
  75%  { opacity: .95; transform: translate(-50%, -18px) scale(.55); }
  100% { opacity: 0;   transform: translate(-50%, -30px) scale(.14); }
}
/* 边收边立起来 */
.wrap.is-pinching .wrap__skin { animation: skinGather 700ms var(--ease) forwards; }
@keyframes skinGather {
  0%   { transform: scale(1, 1);       border-radius: 50%; }
  60%  { transform: scale(.94, 1.06);  border-radius: 50% 50% 46% 46%; }
  100% { transform: scale(.86, 1.1);   border-radius: 50% 50% 42% 42%; }
}

/* 第 3 拍：收口朝下，落成团 */
.wrap.is-done .wrap__skin { animation: ballDrop 640ms var(--ease-back) forwards; }
.wrap.is-pinching .wrap__fill,
.wrap.is-done .wrap__fill { opacity: 0; }
@keyframes ballDrop {
  0%   { transform: scale(.86, 1.1) rotate(0deg);   border-radius: 50% 50% 42% 42%; }
  45%  { transform: scale(1.12, .9) rotate(180deg); border-radius: 50%; }
  72%  { transform: scale(.96, 1.04) rotate(360deg); }
  100% { transform: scale(1, 1) rotate(360deg);     border-radius: 50%; }
}

/* ===================== 压印：拉下来，按住两秒 ===================== */
/* --drop 0→1 让印模垂直下落；印模与粿面图案同宽比 0.9，落下即重合 */
.stamp__stage {
  --drop: 0;
  --range: 180px;
}
.stamp__mold {
  transform: translateY(calc(var(--drop) * var(--range)));
  touch-action: none;
  cursor: grab;
  transition: none;
}
.stamp__mold.is-loose { transition: transform 420ms var(--ease-back); }
.stamp__stage.is-pressing .stamp__mold {
  transform: translateY(calc(var(--drop) * var(--range))) scale(1.02);
}

/* 印上之后：印模抬走，纹样留在粿上 */
.stamp__stage.is-stamped .stamp__mold {
  opacity: 0;
  transform: translateY(calc(-100% - 16px)) scale(.92);
  transition:
    transform 560ms var(--ease),
    opacity 420ms var(--ease);
}

/* 粿面纹样：固定 0.9，大小不变，只随下落变清晰 */
.stamp__seal {
  opacity: calc(.15 + .75 * var(--drop));
  transform: scale(.9);
  clip-path: none;
  transition: opacity 160ms linear;
}

/* 压住两秒：环走满 */
.stamp__stage.is-holding .stamp__ring { opacity: 1; }
.stamp__stage.is-holding .stamp__seal { opacity: calc(.35 + .65 * var(--drop)); }
.stamp__stage.is-stamped .stamp__seal {
  opacity: 1;
  transform: scale(.9);
  transition: opacity 300ms var(--ease);
}

/* 压下去那一瞬间：粿被压扁再回弹 */
.stamp__stage.is-stamped .stamp__disk { animation: kuehPress 620ms var(--ease); }
@keyframes kuehPress {
  0%   { transform: scale(1, 1); }
  30%  { transform: scale(1.05, .94); }
  65%  { transform: scale(.985, 1.02); }
  100% { transform: scale(1, 1); }
}

/* 进度环跟着印模走 */
.stamp__ring {
  transition: none;
  transform: translate(-9px, calc(-9px + var(--drop) * var(--range)));
}
/* ===================== 上笼：灶上有火，火大汽才足 ===================== */
.steam__fire {
  position: absolute;
  left: 50%;
  top: 76%;
  width: 46%;
  height: 22%;
  transform: translateX(-50%);
  z-index: 0;
  pointer-events: none;
  opacity: .55;
  transition: opacity 600ms var(--ease-soft);
}
.steam__fire::before {
  content: "";
  position: absolute;
  inset: -28% -16%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 84%, rgba(237, 162, 63, .5), transparent 68%);
  filter: blur(7px);
  animation: glowPulse 1.8s ease-in-out infinite;
}
.steam__fire i {
  position: absolute;
  bottom: 0;
  width: 17%;
  height: 100%;
  border-radius: 50% 50% 42% 42% / 62% 62% 38% 38%;
  transform-origin: 50% 100%;
  background: linear-gradient(to top, #FFE9A3 0%, #F5B04A 34%, #E2693E 68%, rgba(217, 74, 100, 0) 100%);
  animation: flameFlick 760ms ease-in-out infinite;
}
.steam__fire i:nth-child(1) { left: 7%;  animation-delay: -.12s; height: 76%; }
.steam__fire i:nth-child(2) { left: 21%; animation-delay: -.38s; height: 100%; }
.steam__fire i:nth-child(3) { left: 35%; animation-delay: -.58s; height: 84%; }
.steam__fire i:nth-child(4) { left: 50%; animation-delay: -.22s; height: 112%; }
.steam__fire i:nth-child(5) { left: 64%; animation-delay: -.48s; height: 88%; }
.steam__fire i:nth-child(6) { left: 78%; animation-delay: -.72s; height: 98%; }
.steam__fire i:nth-child(7) { left: 89%; animation-delay: -.28s; height: 74%; }

.steam.is-capped .steam__fire { opacity: 1; }
.steam.is-boiling .steam__fire i { animation-duration: 380ms; }
.steam.is-boiling .steam__fire::before { opacity: 1; }

/* ===================== 上笼：火候上来，汽才大 ===================== */
.steam__puffs i {
  width: 32px;
  height: 32px;
  margin-left: -16px;
  background: rgba(242, 236, 224, .96);
  box-shadow: 0 0 10px rgba(150, 120, 90, .3);
  filter: blur(6px);
}
.steam.is-capped .steam__puffs { opacity: .8; }
.steam.is-boiling .steam__puffs { opacity: 1; }
.steam.is-boiling .steam__puffs i { animation-duration: 2s; }
.steam__lid { transition: transform 640ms var(--ease-back); }

/* ===================== 出锅：掀盖那一下，满屋香气 ===================== */
.serve__steam {
  position: absolute;
  inset: -12% 0 0;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  transition: opacity 420ms var(--ease-soft);
}
.serve.is-open .serve__steam { opacity: 1; }
.serve__steam i {
  position: absolute;
  left: 50%;
  bottom: 24%;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 50%;
  background: rgba(242, 236, 224, .96);
  box-shadow: 0 0 12px rgba(150, 120, 90, .32);
  filter: blur(6px);
  opacity: 0;
  animation: roomSteam 3s linear infinite;
}
@keyframes roomSteam {
  0%   { transform: translate(0, 0) scale(.5);            opacity: 0; }
  16%  { opacity: .95; }
  100% { transform: translate(var(--dx, 0), -150px) scale(2.5); opacity: 0; }
}
.serve__steam i:nth-child(1) { left: 22%; --dx: -26px; animation-delay: 0s; }
.serve__steam i:nth-child(2) { left: 36%; --dx: -12px; animation-delay: .38s; }
.serve__steam i:nth-child(3) { left: 50%; --dx: 0;     animation-delay: .76s; }
.serve__steam i:nth-child(4) { left: 64%; --dx: 14px;  animation-delay: 1.14s; }
.serve__steam i:nth-child(5) { left: 78%; --dx: 28px;  animation-delay: 1.52s; }
.serve__steam i:nth-child(6) { left: 30%; --dx: -20px; animation-delay: 1.9s; }
.serve__steam i:nth-child(7) { left: 58%; --dx: 10px;  animation-delay: 2.28s; }
.serve__steam i:nth-child(8) { left: 44%; --dx: -6px;  animation-delay: 2.66s; }

/* 掀盖瞬间的一层暖光，像热气扑到脸上 */
.serve__stage::after {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 200, .85), transparent 66%);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.serve.is-open .serve__stage::after { animation: aromaFlash 1100ms var(--ease) forwards; }
@keyframes aromaFlash {
  0%   { opacity: 0;   transform: scale(.5); }
  28%  { opacity: .9;  transform: scale(1.05); }
  100% { opacity: 0;   transform: scale(1.3); }
}
.serve__layer.is-on .serve__photo,
.serve__layer.is-on svg {
  animation: serveRise 720ms var(--ease) both;
}
@keyframes serveRise {
  0%   { transform: translateY(14px) scale(.94); opacity: .2; }
  100% { transform: translateY(0) scale(1);     opacity: 1; }
}
