.pipeline-page {
  background: var(--body-bg);
}

.pipe-shell {
  width: min(100%, 82rem);
  max-width: none;
  padding: 3rem 2.5rem 6rem;
}

/* ─── Hero ─── */

.pipe-hero {
  margin: 0 0 2rem;
}

.pipe-hero h1 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--heading-color);
  margin: 0;
}

.pipe-hero p {
  margin-top: 0.375rem;
  color: rgba(0, 0, 0, 0.5);
  font-size: 0.875rem;
}

/* ─── Layout: side nav + content ─── */

.pipe-layout {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 3rem;
}

/* ─── Side navigation ─── */

.pipe-nav {
  position: sticky;
  top: 2rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding-top: 0.25rem;
}

.pipe-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.625rem;
  border-radius: 0.375rem;
  color: rgba(0, 0, 0, 0.52);
  font-size: 0.8125rem;
  font-weight: 520;
  line-height: 1.25;
  text-decoration: none;
  transition: background 100ms, color 100ms;
}

.pipe-nav a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #111;
}

.pipe-nav span {
  color: rgba(0, 0, 0, 0.26);
  font-size: 0.625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 1rem;
}

/* ─── Content ─── */

.pipe-content {
  display: grid;
  gap: 0;
}

/* ─── Stage sections ─── */

.pipe-stage {
  padding: 2.5rem 0;
  border-top: 1px solid var(--soft-line);
  scroll-margin-top: 2rem;
}

.pipe-stage:first-child {
  padding-top: 0;
  border-top: 0;
}

.pipe-stage > header {
  margin-bottom: 1.5rem;
}

.pipe-stage > header h2 {
  font-size: 1.0625rem;
  font-weight: 680;
  color: var(--heading-color);
  margin: 0;
  line-height: 1.35;
}

.pipe-stage > header h2 span {
  color: rgba(0, 0, 0, 0.26);
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.pipe-stage > header p {
  margin-top: 0.25rem;
  color: rgba(0, 0, 0, 0.52);
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* ─── Blocks (content units within a stage) ─── */

.pipe-block {
  padding: 0.875rem 0;
}

.pipe-block + .pipe-block {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.pipe-block h3 {
  font-size: 0.75rem;
  font-weight: 680;
  color: rgba(0, 0, 0, 0.52);
  margin: 0 0 0.5rem;
  line-height: 1;
}

.pipe-block p {
  color: rgba(0, 0, 0, 0.74);
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 0;
}

.pipe-block ul,
.pipe-block ol {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.25rem;
}

.pipe-block li {
  color: rgba(0, 0, 0, 0.72);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.pipe-block dl {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) minmax(0, 1fr);
  gap: 0.3rem 0.75rem;
}

.pipe-block dt {
  color: rgba(0, 0, 0, 0.38);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}

.pipe-block dd {
  color: rgba(0, 0, 0, 0.74);
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* Gate blocks */
.pipe-block--gate {
  background: var(--danger-soft-tint);
  border-radius: 0.375rem;
  padding: 0.75rem 0.875rem;
  margin-top: 0.5rem;
}

.pipe-block--gate h3 {
  color: var(--danger-color);
}

.pipe-block--gate + .pipe-block {
  border-top: 0;
}

/* Minor blocks */
.pipe-block--minor {
  opacity: 0.72;
}

/* ─── Collapsible prompts ─── */

.pipe-prompt-wrap {
  margin: 0.375rem 0;
  border-radius: 0.375rem;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.pipe-prompt-wrap + .pipe-prompt-wrap {
  margin-top: 0.25rem;
}

.pipe-prompt-wrap summary {
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  color: rgba(0, 0, 0, 0.56);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  user-select: none;
}

.pipe-prompt-wrap summary:hover {
  color: #111;
}

.pipe-prompt-wrap pre {
  margin: 0;
  padding: 0 0.75rem 0.625rem;
  color: rgba(0, 0, 0, 0.62);
  font-family: var(--font-code);
  font-size: 0.6875rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ─── Stage footer (implementation files) ─── */

.pipe-stage > footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.pipe-stage > footer code {
  font-family: var(--font-code);
  font-size: 0.6875rem;
  color: rgba(0, 0, 0, 0.42);
  line-height: 1;
  padding: 0.25rem 0.5rem;
  background: rgba(0, 0, 0, 0.025);
  border-radius: 0.25rem;
}

/* ─── Code inline ─── */

.pipe-block code,
.pipe-stage > header code {
  font-family: var(--font-code);
  font-size: 0.88em;
}

/* ─── Responsive ─── */

@media screen and (max-width: 768px) {
  .pipe-shell {
    padding: 2rem 1rem 4rem;
  }

  .pipe-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .pipe-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0;
    padding-bottom: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--soft-line);
  }

  .pipe-nav a {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
  }

  .pipe-block dl {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .pipe-block dt {
    padding-top: 0.25rem;
  }
}
