/* ---------- Kiosk motion ----------
   How the customer screens move: what comes in and how, what answers a touch, and the
   one celebration at the end. Kept apart from app.css (which says how things look) so
   the motion can be tuned in one place. Loaded after app.css, on every page but the
   public landing page (App.razor).

   The rules it lives by:
   - Things that enter come up and settle (ease-out), quickly: half a second at most
     for anything the customer waits on, a little longer only for the attract screen.
   - Entrances use fill "backwards": they hold their first frame through their delay,
     then hand the element back to its own styles, so a press (:active) still works.
   - Reduced motion (the OS setting, or the kiosk's accessibility menu, which sets
     html[data-motion="reduced"]): app.css already cuts every animation to nothing;
     the delays are cut here too (end of file), so nothing waits invisible. */

/* ---------- The attract screen (Home) ---------- */
/* The wordmark, the line, the kosher badge and the button arrive one after another,
   then the wordmark floats - the screen looks alive while it waits for someone. */
.hero-fullscreen .hero-content > * {
    animation: kiosk-rise .9s var(--ease-out) backwards;
}
.hero-fullscreen .hero-content > .hero-word {
    animation:
        kiosk-word-in 1.1s var(--ease-out) backwards,
        kiosk-float 6s ease-in-out 1.2s infinite alternate;
}
.hero-fullscreen .hero-content > :nth-child(2) { animation-delay: .25s; }
.hero-fullscreen .hero-content > :nth-child(3) { animation-delay: .4s; }
.hero-fullscreen .hero-content > :nth-child(4) { animation-delay: .55s; }

/* "Start an order": rings ripple out from it, and a gleam crosses it now and then -
   the one thing on the screen asking to be touched. */
.hero-fullscreen .hero-actions .btn-primary {
    position: relative;
    isolation: isolate;
    background-image: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .3) 50%, transparent 65%);
    background-size: 260% 100%;
    background-repeat: no-repeat;
    background-position: 160% 0;
    box-shadow: 0 16px 40px -12px rgba(20, 12, 4, .55);
    animation: kiosk-gleam 5s ease-in-out 2.2s infinite;
}
.hero-fullscreen .hero-actions .btn-primary::before,
.hero-fullscreen .hero-actions .btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    border: 2px solid rgba(255, 255, 255, .75);
    pointer-events: none;
    opacity: 0;
    animation: kiosk-ring 2.8s var(--ease-out) 1.4s infinite;
}
.hero-fullscreen .hero-actions .btn-primary::after { animation-delay: 2.8s; }

/* ---------- The order steps (StartOrder, Checkout) ---------- */
/* Every step builds itself: the card rises (app.css), then its title, its line and
   its buttons, in order. Never the form with the name or phone field: the on-screen
   keyboard measures where that field is to lift the card clear of the keys, and a
   field still on its way up would be measured in the wrong place. */
.choice-panel > :is(.choice-title, .choice-subtitle, .choice-phone-display, .choice-consent, .choice-back) {
    animation: kiosk-rise .5s var(--ease-out) backwards;
}
.choice-panel > .choice-title { animation-delay: .06s; }
.choice-panel > :is(.choice-subtitle, .choice-phone-display) { animation-delay: .12s; }
.choice-panel > .choice-consent { animation-delay: .18s; }
.choice-panel > .choice-back { animation-delay: .32s; }
.choice-actions > .choice-btn { animation: kiosk-rise .5s var(--ease-out) backwards; }
.choice-actions > .choice-btn:nth-child(1) { animation-delay: .16s; }
.choice-actions > .choice-btn:nth-child(2) { animation-delay: .26s; }

