/* Hero animation: "messy workflow to clean flow" (01.11.2026, v5).
   One 20 s loop:
     1. Today (0-47%): steps scattered, tangled hand-offs, repeat work. A small red dot travels the dotted tangle at a
        steady, slow pace, pausing at each repeat step (which lights up as it is hit), and ends up back at re-typing, stuck ("?").
     2. Clean-up (41-62%): repeat steps are struck out and vanish, the tangle goes, the real steps slide into one row.
     3. After (58-95%): the row connects, an order runs straight through, each step lights as it passes,
        AI marks only the quoting step, a tick lands on Paid.
   Pure CSS + inline SVG, no libraries, no client data.
   BASE state = the finished clean flow (shown with reduced motion or no animation support); motion is added
   only inside the no-preference query. Own colour tokens, so it works in both designs. */

.flow-anim{
  --fa-ink:#16181D; --fa-card:#FFFFFF; --fa-muted:#4A4F5A; --fa-mess:#8A8F99;
  --fa-accent:#B8451A; --fa-tint:#FBEEE8;
  margin: 34px 0 6px; max-width: 640px;
}
.flow-anim svg{ display:block; width:100%; height:auto; overflow:visible; }
.flow-anim text{ font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif; fill: var(--fa-ink); }

/* captions inside the picture */
.flow-anim .fa-cap{ font-size: 16px; font-weight: 700; }
.flow-anim .fa-cap-before{ fill: var(--fa-accent); opacity: 0; }
.flow-anim .fa-cap-after{ fill: var(--fa-ink); }

/* steps */
.flow-anim .fa-node rect{ fill: var(--fa-card); stroke: var(--fa-ink); stroke-width: 1.5; }
.flow-anim .fa-node text{ font-size: 14px; font-weight: 600; text-anchor: middle; }

/* repeat work (only in the messy picture) */
.flow-anim .fa-waste{ opacity: 0; }
.flow-anim .fa-waste rect{ fill: var(--fa-card); stroke: var(--fa-mess); stroke-width: 1.5; stroke-dasharray: 5 4; }
.flow-anim .fa-waste text{ font-size: 13px; font-weight: 600; text-anchor: middle; fill: var(--fa-muted); }
.flow-anim .fa-strike{ stroke: var(--fa-accent); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 112; stroke-dashoffset: 0; }

