/* GitHub Actions: Events and the Workflow File. Opened full screen or in an
   iframe, which cannot see the site's own light/dim switch, so it follows the
   reader's system preference, as the other viewers do. */

:root {
  --bg: #ffffff;
  --card: #ffffff;
  --border: #dfe3e8;
  --text: #22272e;
  --dim: #5f6b78;
  --accent: #326ce5;
  --btn: #f4f5f7;
  --panel: #0d2436;
  --panel-text: #eaf1f6;
  --raw: #f7f8fa;
  --flash: rgba(255, 196, 0, 0.3);
  --code-bg: #f6f8fa;
  --ok: #1f883d;
  --pending: #bf8700;
  --bad: #b3372f;
  --yk: #1b4f9c;
  /* the file's segments: tints with no border between them */
  --s-wf: #eef1f5;
  --s-on: #fbf1d9;
  --s-job-a: #e6f3ea;
  --s-job-b: #dcece2;
  --s-steps: #c9e3d3;
  --guide: rgba(40, 60, 80, 0.22);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1d2b;
    --card: #112b40;
    --border: #234862;
    --text: #eaf1f6;
    --dim: #9fb2c2;
    --accent: #6f9bff;
    --btn: #16374f;
    --panel: #081b29;
    --raw: #0d2233;
    --flash: rgba(255, 196, 0, 0.18);
    --code-bg: #0d2233;
    --ok: #4ac26b;
    --pending: #e3b341;
    --bad: #f08a80;
    --yk: #9cc2ff;
    --s-wf: #16293a;
    --s-on: #33301c;
    --s-job-a: #14332a;
    --s-job-b: #183a30;
    --s-steps: #1f4a3c;
    --guide: rgba(200, 220, 240, 0.2);
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.dim { color: var(--dim); font-weight: 400; }
.kv-app { padding: 0.5rem 16px 0.6rem; max-width: 1800px; margin: 0 auto; }
.kv-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.9rem; margin: 0 0 0.45rem; }
.kv-head h1 { font-size: 1.3rem; margin: 0; letter-spacing: -0.01em; }
.kv-head p { margin: 0; color: var(--dim); font-size: 0.92rem; }
.in-viewer .kv-head { display: none; }

/* --- the controls, the scene's explanation (constant through the scene), and what the step has just done */
.am-top { display: grid; grid-template-columns: 15rem minmax(0, 1fr) minmax(0, 1fr); gap: 12px; height: 142px; margin-bottom: 10px; }
.kv-bar { display: flex; flex-direction: column; gap: 0.45rem; }
.kv-bar .row { display: flex; align-items: center; gap: 0.5rem; }
.kv-bar .count { font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; color: var(--dim); margin-left: auto; }
.kv-btn { background: var(--btn); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.35rem 0.9rem; font-size: 0.88rem; cursor: pointer; font-family: inherit; }
.kv-btn:hover:not(:disabled) { border-color: var(--accent); }
.kv-btn:disabled { opacity: 0.45; cursor: default; }
.kv-btn code { font-size: 0.92em; }
.kv-btn.play { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
  text-align: left; line-height: 1.25; }
.kv-bar select { background: var(--btn); color: var(--text); border: 1px solid var(--border); border-radius: 7px;
  padding: 0.3rem 0.4rem; font-size: 0.86rem; font-family: inherit; min-width: 0; max-width: 100%; }
.am-explain { position: relative; overflow: auto; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px;
  padding: 0.45rem 0.8rem; font-size: 0.84rem; line-height: 1.4; background: var(--card); }
.am-explain p { margin: 0 0 0.3rem; }
.am-explain .main { font-weight: 650; font-size: 1rem; }
.am-explain ul.steps { margin: 0 0 0.3rem; padding-left: 1.1rem; }
.am-explain ul.steps li { margin: 0 0 0.15rem; }
.am-explain ul.steps ul.steps { margin: 0.1rem 0; list-style: circle; }
.am-explain code { font-size: 0.92em; background: var(--code-bg); padding: 0 0.2em; border-radius: 3px; }
.am-explain.about { border-left-color: var(--border); }
.am-explain.about .main { font-size: 0.93rem; }
.am-explain.about:has(li.lit) li:not(.lit) { color: var(--dim); }
.am-explain.about li.lit { --c: #d4a300; color: var(--text); background: color-mix(in srgb, var(--c) 14%, transparent);
  border-left: 3px solid var(--c); border-radius: 4px; margin-left: -0.4rem; padding-left: 0.3rem; }
.am-explain.about li.lit.now { background: color-mix(in srgb, var(--c) 30%, transparent); }