/* The choice's round icon answers the press with a small bounce. */
.choice-btn .choice-icon { transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.choice-btn:active .choice-icon { transform: scale(.88); }

/* The step dots: the current one stretches into place instead of jumping. */
.choice-step { transition: background-color .25s ease, width .35s var(--ease-out); }

/* ---------- The menu ---------- */
/* A category's dishes come in one after another (ProductCard's --i: its place), the
   title with them; the first dozen are staggered, the rest arrive with the twelfth. */
.product-card {
    animation: kiosk-card-in .5s var(--ease-out) backwards;
    animation-delay: calc(min(var(--i, 0), 12) * 40ms);
}
.menu-category-title { animation: kiosk-title-in .45s var(--ease-out) backwards; }

/* The photo leans in under the finger. */
.product-card .thumb { overflow: hidden; }
.product-card .thumb img { transition: transform .45s var(--ease-out); }
.product-card:active:not(:disabled) .thumb img { transform: scale(1.06); }

/* The category just chosen pops, with a soft gold halo. */
.category-circle.active .circle-thumb {
    animation: kiosk-pop .45s cubic-bezier(.34, 1.56, .64, 1);
    box-shadow: 0 0 0 5px rgba(160, 125, 50, .16), var(--shadow);
}

/* ---------- The dish window ---------- */
/* Its choices arrive group by group under the photo. */
.modal-sheet .modifier-group { animation: kiosk-rise .45s var(--ease-out) backwards; }
.modal-sheet .modifier-group:nth-of-type(2) { animation-delay: .06s; }
.modal-sheet .modifier-group:nth-of-type(3) { animation-delay: .12s; }
.modal-sheet .modifier-group:nth-of-type(n + 4) { animation-delay: .18s; }

/* ---------- Order placed (OrderStatus) ---------- */
/* The check mark pops as it draws, and confetti bursts from it (ConfettiBurst). */
.order-done-mark { position: relative; animation: kiosk-pop-in .6s cubic-bezier(.34, 1.56, .64, 1) backwards; }

/* ---------- Keyframes ---------- */
@keyframes kiosk-rise {
    from { opacity: 0; transform: translateY(16px); }
}
@keyframes kiosk-word-in {
    from { opacity: 0; transform: translateY(24px) scale(.94); filter: blur(6px); }
}
@keyframes kiosk-float {
    from { transform: translateY(0); }
    to { transform: translateY(-8px); }
}
@keyframes kiosk-ring {
    0% { opacity: .85; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.12, 1.45); }
}
@keyframes kiosk-gleam {
    0% { background-position: 160% 0; }
    35%, 100% { background-position: -60% 0; }
}
@keyframes kiosk-card-in {
    from { opacity: 0; transform: translateY(22px) scale(.97); }
}
/* From the start side (the right, in Hebrew), where the category rail is. */
@keyframes kiosk-title-in {
    from { opacity: 0; transform: translateX(calc(18px * var(--dir, 1))); filter: blur(4px); }
}
:root[dir="ltr"] { --dir: -1; }
@keyframes kiosk-pop {
    0% { transform: scale(1); }
    55% { transform: scale(1.16); }
    100% { transform: scale(1.08); }
}
@keyframes kiosk-pop-in {
    from { opacity: 0; transform: scale(.6); }
}

/* ---------- Reduced motion ---------- */
/* app.css cuts every animation to nothing; here the delays go too, so nothing is held
   invisible waiting for an entrance that no longer plays. The rings and the gleam,
   which only exist to move, aren't drawn at all. */
@media (prefers-reduced-motion: reduce) {
    .hero-fullscreen .hero-content > *, .choice-panel > *, .choice-actions > .choice-btn,
    .product-card, .menu-category-title, .modal-sheet .modifier-group, .order-done-mark {
        animation-delay: 0s !important;
    }
    .hero-fullscreen .hero-actions .btn-primary::before,
    .hero-fullscreen .hero-actions .btn-primary::after { display: none; }
}
html[data-motion="reduced"] :is(.hero-fullscreen .hero-content > *, .choice-panel > *, .choice-actions > .choice-btn,
    .product-card, .menu-category-title, .modal-sheet .modifier-group, .order-done-mark) {
    animation-delay: 0s !important;
}
html[data-motion="reduced"] .hero-fullscreen .hero-actions .btn-primary::before,
html[data-motion="reduced"] .hero-fullscreen .hero-actions .btn-primary::after { display: none; }

/* ---------- Leaving an order (CancelOrderButton) ---------- */
/* The question comes up from the button's own red: the screen dims, the card pops,
   its badge turns into place, and the two answers arrive. */
.menu-cancel-backdrop { animation: backdrop-in .22s ease-out; backdrop-filter: blur(3px); }
.menu-cancel-dialog { animation: kiosk-dialog-in .38s cubic-bezier(.34, 1.4, .64, 1) backwards; }
.menu-cancel-badge { animation: kiosk-badge-in .5s cubic-bezier(.34, 1.56, .64, 1) .08s backwards; }
.menu-cancel-dialog .cart-cancel-confirm-actions .btn { animation: kiosk-rise .4s var(--ease-out) backwards; }
.menu-cancel-dialog .cart-cancel-confirm-actions .btn:nth-child(1) { animation-delay: .12s; }
.menu-cancel-dialog .cart-cancel-confirm-actions .btn:nth-child(2) { animation-delay: .18s; }
@keyframes kiosk-dialog-in {
    from { opacity: 0; transform: translateY(14px) scale(.92); }
}
@keyframes kiosk-badge-in {
    from { opacity: 0; transform: scale(.5) rotate(-90deg); }
}
@media (prefers-reduced-motion: reduce) {
    .menu-cancel-dialog, .menu-cancel-badge, .menu-cancel-dialog .cart-cancel-confirm-actions .btn { animation-delay: 0s !important; }
}
