.model-flow { --flow-bright: var(--mint); width: 100%; display: flex; flex-direction: column; padding: 4px 0 18px; color: var(--light-surface); }
.flow-step { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0 16px; }
.flow-step + .flow-step { border-top: 1px solid color-mix(in srgb, var(--mint) 35%, transparent); }
.flow-title { align-self: flex-start; display: flex; align-items: baseline; gap: 10px; margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; }
.flow-title span { font: 500 12px var(--font-mono); letter-spacing: .06em; color: var(--mint); }
.flow-item { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 64px; font-size: 13px; line-height: 1.3; }
.flow-item text { stroke: none; }
.flow-item .flow-tag { font: 600 8px ui-monospace, SFMono-Regular, Consolas, monospace; }
.flow-arrow { flex: 0 1 52px; min-width: 28px; height: 12px; margin-top: 14px; stroke: var(--mint); stroke-width: 1.4; }
.flow-note { margin: 0; font-size: 12px; color: var(--mint); text-align: center; }
@container (max-width: 380px) { .flow-row { gap: 8px; } .flow-item { min-width: 52px; } }
/* Static markup is the complete reduced-motion fallback. */
.flow-stage { position: relative; }
.model-flow--motion { --flow-cycle: 9s; }
.model-flow--motion svg, .flow-playback svg { pointer-events: none; }
.model-flow--motion .flow-title { padding-right: 34px; }
.model-flow .flow-row { display: grid; justify-content: center; grid-template-columns: 72px minmax(24px, 64px) 72px; gap: 12px; width: min(100%, 264px); align-items: start; }
.model-flow .flow-request .flow-row { grid-template-columns: 72px minmax(16px, 1fr) 72px minmax(16px, 1fr) 72px; width: min(100%, 372px); }
.model-flow .flow-item { min-width: 0; gap: 6px; }
.model-flow .mf-art { display: block; width: 68px; height: 56px; stroke: var(--flow-bright); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.model-flow .mf-shell { fill: color-mix(in srgb, var(--mint) 8%, transparent); stroke: color-mix(in srgb, var(--mint) 70%, transparent); }
.model-flow .mf-outline { stroke: color-mix(in srgb, var(--mint) 38%, transparent); }
.model-flow .mf-dots { fill: var(--mint); stroke: none; opacity: .6; }
.model-flow .mf-braces { stroke: var(--light-surface); stroke-width: 1.4; }
.model-flow .mf-grid { fill: color-mix(in srgb, var(--mint) 30%, transparent); stroke-width: .7; }
.model-flow .mf-grid:nth-of-type(2) { fill: color-mix(in srgb, var(--mint) 55%, transparent); }
.model-flow .mf-fx { font: italic 500 13px Georgia, serif; fill: var(--mint); }
.model-flow .flow-tag { font-size: 7px; fill: var(--mint); }
.model-flow .mf-line { stroke-width: 2; transform-box: fill-box; transform-origin: left; }
.model-flow .mf-badge { fill: var(--light-action); stroke: var(--mint); }
.model-flow .mf-tick { stroke: var(--light-surface); stroke-width: 1.5; }
.model-flow .mf-model { stroke-width: .85; }
.model-flow .mf-link { width: 100%; min-width: 0; margin-top: 22px; stroke-width: 1.2; overflow: visible; }
.model-flow .mf-track { opacity: .4; }
.model-flow .mf-packet { opacity: 0; stroke: var(--light-surface); stroke-width: 2; stroke-dasharray: 12 80; stroke-linecap: round; }

/* One repeating nine-second clock: setup 0–3.2s, request 3.2–9s. */
.is-animated .mf-upload .mf-detail { animation: mf-upload-draw var(--flow-cycle) ease infinite both; animation-delay: calc(var(--part) * .15s); }
.is-animated .mf-upload-link .mf-packet { animation: mf-upload-travel var(--flow-cycle) ease-in-out infinite both; }
.is-animated .mf-stored .mf-shell { animation: mf-store var(--flow-cycle) ease infinite both; }
.is-animated .mf-stored .mf-confirm { animation: mf-confirm var(--flow-cycle) ease infinite both; transform-origin: 58px 48px; }
.is-animated .mf-engine .mf-model { animation: mf-model-ready var(--flow-cycle) ease infinite both; transform-origin: 58px 48px; }
.is-animated .mf-input .mf-line { animation: mf-input-draw var(--flow-cycle) ease-in-out infinite both; animation-delay: calc(var(--part) * .12s); }
.is-animated .mf-input .mf-shell { animation: mf-input-focus var(--flow-cycle) ease-in-out infinite both; }
.is-animated .mf-input .mf-art { animation: mf-input-lift var(--flow-cycle) ease-in-out infinite both; }
.is-animated .mf-input-link .mf-packet { animation: mf-request-travel var(--flow-cycle) ease-in-out infinite both; }
.is-animated .mf-engine .mf-shell { animation: mf-engine-focus var(--flow-cycle) ease-in-out infinite both; }
.is-animated .mf-engine .mf-braces { animation: mf-compute var(--flow-cycle) ease-in-out infinite both; }
.is-animated .mf-output-link .mf-packet { animation: mf-result-travel var(--flow-cycle) ease-in-out infinite both; }
.is-animated .mf-output .mf-line { animation: mf-output-draw var(--flow-cycle) ease-in-out infinite both; animation-delay: calc(var(--part) * .12s); }
.is-animated .mf-output .mf-shell { animation: mf-output-focus var(--flow-cycle) ease-in-out infinite both; }
.is-animated .mf-output .mf-art { animation: mf-output-lift var(--flow-cycle) ease-in-out infinite both; }
.is-animated .mf-output .mf-confirm { animation: mf-result-confirm var(--flow-cycle) ease-in-out infinite both; transform-origin: 56px 48px; }

.flow-playback { position: absolute; z-index: 1; top: 4px; right: -7px; display: grid; place-items: center; min-height: 36px; width: 36px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--mint); box-shadow: none; cursor: pointer; }
.flow-playback[hidden] { display: none; }
.flow-playback svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.3; fill: none; }
.flow-playback .flow-play-icon { display: none; }
.flow-playback[data-paused="true"] .flow-play-icon { display: block; }
.flow-playback[data-paused="true"] .flow-pause-icon { display: none; }
.flow-playback:hover, .flow-playback:active { color: var(--light-surface); background: color-mix(in srgb, var(--mint) 10%, transparent); box-shadow: none; translate: none; }
.flow-playback:focus:not(:focus-visible) { outline: none; }
.flow-playback:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }

