/* GitHub Actions: a Workflow Run. 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 (their controls, cards and
   events are copied here, so the series look alike). */

: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;
  --hub: #1d63ed;
  --aws: #d97706;
  --slack: #7a3d8f;
  --yk: #1b4f9c;
}
@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;
    --hub: #6f9bff;
    --aws: #f0a050;
    --slack: #c79bd6;
    --yk: #9cc2ff;
  }
}

* { 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 1rem; max-width: 1700px; 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; }

/* --- controls */
.kv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 0.6rem; }
.kv-bar .count { font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; color: var(--dim); }
.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.play { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; min-width: 6rem; }
.kv-btn.go { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.kv-btn.tiny { padding: 0.05rem 0.45rem; font-size: 0.74rem; border-radius: 5px; }
.kv-app 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%; }

/* --- the stage: our workstation over the repository, GitHub Actions, the
   places the job reaches, the events. Every card has a fixed size and scrolls. */
.gv-stage { position: relative; display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 290px) minmax(0, 350px);
  grid-template-rows: 150px minmax(0, 1fr);
  grid-template-areas: "you actions places log" "repo actions places log";
  height: max(520px, calc(100vh - 6.4rem)); }
/* Framed, the stage fills the frame under the controls, with no page scrolling */
@media (min-width: 1101px) { .in-viewer .gv-stage { height: max(480px, calc(100vh - 4.3rem)); } }
.gv-you { grid-area: you; } .gv-repo { grid-area: repo; } .gv-actions { grid-area: actions; }
.gv-places { grid-area: places; } .gv-log { grid-area: log; }
.gv-places { display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 12px; min-height: 0; }
@media (max-width: 1100px) {
  .gv-stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: auto;
    grid-template-rows: 190px 480px auto 440px;
    grid-template-areas: "you actions" "repo actions" "places places" "log log"; }
  .gv-places { grid-template-rows: none; grid-template-columns: repeat(3, minmax(0, 1fr)); height: 230px; }
  /* The cards stand one under another and the page follows the step, so
     the controls stay pinned to the top of the screen */
  .kv-bar { position: sticky; top: 0; z-index: 40; background: var(--bg); margin: 0 -16px 0.6rem; padding: 0.4rem 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }
}
@media (max-width: 640px) {
  .kv-bar { gap: 0.35rem 0.5rem; }
  .kv-bar .kv-btn { padding: 0.3rem 0.7rem; }
  .kv-bar select { flex: 1 1 10rem; }
  .gv-stage { grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 190px 460px 520px auto 440px;
    grid-template-areas: "you" "repo" "actions" "places" "log"; }
  .gv-places { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(3, 190px); height: auto; }
}

.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.45rem 0.7rem 0.4rem; border-bottom: 1px solid var(--border); }
.kv-card > header h2 { font-size: 0.92rem; 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 .turn { font-size: 0.8rem; padding: 0.2rem 0.6rem; 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); } }
.kv-body { flex: 1; min-height: 0; overflow: auto; padding: 0.5rem 0.7rem; }
h3 { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); margin: 0 0 0.35rem; }
section > p { margin: 0; }

/* --- our workstation: the picture, the next command on its screen */
.you-body { display: flex; justify-content: center; align-items: flex-end; padding: 0.3rem 0 0.4rem; overflow: hidden; }
.art.you { position: relative; display: block; height: 100%; }
.art.you img { display: block; height: 100%; width: auto; }
.you-screen { text-align: left; position: absolute; left: 45%; top: 13.5%; width: 32%; height: 17%; color: #8fe3a8; line-height: 1.3;
  font: 700 clamp(6px, 1.05vh, 10px) ui-monospace, Menlo, Consolas, monospace; overflow: hidden; overflow-wrap: anywhere; }

