.grill-sparks { display: none; }

@media screen and (prefers-reduced-motion: no-preference) {
  /* Extra image at the top supplies the crop as the grill recedes. The text and scrim stay put. */
  [data-home-motion] .hero__slide {
    --grill-travel: clamp(24px, 3.8vw, 54px);
    inset-block-start: calc(-1 * var(--grill-travel));
    translate: 0 calc(var(--motion-phase, 0) * var(--grill-travel));
  }

  /* Each photograph moves inside its own stationary arch. Individual translate and scale
     preserve the menu hover interaction and the doorway's original crop. */
  [data-home-motion] .menu-preview__crop img {
    scale: 1.16;
    translate: 0 calc(clamp(-1, var(--motion-phase, 0) * 1.55 + var(--dish-lead, .2), 1) * 7%);
  }
  [data-home-motion] .menu-preview__gallery li:nth-child(2) { --dish-lead: .07; }
  [data-home-motion] .menu-preview__gallery li:nth-child(3) { --dish-lead: -.07; }
  [data-home-motion] .menu-preview__gallery li:nth-child(4) { --dish-lead: -.2; }
  [data-home-motion] .greeting__door img {
    translate: 0 calc(clamp(-1, var(--motion-phase, 0) * 1.45, 1) * 8%);
  }

  /* Warm the restaurant's own calligraphic mark as the charcoal card comes into view. */
  [data-home-motion] .gathering__card--catering::before {
    content: "";
    position: absolute;
    top: clamp(14px, 1.4vw, 22px);
    right: clamp(16px, 1.9vw, 28px);
    width: clamp(22px, 2.2vw, 32px);
    aspect-ratio: 120 / 116;
    pointer-events: none;
    background: linear-gradient(0deg, var(--saffron) 10%, var(--saffron-hi) 37%, var(--muted-on-dark) 72%);
    background-size: 100% 180%;
    background-position: center calc(50% + var(--motion-phase, 0) * 48%);
    mask: url('/img/mark-saffron-120.png') center / contain no-repeat;
    opacity: clamp(.25, .9 - max(var(--motion-phase, 0), var(--motion-phase, 0) * -1) * .9, .9);
  }

  /* A thin coal seam glows as the catering card passes the center of the window. */
  [data-home-motion] .gathering__card--catering::after {
    content: '';
    position: absolute;
    left: 5%; right: 5%; bottom: 1px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--anar) 18%, var(--saffron) 52%, var(--anar) 82%, transparent);
    transform-origin: 0 50%;
    transform: scaleX(clamp(0, (var(--motion-phase, 0) + .72) * 1.35, 1));
    opacity: clamp(0, min((var(--motion-phase, 0) + .8) * 2, (.83 - var(--motion-phase, 0)) * 1.6), .95);
    pointer-events: none;
  }

  [data-home-motion] .grill-sparks {
    display: block;
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
  }
  .grill-sparks i {
    --x: 55%; --y: 76%; --drift: 11px; --rise: -76px; --delay: -.7s;
    position: absolute;
    left: var(--x); top: var(--y);
    width: 2px; height: 4px; border-radius: 60%;
    opacity: 0;
    color: var(--saffron-hi);
    background: currentColor;
    box-shadow: 0 0 4px 1px var(--saffron);
    animation: grill-ember 3.6s linear var(--delay) infinite;
    animation-play-state: paused;
  }
  .grill-sparks i:nth-child(2) { --x: 61%; --y: 69%; --drift: -9px; --rise: -95px; --delay: -2.6s; height: 3px; }
  .grill-sparks i:nth-child(3) { --x: 67%; --y: 80%; --drift: 18px; --rise: -115px; --delay: -1.35s; }
  .grill-sparks i:nth-child(4) { --x: 70%; --y: 65%; --drift: 7px; --rise: -70px; --delay: -.15s; height: 3px; }
  .grill-sparks i:nth-child(5) { --x: 74%; --y: 74%; --drift: -14px; --rise: -104px; --delay: -2.05s; }
  [data-home-motion]:not([data-motion-hidden]) .hero.is-live[data-motion-in-view] .hero__media:not(.is-paused):not(.is-idle) .is-active .grill-sparks i {
    animation-play-state: running;
  }

  @keyframes grill-ember {
    0%, 14% { opacity: 0; transform: translate(0, 0) rotate(-12deg); }
    25% { opacity: .86; }
    62% { opacity: .59; transform: translate(calc(var(--drift) * -.3), calc(var(--rise) * .6)) rotate(20deg); }
    82%, 100% { opacity: 0; transform: translate(var(--drift), var(--rise)) scale(.45); }
  }
}
