/* ==========================================================================
   flow-steps.css: the flow step bar (components/flow-steps.blade.php)
   Pages (behind ?style=v2 for now): /badges, /badges/{id}/edit,
   /badges/{id}/populate, /badges/{id}/names
   Steps: 1 Design · 2 Add names · 3 Checkout (numbers on every step).

   I "Precision Printhead" (default, Daniel Oct 31: "the scrolling name badge
     is dumb"): 3px rail, numbered nodes; a small print carriage makes one
     pass, laying down the blue line, prints a registration mark under the
     current number, then lifts away.
   H "Badge Express" (?stepbar=H): a mini name badge runs from the rail
     start to the current number, overshoots 3px and settles.
   D / E / F / G (?stepbar=D..G, comparison only): static connected pills
     (.nbfs--pills), round-2 mockup specs. D solid; E gradient current step;
     F on a full-width slate band; G inside a white card.
   4 steps (?steps=4, .nbfs--n4): same looks, four nodes; the component
     decides populate = 2 (first time) or 3 (after names).

   - v2 kit only: #1B8FE0 / #0c7cb4 / #DBEAFE / #EFF6FF / ink #0f172a /
     slate #475569 #64748b / borders #cbd5e1 #e2e8f0; Plus Jakarta Sans
   - passive: no hover, default cursor, no links, no tab stops
   - load animation plays once; prefers-reduced-motion = the end state
     (the static rules below ARE the end state; animations only lead into it)
   - phones (<=575px): hidden; .nbfs--phone shows it
   Geometry (1080 x 42 at 1280 wide; scales with the container): the track
   runs 24px .. width-56px; node centres at 9.6% / 45.6% / 81.6% of the track
   (= x 120 / 480 / 840 of 1080). --nbfs-at = current node as a track fraction.
   Specificity: every rule starts with #flow-steps so it beats the scoped
   Tailwind preflight inside #designTool.
   ========================================================================== */

#flow-steps {
  --nbfs-at: .096;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 1080px;
  height: 42px;
  margin: 0 0 25px;                                 /* same gap as live #crumbs */
  overflow: hidden;
  font-family: "Plus Jakarta Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0;
  cursor: default;
  -webkit-user-select: none; user-select: none;
}
#flow-steps.nbfs--step2 { --nbfs-at: .456; }
#flow-steps.nbfs--step3 { --nbfs-at: .816; }
#flow-steps *, #flow-steps *:hover { cursor: default; text-decoration: none; box-sizing: border-box; }

/* ---- rail -------------------------------------------------------------- */
#flow-steps .nbfs__track,
#flow-steps .nbfs__steps { position: absolute; top: 0; bottom: 0; left: 24px; right: 56px; }
#flow-steps .nbfs__rail,
#flow-steps .nbfs__fill { position: absolute; left: 0; top: 33px; width: 100%; height: 3px; border-radius: 1.5px; }
#flow-steps .nbfs__rail { background: #e2e8f0; }
#flow-steps .nbfs__fill {
  background: linear-gradient(90deg, #0c7cb4, #1B8FE0);
  transform-origin: left center;
  transform: scaleX(var(--nbfs-at));
}
/* the traveller rides on .nbfs__mover (track-wide, so translateX % = track %) */
#flow-steps .nbfs__mover {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  transform: translateX(calc(var(--nbfs-at) * 100%));
  pointer-events: none;
}
#flow-steps i { position: absolute; display: block; font-style: normal; }

/* ---- steps ------------------------------------------------------------- */
#flow-steps .nbfs__steps { list-style: none; margin: 0; padding: 0; }
#flow-steps .nbfs__steps li {
  position: absolute; top: 2px; height: 24px; margin: 0; padding: 0;
  display: flex; align-items: center; white-space: nowrap; list-style: none;
}
#flow-steps .nbfs__steps li:nth-child(1) { left: calc(9.6% - 12px); }
#flow-steps .nbfs__steps li:nth-child(2) { left: calc(45.6% - 12px); }
#flow-steps .nbfs__steps li:nth-child(3) { left: calc(81.6% - 12px); }
#flow-steps .nbfs__stem { position: absolute; left: 11.5px; top: 24px; width: 1px; height: 7px; background: #e2e8f0; }
#flow-steps .nbfs__num {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid #cbd5e1; background: #fff; color: #64748b;
  font-size: 12px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums;
}
#flow-steps .nbfs__lab { margin-left: 8px; font-size: 14px; line-height: 20px; font-weight: 600; color: #64748b; }
#flow-steps li.is-done .nbfs__num { background: #DBEAFE; border-color: #DBEAFE; color: #0c7cb4; }
#flow-steps li.is-done .nbfs__lab { color: #475569; }
#flow-steps li.is-done .nbfs__stem,
#flow-steps li.is-current .nbfs__stem { background: #1B8FE0; }
#flow-steps li.is-current .nbfs__num {
  background: #1B8FE0; border-color: #1B8FE0; color: #fff;
  box-shadow: 0 2px 6px rgba(12, 124, 180, .3);
}
#flow-steps li.is-current .nbfs__lab { color: #0f172a; font-weight: 700; }

