/* From the design preview, preview/track-truck.css (tools/theme-sync.mjs). */
/* The flower truck on Track your order (track-truck.js, 14 October). Beside the form it waits,
   bouquets on its back, with a word in a speech bubble. Find my order: it drives forward (2.3 s,
   slow away, gentle stop), its wheels turning, a few petals blowing off the back, and pulls in its
   second compartment, the tracking card (drawn as the account page's bus: ink, a hatched back
   face, a sign). Not found: it shakes its head and says so in the bubble. Reduced motion: no drive.
   Colours per track: 07 blush, 08 sage, the others from their own tokens. */

/* ---- Colours ----------------------------------------------------------------------------------- */
.track .track-scene{--truck-body:var(--soft);--truck-bed:var(--surface);--truck-glass:#eef4f3;--truck-leaf:var(--leaf,#a9b692);--bloom-a:#e58f9c;--bloom-b:var(--petal,#ecc3c5);--bloom-c:#f6d9a6;--bloom-wrap-a:var(--petal-alt,#f5d8c6);--bloom-wrap-c:#dcc29a;--bus-ink:var(--ink);--bus-side:color-mix(in srgb,var(--ink) 14%,var(--surface))}
.track-postcard .track-scene{--truck-body:var(--petal);--truck-bed:var(--soft)}

/* ---- The scene: the sky, the road; the rig drives along it -------------------------------------- */
/* The card (the trailer) takes the room it needs, up to --trailer-max; the truck drives on as far
   as that takes it, out past the scene's edge if need be, and only its back (--peek, the tail
   light, a bouquet and the rear wheel) is sure to stay in view (Jin Hao, 14 October: the card
   was squeezed to the space the whole truck left). Narrow scenes (phones) let it go altogether. */
.track-scene{--truck-w:300px;--hitch-w:24px;--park:34px;--peek:72px;--trailer-max:470px;--trailer-w:min(var(--trailer-max),calc(100cqw - var(--hitch-w) - var(--peek)));position:relative;display:flex;align-items:flex-end;min-height:380px;padding:34px 0 14px;overflow-x:clip;container-type:inline-size}
@container (max-width:419px){.track-rig{--trailer-w:calc(100cqw - 12px)}}
.track-road{position:absolute;left:0;right:0;bottom:24px;height:2px;background:repeating-linear-gradient(90deg,color-mix(in srgb,var(--ink) 45%,transparent) 0 16px,transparent 16px 28px)}
.track-road::after{content:'';position:absolute;left:0;right:0;top:2px;height:22px;background:linear-gradient(180deg,color-mix(in srgb,var(--soft) 70%,transparent),transparent)}
.track-sky{position:absolute;inset:0 0 40px;pointer-events:none}
.track-cloud{position:absolute;width:74px;height:24px;border:1.6px solid color-mix(in srgb,var(--ink) 40%,transparent);border-radius:99px;background:var(--surface);opacity:.75;animation:lv-cloud 38s ease-in-out infinite alternate}
.track-cloud::before{content:'';position:absolute;left:14px;top:-15px;width:34px;height:30px;border:inherit;border-bottom-color:transparent;border-radius:50%;background:var(--surface)}
.track-cloud.is-a{top:28px;right:16%}
.track-cloud.is-b{top:92px;right:44%;width:56px;transform:scale(.8);animation-duration:46s;animation-direction:alternate-reverse}
@keyframes lv-cloud{to{translate:-40px 0}}
/* The card fills the sky once it has come: the clouds go (a sliver of one peeped round its edge). */
.track-cloud{transition:opacity .8s ease}
.track-scene.is-out .track-cloud{opacity:0}

/* Parked, the truck stands at --park with the trailer and hitch behind it, out of sight: the rig's
   own width (100%) less the truck's, so a resize, which changes the trailer, never sets it moving. */
.track-rig{display:flex;align-items:flex-end;flex:0 0 auto;position:relative;z-index:1;transform:translateX(calc(var(--park) + var(--truck-w) - 100%));transition:transform 2.3s cubic-bezier(.62,0,.2,1)}
.track-scene.is-out .track-rig{transform:none}
.track-scene.is-reversing .track-rig{transition-duration:1.25s;transition-timing-function:cubic-bezier(.5,0,.3,1)}

/* ---- The truck ------------------------------------------------------------------------------------ */
.track-truck{position:relative;flex:0 0 auto;width:var(--truck-w)}
.track-truck-art{display:block;width:100%;height:auto;overflow:visible}
.track-scene .truck-wheel,.track-scene .truck-spin{transform-box:fill-box;transform-origin:center}
.track-scene.is-driving .truck-wheel{animation:lv-wheel .44s linear infinite}
.track-scene.is-reversing .truck-wheel{animation:lv-wheel .44s linear infinite reverse}
@keyframes lv-wheel{to{transform:rotate(360deg)}}
.track-scene.is-driving .truck-body,.track-scene.is-reversing .truck-body{animation:lv-truck-bob .3s ease-in-out infinite alternate}
@keyframes lv-truck-bob{to{transform:translateY(-1.5px)}}
/* Not found: a shake of the head. */
.track-scene.is-shaking .track-truck{animation:lv-truck-shake .62s cubic-bezier(.36,.07,.19,.97)}
@keyframes lv-truck-shake{10%,90%{transform:translateX(-1px)}20%,80%{transform:translateX(2px)}30%,50%,70%{transform:translateX(-4px)}40%,60%{transform:translateX(4px)}}

/* Petals blow off the bouquets as it pulls away. */
.track-petals{position:absolute;left:44px;top:18px;width:130px;height:50px;pointer-events:none}
.track-petal{position:absolute;left:calc(var(--i) * 17px);top:calc(8px + var(--i) * 4px);width:9px;height:7px;border-radius:70% 0 70% 0;background:var(--bloom-a);opacity:0}
.track-petal:nth-child(odd){background:var(--bloom-b)}
.track-scene.is-driving .track-petal{animation:lv-petal 1.8s cubic-bezier(.2,.6,.3,1) calc(var(--i) * .17s) forwards}
@keyframes lv-petal{0%{opacity:0;transform:translate(0,0) rotate(0)}14%{opacity:.95}100%{opacity:0;transform:translate(calc(-110px - var(--i) * 14px),calc(-30px + var(--i) * 7px)) rotate(260deg)}}

/* The speech bubble, above the bouquets. */
.track-bubble{position:absolute;left:16px;bottom:calc(100% - 8px);width:max-content;max-width:min(290px,calc(100cqw - 64px));padding:12px 16px 13px;background:var(--surface);border:1.6px solid var(--ink);border-radius:18px 18px 18px 6px;box-shadow:4px 4px 0 var(--bus-side);color:var(--ink);transition:opacity .3s ease,transform .45s cubic-bezier(.16,1,.3,1);transform-origin:20% 100%}
.track-bubble::after{content:'';position:absolute;left:22px;bottom:-9px;width:14px;height:14px;background:inherit;border-right:1.6px solid var(--ink);border-bottom:1.6px solid var(--ink);transform:rotate(45deg) skew(8deg,8deg)}
.track-bubble p{margin:0;font:italic 17px/1.35 var(--serif)}
.track-scene.is-out .track-bubble,.track-scene.is-driving .track-bubble,.track-scene.is-reversing .track-bubble{opacity:0;transform:translateY(8px) scale(.94);pointer-events:none}
.track-scene.is-missing .track-bubble{background:var(--soft)}
.track-bubble .track-result.is-missing{padding:0;background:none;border:0;border-radius:0}
.track-bubble .track-result.is-missing h2{margin:0 0 4px;font-size:22px;line-height:1.15}
.track-bubble .track-result.is-missing p{margin:0;font:13px/1.5 'Lovento Sans',Arial,sans-serif;color:var(--muted)}

/* ---- The second compartment: the tracking card --------------------------------------------------- */
.track-trailer{position:relative;flex:0 0 var(--trailer-w);width:var(--trailer-w);margin-bottom:30px}
.track-trailer .track-result{margin:0}
.track-trailer .track-result.bus-card{margin-top:22px}
.track-trailer .bus-light.is-tail{left:11px;right:auto}
.track-trailer-wheel{position:absolute;bottom:-18px;z-index:1;width:36px;height:36px}
.track-trailer-wheel.is-rear{left:15%}
.track-trailer-wheel.is-front{right:15%}
.track-trailer-wheel svg{display:block;width:100%;height:100%;overflow:visible}
.track-hitch{flex:0 0 var(--hitch-w);height:6px;margin-bottom:34px;border:1.4px solid var(--ink);border-radius:3px;background:var(--bus-side)}
/* Parked (or not found), the compartment and its hitch wait out of sight behind the scene's edge. */
.track-scene:not(.is-out):not(.is-driving):not(.is-reversing) :is(.track-trailer,.track-hitch){visibility:hidden}
.track-bubble b{white-space:nowrap}
/* Empty, the compartment keeps its place and shape (nothing to read). The card inside reads its
   own width from here (lv-card, below), not the window's. */
.track-slot{container:lv-card/inline-size}
.track-slot:empty{height:300px;border:1.6px solid var(--ink);border-radius:22px;background:var(--surface)}

/* The card, compact for its compartment: the steps across (at every size: site.css stacks them
   down the side on small screens), the three facts in one ruled row, the flowers and the delivery
   link on one line. */
.track-trailer .track-result{display:flow-root;padding:22px 24px 20px}
.track-trailer .order-detail-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.track-trailer .order-detail-head h2{margin:2px 0 3px;font-size:34px;line-height:1.05}
.track-trailer .order-steps{grid-template-columns:repeat(5,minmax(0,1fr));gap:0;margin:16px 0 2px}
.track-trailer .order-steps li{padding:26px 8px 0 0;overflow-wrap:break-word}
.track-trailer .order-steps li::before{left:0;right:0;top:8px;bottom:auto;width:auto;height:2px}
.track-trailer .order-steps li:last-child::before{display:block}
.track-trailer .track-facts{grid-template-columns:repeat(3,minmax(0,1fr));gap:0;margin:14px 0 0;border-top:1px dashed var(--line);border-bottom:1px dashed var(--line)}
.track-trailer .track-facts div{min-width:0;padding:10px 10px 10px 0;border:0;border-radius:0;background:none}
.track-trailer .track-facts div+div{padding-left:12px;border-left:1px dashed var(--line)}
.track-trailer .track-facts small{margin-bottom:4px;font-size:9px}
.track-trailer .track-facts .tbc{font-size:8.5px;letter-spacing:1px;padding:3px 7px}
.track-trailer .order-thumbs{display:inline-flex;margin-top:12px;vertical-align:middle}
.track-trailer .order-thumbs img{width:42px;height:42px;border-radius:10px}
.track-trailer .track-result .text-link{float:right;margin-top:24px}
/* A narrow card (phones, and the narrowest computer windows): smaller steps, the facts as rows,
   the delivery link on a line of its own. */
@container lv-card (max-width:420px){
  .track-trailer .order-detail-head h2{font-size:28px}
  .track-trailer .order-steps li{padding:24px 4px 0 0;font-size:10px;line-height:1.25}
  .track-trailer .order-steps small{font-size:9px}
  .track-trailer .track-facts{grid-template-columns:1fr}
  .track-trailer .track-facts div{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:8px 0}
  .track-trailer .track-facts div+div{padding-left:0;border-left:0;border-top:1px dashed var(--line)}
  .track-trailer .track-facts small{margin:0}
  .track-trailer .track-result .text-link{float:none;display:block;margin-top:12px}
}

/* ---- Computers: the truck parks level with the form's foot; the card rises above it ------------- */
@media (min-width:861px){
  /* The card rises above the form into the heading's right side: the intro keeps to the left of
     the scene's column (the form's column, .8fr of the layout less its 44 px gap, at least 280 px). */
  body[data-direction] .site-page.track .page-head p{max-width:min(470px,calc(max(280px,(100% - 44px) * 8 / 22) + 20px))}
  .track .track-layout{align-items:stretch}
  .track-scene{min-height:0;padding:0}
  .track-rig{position:absolute;left:0;bottom:14px}
  /* At most the width the card was drawn for; where the scene is wide, the whole truck still shows. */
  .track-scene{--trailer-max:452px}
}

/* ---- Phones and tablets: the scene under the form, the card's room kept from the start ---------- */
@media (max-width:860px){
  .track-scene{--park:6px;min-height:330px;padding-top:40px}
  .track-slot:empty{height:0}   /* no room kept: the scene grows below the form as the card comes, then scrolls to the truck */
}
@media (max-width:420px){
  /* A smaller truck (262 px): the compartment's wheels and the hitch follow its scale. */
  .track-scene{--truck-w:262px}
  .track-trailer{margin-bottom:26px}
  .track-trailer-wheel{width:30px;height:30px;bottom:-15px}
  .track-hitch{margin-bottom:29px}
  .track-bubble{left:10px}
  .track-bubble p{font-size:16px}
}
@media (prefers-reduced-motion:reduce){
  .track-rig,.track-bubble{transition:none!important}
  .track-cloud,.track-scene .truck-wheel,.track-scene .truck-body,.track-petal,.track-scene.is-shaking .track-truck{animation:none!important}
}
