/* ---- case study flowcharts (.flowd, assets/flowd.js) ----
   A static swimlane built by flowd.js from the hidden .fd-stage markup
   (picked 2026-10-15), with a compact numbered key under it. Every step
   shows at once; the only motion is a one-off fade on first view. */
/* .wrap.fdw keeps the standard page width (1240px) like every other case study section - James 2026-10-12 */
#site .fdhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 18px 40px; margin: 0 0 26px; }
#site .fdhead h2 { margin: 0; }
#site .fdhead p { margin: 8px 0 0; max-width: 60ch; color: var(--k-mu); font-size: 15.5px; line-height: 1.6; }
#site .fd-key { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: #42536E; }
#site .fd-key li { display: flex; align-items: center; gap: 8px; }
#site .fd-key li::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--kc); }
/* the step colours, shared with the key, which sits outside the chart */
#site .flowd, #site .fd-key { --k-ai: #2C5FD8; --k-code: #7C8BA3; --k-person: #5E9C37; --k-shop: #0B1B33; --k-data: #1F9A8A; }
/* the figure: a hairline box with crosshair corners, like the rest of the case study body */
#site .flowd { position: relative; margin: 0; padding: clamp(18px, 2.6vw, 36px); background: rgba(255,255,255,.6); border: 1px solid var(--k-line); }
#site .flowd::before, #site .flowd::after { content: ""; position: absolute; z-index: 1; width: 13px; height: 13px; background: var(--cs-cross); opacity: .55; pointer-events: none; }
#site .flowd::before { top: -7px; left: -7px; }
#site .flowd::after { bottom: -7px; right: -7px; }
#site .flowd.fd-built .fd-stage, #site .flowd.fd-built .fd-cap, #site .flowd .fd-svg { display: none; }
/* without the script: the steps as a plain list */
#site .fd-stage { display: grid; gap: 10px; }
#site .fd-band, #site .fd-lane { display: none; }
#site .fd-n { order: var(--s); padding: 10px 14px; border: 1px solid var(--k-line); }
#site .fd-n b { display: block; font-size: 14.5px; color: var(--nvy); }
#site .fd-n span { display: block; font-size: 13.5px; color: var(--k-mu); }

/* kind colour on anything that carries data-k */
#site .flowd [data-k="ai"] { --kc: var(--k-ai); }
#site .flowd [data-k="code"] { --kc: var(--k-code); }
#site .flowd [data-k="person"] { --kc: var(--k-person); }
#site .flowd [data-k="shop"] { --kc: var(--k-shop); }
#site .flowd [data-k="data"] { --kc: var(--k-data); }

/* shared text: title, short line, description, who, jump notes */
#site .flowd .fdv h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; color: var(--nvy); }
#site .flowd .fx-s { margin: 3px 0 0; font-size: 13.5px; font-weight: 500; line-height: 1.45; color: #42536E; }
#site .flowd .fx-d { margin: 10px 0 0; font-size: 14px; line-height: 1.6; color: var(--k-mu); }
#site .flowd .fx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 8px; font-size: 13px; color: #55657D; }
#site .flowd .fx-who { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: #42536E; }
#site .flowd .fx-who > i { display: grid; place-items: center; flex: none; width: 9px; height: 9px; border-radius: 2px; background: var(--kc); color: var(--kc); }
#site .flowd .fx-who svg { width: 13px; height: 13px; }
#site .flowd .fx-jump { display: flex; width: fit-content; align-items: center; gap: 7px; margin: 10px 0 0; font-size: 13px; font-weight: 600; color: var(--cb); }
#site .flowd .fx-jump::before { content: ""; width: 14px; height: 14px; flex: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8h10M9 4.5L12.5 8 9 11.5' fill='none' stroke='%232C5FD8' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
#site .flowd .fx-jump.back::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M12.5 6.5A5 5 0 1 0 13 9.5M12.8 2.8v3.9H8.9' fill='none' stroke='%232C5FD8' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
/* the numbered square used by the swimlane */
#site .flowd .fsl-sq { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 3px; background: var(--kc); font: 600 13px/1 'JetBrains Mono', monospace; color: #fff; }
/* lines drawn by the script */
#site .flowd svg .ln { fill: none; stroke: #8C99AD; stroke-width: 1.5; stroke-linejoin: round; }
#site .flowd svg .ln.dash { stroke: var(--cb); stroke-dasharray: 4 4; }
#site .flowd svg .mk path { stroke: #8C99AD; }
#site .flowd svg .mk.dash path { stroke: var(--cb); }

