/* The workshop board: the control panel of a workshop flying from repo to repo.
   Dark only. A banner, a status strip, then one column of riveted stage modules
   holding glass readout cards. Plants and robots live only in banner.jpg; the scene laid
   over it (components/scene.js) lights its stations up with the board's stages. */
:root {
  --sky-top: #181444;       /* the banner image's own sky, so the seam above 1400px doesn't show */
  --sky-low: #5e3e80;
  --deck: #0e0c1d;          /* hull behind the modules */
  --metal: #1d1938;         /* module face */
  --metal-hi: #2c2652;      /* module bevel, light edge */
  --metal-lo: #0a0817;      /* module bevel, dark edge */
  --glass: #0c1424;         /* readout screen */
  --seam: #332c5e;
  --fg: #e9e6ff;
  --muted: #9a93c8;
  --holo: #5ee7f2;
  --holo-dim: rgba(94, 231, 242, .13);
  --lamp: #ffc36b;
  --ok: #6fd38a;
  --warn: #ffd34d;
  --bad: #ff5d76;
  --bad-dim: rgba(255, 93, 118, .12);
  --pr: #b99cff;            /* a merged PR's or closed issue's badge, and the Closed stage */
  --blue: #7fb2ff;          /* the Queue stage */
  --f-display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 3px;                 /* the one radius for every chip */
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--deck); }
body {
  margin: 0; color: var(--fg);
  background: var(--deck);
  font: 15px/1.45 var(--f-body);
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 64px var(--gutter);
}
a { color: inherit; }
h1, h2 { font-family: var(--f-display); text-wrap: balance; margin: 0; }
:focus-visible { outline: 2px solid var(--holo); outline-offset: 2px; }

/* ---------- banner: one 3:1 image, crops come off the sky and the sides ---------- */
.banner {
  margin-inline: calc(-1 * var(--gutter));
  position: relative; overflow: hidden;
  height: clamp(200px, 26vw, 340px);
  background: linear-gradient(180deg, var(--sky-top), var(--sky-low));
  border-bottom: 3px solid var(--metal-hi);
}
.banner .art { position: relative; height: 100%; max-width: 1400px; margin: 0 auto; }
.banner img {
  display: block; height: 100%; width: 100%;
  object-fit: cover; object-position: center bottom;
}
@media (min-width: 1401px) { /* wider than the image: its sides fade into the CSS sky */
  .banner .art {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  }
}
/* the scene: CSS animates only opacity (and the ring's dash); scene.js moves things with
   SVG attributes, which stay put on phones where CSS transforms on scaled SVG drift */
.scene { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* Only a lit station takes clicks. Its brackets mark it at rest and pulse twice on load; on
   hover or focus the full frame replaces them. No smooth scroll-behavior on the page: see index.html. */
.scene a.station { pointer-events: auto; cursor: pointer; }
.scene a.station:focus { outline: none; }
.scene .brackets { opacity: .75; transition: opacity .15s; animation: ping .9s ease-in-out 2; }
.scene .hit { stroke-opacity: 0; transition: stroke-opacity .15s; }
.scene a.station:hover .hit, .scene a.station:focus-visible .hit { stroke-opacity: .95; }
.scene a.station:hover .brackets, .scene a.station:focus-visible .brackets { opacity: 0; }
@keyframes ping { 50% { opacity: .15; } }
.art.live img { visibility: hidden; } /* the scene draws the image itself; the <img> is the fallback */
.scene .pr { animation: flicker 3.2s infinite; }
.scene .warning, .scene .fail { animation: pulse 1.1s ease-in-out infinite alternate; }
.scene .wait { mix-blend-mode: screen; animation: breathe 3s ease-in-out infinite; }
.scene .sprout { animation: breathe 2.4s ease-in-out infinite; }
.scene .healthy { animation: breathe 4s ease-in-out infinite; }
.scene .ui { opacity: .8; }
.scene .ui.idle { opacity: .5; }
.scene .wave { stroke-dasharray: 6 5; animation: dash 2.5s linear infinite; }
.scene .beacon { animation: blink 2.2s steps(2, start) infinite; }
.scene .ring { stroke-dasharray: 70 1500; stroke-dashoffset: 1570; opacity: .55; animation: ring 9s linear infinite; }
.scene.paused * { animation: none; }
@keyframes pulse { from { opacity: 1; } to { opacity: .55; } }
@keyframes breathe { 50% { opacity: .5; } }
@keyframes flicker { 0%, 47%, 50%, 100% { opacity: 1; } 48% { opacity: .55; } 82% { opacity: .85; } }
@keyframes dash { to { stroke-dashoffset: -22; } }
@keyframes ring { to { stroke-dashoffset: 0; } }

.banner-title { color: #fff; }
.banner-title h1 { font-size: clamp(26px, 4vw, 38px); letter-spacing: .03em; text-shadow: 0 2px 12px #0009; }
.banner-sub { max-width: 1080px; margin: 14px auto 0; color: var(--muted); }
@media (min-width: 601px) { /* the title sits on the image's upper-left sky */
  .banner-title {
    position: absolute; top: clamp(28px, 4.5vw, 64px);
    left: max(var(--gutter), calc(max(0px, (100vw - 1400px) / 2) + min(100vw, 1400px) * .04));
  }
}
@media (max-width: 600px) { /* phones: the title moves below the image */
  .banner-title { padding-top: 16px; }
  .banner-title h1 { text-shadow: none; }
  .banner-sub { margin-top: 4px; }
}

main { max-width: 1080px; margin: 0 auto; }

/* ---------- notices: paused, stale, load error ---------- */
.notice {
  margin: 18px 0 0; padding: 10px 14px; border-radius: 6px;
  font: 600 14px var(--f-display); letter-spacing: .04em;
  border: 1px solid var(--n); color: var(--n);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--n) 12%, transparent) 0 10px, transparent 10px 20px), var(--metal);
}
.notice.paused { --n: var(--lamp); }
.notice.stale { --n: var(--warn); }
.notice.error { --n: var(--bad); }