@keyframes mf-upload-draw { 0%, 2.2%, 100% { opacity: 0; transform: translateY(3px); } 9.4%, 99.99% { opacity: 1; transform: none; } }
@keyframes mf-upload-travel { 0%, 9.4% { opacity: 0; stroke-dashoffset: 15; } 11.4%, 19.7% { opacity: 1; } 22.2%, 100% { opacity: 0; stroke-dashoffset: -64; } }
@keyframes mf-store { 0%, 18.3%, 100% { stroke: color-mix(in srgb, var(--mint) 58%, transparent); fill: color-mix(in srgb, var(--mint) 8%, transparent); } 22.8%, 99.99% { stroke: var(--mint); fill: color-mix(in srgb, var(--mint) 14%, transparent); } }
@keyframes mf-confirm { 0%, 25.6%, 100% { opacity: 0; transform: scale(.75); } 31.1%, 99.99% { opacity: 1; transform: scale(1); } }
/* The stored-model badge belongs to phase 2: reveal it as the inputs reach API. */
@keyframes mf-model-ready { 0%, 56%, 100% { opacity: 0; transform: scale(.75); } 62%, 99.99% { opacity: 1; transform: scale(1); } }
@keyframes mf-input-draw { 0%, 35.6%, 92.3%, 100% { opacity: .15; transform: scaleX(.2); } 43.3%, 85.8% { opacity: 1; transform: scaleX(1); } }
@keyframes mf-input-focus { 0%, 35.6%, 58.1%, 100% { stroke: color-mix(in srgb, var(--mint) 58%, transparent); fill: color-mix(in srgb, var(--mint) 8%, transparent); } 41.4%, 51% { stroke: var(--mint); fill: color-mix(in srgb, var(--mint) 15%, transparent); } }
@keyframes mf-request-travel { 0%, 44.6% { opacity: 0; stroke-dashoffset: 15; } 47.2%, 54.9% { opacity: 1; } 58.1%, 100% { opacity: 0; stroke-dashoffset: -64; } }
@keyframes mf-engine-focus { 0%, 52.3%, 74.2%, 100% { stroke: color-mix(in srgb, var(--mint) 58%, transparent); fill: color-mix(in srgb, var(--mint) 8%, transparent); } 57.5%, 67.1% { stroke: var(--mint); fill: color-mix(in srgb, var(--mint) 19%, transparent); } }
@keyframes mf-compute { 0%, 52.3%, 72.3%, 100% { opacity: .65; } 57.5%, 66.5% { opacity: 1; } 62% { opacity: .4; } }
@keyframes mf-result-travel { 0%, 64.6% { opacity: 0; stroke-dashoffset: 15; } 67.1%, 74.9% { opacity: 1; } 78.1%, 100% { opacity: 0; stroke-dashoffset: -64; } }
@keyframes mf-output-draw { 0%, 72.3%, 96.1%, 100% { opacity: .15; transform: scaleX(.2); } 80%, 89.7% { opacity: 1; transform: scaleX(1); } }
@keyframes mf-output-focus { 0%, 71.6%, 98.1%, 100% { stroke: color-mix(in srgb, var(--mint) 58%, transparent); fill: color-mix(in srgb, var(--mint) 8%, transparent); } 78.1%, 90.3% { stroke: var(--mint); fill: color-mix(in srgb, var(--mint) 15%, transparent); } }
@keyframes mf-result-confirm { 0%, 80%, 98.7%, 100% { opacity: 0; transform: scale(.75); } 84.5%, 92.3% { opacity: 1; transform: scale(1); } }
@keyframes mf-input-lift { 0%, 35.6%, 58.1%, 100% { transform: translateY(0); } 41.4%, 51% { transform: translateY(-3px); } }
@keyframes mf-output-lift { 0%, 71.6%, 98.1%, 100% { transform: translateY(0); } 78.1%, 90.3% { transform: translateY(-3px); } }

