/* "How work moves through the fleet": the Palamedes pipeline figure on the ai home page (#proof, dark band).
   Markup in index.html (figure.pipe), behaviour in pipeline.js. */
.pipe { --p-gold: var(--gold, #C9A227); --p-cream: var(--cream, #F4EFE6); --p-sage: var(--sage, #BFD3BC);
  --p-line: #2E5A2C; --p-card: #163D15; --p-bad: #F5B7A8;
  margin: 40px 0 36px; padding: 28px; border: 1px solid var(--p-line); border-radius: 16px; background: rgba(0, 0, 0, .12); }
.pipe-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 22px; }
.pipe-head h3 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); margin: 0 0 6px; max-width: 30ch; }
.pipe-head p { margin: 0; color: var(--p-sage); font-size: .95rem; max-width: 60ch; }
.pipe-tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--p-line); border-radius: 999px; }
.pipe-tabs button { font: 600 .88rem var(--sans, system-ui, sans-serif); color: var(--p-sage); background: none; border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer; }
.pipe-tabs button[aria-selected="true"] { background: var(--p-gold); color: #0E2B0D; }
.pipe-tabs button:focus-visible { outline: 3px solid var(--p-gold); outline-offset: 2px; }

.pipe-stage-wrap { position: relative; }
.pipe-flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; position: relative; z-index: 1; }
.pipe-flow[hidden] { display: none; }
.pipe-step { position: relative; background: var(--p-card); border: 1px solid var(--p-line); border-radius: 12px; padding: 12px 12px 12px; min-width: 0; transition: border-color .2s, transform .2s; }
.pipe-step .who { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: .66rem; font-weight: 700; letter-spacing: .07em; overflow-wrap: anywhere; text-transform: uppercase; color: var(--p-sage); }
.pipe-step .who::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--p-gold); flex: none; }
.pipe-step h4 { font-family: var(--serif, Georgia, serif); font-size: 1.02rem; font-weight: 600; line-height: 1.2; margin: 0 0 4px; color: var(--p-cream); }
.pipe-step p { margin: 0; font-size: .82rem; line-height: 1.45; color: var(--p-sage); }
.pipe-step .key { display: inline-block; margin-top: 8px; font: 600 .72rem ui-monospace, "SFMono-Regular", Menlo, monospace; color: var(--p-gold); border: 1px solid rgba(201, 162, 39, .45); border-radius: 999px; padding: 1px 8px; }
.pipe-step .n { display: block; margin-top: 8px; font-family: var(--serif, Georgia, serif); font-size: 1.35rem; font-weight: 600; color: var(--p-gold); font-variant-numeric: tabular-nums; line-height: 1.1; }
.pipe-step .n small { display: block; font: 500 .72rem var(--sans, system-ui, sans-serif); color: var(--p-sage); letter-spacing: 0; }
/* Roles: the dispatcher, the gate and people look different from working agents. */
.pipe-step.is-hub { border-color: var(--p-gold); box-shadow: inset 0 3px 0 var(--p-gold); }
.pipe-step.is-hub .who::before { background: var(--p-gold); }
.pipe-step.is-gate { border-style: dashed; border-color: rgba(201, 162, 39, .7); }
.pipe-step.is-gate .who::before { border-radius: 2px; }
.pipe-step.is-person { background: var(--p-cream); border-color: var(--p-cream); }
.pipe-step.is-person h4, .pipe-step.is-person .who { color: #0E2B0D; }
.pipe-step.is-person p { color: #4E5B4C; }
.pipe-step.is-person .who::before { background: #0E2B0D; border-color: #0E2B0D; }
.pipe-step.is-in .who::before { border-style: dotted; }
.pipe-step.is-lit { border-color: var(--p-gold); transform: translateY(-2px); }
.pipe-step.is-person.is-lit { border-color: var(--p-gold); }

.pipe-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 18px 0 0; padding: 0; list-style: none; font-size: .8rem; color: var(--p-sage); }
.pipe-legend li { display: flex; align-items: center; gap: 7px; }
.pipe-legend i { width: 18px; height: 0; border-top: 2px solid var(--p-gold); }
.pipe-legend i.back { border-top: 2px dashed var(--p-bad); }
.pipe-legend i.dot { width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--p-gold); }

.pipe-contract { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 24px 0 0; padding: 20px 0 0; border-top: 1px solid var(--p-line); list-style: none; }
.pipe-contract li { font-size: .86rem; line-height: 1.45; color: var(--p-sage); }
.pipe-contract b { display: block; color: var(--p-cream); font-size: .92rem; margin-bottom: 2px; }
.pipe-cap { margin: 18px 0 0; font-size: .8rem; color: var(--p-sage); }
.pipe-cap a { color: var(--p-gold); }

/* Overlay: connectors, the send-back loop and moving work items (drawn by pipeline.js, wide screens only). */
.pipe-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.pipe-svg .c { fill: none; stroke: var(--p-gold); stroke-opacity: .55; stroke-width: 2; }
.pipe-svg .back { fill: none; stroke: var(--p-bad); stroke-width: 1.6; stroke-dasharray: 5 5; opacity: .9; }
.pipe-svg .back-t { fill: var(--p-bad); font: 600 11px var(--sans, system-ui, sans-serif); letter-spacing: .02em; }
.pipe-svg .tok { fill: var(--p-gold); stroke: rgba(201, 162, 39, .35); stroke-width: 5; }
.pipe-svg .tok.is-back { fill: var(--p-bad); stroke: rgba(245, 183, 168, .3); }

/* Wide: one row of stages, connectors between them, the send-back loop drawn underneath. */
@media (min-width: 980px) {
  .pipe.is-live .pipe-flow { grid-template-columns: repeat(var(--steps, 8), minmax(0, 1fr)); gap: 14px; padding-bottom: 54px; }
  .pipe.is-live .pipe-step p { font-size: .78rem; }
}
/* Narrow: a vertical rail. */
@media (max-width: 979px) {
  .pipe { padding: 20px 16px; }
  .pipe-flow { padding-left: 20px; border-left: 2px solid rgba(201, 162, 39, .45); margin-left: 6px; }
  .pipe-step::before { content: ""; position: absolute; left: -29px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--p-gold); box-shadow: 0 0 0 3px var(--forest, #0E2B0D); }
  .pipe-step.is-person::before { background: var(--p-cream); }
  .pipe-svg { display: none; }
  .pipe-legend { display: none; }
  .pipe-flow[data-back-label]::after { content: "\21BA  " attr(data-back-label); display: block; margin: 12px 0 0 -20px; padding-left: 20px; color: var(--p-bad); font-size: .8rem; font-weight: 600; }
  .pipe-contract { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .pipe-contract { grid-template-columns: 1fr; }
  .pipe-tabs { width: 100%; }
  .pipe-tabs button { flex: 1; padding: 8px 6px; }
}
@media (prefers-reduced-motion: reduce) { .pipe-step { transition: none; } }
