/* Animated timeline figures for the megakernels post. Everything is scoped under .mkf so it does
   not touch the Bootstrap page around it. Built by assets/js/blog/2026-11-30-megakernels/figures.js. */

.mkf {
  --ink: #16171a;
  --muted: #5c5f66;
  --faint: #8a8d93;
  --line: #e2e0d8;
  --lane: #f5f4ef;
  --surface: #ffffff;
  --accent: #2856d6;
  --good: #1d7f48;
  --bad: #b8402b;
  --r-plan: #2a78d6;
  --r-work: #e5682f;
  --r-prof: #1a9e6f;
  --r-judge: #c98f00;
  --r-merge: #c9508a;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  position: relative;
  margin: 1.6rem 0 0.6rem;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
}
.mkf *, .mkf *::before, .mkf *::after { box-sizing: border-box; }

/* The site's post layout wraps the post in a Bootstrap `.row.g-5` (24px negative side margins)
   inside a `.col-lg-8.p-3` that has only 16px of padding and is full width below 992px. The row
   then sticks out 8px on each side, so phones can pan the whole page sideways. Matching the gutter
   to the padding removes that overflow and leaves the text column exactly as wide as before. */
@media (max-width: 991.98px) {
  .row.g-5 { --bs-gutter-x: 2rem; }
}
.mkf > img { display: block; width: 100%; height: auto; }
/* a little wider than the 800px text column on desktop screens */
@media (min-width: 1120px) {
  .mkf { width: min(1000px, calc(100vw - 64px)); left: 50%; transform: translateX(-50%); }
}

