/* InFaktory marketing site — the AutoQuote and AutoBalloon workflow demos (index.html).
   Pure CSS + marketing-workflows.js, no libraries. Tokens come from marketing.css.

   How it works: .wf[data-step="1".."6"] is the state. Scrolling through the tall .wf track (the .wf-pin stage stays put) moves the step;
   everything on screen is CSS keyed to that state:
     .wf-panel.is-on     the panel of the current step (the others are hidden)
     .st                 an item that enters when its panel turns on, staggered by --i
     .wf[data-step="n"]  layers of the AutoBalloon drawing that belong to step n
   typeUI motion rules: only opacity and transform move, entrances are 320 ms ease-out, nothing animates body copy, every animation has a static
   end state, nothing plays by itself (the scroll is the visitor's), and prefers-reduced-motion switches the transitions off. */

.wf{display:flex; flex-direction:column; gap:var(--sp-6)}
.wf-pin{display:flex; flex-direction:column; gap:var(--sp-4); background:var(--wf-bg, var(--bg))}
.section-alt .wf-pin{--wf-bg:var(--sur)}

/* Story mode (set by marketing-workflows.js): the stage pins under the nav while the visitor scrolls the track; a screen of scrolling per step. */
.wf-story{display:block}
.wf-story .wf-pin{position:sticky; top:calc(var(--nav-h) + var(--sp-3)); z-index:1; padding:var(--sp-2) 0 var(--sp-3)}
.wf-story::after{content:""; display:block; height:calc(var(--wf-n, 6) * 100vh)}   /* a screen of scrolling per step */

/* ── Stage: the "application window" the steps play in ── */
.wf-stage{
  position:relative; display:flex; flex-direction:column; height:clamp(480px, calc(100svh - 300px), 520px); overflow:hidden;
  background:var(--bg); border:1px solid var(--bor);
  box-shadow:0 1px 2px rgba(14,17,17,.06), 0 16px 40px rgba(14,17,17,.08);      /* one light source, from above */
}
.wf-bar{display:flex; align-items:center; justify-content:space-between; gap:var(--sp-4); padding:12px var(--sp-5); background:var(--sur); border-bottom:1px solid var(--bor); font:500 14px var(--fnt-mono); color:var(--mut)}
.wf-bar b{font-weight:500; color:var(--txt)}
.wf-bar-tag{display:inline-flex; align-items:center; gap:var(--sp-2); color:var(--acc-text)}
.wf-bar-tag i{width:8px; height:8px; background:var(--acc)}
.wf-panels{position:relative; flex:1; min-height:0}
.wf-panel{
  position:absolute; inset:0; padding:var(--sp-9) var(--sp-6) var(--sp-6); display:flex; flex-direction:column; justify-content:center; gap:var(--sp-5); overflow:hidden;
  opacity:0; visibility:hidden; transition:opacity .2s ease-out, visibility 0s linear .2s;
}
.wf-panel.is-on{opacity:1; visibility:visible; transition-delay:0s}
.wf-label{position:absolute; top:var(--sp-5); left:var(--sp-6); display:flex; align-items:center; gap:var(--sp-2); font:500 14px var(--fnt-mono); color:var(--acc-text)}
.wf-label::before{content:""; width:8px; height:8px; background:var(--acc); flex:none}

/* an item that enters with its panel; it resets only after the panel has faded out */
.st{opacity:0; transform:translateY(8px); transition:opacity 0s linear .2s, transform 0s linear .2s}
.wf-panel.is-on .st{opacity:1; transform:none; transition:opacity .32s ease-out calc(var(--i,0) * 70ms + 120ms), transform .32s ease-out calc(var(--i,0) * 70ms + 120ms)}

/* ── Steps (tabs under the stage) and the caption ── */
.wf-list{list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(6, minmax(0,1fr)); gap:var(--sp-4)}
.wf-step{
  position:relative; display:flex; align-items:flex-start; gap:var(--sp-3); width:100%; min-height:56px; text-align:left;
  padding:var(--sp-3) var(--sp-2) var(--sp-3) 0; background:transparent; border:0; border-top:2px solid var(--bor);
  font:inherit; color:var(--mut); cursor:pointer;
}
.wf-step:hover{color:var(--txt)}
.wf-n{display:grid; place-items:center; width:28px; height:28px; flex:none; border:1.5px solid var(--bor-strong); background:var(--bg); font:500 14px var(--fnt-mono); color:var(--mut)}
.wf-t{font-size:16px; font-weight:600; line-height:1.3; letter-spacing:-.01em}
.wf-step.is-done .wf-n{border-color:var(--acc-text); color:var(--acc-text)}
.wf-step.is-active{color:var(--txt)}
.wf-step.is-active .wf-n{background:var(--acc); border-color:var(--acc); color:#fff}
.wf-fill{position:absolute; left:0; top:-2px; width:100%; height:2px; background:var(--acc); transform:scaleX(0); transform-origin:left}
.wf-step.is-done .wf-fill{transform:scaleX(1)}
.wf-step.is-active .wf-fill{transform:scaleX(var(--wf-p, 0))}      /* the bar fills as you scroll through the step */
.wf:not(.wf-story) .wf-step.is-active .wf-fill{transform:scaleX(1)}

.wf-foot{display:flex; align-items:flex-start; justify-content:space-between; gap:var(--sp-6); flex-wrap:wrap}
.wf-captions{display:grid; flex:1; min-width:min(100%, 320px); max-width:760px}
.wf-cap{grid-area:1 / 1; margin:0; font-size:18px; line-height:1.5; color:var(--txt); opacity:0; visibility:hidden; transition:opacity .2s ease-out, visibility 0s linear .2s}
.wf-cap.is-on{opacity:1; visibility:visible; transition-delay:0s}
.wf-cap b{font-weight:600}
.wf-controls{display:flex; align-items:center; gap:var(--sp-4)}
.wf-count{font:500 14px var(--fnt-mono); color:var(--mut)}
.wf-count b{color:var(--txt); font-weight:500}
.wf-hint{font:500 14px var(--fnt-mono); color:var(--acc-text); transition:opacity .2s ease-out}
.wf-hint::before{content:"↓ "}
.wf:not(.wf-story) .wf-hint, .wf.is-end .wf-hint{display:none}
.wf-note{margin:var(--sp-5) 0 0}

/* ═══════════════════ AutoQuote panels ═══════════════════ */
.aq-two{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.15fr); gap:var(--sp-6); align-items:center; min-height:0}
.aq-col{display:flex; flex-direction:column; gap:var(--sp-4); min-height:0}