/* ---------- status strip ---------- */
.status {
  margin: 18px 0 22px;
  padding: 10px 14px; border-radius: 6px;
  background: var(--metal); border: 1px solid var(--metal-lo);
  box-shadow: inset 0 1px 0 var(--metal-hi);
  font: 12px var(--f-mono); color: var(--muted); letter-spacing: .04em; text-transform: uppercase;
}
.status b { color: var(--fg); font-weight: 600; }
.status a { color: var(--holo); }
/* Each item stays on one line, with a seam in the gap before it. The seam before the first
   item on each line falls left of the items box, which clips it. */
.status .items { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; overflow: hidden; }
.status .items > span { position: relative; white-space: nowrap; }
.status .items > span::before {
  content: ""; position: absolute; left: -10px; top: 50%; width: 1px; height: 14px;
  margin-top: -7px; background: var(--seam);
}
.status [class^="m-"], .status [class^="m-"] b { color: var(--c); } /* a stage's count in its colour */

/* ---------- stage modules ---------- */
.line { display: grid; gap: 22px; }
.module {
  scroll-margin-top: 16px; transition: box-shadow .3s; /* a station's jump lands 16px from the top, then flashes it */
  position: relative; border-radius: 8px; padding: 0 0 14px;
  border: 1px solid var(--metal-lo);
  box-shadow: inset 0 1px 0 var(--metal-hi), 0 8px 20px #0006;
  background: /* a rivet in each corner */
    radial-gradient(circle at 9px 9px, var(--metal-hi) 2px, transparent 2.5px),
    radial-gradient(circle at calc(100% - 9px) 9px, var(--metal-hi) 2px, transparent 2.5px),
    radial-gradient(circle at 9px calc(100% - 9px), var(--metal-hi) 2px, transparent 2.5px),
    radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), var(--metal-hi) 2px, transparent 2.5px),
    var(--metal);
}
.module-head {
  position: relative; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 84px 10px 22px; border-bottom: 1px solid var(--metal-lo);
  box-shadow: 0 1px 0 var(--metal-hi);
}
.module.flash { box-shadow: 0 0 0 2px var(--c), 0 0 28px color-mix(in srgb, var(--c) 45%, transparent); }
.led { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--c); box-shadow: 0 0 8px var(--c), inset 0 -2px 3px #0005; }
.module h2 { font-size: 16px; letter-spacing: .08em; text-transform: uppercase; }
.module .hint { font: 12px var(--f-mono); color: var(--muted); }
.readout { /* the count, as a recessed digital display */
  position: absolute; top: 8px; right: 22px; font: 600 15px var(--f-mono); color: var(--c); min-width: 3.2ch; text-align: right;
  padding: 2px 8px; border-radius: var(--r); background: var(--glass);
  box-shadow: inset 0 1px 3px #000c; text-shadow: 0 0 6px var(--c);
  font-variant-numeric: tabular-nums;
}
.stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; padding: 14px 22px 0; }

