/* ---------- SERVING SCENE (signature element) ----------
   A 2D-layered illusion of depth: shadow, plate, food sit on
   staggered planes with perspective + parallax. When a plate
   is "requested", a layered hand rises from below the board
   edge carrying food, then settles — as if placed for you. */

.serving-scene {
  position: relative;
  height: 260px;
  margin: 0 auto 1rem;
  max-width: 320px;
  perspective: 900px;
}

/* resting plate, always visible */
.plate-stack {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(50deg) rotateZ(0deg);
}

.plate-stack__shadow {
  position: absolute;
  left: 50%;
  top: 62%;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,0,0,0.55), transparent 70%);
  transform: translate(-50%, -50%) translateZ(-10px);
}

.plate-stack__plate {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at 40% 35%, rgba(255,255,255,0.35), transparent 45%),
    radial-gradient(circle, #efe6d2, #cfc2a4 70%, #b3a582 100%);
  box-shadow:
    0 6px 0 rgba(0,0,0,0.25),
    0 14px 28px rgba(0,0,0,0.4),
    inset 0 0 0 6px rgba(179, 165, 130, 0.5);
}

.plate-stack__food {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  transform: translate(-50%, -50%) translateZ(4px);
}

.plate-stack__food--herring {
  background:
    repeating-linear-gradient(
      100deg,
      #9aa8b8 0px, #9aa8b8 8px,
      #7d8ba0 8px, #7d8ba0 16px,
      #b7c2ce 16px, #b7c2ce 24px
    );
  clip-path: polygon(10% 40%, 40% 15%, 70% 20%, 92% 45%, 85% 75%, 55% 90%, 20% 80%);
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

/* the serving hand — hidden by default, animates in on request */
.serving-hand {
  position: absolute;
  left: 50%;
  bottom: -140px;
  width: 260px;
  height: 220px;
  transform: translate(-50%, 0) rotateX(45deg);
  transform-style: preserve-3d;
  opacity: 0;
  pointer-events: none;
}

.serving-hand__shadow {
  position: absolute;
  left: 50%;
  top: 30px;
  width: 170px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,0,0,0.45), transparent 70%);
  transform: translateX(-50%) translateZ(-6px);
}

.serving-hand__cuff {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 90px;
  height: 130px;
  border-radius: 12px 12px 4px 4px;
  transform: translateX(-50%) translateZ(2px);
  background: linear-gradient(180deg, #2c2016, #1a120c);
  box-shadow: inset 0 0 0 1px rgba(201,150,44,0.25);
}

.serving-hand__palm {
  position: absolute;
  left: 50%;
  top: 34px;
  width: 76px;
  height: 60px;
  border-radius: 40% 40% 46% 46%;
  transform: translateX(-50%) translateZ(6px);
  background: linear-gradient(160deg, #caa27a, #a97f57);
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
}

.serving-hand__plate {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  transform: translateX(-50%) translateZ(10px);
  background:
    radial-gradient(circle at 40% 35%, rgba(255,255,255,0.35), transparent 45%),
    radial-gradient(circle, #efe6d2, #cfc2a4 70%, #b3a582 100%);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4), inset 0 0 0 5px rgba(179,165,130,0.5);
}

.serving-hand__food {
  position: absolute;
  left: 50%;
  top: 40px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  transform: translateX(-50%) translateZ(14px);
  background:
    repeating-linear-gradient(
      100deg,
      #9aa8b8 0px, #9aa8b8 8px,
      #7d8ba0 8px, #7d8ba0 16px,
      #b7c2ce 16px, #b7c2ce 24px
    );
  clip-path: polygon(10% 40%, 40% 15%, 70% 20%, 92% 45%, 85% 75%, 55% 90%, 20% 80%);
}

/* ---------- animation states, toggled via JS classes ---------- */

.serving-scene.is-serving .plate-stack {
  animation: plate-yield 1.4s var(--ease-soft) forwards;
}

@keyframes plate-yield {
  0% { transform: rotateX(50deg) translateY(0); opacity: 1; }
  40% { transform: rotateX(50deg) translateY(-6px); opacity: 0.4; }
  100% { transform: rotateX(50deg) translateY(-6px); opacity: 0; }
}

.serving-hand.is-rising {
  animation: hand-rise 1.6s var(--ease-soft) forwards;
}

@keyframes hand-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) rotateX(45deg) translateY(0);
  }
  15% {
    opacity: 1;
  }
  55% {
    transform: translate(-50%, 0) rotateX(45deg) translateY(-170px);
  }
  75% {
    transform: translate(-50%, 0) rotateX(45deg) translateY(-160px);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) rotateX(45deg) translateY(-165px);
  }
}

.serving-hand.is-retreating {
  animation: hand-retreat 0.8s var(--ease-soft) forwards;
}

@keyframes hand-retreat {
  0% { opacity: 1; transform: translate(-50%, 0) rotateX(45deg) translateY(-165px); }
  100% { opacity: 0; transform: translate(-50%, 0) rotateX(45deg) translateY(-40px); }
}

/* subtle ambient sway on the resting plate, like candlelight catching it */
.plate-stack:not(.serving-scene.is-serving *) {
  animation: plate-idle 5s ease-in-out infinite;
}

@keyframes plate-idle {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.06); }
}