/* screen-reader-only words ("Step", "of 3:", "(done)") */
#flow-steps .nbfs__sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- H: the mini name badge (22 x 12, parked on the rail, 3px below the number) */
#flow-steps .nbfs__badge {
  position: absolute; left: -11px; top: 29px; width: 22px; height: 12px;
  border-radius: 3px; background: #EFF6FF; border: 1px solid #0c7cb4;
}
#flow-steps .nbfs__pic  { left: 3px;  top: 2px; width: 6px; height: 6px; border-radius: 1px; background: #1B8FE0; }
#flow-steps .nbfs__l1   { left: 11px; top: 2px; width: 7px; height: 2px; border-radius: 1px; background: #0c7cb4; }
#flow-steps .nbfs__l2   { left: 11px; top: 6px; width: 5px; height: 2px; border-radius: 1px; background: #64748b; }
#flow-steps .nbfs__clip { left: 7px;  top: -3px;  width: 6px; height: 2px; border-radius: 1px; background: #1B8FE0; }

/* ---- I: print carriage + registration mark ----------------------------- */
#flow-steps .nbfs__carr { position: absolute; left: -9px; top: 25px; width: 18px; height: 12px; opacity: 0; }  /* gone at the end */
#flow-steps .nbfs__body { left: 0; top: 0; width: 18px; height: 6px; border-radius: 1.5px; background: #0f172a; }
#flow-steps .nbfs__ins  { left: 4px; top: 2px; width: 10px; height: 2px; background: #64748b; }
#flow-steps .nbfs__noz  {
  left: 6px; top: 6px; width: 0; height: 0;
  border-left: 3px solid transparent; border-right: 3px solid transparent; border-top: 3px solid #0c7cb4;
}
#flow-steps .nbfs__reg {
  left: calc(var(--nbfs-at) * 100% - 5px); top: 32px; width: 10px; height: 5px;
  border-radius: 1px; background: #1B8FE0;
}

