/* The pipeline board (assets/pipeline.js): tiers left to right as EnMax draws them, Production forking into its blue
   and green copies, and a grid of every feature against every step. Colours come from site.css's tokens; blue and
   green here name the two copies of Production, nothing else. */
/* Five columns need more room than the reading column, so the board runs wider than .wrap, centred on it. */
.pipeline { margin-inline: calc(50% - min(720px, 50vw - 24px)); padding-top: clamp(28px, 5vw, 44px); --pl-blue: var(--accent); --pl-green: var(--up); --pl-run: var(--accent); }

.pl-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-bottom: 18px; }
.pl-top h2 { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); font-weight: 600; width: 100%; }
.pl-project { font-weight: 700; font-size: 1.15rem; }
.pl-usual { color: var(--ink-3); font-size: 0.86rem; }
.pl-usual b { color: var(--ink); font-weight: 600; }
.pl-count { margin-left: auto; padding: 3px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--up); color: var(--up); }
.pl-count[data-kind="deploying"] { border-color: var(--pl-run); color: var(--pl-run); }
.pl-count[data-kind="down"] { border-color: var(--down); color: var(--down); }

/* ---------- the board ---------- */

.pl-board { position: relative; display: grid; gap: 28px 32px; align-items: center;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-areas: "dev qa stage production blue" "dev qa stage production green"; }
.pl-board:not([data-blue-green]) { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "dev qa stage production"; }
.pl-tier[data-tier="dev"] { grid-area: dev; }
.pl-tier[data-tier="qa"] { grid-area: qa; }
.pl-tier[data-tier="stage"] { grid-area: stage; }
.pl-tier[data-tier="production"] { grid-area: production; }
.pl-copy[data-color="blue"] { grid-area: blue; }
.pl-copy[data-color="green"] { grid-area: green; }

/* Stacked, Production sits on top and work climbs up to it: Dev at the bottom, Production's two copies above it. */
@media (max-width: 1180px) {
  .pl-board { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 16px;
    grid-template-areas: "blue green" "production production" "stage stage" "qa qa" "dev dev"; }
  .pl-copy { align-self: start; }
  .pl-board:not([data-blue-green]) { grid-template-columns: 1fr; grid-template-areas: "production" "stage" "qa" "dev"; }
}
@media (max-width: 520px) {
  .pl-board { grid-template-columns: 1fr; grid-template-areas: "blue" "green" "production" "stage" "qa" "dev"; }
}

.pl-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.pl-line { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.pl-line[data-kind="live"] { stroke: var(--up); stroke-width: 2; }
.pl-line[data-kind="deploying"] { stroke: var(--pl-run); stroke-dasharray: 5 4; }
.pl-line[data-kind="standby"] { stroke-dasharray: 2 4; }
.pl-arrow { fill: var(--line-2); }

.pl-card { position: relative; z-index: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--up); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); font-size: 0.85rem; display: flex; flex-direction: column; gap: 6px; }
.pl-card[data-kind="deploying"], .pl-card[data-role="deploying"] { border-top-color: var(--pl-run); }
.pl-card[data-kind="down"] { border-top-color: var(--down); }
.pl-card[data-kind="unknown"], .pl-card[data-role="unknown"] { border-top-color: var(--unknown); }
.pl-copy[data-color="blue"] { border-left: 4px solid var(--pl-blue); }
.pl-copy[data-color="green"] { border-left: 4px solid var(--pl-green); }
.pl-copy[data-role="standby"] { border-top-color: var(--line-2); }

.pl-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.pl-head h3 { font-size: 1rem; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.pl-swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--pl-blue); }
.pl-copy[data-color="green"] .pl-swatch { background: var(--pl-green); }

