/* The request-path figure (`AiFlowDiagram`): one governed call drawn as
   a line with four stations. Linked by the component itself. Colours
   and faces come from the luxury tokens, so the light theme follows. */

.fp {
  --fp-ink: var(--color-slate-100);
  --fp-quiet: var(--color-slate-500);
  --fp-rule: var(--luxury-rule);
  --fp-accent: var(--luxury-link);
}
html:not(.dark) .fp {
  --fp-accent: var(--color-accent);
  --fp-rule: #c9d6d0;
}

/* Two drawings, one shown. Motion runs only while the figure carries
   `fp-live`, which the component's script sets while it is on screen. */
.fp-plate { position: relative; }
.fp .fp-plate-wide { display: block; }
.fp .fp-plate-tall { display: none; }
.fp-drawing { display: block; width: 100%; height: auto; overflow: visible; }
@media (max-width: 899px) {
  .fp .fp-plate-wide { display: none; }
  .fp .fp-plate-tall { display: block; max-width: 400px; margin: 0 auto; }
}

/* Lines. Everything structural is a hairline. Only the thread a call
   follows and the edge it crosses are set in the accent. */
.fp-rule { stroke: var(--fp-rule); stroke-width: 1; }
.fp-leader { stroke: var(--fp-rule); stroke-width: 1; stroke-dasharray: 1 4; stroke-linecap: round; }
.fp-ring { stroke: var(--fp-rule); stroke-width: 1; }
.fp-thread { stroke: var(--fp-accent); stroke-width: 1.25; stroke-opacity: 0.55; stroke-linejoin: round; }
.fp-gate { stroke: var(--fp-accent); stroke-width: 1.25; stroke-linecap: square; }
.fp-node { stroke: var(--fp-ink); stroke-width: 1.25; fill: var(--color-surface); }
.fp-stop { stroke: var(--fp-quiet); stroke-width: 1; fill: var(--color-surface); }
.fp-stop-on { stroke: var(--fp-accent); }
.fp-core { fill: var(--fp-accent); }
.fp-glow-in { stop-color: var(--fp-accent); stop-opacity: 0.13; }
.fp-glow-out { stop-color: var(--fp-accent); stop-opacity: 0; }

/* Type: serif for the things, mono for their particulars. */
.fp-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; fill: var(--fp-ink); letter-spacing: -0.005em; }
.fp-provider { font-family: var(--font-display); font-weight: 500; font-size: 16px; fill: var(--fp-ink); }
.fp-spec { font-family: var(--font-mono); font-size: 10.5px; fill: var(--fp-quiet); letter-spacing: 0.02em; }
.fp-spec-accent { fill: var(--fp-accent); }
.fp-index { font-family: var(--font-mono); font-size: 10px; fill: var(--fp-quiet); letter-spacing: 0.14em; font-variant-numeric: tabular-nums; }
.fp-bezel { font-family: var(--font-mono); font-size: 8.5px; font-weight: 500; fill: var(--color-slate-400); letter-spacing: 0.24em; }

/* A small light travels the path a call takes, to the first provider
   and then to the second. Each light is a box laid over the drawing and
   moved by `transform` in units of the drawing's width (`cqw`), so the
   compositor runs it. Where those units are missing the lights stay
   hidden and the thread alone shows the path. */
.fp-plate { container-type: inline-size; }
.fp-bead {
  position: absolute;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--fp-accent);
  box-shadow: 0 0 9px 1px var(--fp-accent);
  opacity: 0;
  pointer-events: none;
}
.fp-live .fp-bead { will-change: transform, opacity; }
@supports (width: 1cqw) {
  .fp-live .fp-plate-wide .fp-bead-a { animation: fp-bead-wide-a 11s linear infinite; }
  .fp-live .fp-plate-wide .fp-bead-b { animation: fp-bead-wide-b 11s linear 5.5s infinite; }
  .fp-live .fp-plate-tall .fp-bead-a { animation: fp-bead-tall-a 11s linear infinite; }
  .fp-live .fp-plate-tall .fp-bead-b { animation: fp-bead-tall-b 11s linear 5.5s infinite; }
}
/* Wide drawing: one unit is 0.1cqw. Along the axis, up the bus, out
   the tap. The stops are placed by distance so the speed is even. */
@keyframes fp-bead-wide-a {
  0% { transform: translate(0, 0); opacity: 0; }
  2% { opacity: 1; }
  35.2% { transform: translate(73.5cqw, 0); }
  39% { transform: translate(73.5cqw, -8cqw); opacity: 1; }
  40%, 100% { transform: translate(75.5cqw, -8cqw); opacity: 0; }
}
@keyframes fp-bead-wide-b {
  0% { transform: translate(0, 0); opacity: 0; }
  2% { opacity: 1; }
  36.9% { transform: translate(73.5cqw, 0); }
  39% { transform: translate(73.5cqw, -4cqw); opacity: 1; }
  40%, 100% { transform: translate(75.5cqw, -4cqw); opacity: 0; }
}
/* Tall drawing: one unit is 100/360 cqw. Down the axis, out the tap.
   The control names lie across the axis here, so the light goes dark
   from the outer ring to the inner one, as the thread does. */
@keyframes fp-bead-tall-a {
  0% { transform: translate(0, 0); opacity: 0; }
  2%, 12.3% { opacity: 1; }
  13%, 18.6% { opacity: 0; }
  19.3% { opacity: 1; }
  38.1% { transform: translate(0, 124.72cqw); opacity: 1; }
  40%, 100% { transform: translate(6.11cqw, 124.72cqw); opacity: 0; }
}
@keyframes fp-bead-tall-b {
  0% { transform: translate(0, 0); opacity: 0; }
  2%, 11.5% { opacity: 1; }
  12.15%, 17.4% { opacity: 0; }
  18.05% { opacity: 1; }
  38.2% { transform: translate(0, 133.61cqw); opacity: 1; }
  40%, 100% { transform: translate(6.11cqw, 133.61cqw); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .fp-bead { animation: none !important; opacity: 0; }
}

/* The control bands turn like the dials of a lock: each moves a few
   degrees, rests, and moves back, on its own clock, so the names stay
   upright enough to read. Each band is a small SVG in its own box,
   centred on the rings (the component sets left, top and width), so the
   turn is a transform the compositor runs without layout or paint on
   the page. */
.fp-notch { stroke: var(--color-slate-400); stroke-width: 1; }
.fp-band { position: absolute; pointer-events: none; }
.fp-live .fp-band { will-change: transform; }
.fp-band svg { display: block; width: 100%; height: auto; overflow: visible; }
.fp-live .fp-band-outer { animation: fp-dial-outer 26s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
.fp-live .fp-band-middle { animation: fp-dial-middle 31s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
.fp-live .fp-band-inner { animation: fp-dial-inner 19s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
@keyframes fp-dial-outer {
  0%, 10% { transform: rotate(0deg); }
  32%, 48% { transform: rotate(14deg); }
  70%, 84% { transform: rotate(-8deg); }
  100% { transform: rotate(0deg); }
}
@keyframes fp-dial-middle {
  0%, 14% { transform: rotate(0deg); }
  36%, 52% { transform: rotate(-18deg); }
  74%, 88% { transform: rotate(10deg); }
  100% { transform: rotate(0deg); }
}
@keyframes fp-dial-inner {
  0%, 6% { transform: rotate(0deg); }
  28%, 40% { transform: rotate(12deg); }
  62%, 80% { transform: rotate(-10deg); }
  100% { transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .fp-live .fp-band { animation: none; }
}
