/* Flow loops: shared styles for the CSS-only floor-plan loops
   <!-- EMBED:wave-flow --> (partials/wave-flow.html) and
   <!-- EMBED:cluster-flow --> (partials/cluster-flow.html).
   Each loop shows "Without" then "With" the feature, with a switch and a
   narrated status line in HTML (legible on phones; the SVG holds no text).
   Base styles are each loop's end frame, so reduced motion shows the D365
   result. The two loops use different layouts and motion on purpose. */
.wf { max-width: 720px; margin: 0 auto; }
.wf-frame { background: var(--warm-50, var(--bg)); border: 1px solid var(--border); border-radius: var(--radius-2xl); padding: clamp(14px, 2.4vw, 24px); background-image: radial-gradient(rgba(12, 74, 90, .10) 1.4px, transparent 1.6px); background-size: 32px 32px; }
.wf-plan { display: block; width: 100%; height: auto; }
.wf-rack rect { fill: var(--surface, #fff); stroke: #CBC3B7; stroke-width: 1.5; }
.wf-trip { fill: none; stroke: #C7613D; stroke-width: 3; stroke-dasharray: 7 5; stroke-linejoin: round; opacity: 0; }
.wf-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: clamp(10px, 2vw, 14px) 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--fg2); }
.wf-legend li { display: inline-flex; align-items: center; gap: 8px; }
.wf-k { display: inline-block; flex: none; }
.wf-k--pick { width: 14px; height: 11px; border-radius: 2px; background: #E89B43; border: 2px solid #91521E; }
.wf-k--trip { width: 22px; border-top: 3px dashed #C7613D; }

/* ---- wave-flow: without vs with wave picking, 10 s loop ----
   Two aisles, outbound dock on the right, one picker.
   Shows the post's "Before and after on the floor" rows: release (one by
   one vs together, up to the wave threshold), pick work (per order vs for
   the whole wave at once: pick locations light up), route (a late order
   forces a walk back vs one pass in location order).
   0-44 %  Without: orders 1 and 2 are released and picking starts; order 3
           is released after the picker has passed its location, so the
           picker walks back into aisle 1. The grey trail shows distance.
   44-50 % A wave template releases all three orders together.
   50-79 % With: one pass through both aisles in location order.
   80-95 % hold. 95-100 % reset. Picker moves at the same speed in both. */
.wv-orders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; padding: 6px 8px; border: 1.5px solid #0E6376; border-radius: 10px; }
.wv-wave { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: #0E6376; margin-left: 4px; }
.wv-chip { padding: 4px 10px; border-radius: var(--radius-pill, 999px); border: 1.5px solid #0E6376; background: #ECF6F8; color: #0C4A5A; font-size: 14px; font-weight: 600; }
.wv .wv-seg--with { background: var(--harbor-700, #0C4A5A); color: #F4FBFC; }
.cf-status .wv-s6 { opacity: 1; }
.wv-bays rect { fill: url(#wv-stock); stroke: #E2DCD3; stroke-width: 1; }
.wv-bay { fill: none; stroke: #91521E; stroke-width: 2.5; }
.wv-item { fill: #E89B43; stroke: #91521E; stroke-width: 1.5; opacity: 0; }
.wv-walk { fill: none; stroke: #847C6E; stroke-width: 2.5; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; opacity: 0; }
.wv-route { fill: none; stroke: #0E6376; stroke-width: 5; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.wv-picker { fill: #0C4A5A; stroke: #FFFFFF; stroke-width: 2.5; transform: translate(420px, 173px); }
.wv-k--picker { width: 12px; height: 12px; border-radius: 50%; background: #0C4A5A; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #CBC3B7; }
.wv-k--walk { width: 22px; border-top: 3px solid #847C6E; }

@media (prefers-reduced-motion: no-preference) {
  .wv-orders, .wv-wave, .wv-chip, .wv-picker, .wv-walk, .wv-route, .wv-pa, .wv-pb, .wv-pc, .wv-ba, .wv-bb, .wv-bc { animation: 10s ease-in-out infinite; }
  .wv .wv-seg--without { animation-name: wv-seg-without; } .wv .wv-seg--with { animation-name: wv-seg-with; }
  .wv .cf-status .wv-s1 { animation-name: wv-s1; } .wv .cf-status .wv-s2 { animation-name: wv-s2; } .wv .cf-status .wv-s3 { animation-name: wv-s3; }
  .wv .cf-status .wv-s4 { animation-name: wv-s4; } .wv .cf-status .wv-s5 { animation-name: wv-s5; } .wv .cf-status .wv-s6 { animation-name: wv-s6; }
  .wv-orders { animation-name: wv-orders; } .wv-wave { animation-name: wv-wave; }
  .wv-chip { animation-name: wv-chip; } .wv-chip.wv-chip3 { animation-name: wv-chip3; }
  .wv-picker, .wv-walk, .wv-route { animation-timing-function: linear; }
  .wv-picker { animation-name: wv-picker; } .wv-walk { animation-name: wv-walk; }
  .wv-route { animation-name: wv-route; } .wv-ba, .wv-bb { animation-name: wv-bay12; } .wv-bc { animation-name: wv-bay3; }
  .wv-pa { animation-name: wv-pa; } .wv-pb { animation-name: wv-pb; } .wv-pc { animation-name: wv-pc; }
}
/* The switch reuses the cluster loop's colours but this loop's own timing */
@keyframes wv-seg-without { 0%, 44% { background: #B14E2E; color: #FFFFFF } 47%, 95% { background: transparent; color: #6B6459 } 98%, 100% { background: #B14E2E; color: #FFFFFF } }
@keyframes wv-seg-with { 0%, 44% { background: transparent; color: #6B6459 } 47%, 95% { background: #0C4A5A; color: #F4FBFC } 98%, 100% { background: transparent; color: #6B6459 } }
@keyframes wv-s1 { 0%, 21.5% { opacity: 1 } 22.5%, 98% { opacity: 0 } 100% { opacity: 1 } }
@keyframes wv-s2 { 0%, 21.5% { opacity: 0 } 22.5%, 31.5% { opacity: 1 } 32.5%, 100% { opacity: 0 } }
@keyframes wv-s3 { 0%, 31.5% { opacity: 0 } 32.5%, 43.5% { opacity: 1 } 44.5%, 100% { opacity: 0 } }
@keyframes wv-s4 { 0%, 43.5% { opacity: 0 } 44.5%, 49.5% { opacity: 1 } 50.5%, 100% { opacity: 0 } }
@keyframes wv-s5 { 0%, 49.5% { opacity: 0 } 50.5%, 79% { opacity: 1 } 80%, 100% { opacity: 0 } }
@keyframes wv-s6 { 0%, 79% { opacity: 0 } 80%, 95% { opacity: 1 } 98%, 100% { opacity: 0 } }
/* Release row: orders trickle in without a wave, all at once with one */
@keyframes wv-orders { 0%, 45% { border-color: transparent } 48%, 95% { border-color: #0E6376 } 98%, 100% { border-color: transparent } }
@keyframes wv-wave { 0%, 45% { opacity: 0 } 48%, 95% { opacity: 1 } 98%, 100% { opacity: 0 } }
@keyframes wv-chip { 0%, 44% { opacity: 1 } 45%, 47% { opacity: .35 } 48%, 100% { opacity: 1 } }
@keyframes wv-chip3 { 0%, 21.5% { opacity: .35 } 22.5%, 44% { opacity: 1 } 45%, 47% { opacity: .35 } 48%, 95% { opacity: 1 } 98%, 100% { opacity: .35 } }
/* Picker: same walking speed in both scenarios */
@keyframes wv-picker {
  0%, 3% { transform: translate(420px, 81px) } 16.17% { transform: translate(40px, 81px) } 19.5% { transform: translate(40px, 177px) }
  32.12% { transform: translate(404px, 177px) } 35.03% { transform: translate(404px, 93px) } 38.32% { transform: translate(309px, 93px) }
  39.15% { transform: translate(309px, 69px) } 43%, 46% { transform: translate(420px, 69px) } 49%, 50% { transform: translate(420px, 85px) }
  63.17% { transform: translate(40px, 85px) } 66.22% { transform: translate(40px, 173px) } 79.39%, 94% { transform: translate(420px, 173px) }
  98%, 100% { transform: translate(420px, 81px) }
}
@keyframes wv-walk { 0%, 3% { stroke-dashoffset: 1; opacity: 1 } 43%, 44% { stroke-dashoffset: 0; opacity: 1 } 46%, 100% { stroke-dashoffset: 0; opacity: 0 } }
/* Pick work: per order as released (order 3 late), then for the whole wave at once */
@keyframes wv-bay12 { 0%, 44% { opacity: 1 } 45%, 47% { opacity: .15 } 48%, 100% { opacity: 1 } }
@keyframes wv-bay3 { 0%, 21.5% { opacity: .15 } 22.5%, 44% { opacity: 1 } 45%, 47% { opacity: .15 } 48%, 95% { opacity: 1 } 98%, 100% { opacity: .15 } }
@keyframes wv-route { 0%, 49.9% { stroke-dashoffset: 1; opacity: 0 } 50% { stroke-dashoffset: 1; opacity: 1 } 79.39%, 94% { stroke-dashoffset: 0; opacity: 1 } 97% { stroke-dashoffset: 0; opacity: 0 } 100% { stroke-dashoffset: 1; opacity: 0 } }
/* Items leave the shelf as the picker passes (once per scenario) */
@keyframes wv-pa { 0%, 12.4% { opacity: 1 } 12.8%, 46% { opacity: 0 } 48%, 59.4% { opacity: 1 } 59.8%, 95% { opacity: 0 } 98%, 100% { opacity: 1 } }
@keyframes wv-pb { 0%, 26.7% { opacity: 1 } 27.1%, 46% { opacity: 0 } 48%, 73.4% { opacity: 1 } 73.8%, 95% { opacity: 0 } 98%, 100% { opacity: 1 } }
@keyframes wv-pc { 0%, 38.1% { opacity: 1 } 38.5%, 46% { opacity: 0 } 48%, 53.6% { opacity: 1 } 54%, 95% { opacity: 0 } 98%, 100% { opacity: 1 } }

/* ---- cluster-flow: without vs with cluster picking, 10 s loop ----
   Shows the post's "Before and after on the floor" rows:
   trips (3 vs 1), shared item (same shelf twice vs picked once and sorted),
   error check (each tote flashes as its position is scanned).
   0-37 %  Without: one-tote cart, three round trips; trip 3 revisits shelf A.
   37-46 % The three totes go on one cluster cart.
   46-67 % With: stop at A (2 units, sorted into totes 1 and 3), stop at B,
           straight back. 67-92 % hold. 92-100 % reset.
   Items fly from the shelf into the tote: each tote item starts offset to
   its shelf position at the stop, then moves to 0. Totes carry the cart's
   movement in their own keyframes. Base styles are the end frame. */
.cf-eb { margin: 0 0 8px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--harbor-600, #0E6376); }
.cf-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 12px; }
.cf-seg { padding: 9px 10px; border-radius: 9px; text-align: center; font-size: 15px; font-weight: 700; line-height: 1.2; color: var(--fg3, #6B6459); background: transparent; }
.cf-seg b { font-weight: 800; }
.cf-seg--with { background: var(--harbor-700, #0C4A5A); color: #F4FBFC; }
.cf-status { display: grid; margin: 10px 0 clamp(10px, 2vw, 14px); font-size: 15px; font-weight: 600; color: var(--fg1, #1C1815); }
.cf-status span { grid-area: 1 / 1; opacity: 0; }
.cf-status .cf-s7 { opacity: 1; }

.cf-bays rect { fill: url(#cf-stock); stroke: #E2DCD3; stroke-width: 1; }
.cf-bay { fill: none; stroke: #91521E; stroke-width: 2.5; }
.cf-item { fill: #E89B43; stroke: #91521E; stroke-width: 1.5; }
.cf-a1, .cf-a2, .cf-b { opacity: 0; }
.cf-c1, .cf-c2, .cf-c3 { fill: #FFFFFF; stroke-width: 2.5; }
.cf-c1 { stroke: #0E6376; } .cf-c2 { stroke: #2A8C60; } .cf-c3 { stroke: #91521E; }
.cf-body { fill: #ECF6F8; stroke: #0C4A5A; stroke-width: 2; }
.cf-small { opacity: 0; }
.cf-k--totes { display: inline-flex; gap: 3px; }
.cf-k--totes b { width: 8px; height: 8px; border-radius: 2px; background: #fff; border: 2px solid #0E6376; }
.cf-k--totes b:nth-child(2) { border-color: #2A8C60; } .cf-k--totes b:nth-child(3) { border-color: #91521E; }
.cf-k--cart { width: 22px; height: 12px; border-radius: 3px; background: #ECF6F8; border: 2px solid #0C4A5A; }

@media (prefers-reduced-motion: no-preference) {
  .cf-seg, .cf-status span, .cf-small, .cf-big, .cf-o1, .cf-o2, .cf-o3, .cf-got1, .cf-got2, .cf-got3,
  .cf-a1, .cf-a2, .cf-b, .cf-scan1, .cf-scan2, .cf-scan3 { animation: 10s ease-in-out infinite; }
  .cf-seg--without { animation-name: cf-seg-without; } .cf-seg--with { animation-name: cf-seg-with; }
  .cf-status .cf-s1 { animation-name: cf-s1; } .cf-status .cf-s2 { animation-name: cf-s2; } .cf-status .cf-s3 { animation-name: cf-s3; }
  .cf-status .cf-s4 { animation-name: cf-s4; } .cf-status .cf-s5 { animation-name: cf-s5; } .cf-status .cf-s6 { animation-name: cf-s6; } .cf-status .cf-s7 { animation-name: cf-s7; }
  .cf-small { animation-name: cf-small; } .cf-big { animation-name: cf-big; }
  .cf-o1 { animation-name: cf-o1; } .cf-o2 { animation-name: cf-o2; } .cf-o3 { animation-name: cf-o3; }
  .cf-got1 { animation-name: cf-got1; } .cf-got2 { animation-name: cf-got2; } .cf-got3 { animation-name: cf-got3; }
  .cf-a1 { animation-name: cf-a1; } .cf-a2 { animation-name: cf-a2; } .cf-b { animation-name: cf-b; }
  .cf-scan1 { animation-name: cf-scan1; } .cf-scan2 { animation-name: cf-scan2; } .cf-scan3 { animation-name: cf-scan3; }
}
/* Header */
@keyframes cf-seg-without { 0%, 37% { background: #B14E2E; color: #FFFFFF } 40%, 95% { background: transparent; color: #6B6459 } 98%, 100% { background: #B14E2E; color: #FFFFFF } }
@keyframes cf-seg-with { 0%, 37% { background: transparent; color: #6B6459 } 40%, 95% { background: #0C4A5A; color: #F4FBFC } 98%, 100% { background: transparent; color: #6B6459 } }
@keyframes cf-s1 { 0%, 9.5% { opacity: 1 } 10%, 98% { opacity: 0 } 100% { opacity: 1 } }
@keyframes cf-s2 { 0%, 9.5% { opacity: 0 } 10%, 25.5% { opacity: 1 } 26%, 100% { opacity: 0 } }
@keyframes cf-s3 { 0%, 25.5% { opacity: 0 } 26%, 37% { opacity: 1 } 38%, 100% { opacity: 0 } }
@keyframes cf-s4 { 0%, 37% { opacity: 0 } 38%, 46% { opacity: 1 } 47%, 100% { opacity: 0 } }
@keyframes cf-s5 { 0%, 46% { opacity: 0 } 47%, 56% { opacity: 1 } 57%, 100% { opacity: 0 } }
@keyframes cf-s6 { 0%, 56% { opacity: 0 } 57%, 63% { opacity: 1 } 64%, 100% { opacity: 0 } }
@keyframes cf-s7 { 0%, 63% { opacity: 0 } 64%, 95% { opacity: 1 } 98%, 100% { opacity: 0 } }
/* Carts */
@keyframes cf-small {
  0%, 1% { opacity: 1; transform: none } 4%, 6% { transform: translateX(75px) } 9%, 11% { transform: none }
  17%, 19% { transform: translateX(175px) } 25%, 27% { transform: none } 30%, 32% { transform: translateX(75px) }
  35%, 37% { opacity: 1; transform: none } 39%, 95% { opacity: 0; transform: none } 99%, 100% { opacity: 1; transform: none }
}
@keyframes cf-big {
  0%, 39% { opacity: 0; transform: none } 41%, 46% { opacity: 1; transform: none }
  49%, 55% { transform: translateX(73px) } 58%, 61% { transform: translateX(143px) } 67%, 92% { opacity: 1; transform: none } 95%, 100% { opacity: 0; transform: none }
}
/* Totes: staging -> small cart for their own trip -> back; then onto the cluster cart */
@keyframes cf-o1 {
  0% { transform: translate(-54px, -40px) } 1% { transform: translate(-2px, 0) } 4%, 6% { transform: translate(73px, 0) } 9% { transform: translate(-2px, 0) } 10%, 41% { transform: translate(-54px, -40px) }
  45%, 46% { transform: none } 49%, 55% { transform: translate(73px, 0) } 58%, 61% { transform: translate(143px, 0) } 67%, 92% { transform: none } 97%, 100% { transform: translate(-54px, -40px) }
}
@keyframes cf-o2 {
  0%, 10% { transform: translate(-84px, -8px) } 11% { transform: translate(-32px, 0) } 17%, 19% { transform: translate(143px, 0) } 25% { transform: translate(-32px, 0) } 26%, 41% { transform: translate(-84px, -8px) }
  45%, 46% { transform: none } 49%, 55% { transform: translate(73px, 0) } 58%, 61% { transform: translate(143px, 0) } 67%, 92% { transform: none } 97%, 100% { transform: translate(-84px, -8px) }
}
@keyframes cf-o3 {
  0%, 26% { transform: translate(-114px, 24px) } 27% { transform: translate(-62px, 0) } 30%, 32% { transform: translate(13px, 0) } 35% { transform: translate(-62px, 0) } 36%, 41% { transform: translate(-114px, 24px) }
  45%, 46% { transform: none } 49%, 55% { transform: translate(73px, 0) } 58%, 61% { transform: translate(143px, 0) } 67%, 92% { transform: none } 97%, 100% { transform: translate(-114px, 24px) }
}
/* Items: leave the shelf and fly into the tote at the stop */
@keyframes cf-a1 { 0%, 4.4% { opacity: 1 } 4.5%, 38% { opacity: 0 } 40%, 49.4% { opacity: 1 } 49.5%, 93% { opacity: 0 } 97%, 100% { opacity: 1 } }
@keyframes cf-a2 { 0%, 30.4% { opacity: 1 } 30.5%, 38% { opacity: 0 } 40%, 51.4% { opacity: 1 } 51.5%, 93% { opacity: 0 } 97%, 100% { opacity: 1 } }
@keyframes cf-b { 0%, 17.4% { opacity: 1 } 17.5%, 38% { opacity: 0 } 40%, 58.4% { opacity: 1 } 58.5%, 93% { opacity: 0 } 97%, 100% { opacity: 1 } }
@keyframes cf-got1 {
  0%, 4.4% { opacity: 0; transform: translate(-8px, -84px) } 4.5% { opacity: 1; transform: translate(-8px, -84px) } 5.5%, 37% { opacity: 1; transform: none }
  39%, 49.4% { opacity: 0; transform: translate(-8px, -84px) } 49.5% { opacity: 1; transform: translate(-8px, -84px) } 50.5%, 93% { opacity: 1; transform: none } 96%, 100% { opacity: 0; transform: translate(-8px, -84px) }
}
@keyframes cf-got2 {
  0%, 17.4% { opacity: 0; transform: translate(0, 68px) } 17.5% { opacity: 1; transform: translate(0, 68px) } 18.5%, 37% { opacity: 1; transform: none }
  39%, 58.4% { opacity: 0; transform: translate(0, 68px) } 58.5% { opacity: 1; transform: translate(0, 68px) } 59.5%, 93% { opacity: 1; transform: none } 96%, 100% { opacity: 0; transform: translate(0, 68px) }
}
@keyframes cf-got3 {
  0%, 30.4% { opacity: 0; transform: translate(10px, -84px) } 30.5% { opacity: 1; transform: translate(10px, -84px) } 31.5%, 37% { opacity: 1; transform: none }
  39%, 51.4% { opacity: 0; transform: translate(-50px, -84px) } 51.5% { opacity: 1; transform: translate(-50px, -84px) } 52.5%, 93% { opacity: 1; transform: none } 96%, 100% { opacity: 0; transform: translate(10px, -84px) }
}
/* With only: each tote flashes as its position is scanned */
@keyframes cf-scan1 { 0%, 50.5% { stroke-width: 2.5px } 51% { stroke-width: 6px } 52%, 100% { stroke-width: 2.5px } }
@keyframes cf-scan3 { 0%, 52.5% { stroke-width: 2.5px } 53% { stroke-width: 6px } 54%, 100% { stroke-width: 2.5px } }
@keyframes cf-scan2 { 0%, 59.5% { stroke-width: 2.5px } 60% { stroke-width: 6px } 61%, 100% { stroke-width: 2.5px } }

@media (max-width: 520px) { .cf-seg { font-size: 14px; padding: 8px 6px; } .cf-seg b { display: block; } .cf-status { font-size: 14px; min-height: 2.6em; } }

/* ---- Shared timeline for the "fl" loops (pack, rate, count, release, tl, vud) ----
   10 s: Without 0-45 %, switch 45-48 %, With 48-95 %, reset 95-100 %.
   Status slots: s1 0-14, s2 15-29, s3 30-45, s4 47-64, s5 65-79, s6 80-95 (end frame).
   Each loop's own CSS animates its objects to the same windows. */
.fl .fl-seg-v { background: var(--harbor-700, #0C4A5A); color: #F4FBFC; }
.fl .cf-status .fl-s6 { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .fl .fl-seg-w { animation-name: fl-seg-w; } .fl .fl-seg-v { animation-name: fl-seg-v; }
  .fl .cf-status .fl-s1 { animation-name: fl-s1; } .fl .cf-status .fl-s2 { animation-name: fl-s2; } .fl .cf-status .fl-s3 { animation-name: fl-s3; }
  .fl .cf-status .fl-s4 { animation-name: fl-s4; } .fl .cf-status .fl-s5 { animation-name: fl-s5; } .fl .cf-status .fl-s6 { animation-name: fl-s6; }
}
@keyframes fl-seg-w { 0%, 44% { background: #B14E2E; color: #FFFFFF } 47%, 95% { background: transparent; color: #6B6459 } 98%, 100% { background: #B14E2E; color: #FFFFFF } }
@keyframes fl-seg-v { 0%, 44% { background: transparent; color: #6B6459 } 47%, 95% { background: #0C4A5A; color: #F4FBFC } 98%, 100% { background: transparent; color: #6B6459 } }
@keyframes fl-s1 { 0%, 14% { opacity: 1 } 15%, 97% { opacity: 0 } 100% { opacity: 1 } }
@keyframes fl-s2 { 0%, 14% { opacity: 0 } 15%, 29% { opacity: 1 } 30%, 100% { opacity: 0 } }
@keyframes fl-s3 { 0%, 29% { opacity: 0 } 30%, 45% { opacity: 1 } 46%, 100% { opacity: 0 } }
@keyframes fl-s4 { 0%, 46% { opacity: 0 } 47%, 64% { opacity: 1 } 65%, 100% { opacity: 0 } }
@keyframes fl-s5 { 0%, 64% { opacity: 0 } 65%, 79% { opacity: 1 } 80%, 100% { opacity: 0 } }
@keyframes fl-s6 { 0%, 79% { opacity: 0 } 80%, 95% { opacity: 1 } 97%, 100% { opacity: 0 } }
.fl-k { display: inline-block; flex: none; width: 14px; height: 11px; border-radius: 2px; }
