/* Copied from mstar's docs/mintlify/style.css (.mfig) so the site and the docs draw the same figures. */

/* Figures (snippets/fig-*.jsx). Each part of a model has its own hue, drawn as a thin
   outline over a faint tint of that hue. Connectors are thin blue lines. The tokens
   switch with the site's dark theme, so one component serves both themes. */

.mfig-wrap {
  margin: 28px 0;
}

.mfig {
  --fig-bg: #ffffff;
  --fig-ink: #1d2433;
  --fig-muted: #6b7280;
  --fig-rule: #e6e8eb;
  --fig-wire: #3b78bd;
  --fig-glow: rgba(59, 120, 189, 0.75);
  --fig-glow-0: rgba(59, 120, 189, 0);
  --fig-grid: #eef0f2;
  --fig-enc: #3d8a39;
  --fig-enc-tint: rgba(61, 138, 57, 0.07);
  --fig-llm: #23808a;
  --fig-llm-tint: rgba(35, 128, 138, 0.08);
  --fig-dec: #b25a41;
  --fig-dec-tint: rgba(178, 90, 65, 0.07);
  --fig-ctl: #8b95a3;
  --fig-ctl-tint: rgba(139, 149, 163, 0.08);
  --fig-s2: #8f98a3;
  --fig-s3: #c3c9d0;
  position: relative;
  overflow-x: auto;
  padding: 28px 28px 24px;
  border: 1px solid var(--fig-rule);
  border-radius: 16px;
  background: var(--fig-bg);
  color: var(--fig-ink);
  font-size: 14px;
  line-height: 1.35;
}

html[data-theme="bold"] .mfig {
  --fig-bg: #0c0d0f;
  --fig-ink: #e6e8eb;
  --fig-muted: #959ca5;
  --fig-rule: #24272b;
  --fig-wire: #82bbe8;
  --fig-glow: rgba(130, 187, 232, 0.7);
  --fig-glow-0: rgba(130, 187, 232, 0);
  --fig-grid: #1b1e21;
  --fig-enc: #63ae4c;
  --fig-enc-tint: rgba(99, 174, 76, 0.1);
  --fig-llm: #3fa1a1;
  --fig-llm-tint: rgba(63, 161, 161, 0.1);
  --fig-dec: #c4664b;
  --fig-dec-tint: rgba(196, 102, 75, 0.1);
  --fig-ctl: #646b75;
  --fig-ctl-tint: rgba(120, 128, 140, 0.09);
  --fig-s2: #7d848d;
  --fig-s3: #4a5058;
}

.mfig-caption {
  margin-top: 10px;
  color: rgb(100, 116, 139);
  font-size: 0.85rem;
  text-align: center;
}

.mfig-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.mfig-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--c, var(--fig-ctl));
  border-radius: 6px;
  background: var(--t, var(--fig-ctl-tint));
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.mfig-node[data-role="enc"] { --c: var(--fig-enc); --t: var(--fig-enc-tint); }
.mfig-node[data-role="llm"] { --c: var(--fig-llm); --t: var(--fig-llm-tint); }
.mfig-node[data-role="dec"] { --c: var(--fig-dec); --t: var(--fig-dec-tint); }
.mfig-node[data-role="ctl"] { --c: var(--fig-ctl); --t: var(--fig-ctl-tint); }

.mfig-muted {
  color: var(--fig-muted);
}

.mfig-wire {
  color: var(--fig-wire);
}

.mfig-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
}