.pl-badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; border: 1px solid currentColor; }
.pl-badge[data-kind="live"] { color: var(--up); }
.pl-badge[data-kind="deploying"] { color: #fff; background: var(--pl-run); border-color: var(--pl-run); }
.pl-badge[data-kind="down"] { color: var(--down); }
.pl-badge[data-kind="standby"], .pl-badge[data-kind="unknown"] { color: var(--ink-3); }
.pl-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
@media (prefers-reduced-motion: no-preference) { .pl-badge-dot { animation: pl-pulse 1.4s ease-in-out infinite; } }
@keyframes pl-pulse { 50% { opacity: 0.3; } }

.pl-url { color: var(--accent); text-decoration: none; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-url:hover { text-decoration: underline; }
.pl-build { display: flex; gap: 8px; min-width: 0; }
.pl-build .mono { color: var(--ink-3); flex: none; }
.pl-build-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-when { color: var(--ink-3); font-size: 0.8rem; }
.pl-when time { color: var(--up); font-weight: 600; }
.pl-ready { all: unset; cursor: pointer; align-self: flex-start; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 0.78rem; }
.pl-ready:hover { text-decoration: underline; }
.pl-ready:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pl-fork-note { color: var(--ink-3); font-size: 0.78rem; }
.pl-fork-note span { color: var(--pl-run); font-weight: 600; }

.pl-here { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding-top: 4px; border-top: 1px dashed var(--line); }
.pl-here li { padding: 1px 7px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-size: 0.72rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pl-traffic { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 0.78rem; }
.pl-traffic-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); }
.pl-traffic-bar[data-on] { background: var(--pl-green); }
.pl-copy[data-color="blue"] .pl-traffic-bar[data-on] { background: var(--pl-blue); }

/* ---------- a deploy on its way ---------- */

.pl-incoming { margin-top: 4px; padding: 10px; border-radius: 8px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.pl-in-title { display: flex; align-items: center; gap: 6px; font-weight: 600; min-width: 0; }
.pl-in-sub { color: var(--ink-3); font-size: 0.78rem; }
.pl-branch { color: var(--accent); }
.pl-spin { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--pl-run); }
@media (prefers-reduced-motion: no-preference) { .pl-spin, .pl-step[data-stage="running"] .pl-step-mark { animation: pl-turn 1s linear infinite; } }
@keyframes pl-turn { to { transform: rotate(360deg); } }
.pl-in-total { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.pl-in-total .pl-bar { flex: 1; height: 6px; }

.pl-bar { display: block; height: 4px; border-radius: 3px; background: var(--line); overflow: hidden; }
.pl-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--pl-run); }
.pl-bar[data-state="done"] > i { background: var(--up); }
.pl-bar[data-state="failed"] > i { background: var(--down); }

.pl-steps { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.pl-step { display: grid; grid-template-columns: 14px 1fr auto; grid-template-areas: "mark label time" ". bar bar"; column-gap: 6px; row-gap: 3px; font-size: 0.8rem; }
.pl-step[data-sub] { padding-left: 14px; }
.pl-step-mark { grid-area: mark; align-self: center; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-2); }
.pl-step[data-stage="done"] .pl-step-mark { border: 0; background: var(--up); }
.pl-step[data-stage="running"] .pl-step-mark { border-color: var(--line-2); border-top-color: var(--pl-run); }
.pl-step[data-stage="failed"] .pl-step-mark { border: 0; background: var(--down); }
.pl-step-label { grid-area: label; font-weight: 500; }
.pl-step[data-stage="queued"] .pl-step-label { color: var(--accent); font-weight: 500; }
.pl-step > .pl-bar { grid-area: bar; align-self: center; }
.pl-step-time { grid-area: time; color: var(--ink-3); font-size: 0.72rem; white-space: nowrap; }
.pl-eta { color: var(--ink-2); font-size: 0.8rem; }

/* ---------- the feature slots under Dev ---------- */