/* the one-off reveal: the whole chart fades in once and the lines draw.
   Kept to a single fade on purpose - the figure used to slide in (.rv) while
   every step faded separately, and that stack of animations on one big
   layer let Chrome drop a tile of the chart while scrolling (James 2026-10-15). */
#site .flowd.fd-pre:not(.fd-go) .fdv { opacity: 0; }
#site .flowd.fd-go:not(.fd-done) .fdv { animation: fdfade .7s ease both; }
#site .flowd.fd-go:not(.fd-done) .fsl-svg .ln:not(.dash) { stroke-dasharray: 1; animation: fddraw 1.1s cubic-bezier(.4,0,.2,1) .2s both; }
@keyframes fdfade { from { opacity: 0; } }
@keyframes fddraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* ===== A: Swimlane ===== */
#site .fsl-dia { position: relative; display: grid; grid-template-columns: 148px repeat(var(--C), minmax(0, 1fr)); grid-template-rows: repeat(var(--L), auto); }
#site .fsl-dia.has-top { padding-top: 34px; }
#site .fsl-dia.has-bot { padding-bottom: 40px; }
#site .fsl-rule { grid-column: 1 / -1; border-top: 1px solid var(--k-line); }
#site .fsl-rule:last-of-type { border-bottom: 1px solid var(--k-line); }
#site .fsl-ln { grid-column: 1; display: flex; align-items: center; gap: 10px; margin: 0; padding: 0 14px 0 0; font-size: 13.5px; font-weight: 600; line-height: 1.3; color: var(--nvy); }
#site .fsl-ln i { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 3px; border: 1px solid var(--k-line); background: #fff; color: var(--kc); }
#site .fsl-ln svg { width: 14px; height: 14px; }
#site .fsl-n { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; padding: 18px 4px 16px; text-align: center; }
#site .fsl-n b { display: block; margin-top: 9px; max-width: 120px; font-size: 13.5px; font-weight: 600; line-height: 1.3; color: var(--nvy); }
#site .fsl-svg, #site .fsl-svg2 { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
#site .fsl-tag { position: absolute; z-index: 2; transform: translate(-50%, -50%); padding: 0 8px; background: #fff; font-size: 12.5px; font-weight: 600; line-height: 18px; color: var(--cb); white-space: nowrap; }
#site .fsl-lk { display: none; margin: 0 0 14px; font-size: 13px; color: #55657D; }
#site .fsl-wrap { position: relative; margin-top: 22px; }
/* the key: number, title and short line only, in tight columns */
#site .fsl-notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(24px, 3vw, 44px); margin: 0; padding: 0; list-style: none; }
#site .fsl-note { min-width: 0; padding: 11px 0 12px; border-top: 1px solid var(--k-line); }
#site .fsl-tx { display: flex; align-items: baseline; gap: 12px; }
#site .flowd .fsl-tx h3 { font-size: 14.5px; }
#site .flowd .fsl-tx .fx-s { margin-top: 2px; font-size: 13px; font-weight: 400; color: #55657D; }
#site .fsl-no { display: inline-flex; align-items: center; gap: 7px; flex: none; font: 600 13px/1 'JetBrains Mono', monospace; color: var(--nvy); }
#site .fsl-no::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--kc); }
#site .fsl-strip { display: none; }
@media (max-width: 1240px) {
  #site .fsl-dia { grid-template-columns: 124px repeat(var(--C), minmax(0, 1fr)); }
  #site .fsl-n b { font-size: 13px; }
}
/* below 1024px: no diagram, the notes become one list with a lane strip */
@media (max-width: 1023px) {
  #site .fsl-dia { display: none; }
  #site .fsl-lk { display: block; }
  #site .fsl-wrap { margin-top: 0; }
  #site .fsl-notes { grid-template-columns: minmax(0, 1fr); gap: 0; padding-left: 14px; }
  #site .fsl-note { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 18px; padding: 12px 0 14px; }
  #site .fsl-note:first-child { border-top: 0; padding-top: 4px; }
  #site .fsl-strip { display: grid; grid-template-columns: repeat(var(--L), 26px); align-self: start; }
  #site .fsl-strip i { display: grid; justify-items: center; }
  #site .fsl-strip .fsl-sq { width: 24px; height: 24px; font-size: 12.5px; }
  #site .fsl-no { display: none; }
}
@media (max-width: 560px) {
  #site .fsl-notes { padding-left: 12px; }
  #site .fsl-note { column-gap: 12px; }
  #site .fsl-strip { grid-template-columns: repeat(var(--L), 21px); }
  #site .fsl-strip .fsl-sq { width: 21px; height: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  #site .flowd .fdv *, #site .flowd svg { animation: none !important; }
}