/* --- the repository: its files, its commits, the workflow file */
.repo-body { display: flex; flex-direction: column; gap: 0.6rem; }
.tree { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; font: 0.78rem ui-monospace, Menlo, monospace; }
.tree span { padding: 0.05rem 0.35rem; border: 1px solid var(--border); border-radius: 4px; background: var(--raw); }
.tree .changed { border-color: var(--pending); background: color-mix(in srgb, var(--pending) 14%, transparent); }
.tree .wf { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.commits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.commits li { display: grid; grid-template-columns: 1.2rem 4.4rem minmax(0, 1fr); gap: 0.35rem; align-items: baseline;
  padding: 0.18rem 0.4rem; border-radius: 6px; background: var(--raw); font-size: 0.8rem; }
.commits code { font-size: 0.76rem; color: var(--dim); }
.commits .path { color: var(--dim); font: 0.74rem ui-monospace, Menlo, monospace; }
.st { font-weight: 800; text-align: center; border-radius: 50%; }
.st.ok { color: var(--ok); }
.st.pending { color: var(--pending); animation: gv-blink 1.2s ease-in-out infinite; }
@keyframes gv-blink { 50% { opacity: 0.35; } }
.wf-file { flex: 1; min-height: 0; display: flex; flex-direction: column; }
pre.yaml { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 0.35rem 0; background: var(--code-bg); border-radius: 7px;
  font: 0.74rem/1.42 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
/* A long line wraps under its own text, not under the indentation */
pre.yaml .ln { display: block; padding: 0 0.6rem 0 calc(0.6rem + var(--ind)); text-indent: calc(-1 * var(--ind));
  white-space: pre-wrap; overflow-wrap: anywhere; }
pre.yaml .yk { color: var(--yk); }
pre.yaml .ln.lit { background: color-mix(in srgb, var(--flash) 75%, transparent); box-shadow: inset 3px 0 0 var(--accent); }

/* --- GitHub Actions: the event, the run and its job, the runner */
.act-body { display: flex; flex-direction: column; gap: 0.7rem; }
.box { border: 1px solid var(--border); border-radius: 8px; padding: 0.45rem 0.6rem; background: var(--raw); }
.box.empty { background: none; border-style: dashed; }
.run-head { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.run-head b { font-size: 0.92rem; }
.chip { font-size: 0.72rem; font-weight: 700; padding: 0.05rem 0.45rem; border-radius: 10px; border: 1px solid; }
.chip.queued { color: var(--dim); }
.chip.running { color: var(--pending); }
.chip.success { color: var(--ok); }
.job { border-top: 1px dashed var(--border); padding-top: 0.35rem; }
.job > div { font-size: 0.82rem; margin-bottom: 0.25rem; }
.jsteps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.jsteps li { display: grid; grid-template-columns: 1.2rem minmax(0, 1fr); gap: 0.3rem; padding: 0.12rem 0.3rem; border-radius: 5px; font-size: 0.82rem; }
.jsteps li i { font-style: normal; font-weight: 800; text-align: center; }
.jsteps li.wait { color: var(--dim); }
.jsteps li.done i { color: var(--ok); }
.jsteps li.running { background: color-mix(in srgb, var(--flash) 75%, transparent); font-weight: 600; }
.jsteps li.running i { color: var(--pending); animation: gv-blink 1.2s ease-in-out infinite; }
.vm { border: 2px dashed var(--accent); border-radius: 10px; padding: 0.5rem 0.6rem; display: flex; flex-direction: column; gap: 0.4rem;
  background: color-mix(in srgb, var(--accent) 5%, transparent); }
.slot { border: 1px solid var(--border); border-radius: 6px; padding: 0.3rem 0.5rem; background: var(--card); font-size: 0.8rem; }
.slot b { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.slot code { font-size: 0.78rem; }

/* --- the places the job reaches */
.place > header { border-top: 4px solid var(--c); }
.place > header h2 { color: var(--c); }
#gv-hub { --c: var(--hub); } #gv-aws { --c: var(--aws); } #gv-slack { --c: var(--slack); }
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.tags li, .dep, .slmsg { padding: 0.2rem 0.45rem; border-radius: 6px; background: var(--raw); border-left: 3px solid var(--c); font-size: 0.8rem; }
.tags code, .dep code { font-size: 0.76rem; }
.dep { margin-bottom: 0.4rem; }
.dep b { display: block; font: 700 0.8rem ui-monospace, Menlo, monospace; }
.pods { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.pod { font: 0.72rem ui-monospace, Menlo, monospace; padding: 0.1rem 0.4rem; border-radius: 10px; border: 1px solid var(--c); }
.pod.new { background: color-mix(in srgb, var(--c) 18%, transparent); font-weight: 700; }
.slmsg b { display: block; font-size: 0.76rem; }

/* --- the events */
.log { list-style: none; margin: 0; padding: 0; }
.log-intro { font-size: 0.84rem; line-height: 1.45; }
.log-intro p { margin: 0 0 0.4rem; }
.log-intro .main { font-weight: 600; }
.log li { border-bottom: 1px dashed var(--border); }
.log-head { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: 0.4rem; align-items: baseline; padding: 0.15rem 0.3rem; cursor: pointer; }
.log-head::after { content: '▸'; color: var(--dim); font-size: 0.7rem; }
.log li.open .log-head::after { content: '▾'; }
.log-head:focus-visible { outline: 2px solid var(--accent); }
.log li:hover .log-head { background: color-mix(in srgb, var(--flash) 40%, transparent); }
.log li.now .log-head { background: color-mix(in srgb, var(--flash) 75%, transparent); }
.log li.now.open .log-body { background: color-mix(in srgb, var(--flash) 30%, transparent); }
.log-body { padding: 0.2rem 0.5rem 0.5rem 2.1rem; font-size: 0.8rem; line-height: 1.42; }
.log-body p { margin: 0 0 0.3rem; }
.log-body .main { font-weight: 600; font-size: 0.9rem; }
.log .n { color: var(--dim); font-family: ui-monospace, Menlo, monospace; font-size: 0.72rem; }
.log .scene { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); padding: 0.5rem 0.3rem 0.15rem; border-bottom: none; }
.log-body ul.steps, .log-intro ul.steps { margin: 0 0 0.35rem; padding-left: 1.05rem; list-style: disc; }
.log-body ul.steps li, .log-intro ul.steps li { border: 0; margin: 0 0 0.15rem; }
.log-body ul.steps ul.steps, .log-intro ul.steps ul.steps { margin: 0.1rem 0; list-style: circle; }
.log code, .log-intro code { font-size: 0.92em; background: var(--code-bg); padding: 0 0.2em; border-radius: 3px; }

/* --- a tour step's spotlight: what it names pulses, the rest dims */
.gv-stage.spotlight .kv-card:not(.here):not(.gv-log) { opacity: 0.35; }
.gv-stage .act { animation: gv-pulse 1.1s ease-in-out 3; outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
@keyframes gv-pulse { 50% { filter: brightness(1.12); } }

/* --- 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; }