.pl-slots-wrap { margin-bottom: 32px; }
.pl-slot p { margin: 0; }
.pl-ready-count { color: var(--up); letter-spacing: 0.06em; }
.pl-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; align-items: start; }
.pl-slot[data-kind="ready"] { border-color: var(--up); box-shadow: 0 0 0 1px var(--up), var(--shadow); }
.pl-badge[data-kind="ready"] { color: var(--up); background: color-mix(in srgb, var(--up) 12%, transparent); }
.pl-slot .pl-when[data-failed] time { color: var(--down); }
.pl-chip { display: inline-block; max-width: 100%; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.pl-try { margin-top: 4px; padding: 10px; border-radius: 8px; background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent); display: flex; flex-direction: column; gap: 5px; }
.pl-try-feature { font-weight: 700; color: var(--ink); }
.pl-try-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--gold); font-weight: 600; }
.pl-try-count { padding: 1px 8px; border-radius: 999px; background: var(--gold); color: #fff; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.pl-look { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.pl-look-label { font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: var(--gold); }
.pl-screen { padding: 1px 7px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-size: 0.74rem; font-weight: 600; }
.pl-try-group { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700; color: var(--ink-2); }
.pl-try-quiet { color: var(--ink-3); font-size: 0.76rem; }
.pl-try-none { margin-top: 4px; padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: 8px; color: var(--ink-3); font-size: 0.8rem; }

/* ---------- every feature against every step ---------- */

.pl-features { margin-top: 36px; padding-top: 20px; border-top: 1px dashed var(--line-2); }
.pl-sub { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 12px; }
.pl-up { color: var(--gold); }
.pl-stale { margin: -4px 0 10px; font-size: 0.78rem; }
.pl-grid-scroll { overflow-x: auto; }
.pl-grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.82rem; min-width: 1040px; }
.pl-grid th, .pl-grid td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.pl-grid thead th { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.pl-grid thead th[data-tier] { color: var(--ink); }
.pl-grid th:first-child { text-align: left; width: 32%; padding-left: 0; }
/* The steps share the rest evenly, so each has room for a note like "not pushed" or a build id. */
.pl-grid thead th:not(:first-child) { width: calc(68% / 11); }
.pl-grid :not([data-tier]) + [data-tier] { border-left: 1px dashed var(--line-2); }
.pl-fname { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pl-fstatus { display: block; padding-left: 16px; color: var(--ink-2); font-weight: 400; font-size: 0.76rem; }
.pl-tone { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.pl-frow[data-tone="green"] .pl-tone { background: var(--up); }
.pl-frow[data-tone="gold"] .pl-tone { background: var(--warn); }
.pl-frow[data-tone="bad"] .pl-tone { background: var(--down); }
.pl-frow[data-tone="done"] .pl-tone { background: var(--ink-3); }

/* A line runs through the row, solid as far as the feature has got. */
.pl-cell { position: relative; --pl-note-line: 13px; --pl-note-h: calc(2 * var(--pl-note-line)); }
.pl-cell::before { content: ""; position: absolute; left: 0; right: 0; top: calc(50% - (var(--pl-note-h) + 2px) / 2 - 1px); height: 2px; background: var(--line); }
.pl-cell[data-state="done"]::before { background: var(--up); }
.pl-frow td:nth-child(2)::before { left: 50%; }
.pl-frow td:last-child::before { right: 50%; }
.pl-pip { position: relative; display: grid; place-items: center; margin: 0 auto; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line-2); font-size: 0.7rem; font-weight: 700; color: #fff; }
.pl-cell[data-state="done"] .pl-pip { background: var(--up); border-color: var(--up); }
.pl-cell[data-state="failed"] .pl-pip { background: var(--down); border-color: var(--down); }
.pl-cell[data-state="waiting"] .pl-pip { background: var(--warn); border-color: var(--warn); }
.pl-cell[data-state="running"] .pl-pip { border-color: var(--pl-run); border-top-color: transparent; }
@media (prefers-reduced-motion: no-preference) { .pl-cell[data-state="running"] .pl-pip { animation: pl-turn 1.2s linear infinite; } }
.pl-cell[data-state="none"] .pl-pip { visibility: hidden; }
/* Only a running step turns; the "now" ring stands still on a step that is waiting or not yet. */
.pl-cell[data-now] .pl-pip { box-shadow: 0 0 0 3px var(--gold-soft), 0 0 0 4px var(--gold); }
.pl-cell:not([data-state="running"]) .pl-pip { animation: none; }
/* The step's note under its mark, up to two lines; zero width to the table, so a long one never widens its column, only fills it. */
.pl-cell .pl-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; width: 0; min-width: 100%; height: var(--pl-note-h); margin-top: 2px; font-size: 0.64rem; line-height: var(--pl-note-line); color: var(--ink-3); overflow: hidden; overflow-wrap: anywhere; }
.pl-empty { padding: 12px 0; }
.pl-frow[data-flash] > * { background: var(--gold-soft); transition: background 0.4s var(--ease); }