/* --- the stage: the runners over the file, GitHub over the two people */
.gv-stage { position: relative; display: grid; gap: 10px; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  height: max(540px, calc(100vh - 142px - 5rem)); }
@media (min-width: 1101px) { .in-viewer .gv-stage { height: max(500px, calc(100vh - 142px - 1.7rem)); } }
.gv-left, .gv-right { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
#gv-runners { flex: none; height: 146px; }
#gv-file { flex: 1; }
#gv-github { flex: 1; }
#gv-people { flex: none; height: 200px; }

.kv-card { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card); font-size: 0.84rem;
  transition: box-shadow 0.25s, border-color 0.25s, opacity 0.4s; }
.kv-card.here { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.kv-card > header { flex: none; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.28rem 0.7rem; border-bottom: 1px solid var(--border); }
.kv-card > header h2 { font-size: 0.88rem; margin: 0; flex: 1; min-width: 0; }
.kv-card > header h2 code { font-size: 0.72rem; color: var(--dim); font-weight: 400; margin-left: 0.3rem; }
.kv-card > header h2 code.path { font-size: 0.8rem; color: var(--text); font-weight: 600; margin: 0; }
.kv-body { flex: 1; min-height: 0; overflow: auto; padding: 0.4rem 0.6rem; }
h3 { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); margin: 0 0 0.3rem; }
h3.next { margin-top: 0.5rem; }