/* ---- load animation (once, when the bar is first displayed) ------------- */
/* H: badge + fill travel, overshoot 3px, settle; number lights up on arrival */
@keyframes nbfsH-move {
  0%   { transform: translateX(0); animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
  80%  { transform: translateX(calc(var(--nbfs-at) * 100% + 3px)); animation-timing-function: cubic-bezier(.2, 0, .2, 1); }
  100% { transform: translateX(calc(var(--nbfs-at) * 100%)); }
}
@keyframes nbfsH-fill {
  0%   { transform: scaleX(0); animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
  80%  { transform: scaleX(calc(var(--nbfs-at) + .003)); animation-timing-function: cubic-bezier(.2, 0, .2, 1); }
  100% { transform: scaleX(var(--nbfs-at)); }
}
@keyframes nbfsH-clip { from { background: #0c7cb4; } to { background: #1B8FE0; } }
/* I: one even pass, then the carriage lifts away and the mark appears */
@keyframes nbfsI-move { from { transform: translateX(0); } to { transform: translateX(calc(var(--nbfs-at) * 100%)); } }
@keyframes nbfsI-fill { from { transform: scaleX(0); } to { transform: scaleX(var(--nbfs-at)); } }
@keyframes nbfsI-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes nbfsI-lift { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-3px); } }
@keyframes nbfs-fade { from { opacity: 0; } to { opacity: 1; } }
/* current number: upcoming look until the traveller arrives, small pop, then current */
@keyframes nbfs-light {
  0%   { background: #fff; border-color: #cbd5e1; color: #64748b; box-shadow: none; transform: scale(1); }
  45%  { transform: scale(1.12); }
  100% { background: #1B8FE0; border-color: #1B8FE0; color: #fff; box-shadow: 0 2px 6px rgba(12, 124, 180, .3); transform: scale(1); }
}

@media (prefers-reduced-motion: no-preference) {
  /* H timings: start 80ms; travel+settle 340ms (step 1) / 800ms (step 2+); arrival at 80% */
  #flow-steps.nbfs--H .nbfs__mover { animation: nbfsH-move 340ms linear 80ms both; }
  #flow-steps.nbfs--H .nbfs__fill  { animation: nbfsH-fill 340ms linear 80ms both; }
  #flow-steps.nbfs--H .nbfs__clip  { animation: nbfsH-clip 120ms ease-out 420ms both; }
  #flow-steps.nbfs--H li.is-current .nbfs__num { animation: nbfs-light 220ms ease-out 352ms both; }
  #flow-steps.nbfs--H:not(.nbfs--step1) .nbfs__mover,
  #flow-steps.nbfs--H:not(.nbfs--step1) .nbfs__fill { animation-duration: 800ms; }
  #flow-steps.nbfs--H:not(.nbfs--step1) .nbfs__clip { animation-delay: 880ms; }
  #flow-steps.nbfs--H:not(.nbfs--step1) li.is-current .nbfs__num { animation-delay: 720ms; }

  /* I timings: carriage fades in 100ms; pass 240ms (step 1) / 600ms (step 2+);
     mark + number at arrival; 80ms dwell, 160ms lift */
  #flow-steps.nbfs--I .nbfs__mover { animation: nbfsI-move 240ms cubic-bezier(.45, 0, .2, 1) 100ms both; }
  #flow-steps.nbfs--I .nbfs__fill  { animation: nbfsI-fill 240ms cubic-bezier(.45, 0, .2, 1) 100ms both; }
  #flow-steps.nbfs--I .nbfs__carr  { animation: nbfsI-appear 100ms linear both, nbfsI-lift 160ms cubic-bezier(.4, 0, 1, 1) 420ms forwards; }
  #flow-steps.nbfs--I .nbfs__reg   { animation: nbfs-fade 80ms linear 340ms both; }
  #flow-steps.nbfs--I li.is-current .nbfs__num { animation: nbfs-light 220ms ease-out 340ms both; }
  #flow-steps.nbfs--I:not(.nbfs--step1) .nbfs__mover,
  #flow-steps.nbfs--I:not(.nbfs--step1) .nbfs__fill { animation-duration: 600ms; }
  #flow-steps.nbfs--I:not(.nbfs--step1) .nbfs__carr { animation-delay: 0ms, 780ms; }
  #flow-steps.nbfs--I:not(.nbfs--step1) .nbfs__reg,
  #flow-steps.nbfs--I:not(.nbfs--step1) li.is-current .nbfs__num { animation-delay: 700ms; }
}

/* ---- D / E / F / G: static connected pills (comparison looks) ----------
   Three 320 x 36 pills (in 1080) joined by 54px connectors; current = solid
   site blue + white text, done = soft blue + check, upcoming = white + slate
   border. Positions in % so they follow the container. */
#flow-steps.nbfs--pills .nbfs__steps { left: 0; right: 0; }
#flow-steps.nbfs--pills .nbfs__stem { display: none; }
#flow-steps.nbfs--pills .nbfs__steps li {
  top: 3px; height: 36px; width: 29.6296%; padding: 0 14px 0 12px;
  border: 1px solid #cbd5e1; border-radius: 10px; background: #fff;
}
#flow-steps.nbfs--pills .nbfs__steps li:nth-child(1) { left: .5556%; }
#flow-steps.nbfs--pills .nbfs__steps li:nth-child(2) { left: 35.1852%; }
#flow-steps.nbfs--pills .nbfs__steps li:nth-child(3) { left: 69.8148%; }
#flow-steps.nbfs--pills .nbfs__num { border: 0; background: #f1f5f9; color: #475569; font-size: 13px; box-shadow: none; }
#flow-steps.nbfs--pills .nbfs__lab { margin-left: 12px; font-weight: 700; color: #475569; }
#flow-steps.nbfs--pills .nbfs__chk { margin-left: auto; width: 14px; height: 14px; flex: none; }
#flow-steps.nbfs--pills li.is-done { background: #DBEAFE; border-color: #DBEAFE; }
#flow-steps.nbfs--pills li.is-done .nbfs__num { background: #fff; color: #0c7cb4; }
#flow-steps.nbfs--pills li.is-done .nbfs__lab { color: #0c7cb4; }
#flow-steps.nbfs--pills li.is-current { background: #1B8FE0; border-color: #1B8FE0; box-shadow: 0 2px 6px rgba(12, 124, 180, .28); }
#flow-steps.nbfs--pills li.is-current .nbfs__num { background: #fff; color: #0c7cb4; box-shadow: none; }
#flow-steps.nbfs--pills li.is-current .nbfs__lab { color: #fff; }
#flow-steps .nbfs__con { top: 20px; width: 5%; height: 2px; background: #cbd5e1; }
#flow-steps .nbfs__con--1 { left: 30.1852%; }
#flow-steps .nbfs__con--2 { left: 64.8148%; }
#flow-steps .nbfs__con.is-on { background: #1B8FE0; }
/* E: gradient current step */
#flow-steps.nbfs--E li.is-current { background: linear-gradient(100deg, #1B8FE0 0%, #0c7cb4 100%); }
/* F: full-width slate band behind the bar (box-shadow, so no page overflow) */
#flow-steps.nbfs--F { overflow: visible; background: #f1f5f9; box-shadow: 0 0 0 100vmax #f1f5f9; clip-path: inset(0 -100vmax); }
/* G: inside a white card like the v2 cart cards */
#flow-steps.nbfs--G { background: #fff; border-radius: 12px; box-shadow: inset 0 0 0 1px #e2e8f0, 0 2px 8px rgba(15, 23, 42, .08); }
#flow-steps.nbfs--G .nbfs__steps li { top: 5px; height: 32px; border-radius: 8px; }
#flow-steps.nbfs--G .nbfs__con { top: 20px; }
@keyframes nbfs-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  #flow-steps.nbfs--pills .nbfs__steps li { animation: nbfs-in 280ms cubic-bezier(.22, 1, .36, 1) both; }
  #flow-steps.nbfs--pills .nbfs__steps li:nth-child(2) { animation-delay: 60ms; }
  #flow-steps.nbfs--pills .nbfs__steps li:nth-child(3) { animation-delay: 120ms; }
  #flow-steps.nbfs--pills .nbfs__con { animation: nbfs-fade 220ms cubic-bezier(.22, 1, .36, 1) 80ms both; }
  #flow-steps.nbfs--E .nbfs__steps li { animation-name: nbfs-fade; animation-duration: 320ms; }
  #flow-steps.nbfs--G .nbfs__steps li { animation-name: nbfs-fade; }
}

/* ---- 4 steps (?steps=4): 1 Design · 2 Review · 3 Add names · 4 Checkout ----
   Node centres at 9.6 / 35.2 / 60.8 / 86.4% of the track (= x 120 / 376 /
   632 / 888 of 1080). Pills: four 240 x 36 joined by 36px connectors. */
#flow-steps.nbfs--n4.nbfs--step1 { --nbfs-at: .096; }
#flow-steps.nbfs--n4.nbfs--step2 { --nbfs-at: .352; }
#flow-steps.nbfs--n4.nbfs--step3 { --nbfs-at: .608; }
#flow-steps.nbfs--n4.nbfs--step4 { --nbfs-at: .864; }
#flow-steps.nbfs--n4 .nbfs__steps li:nth-child(1) { left: calc(9.6% - 12px); }
#flow-steps.nbfs--n4 .nbfs__steps li:nth-child(2) { left: calc(35.2% - 12px); }
#flow-steps.nbfs--n4 .nbfs__steps li:nth-child(3) { left: calc(60.8% - 12px); }
#flow-steps.nbfs--n4 .nbfs__steps li:nth-child(4) { left: calc(86.4% - 12px); }
#flow-steps.nbfs--n4.nbfs--pills .nbfs__steps li { width: 22.2222%; }
#flow-steps.nbfs--n4.nbfs--pills .nbfs__steps li:nth-child(1) { left: .5556%; }
#flow-steps.nbfs--n4.nbfs--pills .nbfs__steps li:nth-child(2) { left: 26.1111%; }
#flow-steps.nbfs--n4.nbfs--pills .nbfs__steps li:nth-child(3) { left: 51.6667%; }
#flow-steps.nbfs--n4.nbfs--pills .nbfs__steps li:nth-child(4) { left: 77.2222%; }
#flow-steps.nbfs--n4 .nbfs__con { width: 3.3333%; }
#flow-steps.nbfs--n4 .nbfs__con--1 { left: 22.7778%; }
#flow-steps.nbfs--n4 .nbfs__con--2 { left: 48.3333%; }
#flow-steps.nbfs--n4 .nbfs__con--3 { left: 73.8889%; }
@media (prefers-reduced-motion: no-preference) {
  #flow-steps.nbfs--n4.nbfs--pills .nbfs__steps li:nth-child(4) { animation-delay: 180ms; }
}

/* NEXT-NUDGE START ---------------------------------------------------------
   4 steps, back on populate after names (.nbfs--next; Daniel Oct 31): after the
   print-head pass a short rail segment grows from Add names to halfway toward
   the last step (blue fading to the site green #22C55E, the Add Text green),
   and the last marker gets a steady faint green ring: RING ONLY, no fill, NO
   PULSE, shown from the first frame; number + label keep the normal upcoming
   colours. No hint text.
   Must not read as a button (Daniel: "looks almost like a button"; Astra: keep
   it passive, drop the pulses): no filled shape, no label colour change, no
   repeating animation, no hover, default cursor.
   Reduced motion = this static end state.
   The nudge colours live between START and END (tests check). */
#flow-steps.nbfs--next { --nbfs-half: .736; overflow: visible; }
#flow-steps.nbfs--next .nbfs__half {
  left: calc(var(--nbfs-at) * 100%); top: 33px;
  width: calc((var(--nbfs-half) - var(--nbfs-at)) * 100%); height: 3px;
  border-radius: 0 1.5px 1.5px 0;
  background: linear-gradient(90deg, #1B8FE0, #22C55E);
  transform-origin: left center;
}
#flow-steps.nbfs--next .nbfs__steps li:nth-child(4) .nbfs__num {
  border-color: rgba(34, 197, 94, .6);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}
/* pills: third connector half blue-to-green, last pill gets the same faint ring */
#flow-steps.nbfs--next.nbfs--pills .nbfs__con--3 { background: linear-gradient(90deg, #1B8FE0 0%, #22C55E 50%, #cbd5e1 50%); }
#flow-steps.nbfs--next.nbfs--pills .nbfs__steps li:nth-child(4) { border-color: rgba(34, 197, 94, .6); box-shadow: 0 0 0 3px rgba(34, 197, 94, .16); }
#flow-steps.nbfs--next.nbfs--pills .nbfs__steps li:nth-child(4) .nbfs__num { border-color: transparent; box-shadow: none; }

@keyframes nbfs-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: no-preference) {
  /* the segment grows after the pass (I lifts at ~940ms, H settles at ~880ms); the ring is static */
  #flow-steps.nbfs--next .nbfs__half { animation: nbfs-grow 520ms cubic-bezier(.22, 1, .36, 1) 960ms both; }
  /* return visit: Add names is already current, so it stays solid blue from the first frame
     (no "lights up on arrival"; Astra Oct 31) */
  #flow-steps.nbfs--n4.nbfs--next li.is-current .nbfs__num { animation: none; }
}
/* NEXT-NUDGE END */