/* 1 · inbox */
.aq-inbox{border:1px solid var(--bor)}
.aq-mail{display:grid; grid-template-columns:minmax(0,1fr) auto; gap:var(--sp-4); align-items:center; padding:12px var(--sp-4); border-bottom:1px solid var(--bor); font-size:14px}
.aq-mail:last-child{border-bottom:0}
.aq-mail b{display:block; font-weight:600; font-size:14px; color:var(--txt)}
.aq-mail span{display:block; color:var(--mut); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.aq-mail time{font-family:var(--fnt-mono); color:var(--mut)}
.aq-mail-new{background:var(--acc-soft); border-left:3px solid var(--acc)}
.aq-open{border:1px solid var(--bor); padding:var(--sp-5); display:flex; flex-direction:column; gap:var(--sp-4)}
.aq-subject{font-size:18px; font-weight:600; line-height:1.3; letter-spacing:-.01em; color:var(--txt)}
.aq-from{font-size:14px; color:var(--mut)}
.aq-attach{display:flex; flex-wrap:wrap; gap:var(--sp-2)}
.aq-file{display:inline-flex; align-items:center; gap:var(--sp-2); padding:8px 12px; border:1px solid var(--bor-strong); font:500 14px var(--fnt-mono); color:var(--txt)}
.aq-file::before{content:""; width:10px; height:12px; border:1.5px solid var(--mut); flex:none}
.aq-created{display:flex; align-items:center; gap:var(--sp-3); padding:12px var(--sp-4); background:var(--acc-soft); color:var(--acc-text); font-size:14px; font-weight:500}
.aq-created svg{width:16px; height:16px; flex:none; stroke:currentColor; fill:none; stroke-width:2}

/* 2 · drawing is read */
.aq-sheet{position:relative; border:1px solid var(--bor); background:#fff; aspect-ratio:4 / 3; max-height:100%; overflow:hidden}
.aq-sheet svg{display:block; width:100%; height:100%}
.aq-scan{position:absolute; inset:0; pointer-events:none; transform:translateY(-50%); opacity:0;
  background:linear-gradient(to bottom, transparent calc(50% - 1px), var(--acc) calc(50% - 1px), var(--acc) calc(50% + 1px), transparent calc(50% + 1px))}
.wf-panel.is-on .aq-scan{animation:aq-scan 1.7s ease-in-out .25s 1 both}
@keyframes aq-scan{0%{transform:translateY(-50%); opacity:1} 100%{transform:translateY(50%); opacity:1}}
.aq-fields{display:flex; flex-direction:column; border:1px solid var(--bor)}
.aq-field{display:grid; grid-template-columns:minmax(0,1fr) auto; gap:var(--sp-3); align-items:center; padding:12px var(--sp-4); border-bottom:1px solid var(--bor)}
.aq-field:last-child{border-bottom:0}
.aq-field small{display:block; font:500 14px var(--fnt-mono); color:var(--mut)}
.aq-field strong{display:block; font-size:16px; font-weight:500; color:var(--txt)}
.aq-ok{width:20px; height:20px; display:grid; place-items:center; background:var(--acc); flex:none}
.aq-ok svg{width:12px; height:12px; stroke:#fff; fill:none; stroke-width:2.5}
.aq-ready{display:inline-flex; align-items:center; gap:var(--sp-2); align-self:flex-start; padding:6px 12px; background:var(--acc-soft); color:var(--acc-text); font:500 14px var(--fnt-mono)}

/* 3 · process route */
.aq-route{display:grid; grid-template-columns:repeat(5, minmax(0,1fr)); gap:var(--sp-5); align-items:stretch}
.aq-node{position:relative; display:flex; flex-direction:column; gap:var(--sp-2); padding:var(--sp-4); border:1px solid var(--bor); background:var(--bg)}
.aq-node::after{content:""; position:absolute; top:50%; left:100%; width:var(--sp-5); height:2px; background:var(--acc); transform:scaleX(0); transform-origin:left; transition:transform 0s linear .2s}
.aq-node:last-child::after{display:none}
.wf-panel.is-on .aq-node::after{transform:scaleX(1); transition:transform .3s ease-out calc(var(--i,0) * 70ms + 320ms)}
.aq-node h4, .aq-node h3{margin:0; font-size:16px; line-height:1.25}
.aq-node small{font:500 14px var(--fnt-mono); color:var(--mut); line-height:1.4}
.aq-node em{font-style:normal; font:500 14px var(--fnt-mono); color:var(--acc-text)}
.aq-bars{display:flex; flex-direction:column; gap:var(--sp-3); border:1px solid var(--bor); padding:var(--sp-4) var(--sp-5)}
.aq-bar-row{display:grid; grid-template-columns:132px minmax(0,1fr) 72px; gap:var(--sp-4); align-items:center; font-size:14px}
.aq-bar-row span:first-child{color:var(--txt)}
.aq-bar-row span:last-child{font-family:var(--fnt-mono); color:var(--mut); text-align:right}
.aq-track{height:8px; background:var(--sur2)}
.aq-track i{display:block; height:100%; width:var(--w); background:var(--acc); transform:scaleX(0); transform-origin:left; transition:transform 0s linear .2s}
.wf-panel.is-on .aq-track i{transform:scaleX(1); transition:transform .6s ease-out calc(var(--i,0) * 90ms + 500ms)}
.aq-tip{margin:0; font-size:14px; color:var(--mut)}

/* 4 · costing */
.aq-cost{display:flex; flex-direction:column; border:1px solid var(--bor)}
.aq-row{position:relative; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:var(--sp-4); align-items:center; padding:12px var(--sp-5); border-bottom:1px solid var(--bor); font-size:16px}
.aq-row span:last-child{font-family:var(--fnt-mono); color:var(--txt)}
.aq-row .aq-b{position:absolute; left:0; bottom:-1px; height:2px; width:var(--w); background:var(--acc); transform:scaleX(0); transform-origin:left; transition:transform 0s linear .2s}
.wf-panel.is-on .aq-row .aq-b{transform:scaleX(1); transition:transform .6s ease-out calc(var(--i,0) * 70ms + 400ms)}
.aq-row.aq-price{border-bottom:0; background:var(--sur); padding:var(--sp-4) var(--sp-5); font-weight:600}
.aq-row.aq-price span:last-child{font-size:24px; font-weight:600}
.aq-edit{display:inline-flex; align-items:center; gap:var(--sp-2); align-self:flex-start; padding:6px 12px; border:1px solid var(--bor-strong); font:500 14px var(--fnt-mono); color:var(--mut)}

/* 5 · quotation and approval */
.aq-doc{border:1px solid var(--bor); background:#fff; padding:var(--sp-5); display:flex; flex-direction:column; gap:var(--sp-3); box-shadow:0 1px 2px rgba(14,17,17,.06)}
.aq-doc h4, .aq-doc h3{margin:0; font-size:20px; line-height:1.25}
.aq-doc-row{display:flex; justify-content:space-between; gap:var(--sp-4); padding:8px 0; border-bottom:1px solid var(--bor); font-size:14px}
.aq-doc-row span:first-child{color:var(--mut)}
.aq-doc-row span:last-child{font-family:var(--fnt-mono); color:var(--txt)}
.aq-doc-row.total{border-bottom:2px solid var(--txt); font-weight:600}
.aq-pipe{display:flex; flex-direction:column; gap:0; border:1px solid var(--bor)}
.aq-stage{display:grid; grid-template-columns:24px minmax(0,1fr); gap:var(--sp-3); align-items:center; padding:12px var(--sp-4); border-bottom:1px solid var(--bor); font-size:16px; color:var(--mut); background:var(--bg); transition:background .3s ease-out, color .3s ease-out}
.aq-stage:last-child{border-bottom:0}
.aq-stage i{width:16px; height:16px; border:1.5px solid var(--bor-strong); background:var(--bg); transition:background .3s ease-out, border-color .3s ease-out}
.wf-panel.is-on .aq-stage{transition-delay:calc(var(--i,0) * 450ms + 500ms)}
.wf-panel.is-on .aq-stage{background:var(--acc-soft); color:var(--acc-text); font-weight:500}
.wf-panel.is-on .aq-stage i{background:var(--acc); border-color:var(--acc); transition-delay:calc(var(--i,0) * 450ms + 500ms)}
.aq-stamp{display:inline-flex; align-items:center; gap:var(--sp-2); align-self:flex-start; padding:8px 12px; border:1.5px solid var(--acc-text); color:var(--acc-text); font:500 14px var(--fnt-mono)}

/* 6 · export and send */
.aq-out{display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:var(--sp-5)}
.aq-card{display:flex; flex-direction:column; gap:var(--sp-3); padding:var(--sp-5); border:1px solid var(--bor); background:var(--bg); box-shadow:0 1px 2px rgba(14,17,17,.06)}
.aq-card h4, .aq-card h3{margin:0; font-size:18px; line-height:1.25}
.aq-card p{margin:0; font-size:14px; color:var(--mut)}
.aq-ico{width:40px; height:48px; border:1.5px solid var(--txt); position:relative; background:var(--bg)}
.aq-ico::after{content:attr(data-t); position:absolute; left:-1.5px; right:-1.5px; bottom:8px; text-align:center; font:600 12px var(--fnt-mono); color:var(--acc-text)}
.aq-sent{display:flex; flex-direction:column; gap:var(--sp-2); padding:var(--sp-4) var(--sp-5); border:1px solid var(--bor); font-size:16px}
.aq-sent div{display:flex; align-items:center; gap:var(--sp-3)}
.aq-sent svg{width:16px; height:16px; stroke:var(--acc-text); fill:none; stroke-width:2.5; flex:none}

/* ═══════════════════ AutoBalloon panels ═══════════════════ */
.bp-up{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.2fr); gap:var(--sp-6); align-items:stretch; min-height:0}
.bp-drop{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:var(--sp-4); border:2px dashed var(--bor-strong); padding:var(--sp-6); text-align:center; font-size:16px; color:var(--mut)}
.bp-pdf{width:56px; height:72px; border:1.5px solid var(--txt); background:var(--bg); position:relative}
.bp-pdf::after{content:"PDF"; position:absolute; left:0; right:0; bottom:10px; text-align:center; font:600 12px var(--fnt-mono); color:var(--acc-text)}
.bp-file{font:500 14px var(--fnt-mono); color:var(--txt)}
.bp-ways{display:flex; flex-direction:column; gap:var(--sp-4)}
.bp-way{display:flex; flex-direction:column; gap:var(--sp-2); padding:var(--sp-5); border:1px solid var(--bor); background:var(--bg)}
.bp-way.is-pick{border-color:var(--acc); background:var(--acc-soft)}
.bp-way h4, .bp-way h3{margin:0; font-size:18px; line-height:1.25}
.bp-way p{margin:0; font-size:14px; color:var(--mut)}
.bp-way.is-pick p{color:var(--txt)}

.wf-panel.bp-work{display:grid; grid-template-columns:minmax(0,1.9fr) minmax(0,1fr); gap:var(--sp-5); min-height:0; padding:var(--sp-5) var(--sp-6); justify-content:stretch}
.bp-draw{position:relative; border:1px solid var(--bor); background:#fff; min-height:0; overflow:hidden}
.bp-draw svg{position:absolute; top:0; left:0; width:100%; height:calc(100% - 36px)}
.bp-cap{position:absolute; left:0; right:0; bottom:0; z-index:2; margin:0; padding:8px var(--sp-4); border-top:1px solid var(--bor); background:var(--sur); font:500 14px var(--fnt-mono); color:var(--acc-text); min-height:36px}
.bp-cap span{display:none}
.wf[data-step="2"] .bp-cap .c2, .wf[data-step="3"] .bp-cap .c3, .wf[data-step="4"] .bp-cap .c4, .wf[data-step="5"] .bp-cap .c5{display:inline}
.bp-side{position:relative; min-height:0}
.bp-pin{display:contents}
.bp-stackcap{display:none}
.bp-sub{position:absolute; inset:0; display:flex; flex-direction:column; gap:var(--sp-3); opacity:0; visibility:hidden; transition:opacity .2s ease-out, visibility 0s linear .2s}
.wf[data-step="2"] .bp-s2, .wf[data-step="3"] .bp-s3, .wf[data-step="4"] .bp-s45, .wf[data-step="5"] .bp-s45{opacity:1; visibility:visible; transition-delay:0s}
.sst{opacity:0; transform:translateY(8px); transition:opacity 0s linear .2s, transform 0s linear .2s}
.wf[data-step="2"] .bp-s2 .sst, .wf[data-step="3"] .bp-s3 .sst, .wf[data-step="4"] .bp-s45 .sst, .wf[data-step="5"] .bp-s45 .sst{
  opacity:1; transform:none; transition:opacity .32s ease-out calc(var(--i,0) * 70ms + 120ms), transform .32s ease-out calc(var(--i,0) * 70ms + 120ms)}
.wf[data-step="4"] .bp-s45 .sst-new{opacity:0; transform:translateY(8px); transition-delay:0s}
.bp-stat{display:flex; justify-content:space-between; gap:var(--sp-4); padding:12px var(--sp-4); border:1px solid var(--bor); font-size:14px; color:var(--mut)}
.bp-stat b{font-family:var(--fnt-mono); font-weight:500; color:var(--txt)}
.bp-rule{display:flex; flex-direction:column; gap:4px; padding:12px var(--sp-4); border:1px solid var(--bor); font-size:14px; line-height:1.4}
.bp-rule b{font-weight:600; color:var(--txt)}
.bp-rule span{color:var(--mut)}
.bp-rule.is-skip{background:var(--sur)}
.bp-list{display:flex; flex-direction:column; border:1px solid var(--bor); background:var(--bg)}
.bp-item{display:grid; grid-template-columns:24px minmax(0,1fr) auto; gap:var(--sp-3); align-items:center; padding:8px var(--sp-3); border-bottom:1px solid var(--bor); font-size:14px; line-height:1.35}
.bp-item:last-child{border-bottom:0}
.bp-item-n{width:24px; height:24px; display:grid; place-items:center; border:1.5px solid var(--txt); font:500 12px var(--fnt-mono); color:var(--txt); background:var(--bg)}
.bp-item.is-cf .bp-item-n{border-width:3px}
.bp-item-t{font-family:var(--fnt-mono); color:var(--txt); font-size:14px}
.bp-item-g{display:block; font-family:var(--fnt); color:var(--mut); font-size:14px}
.bp-chip{padding:2px 8px; font:500 12px var(--fnt-mono); background:var(--sur2); color:var(--mut); white-space:nowrap}
.bp-chip.is-review{background:var(--warn-soft); color:var(--warn)}
.bp-chip.is-box{background:var(--acc-soft); color:var(--acc-text)}
.bp-item .chip-v{display:none}
.wf[data-step="5"] .bp-item .chip-v{display:inline-block}
.wf[data-step="5"] .bp-item .chip-r{display:none}
.bp-keys{display:flex; flex-wrap:wrap; gap:var(--sp-2); font-size:14px; color:var(--mut); align-items:center}
.bp-keys kbd{font:500 12px var(--fnt-mono); padding:2px 8px; border:1px solid var(--bor-strong); background:var(--bg); color:var(--txt)}

/* the drawing (SVG) and the layers each step adds */
.bp-draw .ln{fill:none; stroke:#2b3333; stroke-width:1.2}
.bp-draw .thin{fill:none; stroke:#6b7674; stroke-width:.8}
.bp-draw .cl{fill:none; stroke:#6b7674; stroke-width:.8; stroke-dasharray:10 3 2 3}
.bp-draw .hid{fill:none; stroke:#6b7674; stroke-width:.9; stroke-dasharray:5 3}
.bp-draw text{font-family:var(--fnt-mono); font-size:12px; fill:#0e1111}
.bp-draw .dim{font-size:10px}
.bp-draw .faint{fill:#6b7674}
.layer{opacity:0; transition:opacity .25s ease-out}
.wf[data-step="2"] .l-cand, .wf[data-step="3"] .l-cand{opacity:1}
.wf[data-step="3"] .l-group, .wf[data-step="3"] .l-skip{opacity:1}
.wf[data-step="4"] .l-bal, .wf[data-step="5"] .l-bal, .wf[data-step="4"] .l-cf, .wf[data-step="5"] .l-cf{opacity:1}
.wf[data-step="5"] .l-box{opacity:1}
.cand{fill:rgba(14,124,107,.07); stroke:#0e7c6b; stroke-width:1; stroke-dasharray:3 2}
.cand-id{font-size:8px !important; fill:#0b6a5c !important}
.grp{fill:rgba(14,124,107,.12); stroke:#0b6a5c; stroke-width:1.5}
.skipbox{fill:rgba(107,118,116,.12); stroke:#6b7674; stroke-width:1; stroke-dasharray:4 3}
.skiptag{font-size:10px !important; fill:#56605e !important}
.bal{transform-box:fill-box; transform-origin:center; opacity:0; transform:scale(.6); transition:opacity .25s ease-out, transform .25s ease-out}
.wf[data-step="4"] .bal, .wf[data-step="5"] .bal{opacity:1; transform:none; transition-delay:calc(var(--i,0) * 110ms + 150ms)}
.bal rect{fill:#fff; stroke:#0e1111; stroke-width:1.5; transition:fill .3s ease-out .9s, stroke .3s ease-out .9s}
.bal text{font-size:12px; font-weight:500; text-anchor:middle; fill:#0e1111; transition:fill .3s ease-out .9s}
.bal.is-review rect{fill:#fbf1de; stroke:#9a5b00}
.bal.is-review text{fill:#7a4800}
.wf[data-step="5"] .bal.is-review.is-fixed rect{fill:#0e7c6b; stroke:#0e7c6b}
.wf[data-step="5"] .bal.is-review.is-fixed text{fill:#fff}
.bal.is-cf rect{stroke-width:3}
.lead{fill:none; stroke:#0e1111; stroke-width:1}
.cf-tag{font-size:10px !important; font-weight:600; fill:#0b6a5c !important}
.boxsel{fill:rgba(14,124,107,.1); stroke:#0b6a5c; stroke-width:1.5; stroke-dasharray:5 3}
.cursor{fill:#0e1111; stroke:#fff; stroke-width:1}
.l-box .bal-new{transition-delay:.9s}

/* 6 · documents */
.bp-docs{display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:var(--sp-5); min-height:0; align-content:center}
.bp-doc{display:flex; flex-direction:column; gap:var(--sp-3); padding:var(--sp-5); border:1px solid var(--bor); background:var(--bg); box-shadow:0 1px 2px rgba(14,17,17,.06)}
.bp-doc h4, .bp-doc h3{margin:0; font-size:18px; line-height:1.25}
.bp-doc p{margin:0; font-size:14px; color:var(--mut)}
.bp-doc .aq-ico{width:44px; height:56px}
.bp-doc-chips{display:flex; flex-wrap:wrap; gap:var(--sp-2)}
.bp-done{display:flex; align-items:center; gap:var(--sp-3); padding:12px var(--sp-4); background:var(--acc-soft); color:var(--acc-text); font-size:14px; font-weight:500}
.bp-done svg{width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:2.5; flex:none}

/* two ways to balloon */
.ways{display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:var(--sp-6); margin-top:var(--sp-9)}
.way{display:flex; flex-direction:column; gap:var(--sp-4); padding:var(--sp-6); border:1px solid var(--bor); background:var(--bg)}
.way h4, .way h3{margin:0; font-size:20px; line-height:1.25}
.way p{margin:0; font-size:16px}
.way ul{display:flex; flex-direction:column; gap:var(--sp-2); font-size:16px; color:var(--mut)}
.way li{position:relative; padding-left:var(--sp-5)}
.way li::before{content:""; position:absolute; left:0; top:.55em; width:8px; height:8px; background:var(--acc)}
.way-tag{font:500 14px var(--fnt-mono); color:var(--acc-text)}

/* ── hero card: one orchestrated entrance, then still ── */
.hv-row{opacity:1}
@media (prefers-reduced-motion: no-preference){
  .hero-visual .hv-row{animation:hv-in .4s ease-out both; animation-delay:calc(var(--i,0) * 140ms + 300ms)}
  .hero-visual .hv-num.done{animation:hv-done .3s ease-out 1.4s both}
}
@keyframes hv-in{from{opacity:0; transform:translateY(8px)} to{opacity:1; transform:none}}
@keyframes hv-done{from{background:transparent; color:var(--ds-text)} to{background:var(--ds-accent); color:var(--ds-bg)}}

/* ═══════════════════ small screens ═══════════════════ */
@media (max-width: 1100px){
  .wf-list{grid-template-columns:repeat(3, minmax(0,1fr)); row-gap:var(--sp-2)}
  .wf-story .wf-list{grid-template-columns:repeat(6, minmax(0,1fr)); gap:var(--sp-3)}
  .bp-docs{grid-template-columns:1fr; align-content:start; overflow:auto}
}
@media (max-width: 860px){
  .wf-stage{height:640px}
  .wf-panel{padding-top:var(--sp-9)}
  .aq-two, .bp-up, .bp-work{grid-template-columns:1fr}
  .aq-route{grid-template-columns:repeat(2, minmax(0,1fr)); gap:var(--sp-3)}
  .aq-node{padding:var(--sp-3)}
  .aq-node::after{display:none}
  .aq-out{grid-template-columns:1fr}
  .bp-side{display:none}
  .bp-work{padding:var(--sp-4)}
  .ways{grid-template-columns:1fr}
  .aq-bar-row{grid-template-columns:96px minmax(0,1fr) 64px}
}
@media (max-width: 560px){
  .wf-list{grid-template-columns:repeat(2, minmax(0,1fr))}
  .wf-stage{height:664px}
  .wf-panel{padding:var(--sp-9) var(--sp-4) var(--sp-4)}
}
@media (max-width: 420px){
  .wf-stage{height:720px}
  .aq-bar-row{grid-template-columns:84px minmax(0,1fr) 56px; gap:var(--sp-3)}
  .aq-row{padding:12px var(--sp-4)}
}
@media (prefers-reduced-motion: reduce){
  .wf-panel, .wf-cap, .layer, .bal, .st, .sst, .bp-stackcap p{transition:none !important}
  .aq-scan{display:none}
}

/* ═══════ Phones, tablets and short laptops: the story becomes a stack of cards ═══════
   There is not room to pin a whole stage, a step list and a caption in one screen, so each step's text is followed by its own panel, in order,
   and a panel plays its entrance when it is scrolled into view (marketing-workflows.js). The wrappers become display:contents so the captions
   and the panels sit in one list and `order` can interleave them. */
@media (max-width: 1100px), (max-height: 760px){
  .wf-story{display:flex; flex-direction:column; gap:var(--sp-5); counter-reset:wfs}
  .wf-story::after{display:none}
  .wf-story .wf-pin, .wf-story .wf-stage, .wf-story .wf-panels, .wf-story .wf-foot, .wf-story .wf-captions{display:contents}
  .wf-story .wf-bar, .wf-story .wf-list, .wf-story .wf-controls{display:none}
  .wf-story .wf-panel{
    position:relative; inset:auto; opacity:1; visibility:visible; transition:none; overflow:hidden;
    background:var(--bg); border:1px solid var(--bor); box-shadow:0 1px 2px rgba(14,17,17,.06), 0 12px 28px rgba(14,17,17,.07);
  }
  .wf-story .wf-cap{grid-area:auto; opacity:1; visibility:visible; transition:none; font-size:16px; margin-top:var(--sp-5)}
  .wf-story .wf-cap::before{counter-increment:wfs; content:"Step " counter(wfs) " of 6"; display:block; margin-bottom:var(--sp-2); font:500 14px var(--fnt-mono); color:var(--acc-text)}
  .wf-story .wf-cap:nth-child(1){order:10} .wf-story .wf-cap:nth-child(2){order:20} .wf-story .wf-cap:nth-child(3){order:30}
  .wf-story .wf-cap:nth-child(4){order:40} .wf-story .wf-cap:nth-child(5){order:50} .wf-story .wf-cap:nth-child(6){order:60}
  .wf-story .wf-panel:nth-child(1){order:15} .wf-story .wf-panel:nth-child(2){order:25} .wf-story .wf-panel:nth-child(3){order:35}
  .wf-story .wf-panel:nth-child(4){order:45} .wf-story .wf-panel:nth-child(5){order:55} .wf-story .wf-panel:nth-child(6){order:65}
  /* AutoBalloon has three panels: upload, the drawing (steps 2 to 5 happen on it) and the documents */
  .wf-story .wf-panel{min-height:0}
  /* the drawing card is a runway: the drawing sticks under the nav while three screens of scrolling play steps 2 to 5 on it */
  .wf-story .wf-panel.bp-work{display:block; min-height:300svh; padding:0; background:none; border:0; box-shadow:none; overflow:visible}
  .wf-story .bp-pin{display:block; position:sticky; top:calc(var(--nav-h) + var(--sp-3)); z-index:2; background:var(--bg); padding-bottom:var(--sp-3)}
  .wf-story .bp-draw{position:relative; aspect-ratio:1.15; max-height:calc(100svh - var(--nav-h) - 210px); border:1px solid var(--bor); box-shadow:0 1px 2px rgba(14,17,17,.06), 0 12px 28px rgba(14,17,17,.07)}
  .wf-story .bp-side{display:none}
  /* the drawing follows step 2's caption; the captions of steps 2 to 5 are read from the pinned caption under the drawing (the page's own copies stay for screen readers) */
  #autoballoon .wf-story .wf-panel:nth-child(2){order:25}
  #autoballoon .wf-story .wf-panel:nth-child(3){order:65}
  #autoballoon .wf-story .wf-cap:nth-child(n+2):nth-child(-n+5){position:absolute; width:1px; height:1px; margin:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap}
  .wf-story .bp-stackcap{display:grid; margin-top:var(--sp-3)}
  .wf-story .bp-stackcap p{grid-area:1 / 1; margin:0; font-size:16px; line-height:1.5; color:var(--txt); opacity:0; transition:opacity .2s ease-out}
  .wf-story .bp-stackcap b{font-weight:600}
  .wf-story .bp-stack-n{display:block; margin-bottom:var(--sp-1); font:500 14px var(--fnt-mono); color:var(--acc-text)}
  #autoballoon .wf[data-step="2"] .bp-stackcap [data-s="2"], #autoballoon .wf[data-step="3"] .bp-stackcap [data-s="3"],
  #autoballoon .wf[data-step="4"] .bp-stackcap [data-s="4"], #autoballoon .wf[data-step="5"] .bp-stackcap [data-s="5"]{opacity:1}
}

/* ═══════════════════ Scroll-scrubbed motion (pinned mode) ═══════════════════
   marketing-workflows.js sets --q on the .wf root: where the visitor is in the story, 0 to 6, eased so each step builds over the middle of its
   stretch of scroll and holds, finished, at both ends (--s is the same position, linear, for the crossfades in those holds). Everything below is
   a function of --q or --s, so scrolling back plays it backwards and nothing runs on a timer. Each panel carries --a / --b (its first and last
   step, counted from 0; --ao / --bo are the same, opened out so the first and last panel never fade at the ends); --g is how far its own step
   has built, in "items". */
.wf.is-scrub{
  --fx:clamp(0, calc((var(--q) - 4.25) * 5), 1);                       /* the engineer's fix turns a review balloon green */
}
.wf.is-scrub .wf-panel{
  --g:calc((var(--q) - var(--a)) * 12);
  --po:min(clamp(0, calc((var(--s) - var(--ao) + .06) / .12), 1), clamp(0, calc((var(--bo) + 1.06 - var(--s)) / .12), 1));   /* crossfade in the middle of the hold between two steps */
  opacity:var(--po); visibility:visible; transition:none; pointer-events:none;
}
.wf.is-scrub .wf-panel .st{
  --r:clamp(0, calc(var(--g) - var(--i, 0)), 1);
  opacity:var(--r); transform:translateY(calc((1 - var(--r)) * 18px)); transition:none;
}
/* AutoQuote */
.wf.is-scrub .aq-track i{transform:scaleX(clamp(0, calc(var(--g) - 3 - var(--i, 0)), 1)); transition:none}
.wf.is-scrub .aq-row .aq-b{transform:scaleX(clamp(0, calc(var(--g) - 2 - var(--i, 0)), 1)); transition:none}
.wf.is-scrub .aq-node::after{transform:scaleX(clamp(0, calc(var(--g) - 1.5 - var(--i, 0) * .8), 1)); transition:none}
.wf.is-scrub .aq-scan{
  animation:none; transform:translateY(calc(-50% + 100% * clamp(0, calc((var(--g) - 1.5) / 5.5), 1)));
  opacity:calc(clamp(0, calc((var(--g) - 1.4) * 5), 1) * (1 - clamp(0, calc((var(--g) - 7.2) * 5), 1)));
}
.wf.is-scrub .aq-stage{
  --on:clamp(0, calc((var(--g) - 2.5 - var(--i, 0) * 1.8) * 3), 1); transition:none;
  background:color-mix(in srgb, var(--acc-soft) calc(var(--on) * 100%), var(--bg));
  color:color-mix(in srgb, var(--acc-text) calc(var(--on) * 100%), var(--mut));
}
.wf.is-scrub .aq-stage i{transition:none; background:color-mix(in srgb, var(--acc) calc(var(--on) * 100%), var(--bg)); border-color:color-mix(in srgb, var(--acc) calc(var(--on) * 100%), var(--bor-strong))}
/* AutoBalloon: the drawing's layers, by step */
.wf.is-scrub .layer{transition:none}
.wf.is-scrub .l-cand{opacity:calc(clamp(0, calc((var(--q) - 1) * 3), 1) * (1 - clamp(0, calc((var(--q) - 3) * 3), 1)))}
.wf.is-scrub .l-group, .wf.is-scrub .l-skip{opacity:calc(clamp(0, calc((var(--q) - 2) * 3), 1) * (1 - clamp(0, calc((var(--q) - 3) * 3), 1)))}
.wf.is-scrub .l-bal, .wf.is-scrub .l-cf{opacity:clamp(0, calc((var(--q) - 3) * 4), 1)}
.wf.is-scrub .l-box{opacity:clamp(0, calc((var(--q) - 4) * 4), 1)}
.wf.is-scrub .bal{
  --r:clamp(0, calc((var(--q) - 3) * 10 - var(--i, 0)), 1);
  opacity:var(--r); transform:scale(calc(.5 + .5 * var(--r))); transition:none;
}
.wf.is-scrub .l-box .bal{--r:clamp(0, calc((var(--q) - 4) * 10 - var(--i, 0) + 5), 1)}
.wf.is-scrub .bal rect, .wf.is-scrub .bal text{transition:none}
.wf.is-scrub .bal.is-review.is-fixed rect{fill:color-mix(in srgb, #0e7c6b calc(var(--fx) * 100%), #fbf1de); stroke:color-mix(in srgb, #0e7c6b calc(var(--fx) * 100%), #9a5b00)}
.wf.is-scrub .bal.is-review.is-fixed text{fill:color-mix(in srgb, #fff calc(var(--fx) * 100%), #7a4800)}
.wf.is-scrub .cursor{transform:translate(calc((1 - clamp(0, calc((var(--q) - 4) * 3), 1)) * 120px), calc((1 - clamp(0, calc((var(--q) - 4) * 3), 1)) * -90px))}
.wf.is-scrub .l-box .boxsel{opacity:clamp(0, calc((var(--q) - 4.15) * 6), 1)}
/* AutoBalloon: the side list, by step (it reads --q from the root, not a panel) */
.wf.is-scrub .bp-s2, .wf.is-scrub .bp-s3, .wf.is-scrub .bp-s45{transition:none; visibility:visible}
.wf.is-scrub .bp-s2{--q0:1; opacity:calc(clamp(0, calc((var(--q) - 1) * 4), 1) * (1 - clamp(0, calc((var(--q) - 2) * 4), 1)))}
.wf.is-scrub .bp-s3{--q0:2; opacity:calc(clamp(0, calc((var(--q) - 2) * 4), 1) * (1 - clamp(0, calc((var(--q) - 3) * 4), 1)))}
.wf.is-scrub .bp-s45{--q0:3; opacity:clamp(0, calc((var(--q) - 3) * 4), 1)}
.wf.is-scrub .sst{
  --r:clamp(0, calc((var(--q) - var(--q0, 1)) * 12 - var(--i, 0)), 1);
  opacity:var(--r); transform:translateY(calc((1 - var(--r)) * 14px)); transition:none;
}
.wf.is-scrub .bp-s45 .sst-new{--q0:4}
/* the step list's bar fills as you scroll through the step */
.wf.is-scrub .wf-step.is-active .wf-fill{transform:scaleX(var(--wf-p, 0))}

/* in a stack every card is simply there; --g (set by the script from the card's place on screen) builds what is inside it */
.wf.is-stack .wf-panel{opacity:1; visibility:visible}

/* ═══════ Phones: tighter cards so each fits one screen (text stays 14px and up, nothing is hidden) ═══════ */
@media (max-width: 560px){
  .wf-story .wf-panel{padding:var(--sp-8) var(--sp-4) var(--sp-4); gap:var(--sp-4)}
  .wf-story .wf-label{top:var(--sp-4); left:var(--sp-4)}
  .aq-doc{padding:var(--sp-4); gap:var(--sp-2)}
  .aq-doc-row{padding:6px 0}
  .aq-stage{padding:10px var(--sp-3)}
  .aq-open{padding:var(--sp-4); gap:var(--sp-3)}
  .aq-field{padding:10px var(--sp-3)}
  .aq-row{padding:10px var(--sp-4)}
  .aq-row.aq-price{padding:var(--sp-3) var(--sp-4)}
  .aq-card, .bp-doc{display:grid; grid-template-columns:44px minmax(0,1fr); column-gap:var(--sp-4); row-gap:var(--sp-1); padding:var(--sp-4); align-items:start}
  .aq-card .aq-ico, .bp-doc .aq-ico{grid-row:1 / span 2; width:44px; height:52px}
  .bp-drop{padding:var(--sp-4); gap:var(--sp-3)}
  .bp-pdf{width:44px; height:56px}
  .bp-way{padding:var(--sp-4)}
  .bp-up{gap:var(--sp-4)}
}
@media (max-width: 860px){
  .aq-sheet{aspect-ratio:16 / 9}                       /* the drawing stays on phones, letterboxed so the card stays short */
}
@media (max-width: 560px){
  /* the process route reads top to bottom: step on the left, its time and rate on the right, a line joining them */
  .aq-route{grid-template-columns:minmax(0,1fr); gap:var(--sp-3)}
  .aq-node{display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:var(--sp-3); padding:var(--sp-3) var(--sp-4)}
  .aq-node small{text-align:right}
  .aq-node::after{display:block; top:100%; left:var(--sp-5); width:2px; height:var(--sp-3); transform:scaleY(0); transform-origin:top}
  .aq-node:last-child::after{display:none}
  .wf.is-scrub .aq-node::after{transform:scaleY(clamp(0, calc(var(--g) - 1.5 - var(--i, 0) * .8), 1))}
}
