/* doc-project | public/assets/css/pizza-truck-animation.css | garantit trois clients visibles sans JavaScript puis anime la file de façon responsive */

.pizza-truck-section {
    width: min(calc(100% - 40px), var(--content-width));
    margin: 0 auto;
    padding: 34px 0 100px;
}

.pizza-truck-section__heading {
    max-width: 720px;
    margin-bottom: 34px;
}

.pizza-truck-section__heading h2 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1.05;
    letter-spacing: -0.05em;
}

.pizza-truck-section__heading > p:last-child {
    max-width: 620px;
    margin: 18px 0 0;
    color: var(--muted);
}

.pizza-truck-scene {
    position: relative;
    min-height: 380px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 78% 18%, rgba(246, 161, 127, 0.32), transparent 25%),
        linear-gradient(#f9d8ae 0 66%, #e7c299 66% 72%, #5b554f 72% 100%);
    box-shadow: var(--shadow);
    isolation: isolate;
}

.pizza-truck-scene::before {
    position: absolute;
    inset: 24px 28px auto auto;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 248, 213, 0.9);
    content: "";
    box-shadow: 0 0 45px rgba(255, 234, 157, 0.55);
}

.pizza-truck-scene__road {
    position: absolute;
    right: 0;
    bottom: 44px;
    left: 0;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.7) 0 50px,
        transparent 50px 88px
    );
}

.pizza-truck-scene__truck {
    position: absolute;
    z-index: 2;
    bottom: 66px;
    left: clamp(18px, 5vw, 64px);
    width: clamp(220px, 36vw, 390px);
    filter: drop-shadow(0 14px 16px rgba(44, 33, 26, 0.2));
}

.pizza-truck-scene__truck img {
    display: block;
    width: 100%;
    height: auto;
}

.pizza-truck-scene__queue {
    position: absolute;
    z-index: 3;
    right: clamp(20px, 5vw, 72px);
    bottom: 65px;
    display: grid;
    grid-template-columns: repeat(3, minmax(74px, 112px));
    direction: rtl;
    align-items: flex-end;
    justify-content: end;
    gap: clamp(4px, 1.2vw, 16px);
    width: min(52%, 380px);
    min-height: 170px;
    pointer-events: none;
}

.pizza-customer {
    position: relative;
    z-index: 1;
    display: block;
    direction: ltr;
    width: 100%;
    min-width: 0;
    opacity: 1;
    visibility: visible;
    transform: translate3d(0, 0, 0);
    transform-origin: 50% 100%;
    transition: transform 480ms cubic-bezier(0.22, 1, 0.36, 1), opacity 260ms ease;
    will-change: transform, opacity;
}

.pizza-customer > img:first-child {
    display: block;
    min-width: 1px;
    width: 100%;
    height: auto;
    opacity: 1;
    visibility: visible;
    filter: drop-shadow(0 8px 8px rgba(44, 33, 26, 0.16));
}

.pizza-customer__box {
    position: absolute;
    z-index: 2;
    top: 54%;
    left: 48%;
    width: 52%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55) rotate(-5deg);
    transition: opacity 180ms ease, transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.pizza-customer.is-served .pizza-customer__box {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(-5deg);
}

.pizza-customer.is-serving {
    transform: translateX(clamp(-14px, -2vw, -28px)) scale(1.04);
}

.pizza-customer.is-leaving {
    animation: pizza-customer-dash 760ms cubic-bezier(0.22, 0.8, 0.3, 1) forwards;
}

.pizza-truck-scene.is-animation-ready .pizza-customer.is-arriving {
    animation: pizza-customer-arrive 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pizza-truck-scene__status {
    position: absolute;
    z-index: 4;
    right: 18px;
    bottom: 12px;
    margin: 0;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(35, 23, 15, 0.78);
    color: #fffaf2;
    font-size: 0.76rem;
}

@keyframes pizza-customer-dash {
    0% {
        opacity: 1;
        transform: translateX(0) rotate(0);
    }
    18% {
        transform: translateX(10px) rotate(-4deg) scale(1.05);
    }
    100% {
        opacity: 0;
        transform: translateX(72vw) rotate(8deg) scale(0.96);
    }
}

@keyframes pizza-customer-arrive {
    from {
        opacity: 0;
        transform: translateX(90px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@media (max-width: 760px) {
    .pizza-truck-section {
        padding: 20px 0 72px;
    }

    .pizza-truck-scene {
        min-height: 330px;
    }

    .pizza-truck-scene__truck {
        bottom: 62px;
        width: clamp(190px, 48vw, 280px);
    }

    .pizza-truck-scene__queue {
        right: 14px;
        bottom: 64px;
        gap: 0;
        width: 54%;
        grid-template-columns: repeat(3, minmax(58px, 88px));
    }
}

@media (max-width: 480px) {
    .pizza-truck-scene {
        min-height: 310px;
    }

    .pizza-truck-scene__truck {
        left: 8px;
        width: 205px;
    }

    .pizza-truck-scene__queue {
        right: 4px;
        width: 50%;
        grid-template-columns: repeat(3, minmax(48px, 62px));
    }

    .pizza-truck-scene__status {
        max-width: calc(100% - 24px);
        font-size: 0.68rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pizza-customer,
    .pizza-customer__box {
        transition: none;
    }

    .pizza-customer.is-leaving,
    .pizza-truck-scene.is-animation-ready .pizza-customer.is-arriving {
        animation: none;
    }
}