/* the command you type, above the timeline */
.mkf-you { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mkf-you .lab { font: 600 11px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mkf-you code { padding: 6px 10px; border-radius: 7px; background: var(--ink); color: #e9e8e3; font: 12.5px/1.3 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mkf-you code .p { color: #8d9097; }

.mkf-scroll { overflow-x: auto; overflow-y: hidden; }
.mkf-scroll > svg { display: block; width: 100%; min-width: 660px; height: auto; }
.mkf svg text { font: 500 11px var(--mono); fill: var(--ink); }
.mkf .row-lab { fill: var(--muted); font-size: 11.5px; }
.mkf .row-lab.strong { fill: var(--ink); font-weight: 700; font-size: 12px; }
.mkf .row-sub { fill: var(--faint); font-size: 10px; }
.mkf .grp-lab { fill: var(--faint); font-size: 10px; letter-spacing: .05em; text-transform: uppercase; }
.mkf .axis-lab { fill: var(--faint); font-size: 10.5px; }
.mkf .lane { fill: var(--lane); }

/* lead row */
.mkf .lead-line { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.mkf .lead-tick { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.mkf .chip rect { fill: var(--surface); stroke: var(--ink); stroke-width: 1.2; }
.mkf .chip text { font-size: 10.5px; font-weight: 600; }
.mkf .chip.promote rect { fill: var(--good); stroke: var(--good); }
.mkf .chip.promote text { fill: #fff; }
.mkf .chip.stop rect { stroke: var(--bad); }
.mkf .chip.stop text { fill: var(--bad); }
.mkf .chip.park text { fill: var(--muted); }
.mkf .leader { stroke: var(--ink); stroke-width: 1; }
/* earlier decisions stay as a muted history; the newest one is highlighted */
.mkf .chip.old rect { fill: var(--surface); stroke: var(--line); }
.mkf .chip.old text { fill: var(--faint); font-weight: 500; }
.mkf .chip.promote.old rect { fill: color-mix(in srgb, var(--good) 14%, var(--surface)); stroke: color-mix(in srgb, var(--good) 40%, var(--surface)); }
.mkf .chip.promote.old text { fill: var(--good); }
.mkf .leader.old { stroke: var(--line); }
.mkf .promo circle { fill: var(--good); }
.mkf .promo text { fill: #fff; font-size: 10px; font-weight: 700; }
.mkf .promo-lab { fill: var(--good); font-weight: 700; font-size: 11.5px; }

/* subagent bars and the arrows between them and the lead */
.mkf .bar rect { fill: color-mix(in srgb, var(--c) 18%, var(--surface)); stroke: var(--c); stroke-width: 1.2; }
.mkf .bar.on rect { fill: color-mix(in srgb, var(--c) 40%, var(--surface)); stroke-width: 2; }
.mkf .bar.done text { fill: var(--muted); }
.mkf .r-plan { --c: var(--r-plan); }
.mkf .r-work { --c: var(--r-work); }
.mkf .r-prof { --c: var(--r-prof); }
.mkf .r-judge { --c: var(--r-judge); }
.mkf .r-merge { --c: var(--r-merge); }
.mkf .role-dot { fill: var(--c); }
.mkf .spawn line { stroke: var(--c); stroke-width: 1.6; }
.mkf .spawn path { fill: var(--c); }
.mkf .spawn.done line { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 3; }
.mkf .spawn.done path { display: none; }
.mkf .ret line { stroke: var(--c); stroke-width: 1.6; }
.mkf .ret path { fill: var(--c); }
.mkf .ret.ok { --c: var(--good); }
.mkf .ret.kill { --c: var(--bad); }
.mkf .ret.park { --c: var(--faint); }
.mkf .ret.done line { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 3; }
.mkf .ret.done path { display: none; }
.mkf .tag { font-size: 10.5px; font-weight: 600; fill: var(--muted); }
.mkf .badge text { fill: #fff; font-size: 10px; font-weight: 700; }
.mkf .badge.ok circle { fill: var(--good); }
.mkf .badge.kill circle { fill: var(--bad); }
.mkf .badge.park circle { fill: var(--faint); }

/* execution breakdown of the megakernel (figure 3) */
.mkf .seg path { fill: color-mix(in srgb, var(--c) 30%, var(--surface)); stroke: none; }
.mkf .seg text { font-size: 10.5px; font-weight: 600; }
.mkf .seg.tgt path { fill: color-mix(in srgb, var(--c) 60%, var(--surface)); }
.mkf .sync { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: miter; }
.mkf .sync.tgt { stroke: var(--accent); }
.mkf .mono rect { fill: #dcdde0; }
.mkf .mono text { fill: var(--muted); font-weight: 600; }
.mkf .empty rect { fill: none; stroke: var(--faint); stroke-dasharray: 4 4; }
.mkf .empty text { fill: var(--faint); }
.mkf .lat { font-size: 12.5px; font-weight: 700; }
.mkf .assign { fill: none; stroke: var(--c); stroke-width: 1.6; stroke-dasharray: 5 4; opacity: .85; }

.mkf .playhead { stroke: var(--accent); stroke-width: 1.5; opacity: .7; }

.mkf-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.mkf-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mkf-legend i { width: 14px; height: 10px; border-radius: 2px; border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 25%, var(--surface)); }
.mkf-legend b { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; color: #fff; font-size: 9px; }
.mkf-legend em { font-style: normal; font-weight: 700; color: var(--ink); }

.mkf-foot { position: relative; display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.mkf-cap { flex: 1; min-height: 3em; font-size: 14.5px; line-height: 1.5; transition: opacity .25s; margin-right: 6px; }
.mkf-cap.is-out { opacity: 0; }
.mkf-btn { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.mkf-btn:hover { color: var(--ink); border-color: var(--faint); }
.mkf-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mkf-btn svg { width: 14px; height: 14px; }

/* Phones: the figure runs edge to edge, and the script switches it to a compact layout (narrower
   canvas, larger text, newest decision only) below 620px, so it fits without sideways scrolling. */
@media (max-width: 760px) {
  .mkf {
    width: 100vw; left: 50%; transform: translateX(-50%);
    padding: 14px 12px 12px; border-radius: 0; border-left: 0; border-right: 0;
  }
}
.mkf.mkf-compact .mkf-scroll { overflow: visible; }
.mkf.mkf-compact .mkf-scroll > svg { min-width: 0; }
.mkf.mkf-compact svg text { font-size: 13.5px; }
.mkf.mkf-compact .row-lab { font-size: 14px; }
.mkf.mkf-compact .row-lab.strong { font-size: 14.5px; }
.mkf.mkf-compact .axis-lab { font-size: 12.5px; }
.mkf.mkf-compact .chip text, .mkf.mkf-compact .seg text { font-size: 13.5px; }
.mkf.mkf-compact .lat { font-size: 15px; }
.mkf.mkf-compact .badge text, .mkf.mkf-compact .promo text { font-size: 12px; }
.mkf.mkf-compact .mkf-you { margin-bottom: 10px; }
.mkf.mkf-compact .mkf-you code { font-size: 12px; }
.mkf.mkf-compact .mkf-legend { font-size: 12px; gap: 4px 12px; }
/* the caption gets the full width, and the buttons sit below it at a comfortable touch size */
.mkf.mkf-compact .mkf-foot { flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.mkf.mkf-compact .mkf-cap { flex: 1 1 100%; margin-right: 0; font-size: 15px; }
.mkf.mkf-compact .mkf-btn { width: 44px; height: 40px; }
.mkf.mkf-compact .mkf-btn svg { width: 16px; height: 16px; }
@media (prefers-reduced-motion: reduce) {
  .mkf *, .mkf *::before, .mkf *::after { transition: none !important; animation: none !important; }
}

/* The post's collapsible "detailed configuration" block, framed so its start and end are clear. */
.post-content details.mk-box {
  margin: 1.5rem 0;
  padding: 0 1.1rem;
  border: 1px solid #dddbd2;
  border-radius: 10px;
  background: #fafaf7;
}
.post-content details.mk-box > summary {
  padding: 0.75rem 0;
  cursor: pointer;
}
.post-content details.mk-box[open] {
  padding-bottom: 0.4rem;
}
.post-content details.mk-box[open] > summary {
  margin-bottom: 1rem;
  border-bottom: 1px solid #dddbd2;
}
.post-content details.mk-box table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  background: #ffffff;
}
/* on desktop, widen the box like the figures so its tables fit without scrolling */
@media (min-width: 1120px) {
  .post-content details.mk-box[open] {
    position: relative;
    width: min(1000px, calc(100vw - 64px));
    left: 50%;
    transform: translateX(-50%);
  }
}