/* --- the runners: small computers, a screen on a stand, printing lines */
.pcs { display: flex; gap: 14px; align-items: flex-start; padding: 0.35rem 0.6rem 0; overflow-x: auto; overflow-y: hidden; }
.none { margin: 0.3rem 0; font-size: 0.8rem; list-style: none; }
.pc { flex: 0 0 232px; display: flex; flex-direction: column; align-items: center; }
.scr { width: 100%; height: 84px; overflow: hidden; background: #0c1620; color: #b6f0c6; border: 3px solid #39465a; border-bottom-width: 7px; border-radius: 6px;
  padding: 0.12rem 0.35rem; font: 0.66rem/1.32 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.scr .ttl { color: #eaf1f6; font-weight: 700; border-bottom: 1px solid #2b3a4a; margin-bottom: 0.1rem; white-space: nowrap; overflow: hidden; }
.scr .ttl span { color: #8ba0b3; font-weight: 400; }
.scr .ttl b { color: #4ac26b; }
.scr .tl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scr .tl.out { color: #8ba0b3; }
.neck { width: 26px; height: 8px; background: #39465a; }
.foot { width: 74px; height: 4px; background: #39465a; border-radius: 3px 3px 0 0; }
.pc.done { opacity: 0.55; }

/* --- the workflow files: three panes, one file in each. Inside a file the parts are told
   apart by tint alone; each key with lines under it folds; the guides show what sits inside what. */
.file-panes { flex: 1; min-height: 0; display: flex; gap: 6px; background: var(--card); }
pre.fcol { flex: 1 1 0; min-width: 0; margin: 0; padding: 0; overflow: auto; position: relative; background: var(--s-wf);
  font: clamp(11px, 1.4vh, 12.5px)/1.38 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre.fcol.folded { flex: 0 0 8.5rem; overflow: hidden; }
pre.fcol.folded .seg-name { display: none; }
.ln { --g: 1.6rem; position: relative; display: block; padding: 0 0.4rem 0 calc(var(--g) + var(--ind)); text-indent: calc(-1 * var(--ind)); white-space: pre-wrap; overflow-wrap: anywhere;
  background-image: repeating-linear-gradient(90deg, var(--guide) 0 1px, transparent 1px 2ch); background-repeat: no-repeat;
  background-size: var(--at) 100%; background-position: calc(var(--g) + 0.5ch) 0; }
.ln.tagged { padding-right: 2.2rem; }
.s-wf { background-color: var(--s-wf); }
.s-on { background-color: var(--s-on); }
.s-job { background-color: var(--s-job-a); }
.s-job.odd { background-color: var(--s-job-b); }
.s-steps { background-color: var(--s-steps); }
.ln.top { font-weight: 700; }
/* A file's own row, which stays on top as its pane scrolls */
.ln.fhead { --g: 1.2rem; position: sticky; top: 0; z-index: 2; background-color: var(--panel); color: var(--panel-text); padding-top: 0.14rem; padding-bottom: 0.14rem; }
.ln.fhead .tri, .ln.fhead .more, .ln.fhead .seg-name { color: var(--panel-text); }
.ln.fhead.can-fold:hover { filter: brightness(1.25); }
.ln.off { opacity: 0.5; }
.ln.can-fold { cursor: pointer; }
.ln.can-fold:hover { filter: brightness(0.96); }
.tri { position: absolute; left: calc(var(--g) + var(--at) - 1.05rem); width: 1rem; text-indent: 0; text-align: center; font-style: normal; color: var(--accent); font-weight: 400; }
.more { color: var(--dim); }
.seg-name { position: absolute; right: 0.5rem; top: 0.12em; text-indent: 0; font: 700 0.6rem/1.3 -apple-system, 'Segoe UI', Roboto, sans-serif; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); opacity: 0.85; }
.ln .yk { color: var(--yk); }
.ln.lit { background-color: color-mix(in srgb, #ffc400 42%, var(--card)); box-shadow: inset 3px 0 0 var(--accent); }
.ln.fhead.lit { background-color: var(--panel); }
.mark { font: 700 0.68rem -apple-system, 'Segoe UI', Roboto, sans-serif; margin-left: 0.5rem; padding: 0 0.35rem; border-radius: 8px; border: 1px solid; white-space: nowrap; text-indent: 0; display: inline-block; }
.mark.yes { color: var(--ok); }
.mark.no { color: var(--bad); }

/* --- GitHub: the events as they come, the repository, the runs */
.src { font-size: 0.72rem; padding: 0.02rem 0.4rem; border: 1px dashed var(--border); border-radius: 10px; color: var(--dim); }
.gh-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); }
.gh-col + .gh-col { border-left: 1px solid var(--border); }
.evs, .rns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.ev { padding: 0.12rem 0.4rem; border-radius: 6px; border-left: 3px solid var(--pending); background: var(--raw); font-size: 0.76rem; line-height: 1.3; }
.ev code { font-weight: 700; font-size: 0.74rem; overflow-wrap: anywhere; }
.ev .d { display: block; font-size: 0.72rem; overflow-wrap: anywhere; }
.ev .to { display: block; font-size: 0.68rem; color: var(--dim); }
.ev.run { border-left-color: var(--ok); }
.ev.run .to { color: var(--ok); font-weight: 700; }
.ev.dim, .ev.cut { border-left-color: var(--border); color: var(--dim); }
.ev.cut .to { color: var(--bad); }
/* the branches: main runs on past both edges, topic branches come and go */
.gh-branches { flex: none; padding: 0.25rem 0.6rem 0.2rem; border-bottom: 1px solid var(--border); }
.gh-branches h3 { margin-bottom: 0.05rem; }
.gh-branches svg { display: block; width: 100%; max-height: 82px; }
.gh-branches [data-key] { transform-box: fill-box; transform-origin: center; }
.gh-branches svg path { fill: none; stroke-linecap: round; }
.ln-main { stroke: var(--text); stroke-width: 3; }
.ln-on { stroke: var(--text); stroke-width: 3; stroke-dasharray: 2 7; opacity: 0.55; }
.mh { fill: var(--text); stroke: none; }
.ln-topic { stroke: var(--accent); stroke-width: 2.5; }
.ln-old { stroke: var(--dim); stroke-width: 2; opacity: 0.55; }
.ln-pr { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 4; }
circle.main { fill: var(--text); }
circle.topic { fill: var(--accent); }
circle.old { fill: var(--dim); opacity: 0.7; }
.gh-branches circle.act { outline: none; stroke: #ffc400; stroke-width: 3; }
.bname { font: 700 10.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; fill: var(--accent); }
.bname.main { fill: var(--text); }
.bname.old { fill: var(--dim); font-weight: 400; }
.bname.tag { fill: var(--pending); }
.bnote { font: 400 9px -apple-system, 'Segoe UI', Roboto, sans-serif; fill: var(--dim); }
.bnote.pr { fill: var(--accent); font-weight: 700; }
.pr { font-size: 0.76rem; padding: 0.25rem 0.4rem; border: 1px solid var(--border); border-radius: 7px; background: var(--raw); }
.pr code { font-size: 0.72rem; }
.chip { display: inline-block; margin-left: 0.25rem; font-size: 0.66rem; font-weight: 700; padding: 0 0.35rem; border-radius: 9px; border: 1px solid; }
.chip.open { color: var(--ok); } .chip.merged { color: #8250df; }
.chip.rev-changes { color: var(--bad); } .chip.rev-approved { color: var(--ok); }
.chks { display: flex; flex-wrap: wrap; gap: 0.15rem 0.45rem; margin-top: 0.15rem; }
.chk { font-size: 0.7rem; color: var(--ok); }
.rn { padding: 0.12rem 0.4rem; border-radius: 6px; background: var(--raw); font-size: 0.74rem; line-height: 1.3; }
.rh { display: flex; gap: 0.3rem; align-items: baseline; }
.rh i { font-style: normal; font-weight: 800; width: 0.9rem; text-align: center; color: var(--dim); }
.rh span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rn.ok .rh i { color: var(--ok); }
.rn.running .rh i, .rn.waiting .rh i { color: var(--pending); }
.rj { display: flex; flex-wrap: wrap; gap: 0 0.5rem; padding-left: 1.2rem; font-size: 0.7rem; }
.rjob.ok { color: var(--ok); } .rjob.running, .rjob.waiting { color: var(--pending); font-weight: 700; }
.skip { color: var(--dim); }

/* --- the two people: the developer on the floor, the senior smaller and higher */
#gv-people { flex-direction: row; gap: 0.5rem; padding: 0.3rem 0.5rem 0; }
.who { display: flex; gap: 0.5rem; min-width: 0; flex: 0 1 auto; }
#gv-people { justify-content: space-between; }
.who.dev { align-items: flex-end; }
.who.senior { align-items: flex-start; }
.art { position: relative; display: block; flex: none; }
.art img { display: block; width: auto; }
.dev .art img { height: 160px; }
.senior .art img { height: 128px; }
@media (prefers-color-scheme: dark) { .senior .art img { filter: brightness(2.4); } }
.you-screen { position: absolute; top: 13.5%; width: 32%; height: 17%; color: #8fe3a8; line-height: 1.25; text-align: left;
  font: 700 8px ui-monospace, Menlo, Consolas, monospace; overflow: hidden; overflow-wrap: anywhere; }
.dev .you-screen { left: 43%; }
.side { min-width: 0; flex: 1; align-self: flex-start; }
.side h2 { font-size: 0.82rem; margin: 0 0 0.2rem; white-space: nowrap; }
.acts { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; }
.kv-btn.tiny { padding: 0.04rem 0.4rem; font-size: 0.7rem; border-radius: 5px; line-height: 1.3; text-align: left; white-space: nowrap; }
.kv-btn.tiny.past { color: var(--dim); }
.kv-btn.tiny.now { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.kv-btn.tiny.turn { border-color: var(--accent); color: var(--accent); font-weight: 700; animation: gv-due 1.4s ease-in-out infinite; }
@keyframes gv-due { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); } }

/* --- a tour step's spotlight: what it names stays, the rest dims */
.gv-stage.spotlight .kv-card:not(.here) { opacity: 0.35; }
.gv-stage .act { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }

/* --- what is in the air: a message flying along its arrow */
#gv-fly { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: visible; pointer-events: none; z-index: 50; }
#gv-fly .trail { position: absolute; left: 0; top: 0; overflow: visible; }
#gv-fly .trail polyline { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 3 7; }
#gv-fly .trail path { fill: var(--accent); }
#gv-fly .msg { position: absolute; transform: translate(-50%, -50%); background: var(--panel); color: var(--panel-text);
  border-radius: 6px; padding: 0.12rem 0.5rem; font-size: 0.74rem; font-weight: 600; white-space: nowrap;
  font-family: ui-monospace, Menlo, Consolas, monospace; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); }
#gv-fly .msg.doc { background: #fffdf4; color: #22272e; border: 1px solid #c9b98a; border-radius: 3px 10px 3px 3px; font-size: 0.78rem; }

@media (max-width: 1450px) {
  .dev .art img { height: 128px; }
  .senior .art img { height: 108px; }
  .kv-btn.tiny { font-size: 0.66rem; }
  .side h2 { font-size: 0.76rem; }
}

/* --- narrow screens: everything stacks, the controls stay pinned, the page follows the step */
@media (max-width: 1100px) {
  .am-top { grid-template-columns: minmax(0, 1fr); height: auto; position: sticky; top: 0; z-index: 40; background: var(--bg); padding-bottom: 0.4rem; }
  .am-top .about { display: none; }
  .am-top .am-explain { max-height: 24vh; }
  .kv-bar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .gv-stage { grid-template-columns: minmax(0, 1fr); height: auto; }
  #gv-file { height: 620px; flex: none; }
  #gv-github { height: 480px; flex: none; }
}
@media (max-width: 640px) {
  .file-panes { flex-direction: column; }
  pre.fcol, pre.fcol.folded { flex: 1 1 auto; max-height: 300px; }
  #gv-file { height: auto; }
  #gv-people { flex-direction: column; height: auto; padding-bottom: 0.4rem; }
  .dev .art img { height: 130px; }
  .gh-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr 1fr; }
  .gh-col + .gh-col { border-left: 0; border-top: 1px solid var(--border); }
}