/* the tangle, the order travelling it, and where it gets stuck */
.flow-anim .fa-mess{ fill: none; stroke: var(--fa-mess); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: 0; }
.flow-anim .fa-wander{
  opacity: 0;
  offset-path: path("M90 80 C 200 40, 300 200, 380 160 C 440 130, 260 260, 150 165 C 60 90, 330 0, 450 70 C 560 130, 160 200, 90 255 C 40 290, 200 300, 240 250 C 280 200, 120 120, 150 165");
  offset-rotate: 0deg;
}
/* the bee (Modelsbee) riding the dotted lines */
.flow-anim .fa-body{ fill:#F5B921; stroke: var(--fa-ink); stroke-width:1.4; }
.flow-anim .fa-stripe{ fill:none; stroke: var(--fa-ink); stroke-width:2.2; }
.flow-anim .fa-head{ fill: var(--fa-ink); }
.flow-anim .fa-feel{ fill:none; stroke: var(--fa-ink); stroke-width:1.2; stroke-linecap:round; }
.flow-anim .fa-sting{ fill: var(--fa-ink); }
.flow-anim .fa-wing{ fill:#fff; fill-opacity:.9; stroke: var(--fa-ink); stroke-width:1.1; transform-box: fill-box; transform-origin: 50% 100%; }
.flow-anim .fa-stuck{ opacity: 0; }
.flow-anim .fa-stuck circle{ fill: var(--fa-card); stroke: var(--fa-accent); stroke-width: 1.5; }
.flow-anim .fa-stuck text{ fill: var(--fa-accent); font-size: 14px; font-weight: 700; text-anchor: middle; }

/* the clean line, its arrows, and an order running straight through */
.flow-anim .fa-line{ fill: none; stroke: var(--fa-ink); stroke-width: 2; stroke-dasharray: 480; stroke-dashoffset: 0; }
.flow-anim .fa-arrows path{ fill: none; stroke: var(--fa-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.flow-anim .fa-token{ opacity: 0; }

/* AI tag and finish tick */
.flow-anim .fa-badge{ transform-box: fill-box; transform-origin: center; }
.flow-anim .fa-badge rect, .flow-anim .fa-badge circle{ fill: var(--fa-accent); }
.flow-anim .fa-badge text{ fill: #fff; font-size: 11px; font-weight: 700; text-anchor: middle; }
.flow-anim .fa-badge path{ fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.flow-anim figcaption{ font-size: 15px; line-height: 1.5; color: var(--fa-muted); margin-top: 12px; max-width: 52ch; }

@media (prefers-reduced-motion: no-preference){
  .flow-anim .fa-scene{ animation: fa-scene 20s linear infinite; }
  .flow-anim .fa-node{ animation: fa-move 20s cubic-bezier(.55,.05,.25,1) infinite; }
  .flow-anim .fa-node > rect{ animation: fa-lit 20s ease infinite; }
  .flow-anim .n2 > rect{ animation-delay: .8s; }
  .flow-anim .n3 > rect{ animation-delay: 1.6s; }
  .flow-anim .n4 > rect{ animation-delay: 2.4s; }
  .flow-anim .n5 > rect{ animation-delay: 3.2s; }
  .flow-anim .fa-waste{ animation: fa-waste 20s ease infinite; }
  .flow-anim .v-copy rect{ animation: fa-visit-copy 20s ease infinite; }
  .flow-anim .v-retype rect{ animation: fa-visit-retype 20s ease infinite; }
  .flow-anim .v-chase rect{ animation: fa-visit-chase 20s ease infinite; }
  .flow-anim .fa-strike{ animation: fa-strike 20s ease infinite; }
  .flow-anim .fa-mess{ animation: fa-mess 20s ease infinite; }
  .flow-anim .fa-wander{ animation: fa-wander 20s linear infinite; }
  .flow-anim .fa-stuck{ animation: fa-stuck 20s ease infinite; }
  .flow-anim .fa-line{ animation: fa-line 20s ease-out infinite; }
  .flow-anim .fa-arrows{ animation: fa-arrows 20s ease infinite; }
  .flow-anim .fa-token{ animation: fa-token 20s linear infinite; }
  .flow-anim .fa-wing{ animation: fa-flutter .18s ease-in-out infinite alternate; }
  .flow-anim .fa-wing2{ animation-delay: .09s; }
  .flow-anim .fa-ai{ animation: fa-pop-ai 20s ease-out infinite; }
  .flow-anim .fa-done{ animation: fa-pop-done 20s ease-out infinite; }
  .flow-anim .fa-cap-before{ animation: fa-before 20s ease infinite; }
  .flow-anim .fa-cap-after{ animation: fa-after 20s ease infinite; }
}

@keyframes fa-scene{ 0%{opacity:0} 3%{opacity:1} 95%{opacity:1} 99%,100%{opacity:0} }
@keyframes fa-move{
  0%   { transform: translate(var(--mx),var(--my)) rotate(var(--rot)); }
  24%  { transform: translate(var(--mx),var(--my)) rotate(calc(var(--rot) * -1)); }
  48%  { transform: translate(var(--mx),var(--my)) rotate(var(--rot)); }
  62%,100% { transform: translate(0,0) rotate(0deg); }
}
@keyframes fa-lit{ 0%,69%{fill:var(--fa-card)} 71%,80%{fill:var(--fa-tint)} 85%,100%{fill:var(--fa-card)} }

/* the order stops at each repeat step: Copy to sheet 17.5 %, Re-type 32.8 %, Quote 54.8 %, Chase 79.9 %, Job 90.6 %, back to Re-type 100 % of the path */
/* steady pace (linear), a short pause at each repeat step it hits */
@keyframes fa-wander{
  0%,3%  { offset-distance: 0%;    opacity: 0; }
  4%     { offset-distance: 0%;    opacity: 1; }
  9.1%   { offset-distance: 17.5%; }
  10.1%  { offset-distance: 17.5%; }
  14.5%  { offset-distance: 32.8%; }
  15.5%  { offset-distance: 32.8%; }
  21.9%  { offset-distance: 54.8%; }
  22.9%  { offset-distance: 54.8%; }
  30.2%  { offset-distance: 79.9%; }
  31.2%  { offset-distance: 79.9%; }
  34.3%  { offset-distance: 90.6%; }
  35.3%  { offset-distance: 90.6%; }
  38%    { offset-distance: 100%;  opacity: 1; }
  44%    { offset-distance: 100%;  opacity: 1; }
  47%,100%{ offset-distance: 100%; opacity: 0; }
}
@keyframes fa-visit-copy{
  0%,8.6%{ stroke:var(--fa-mess); fill:var(--fa-card); } 9.1%,12.5%{ stroke:var(--fa-accent); fill:var(--fa-tint); } 14%,100%{ stroke:var(--fa-mess); fill:var(--fa-card); }
}
@keyframes fa-visit-retype{
  0%,14%{ stroke:var(--fa-mess); fill:var(--fa-card); } 14.5%,18%{ stroke:var(--fa-accent); fill:var(--fa-tint); }
  19.5%,37.5%{ stroke:var(--fa-mess); fill:var(--fa-card); } 38%,45%{ stroke:var(--fa-accent); fill:var(--fa-tint); }
  48%,100%{ stroke:var(--fa-mess); fill:var(--fa-card); }
}
@keyframes fa-visit-chase{
  0%,29.7%{ stroke:var(--fa-mess); fill:var(--fa-card); } 30.2%,33.5%{ stroke:var(--fa-accent); fill:var(--fa-tint); } 35%,100%{ stroke:var(--fa-mess); fill:var(--fa-card); }
}
@keyframes fa-stuck{ 0%,37.5%{opacity:0} 39.5%,45%{opacity:1} 48%,100%{opacity:0} }
@keyframes fa-strike{ 0%,41%{stroke-dashoffset:112} 45%,100%{stroke-dashoffset:0} }
@keyframes fa-waste{ 0%,46%{opacity:1} 51%,100%{opacity:0} }
@keyframes fa-mess{ 0%,46%{opacity:1} 51%,100%{opacity:0} }
@keyframes fa-line{ 0%,62%{stroke-dashoffset:480} 68%,100%{stroke-dashoffset:0} }
@keyframes fa-arrows{ 0%,65%{opacity:0} 69%,100%{opacity:1} }
@keyframes fa-token{
  0%,69% { opacity:0; transform: translateX(0); }
  70%    { opacity:1; transform: translateX(0); }
  86%    { opacity:1; transform: translateX(480px); }
  88%,100%{ opacity:0; transform: translateX(480px); }
}
@keyframes fa-flutter{ from{ transform: scaleY(1) } to{ transform: scaleY(.45) } }
@keyframes fa-pop-ai{ 0%,73%{opacity:0; transform:scale(.4)} 76%,100%{opacity:1; transform:scale(1)} }
@keyframes fa-pop-done{ 0%,86%{opacity:0; transform:scale(.4)} 89%,100%{opacity:1; transform:scale(1)} }
@keyframes fa-before{ 0%,47%{opacity:1} 52%,100%{opacity:0} }
@keyframes fa-after{ 0%,58%{opacity:0} 64%,100%{opacity:1} }

/* Wide screens: the picture sits beside the headline instead of below the buttons. */
@media (min-width: 1100px){
  .hero .wrap:has(> .flow-anim){
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); column-gap: 56px; align-items: start;
  }
  .hero .wrap:has(> .flow-anim) > *{ grid-column: 1; }
  .hero .wrap:has(> .flow-anim) > .flow-anim{ grid-column: 2; grid-row: 1 / span 4; align-self: center; margin: 0; }
  .hero .wrap:has(> .flow-anim) > .facts{ grid-column: 1 / -1; }
}

/* the figure is the hero's 5th child, so the facts row is 6th: keep the stagger */
.hero .rise:nth-child(6){ animation-delay: .48s; }