.mfig-button {
  padding: 4px 11px;
  border: 1px solid var(--fig-rule);
  border-radius: 6px;
  background: transparent;
  color: var(--fig-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.mfig-button:hover {
  color: var(--fig-ink);
}

.mfig-button[aria-pressed="true"] {
  border-color: var(--fig-wire);
  color: var(--fig-ink);
}

.mfig-button:focus-visible {
  outline: 2px solid var(--fig-wire);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .mfig-node, .mfig-button { transition: none; }
}

/* The placement figure: tabs, one row per GPU, the serve command. */
.mfig-tabs { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 18px; border-bottom: 1px solid var(--fig-rule); }
.mfig-tabs button {
  appearance: none; margin: 0 0 -1px; padding: 0 0 10px; border: 0; border-bottom: 2px solid transparent;
  background: none; color: var(--fig-muted); font: inherit; font-size: 13.5px; line-height: 1.3; cursor: pointer;
  transition: color .5s ease, border-color .5s ease;
}
.mfig-tabs button:hover { color: var(--fig-ink); }
.mfig-tabs button[aria-selected="true"] { color: var(--fig-ink); border-bottom-color: var(--fig-wire); }
.mfig-tabs button:focus-visible { outline: 2px solid var(--fig-wire); outline-offset: 2px; }
.mfig-gpus { display: grid; gap: 8px; }
.mfig-gpu { display: grid; grid-template-columns: 50px minmax(0, 1fr); align-items: center; gap: 12px;
  min-height: 50px; padding: 9px 12px; border: 1px solid var(--fig-rule); border-radius: 10px; }
.mfig-gpu[data-idle] { border-style: dashed; }
.mfig-gpu-label { font-size: 13px; font-weight: 600; color: var(--fig-ink); }
.mfig-gpu[data-idle] .mfig-gpu-label { color: var(--fig-muted); font-weight: 500; }
.mfig-gpu-nodes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.mfig-gpu-note { margin-left: 4px; font-size: 12.5px; }
.mfig-placement .mfig-node { padding: 5px 10px; font-size: 12px; }
.mfig-cmd { margin: 16px 0 0; padding: 10px 12px 10px calc(12px + 4ch); text-indent: -4ch; border: 1px solid var(--fig-rule);
  border-radius: 8px; background: transparent; color: var(--fig-ink); white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.55; }
.mfig-cmd code { font: inherit; background: none; padding: 0; border: 0; color: inherit; }
.mfig-nowrap { white-space: nowrap; }

/* The hero's walks figure lights up each walk in reading order (fig-walks.jsx, animate). */
.mfig-animate .mfig-step {
  animation: mfig-step calc((var(--steps) + 1) * 0.9s) ease infinite;
  animation-delay: calc(var(--seq) * 0.9s);
}
@keyframes mfig-step {
  0%, 16%, 100% { border-color: var(--pill-c); box-shadow: 0 0 0 0 transparent, 0 0 0 0 transparent; }
  3%, 11% { border-color: var(--fig-wire); box-shadow: 0 0 0 1.5px var(--fig-wire), 0 0 18px 4px color-mix(in srgb, var(--fig-wire) 55%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .mfig-animate .mfig-step { animation: none; }
}

/* The hero graph (fig-graph.jsx): on each beat a walk's pill and the parts of the graph it runs
   on flash and fade with the same ring and glow as the walks figure's steps, more slowly. Each
   keyframe has two copies so the next beat restarts it on a part lit the beat before. */
.mfig-graph .mfig-pulse-a { animation: mfig-pill-a 1.5s ease both; }
.mfig-graph .mfig-pulse-b { animation: mfig-pill-b 1.5s ease both; }
.mfig-graph g.mfig-pulse-a { animation-name: mfig-glow-a; }
.mfig-graph g.mfig-pulse-b { animation-name: mfig-glow-b; }
.mfig-graph g.mfig-pulse-a :is(rect, line, .mfig-stroke) { animation: mfig-ring-a 1.5s ease both; }
.mfig-graph g.mfig-pulse-b :is(rect, line, .mfig-stroke) { animation: mfig-ring-b 1.5s ease both; }
@keyframes mfig-pill-a {
  0%, 100% { border-color: var(--pill-c); box-shadow: 0 0 0 0 transparent, 0 0 0 0 transparent; }
  18%, 62% { border-color: var(--fig-wire); box-shadow: 0 0 0 1.5px var(--fig-wire), 0 0 18px 4px color-mix(in srgb, var(--fig-wire) 55%, transparent); }
}
@keyframes mfig-pill-b {
  0%, 100% { border-color: var(--pill-c); box-shadow: 0 0 0 0 transparent, 0 0 0 0 transparent; }
  18%, 62% { border-color: var(--fig-wire); box-shadow: 0 0 0 1.5px var(--fig-wire), 0 0 18px 4px color-mix(in srgb, var(--fig-wire) 55%, transparent); }
}
/* Both ends are the glow's own blue at zero alpha, so it fades in blue rather than through gray. */
@keyframes mfig-glow-a { 0%, 100% { filter: drop-shadow(0 0 0 var(--fig-glow-0)); } 18%, 62% { filter: drop-shadow(0 0 6px var(--fig-glow)); } }
@keyframes mfig-glow-b { 0%, 100% { filter: drop-shadow(0 0 0 var(--fig-glow-0)); } 18%, 62% { filter: drop-shadow(0 0 6px var(--fig-glow)); } }
@keyframes mfig-ring-a { 18%, 62% { stroke: var(--fig-wire); stroke-width: 2.25px; } }
@keyframes mfig-ring-b { 18%, 62% { stroke: var(--fig-wire); stroke-width: 2.25px; } }
/* The walk pills are sized in em, so the row shrinks with the figure as the graph above it does. */
.mfig-graph .mfig { container-type: inline-size; }
.mfig-graph .mfig-walk-rows { font-size: min(12px, 3.1cqi); }
@media (prefers-reduced-motion: reduce) {
  .mfig-graph .mfig-pulse-a, .mfig-graph .mfig-pulse-b, .mfig-graph .mfig-pulse-a *, .mfig-graph .mfig-pulse-b * { animation: none; }
}

/* Phones: the placement figure stacks its ranks and the streaming strip narrows its cells. */
@media (max-width: 560px) {
  .mfig-graph .mfig, .mfig-placement .mfig, .mfig-streaming .mfig { padding: 18px 14px 16px; }
  .mfig-tabs { gap: 4px 16px; }
  .mfig-tabs button { font-size: 13px; padding-bottom: 8px; }
  .mfig-gpu { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; padding: 8px 10px; }
  .mfig-placement .mfig-node { font-size: 11.5px; padding: 5px 9px; }
  .mfig-cmd { font-size: 11.5px; }
  .mfig-streaming { --sc-cell: 9px; --sc-gap: 2px; --sc-label: 10px; --sc-range: 110px; }
}

/* The walks figure on phones: narrower columns and smaller type, same rows. */
@media (max-width: 560px) {
  .mfig-walks .mfig { padding: 18px 6px 16px; }
  .mfig-walks {
    --walks-cols: 80px 12px 98px 12px 80px 12px 34px;
    --walks-pill-font: 10.5px;
    --walks-pill-pad: 3px;
    --walks-loop-font: 10px;
    --walks-out-font: 11px;
    --walks-arrow: 12px;
  }
  .mfig-walks .mfig-node { font-size: 10px; padding: 4px 4px; }
}
@media (max-width: 380px) {
  .mfig-streaming { --sc-cell: 8px; }
  .mfig-cmd { font-size: 10.5px; padding-left: calc(10px + 2ch); text-indent: -2ch; }
  .mfig-placement .mfig, .mfig-streaming .mfig { padding-left: 10px; padding-right: 10px; }
  .mfig-walks {
    --walks-cols: 74px 10px 92px 10px 74px 10px 30px;
    --walks-pill-font: 10px;
    --walks-loop-font: 9.5px;
    --walks-out-font: 10.5px;
    --walks-arrow: 10px;
  }
  .mfig-walks .mfig-node { font-size: 9.5px; }
}

/* The post's guidance figure: the three branches light up together, then combine_cfg (fig-cfg.jsx). */
.mfig-cfg-animate .mfig-cfg-branch rect { animation: mfig-cfg-branch 2.8s linear infinite; }
.mfig-cfg-animate .mfig-cfg-combine rect { animation: mfig-cfg-combine 2.8s linear infinite; }
@keyframes mfig-cfg-branch {
  0%, 18% { stroke: var(--fig-llm); stroke-width: 1; }
  22%, 46% { stroke: var(--fig-wire); stroke-width: 2.5; filter: drop-shadow(0 0 7px var(--fig-wire)); }
  50%, 100% { stroke: var(--fig-llm); stroke-width: 1; }
}
@keyframes mfig-cfg-combine {
  0%, 60% { stroke: var(--fig-ctl); stroke-width: 1; }
  64%, 88% { stroke: var(--fig-wire); stroke-width: 2.5; filter: drop-shadow(0 0 7px var(--fig-wire)); }
  92%, 100% { stroke: var(--fig-ctl); stroke-width: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .mfig-cfg-animate .mfig-cfg-branch rect, .mfig-cfg-animate .mfig-cfg-combine rect { animation: none; }
}