/* ---- per-page alignment (v2 only: this file loads only with the bar) -----
   Target: bar top = fixed header bottom + 16px, the same on every page
   (header 98px at >=768 -> bar top 114px; body padding-top is 100px).
   The pages' own wrappers put the bar at different, breakpoint-dependent
   heights (populate: application.css margin 0 at >=1300, 60px <=1299,
   20px <=991, plus 25px/5px padding; names: mt-6; /badges: pt-4 lg:py-8),
   so a fixed pull cannot work (Oct 31: -53px hid the bar under the header
   at >=1300 and <=991). Instead, the wrapper ABOVE the bar loses its top
   spacing when it holds the bar (:has), and the bar adds one uniform 14px.
   Browsers without :has() simply keep the page's spacing + 14px: the bar
   sits lower, never under the header. */
@media screen and (min-width: 576px) {
  #flow-steps { margin-top: 14px; }
  /* /badges: the container around #designTool (pt-4 lg:py-8) */
  .toolmain .container:has(> #designTool #flow-steps) { padding-top: 0; }
  /* populate + populate_lock: .inner-pages.mrg-top-none (margin 0/60/20 + padding 25/5) */
  .populate-page .inner-pages.no_border.mrg-top-none:has(.nbfs-slot--populate #flow-steps) { margin-top: 0; padding-top: 0; }
  /* names: .inner-pages.mt-6 */
  .names-pages .inner-pages.no_border:has(.nbfs-slot--names #flow-steps) { margin-top: 0; padding-top: 0; }
}

/* populate + names: the bar spans the full content width, as on /badges (r8h, Nov 1). The r8h rule lives in
   badges-v2.css, which only /badges loads, so on these pages the bar stopped 100px short of the right edge at >=1180px
   containers. Same rule here (this file is loaded by the step bar itself). */
@media screen and (min-width: 1024px) {
  .populate-page #flow-steps, .names-pages #flow-steps { max-width: none; }
}

/* ---- phones ------------------------------------------------------------- */
@media screen and (max-width: 575px) {
  #flow-steps { display: none; }                           /* hidden on phones for now (Daniel) */
  #flow-steps.nbfs--phone { display: block; margin: 8px 0 12px; }
  #flow-steps.nbfs--phone .nbfs__track,
  #flow-steps.nbfs--phone .nbfs__steps { left: 4px; right: 4px; }
  #flow-steps.nbfs--phone .nbfs__lab { font-size: 12px; margin-left: 5px; }
}