.m-stuck { --c: var(--bad); }
.m-stuck .module-head { background: repeating-linear-gradient(135deg, var(--bad-dim) 0 10px, transparent 10px 20px); }
.m-stuck .led { animation: blink 1.2s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.m-waiting { --c: var(--warn); }
.m-closed { --c: var(--pr); }
.m-pr { --c: var(--ok); }
.m-queue { --c: var(--blue); }
.m-behind { --c: var(--muted); }

/* ---------- readout cards ---------- */
.card {
  position: relative; min-width: 0; display: grid; gap: 7px; align-content: start;
  padding: 10px 12px; border-radius: 4px;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 3px), var(--glass);
  border: 1px solid #000;
  box-shadow: inset 0 0 0 1px var(--holo-dim), inset 0 0 18px rgba(94, 231, 242, .05);
}
.card::before { /* the stage's colour as a thin lit edge */
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: var(--c); box-shadow: 0 0 6px var(--c);
}
.card .title { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.card .title a { text-decoration: none; }
.card .title a:hover { text-decoration: underline; text-decoration-color: var(--holo); }
.card .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card .why { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

/* every chip is the same rectangle; only its fill or outline changes */
/* every chip and badge on a card's top row is --h tall, whatever its font or icon */
.card { --h: 22px; }
.chip { display: inline-flex; align-items: center; height: var(--h); font: 600 11px/1 var(--f-mono); padding: 0 7px; border-radius: var(--r); letter-spacing: .03em; border: 1px solid transparent; }
.chip.repo { color: var(--repo); border-color: currentColor; }
.chip.tier { background: var(--holo-dim); color: var(--holo); }
.chip.sub { background: var(--metal-hi); color: var(--fg); }
/* Octicons, and the badge: a small link to the card itself (its kind's icon, number and a PR's CI)
   or to its other kind (a PR's issue, an issue's merged PRs) */
.ic { width: 14px; height: 14px; flex: none; fill: currentColor; }
.badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: var(--h); font: 600 11px/14px var(--f-mono); /* 14px: the icon's height, so it sits on the text's line */ padding: 0 7px; border-radius: var(--r); border: 1px solid currentColor; text-decoration: none; }
.badge.issue { justify-self: start; }
/* by state, as on GitHub: open green, merged PR and closed (done) issue purple */
.badge.open { color: var(--ok); }
.badge.merged, .badge.closed { color: var(--pr); }
.badge:hover { background: rgba(255, 255, 255, .06); }
.badge .tt { color: var(--fg); font-weight: 400; overflow-wrap: anywhere; }
.badge.wide { align-items: flex-start; height: auto; min-height: var(--h); padding-block: 3px; } /* a wrapped title keeps the icon on its first line */
.noissue { color: var(--muted); font: italic 12px var(--f-body); }
.chip.claude { color: #f0a283; border-color: currentColor; text-decoration: none; padding: 0 5px; font: 700 15px/1 var(--f-body); } /* Claude's coral */
.chip.claude:hover { background: rgba(240, 162, 131, .14); }
.check { display: inline-flex; align-items: center; margin-left: 2px; } /* a PR's CI, inside its badge after the number */
.check.green { color: var(--ok); }
.check.red { color: var(--bad); }
.check.pending { color: var(--lamp); }

.card[hidden] { display: none; }
.more { /* below a module's cards, as wide as their grid: reveals the next ones */
  display: block; width: calc(100% - 44px); min-height: 44px; margin: 12px 22px 0; padding: 8px 14px; cursor: pointer;
  font: 600 12px var(--f-mono); letter-spacing: .04em; text-transform: uppercase;
  color: var(--c); background: var(--glass); border: 1px solid currentColor; border-radius: var(--r);
}
.more:hover { background: rgba(255, 255, 255, .06); }

.empty { grid-column: 1 / -1; font: 12px var(--f-mono); color: var(--muted); padding: 4px 0; letter-spacing: .04em; text-transform: uppercase; }
.empty::before { content: "◦ "; color: var(--c); }

@media (max-width: 560px) {
  .module-head { padding-inline: 12px 74px; }
  .stack { padding-inline: 12px; }
  .readout { right: 12px; }
  .more { width: calc(100% - 24px); margin-inline: 12px; }
  .stack { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .m-stuck .led, .scene * { animation: none; } }