@container (max-width: 340px) {
  .model-flow .flow-row { gap: 8px; }
  .model-flow .flow-request .flow-row { grid-template-columns: 56px minmax(12px, 1fr) 56px minmax(12px, 1fr) 56px; }
  .model-flow .mf-art { width: 56px; }
}
@media (pointer: coarse) { .flow-playback { width: 44px; min-height: 44px; top: 0; right: -10px; } }
@media (prefers-reduced-motion: reduce) {
  .model-flow--motion * { animation: none !important; }
  .flow-playback { display: none; }
}

/* The use-case pages load this component without the home page's layout. */
.flow-stage--planned { container-type: inline-size; max-width: 680px; margin: 24px 0; padding: 12px 24px 8px; border-radius: 6px; background: linear-gradient(180deg, color-mix(in srgb, var(--light-action) 75%, var(--light-dark)), var(--light-dark) 55%, var(--dark-canvas)); color: var(--light-surface); }
.flow-stage--planned .flow-playback { top: 12px; right: 12px; }
.flow-planned { display: inline-block; border: 1px solid color-mix(in srgb, var(--mint) 45%, transparent); border-radius: 3px; padding: 2px 7px; color: var(--mint); font: 500 11px/1.5 var(--font-mono); }
.model-flow--planned { --flow-cycle: 12s; width: 100%; display: flex; flex-direction: column; padding: 4px 0 8px; color: var(--light-surface); }
.model-flow--planned .flow-step { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px 0 18px; }
.model-flow--planned .flow-step + .flow-step { border-top: 1px solid color-mix(in srgb, var(--mint) 35%, transparent); }
.model-flow--planned .flow-title { align-self: flex-start; display: flex; align-items: baseline; gap: 10px; margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; color: var(--light-surface); }
.model-flow--planned .flow-title span { font: 500 12px var(--font-mono); letter-spacing: .06em; color: var(--mint); }
.model-flow--planned .flow-row { justify-content: center; grid-template-columns: 96px minmax(24px, 64px) 96px; width: min(100%, 320px); }
.model-flow--planned .flow-step .flow-row--three { grid-template-columns: 86px minmax(12px, 1fr) 86px minmax(12px, 1fr) 86px; width: min(100%, 430px); }
.model-flow--planned .flow-item { position: relative; display: flex; flex-direction: column; align-items: center; font-size: 13px; line-height: 1.3; text-align: center; }
.model-flow--planned .mf-art { width: 78px; height: 60px; }
.model-flow--planned .mf-art text { fill: var(--mint); stroke: none; }
.model-flow--planned .flow-arrow { height: 12px; stroke: var(--mint); }
.model-flow--planned .flow-note { margin: 0; font-size: 12px; line-height: 1.6; color: var(--mint); text-align: center; }
.model-flow--planned .mf-answer { position: absolute; top: 29px; left: 0; right: 0; color: var(--light-surface); font: 600 12px/1.3 var(--font-mono); transform-origin: center; }
.is-animated .mf-setup-choice .mf-shell { animation: mf-setup-choice var(--flow-cycle) ease infinite both; }
.is-animated .mf-setup-link .mf-packet { animation: mf-setup-travel var(--flow-cycle) ease-in-out infinite both; }
.is-animated .mf-answer { animation: mf-result-confirm var(--flow-cycle) ease infinite both; }
@keyframes mf-setup-choice { 0%, 10%, 31%, 100% { fill: color-mix(in srgb, var(--mint) 8%, transparent); } 16%, 24% { fill: color-mix(in srgb, var(--mint) 24%, transparent); } }
@keyframes mf-setup-travel { 0%, 20% { opacity: 0; stroke-dashoffset: 15; } 23%, 28% { opacity: 1; } 31%, 100% { opacity: 0; stroke-dashoffset: -64; } }
@container (max-width: 340px) {
  .model-flow--planned .flow-step .flow-row--three { grid-template-columns: 80px minmax(8px, 1fr) 80px minmax(8px, 1fr) 80px; gap: 6px; }
  .model-flow--planned .flow-request .flow-row--three { grid-template-columns: 72px minmax(12px, 1fr) 72px minmax(12px, 1fr) 72px; }
  .model-flow--planned .flow-request .mf-art { width: 72px; }
  .model-flow--planned .flow-request .flow-arrow path { vector-effect: non-scaling-stroke; }
}
@media (max-width: 480px) { .flow-stage--planned { padding-left: 16px; padding-right: 16px; } }

/* Bands reuse the step-02 art; their container decides the reading direction. */
.flow-band .model-flow { padding: 0; min-height: 112px; justify-content: center; }
.flow-band .flow-request .flow-row { display: grid; grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr) 12px minmax(0, 1fr); gap: 4px; width: 100%; }
.flow-band .flow-item { position: relative; min-width: 0; font-size: 12px; text-align: center; overflow-wrap: anywhere; }
.flow-band .model-flow .mf-art { width: 64px; height: 56px; }
.flow-band .mf-answer { top: 27px; font-size: 10px; }
.flow-band .flow-arrow { min-width: 0; }
.flow-band .flow-arrow path { vector-effect: non-scaling-stroke; }
@container (max-width: 240px) {
  .flow-band .model-flow { min-height: 292px; }
  .flow-band .flow-request .flow-row { grid-template-columns: 1fr; justify-items: center; gap: 6px; }
  .flow-band .flow-item { width: 100%; }
  .flow-band .flow-arrow { width: 22px; height: 12px; margin: 0; transform: rotate(90deg); }
}
