/* ================================================================
   AMTP Documentation — assets/styles.css
   ZagTrader brand. Chakra Petch + Hanken Grotesk.
   Dark default, light via prefers-color-scheme.
   ================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* --- Custom properties ----------------------------------------- */
:root {
  color-scheme: dark;

  --bg: oklch(12.5% 0.012 240);
  --surface: oklch(17% 0.013 240);
  --surface-2: oklch(21% 0.014 240);
  --fg: oklch(92% 0.007 240);
  --muted: oklch(58% 0.012 240);

  --accent: oklch(63% 0.2 241);
  --accent-hover: oklch(70% 0.18 241);
  --accent-dim: oklch(28% 0.1 241);

  --border: oklch(26% 0.015 240);
  --nav-bg: oklch(10% 0.014 240);

  --code-bg: oklch(15% 0.013 240);
  --code-fg: oklch(88% 0.009 240);

  --table-stripe: oklch(19.5% 0.013 240);

  --planned-bg: oklch(17% 0.018 58);
  --planned-border: oklch(55% 0.13 58);
  --planned-fg: oklch(78% 0.09 58);

  --info-bg: oklch(16% 0.015 240);
  --info-border: oklch(55% 0.17 240);
  --info-fg: oklch(75% 0.12 240);

  --warning-bg: oklch(17% 0.016 82);
  --warning-border: oklch(65% 0.14 82);
  --warning-fg: oklch(80% 0.1 80);

  --danger-bg: oklch(16% 0.016 22);
  --danger-border: oklch(55% 0.2 22);
  --danger-fg: oklch(75% 0.14 22);

  --radius: 0.25rem;

  --font-head: "Chakra Petch", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Fira Code", "Courier New", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg: oklch(97% 0.006 240);
    --surface: oklch(99% 0.006 240);
    --surface-2: oklch(95% 0.008 240);
    --fg: oklch(18% 0.012 240);
    --muted: oklch(44% 0.014 240);

    --accent: oklch(46% 0.22 248);
    --accent-hover: oklch(38% 0.22 248);
    --accent-dim: oklch(90% 0.07 248);

    --accent-nav-light: oklch(72% 0.18 241);

    --border: oklch(86% 0.009 240);
    --nav-bg: oklch(14% 0.014 240);

    --code-bg: oklch(94% 0.007 240);
    --code-fg: oklch(24% 0.015 240);

    --table-stripe: oklch(96% 0.006 240);

    --planned-bg: oklch(97% 0.014 60);
    --planned-border: oklch(52% 0.14 58);
    --planned-fg: oklch(32% 0.12 58);

    --info-bg: oklch(96% 0.009 240);
    --info-border: oklch(48% 0.19 248);
    --info-fg: oklch(28% 0.16 248);

    --warning-bg: oklch(98% 0.014 90);
    --warning-border: oklch(58% 0.14 82);
    --warning-fg: oklch(32% 0.12 75);

    --danger-bg: oklch(98% 0.012 20);
    --danger-border: oklch(50% 0.22 22);
    --danger-fg: oklch(28% 0.18 20);
  }
}

/* --- Base ------------------------------------------------------- */
html {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Skip link -------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 9999;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: var(--nav-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
}

/* --- Navigation ------------------------------------------------- */
.site-header {
  background: var(--nav-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.site-nav {
  display: flex;
  align-items: center;
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  flex-wrap: wrap;
}

.site-nav .nav-home {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-decoration: none;
  padding: 0.65rem 1.25rem 0.65rem 0;
  margin-right: 0.75rem;
  white-space: nowrap;
  text-transform: uppercase;
  border-right: 1px solid var(--border);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}

.site-nav ul li a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.875rem 0.875rem;
  transition: color 0.1s;
  white-space: nowrap;
}

.site-nav ul li a:hover {
  color: var(--fg);
}

.site-nav ul li a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.site-nav ul li a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
  background: var(--accent-dim);
  border-radius: 2px;
}

/* --- Main ------------------------------------------------------- */
main {
  flex: 1;
  max-width: 76rem;
  margin: 2.5rem auto;
  padding: 0 1.5rem 4rem;
  width: 100%;
}

main.wide {
  max-width: 92rem;
}

/* --- Typography ------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-head);
  line-height: 1.25;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-top: 0;
  letter-spacing: -0.01em;
}
.hero h1::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  background: var(--accent);
  margin-bottom: 0.75rem;
}
h2 {
  font-size: clamp(1.3rem, 2.5vw, 1.6rem);
  margin-top: 3rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}
h3 {
  font-size: 1.1rem;
  margin-top: 1.75rem;
}
h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

p {
  margin: 0.75rem 0;
}
ul,
ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}
li {
  margin: 0.3rem 0;
}

/* Prose readability — 72ch cap on body text */
main p,
main li {
  max-width: 72ch;
}

/* Restore for components where width is set by layout */
main figure p,
main figure li,
main table p,
main table li,
main .card p,
main .card li {
  max-width: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Glossary links (dfn) --------------------------------------- */
/* dfn-wrapped anchors point to /concepts.html#section. They must be
   visually distinct from regular nav links to signal "inline definition
   lookup, jump to primer". Dotted underline + neutral fg colour. */
dfn a {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  font-style: normal;
  color: var(--fg);
}
dfn a:hover {
  color: var(--accent);
  text-decoration: underline solid;
}

/* --- Cite ------------------------------------------------------- */
cite {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.82em;
  color: var(--muted);
  background: var(--code-bg);
  padding: 0.1em 0.4em;
  border-radius: 0.2rem;
  border: 1px solid var(--border);
  white-space: nowrap;
}

cite::before {
  content: "\00a7\00a0";
  opacity: 0.6;
}

/* --- Code ------------------------------------------------------- */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
  tab-size: 2;
}

pre code {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--code-fg);
  background: transparent;
  padding: 0;
  line-height: 1.75;
  border: none;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  color: var(--code-fg);
  background: var(--code-bg);
  padding: 0.1em 0.4em;
  border-radius: 0.2rem;
  border: 1px solid var(--border);
}

figure {
  margin: 1rem 0;
}

figcaption {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.3rem;
  font-style: italic;
}

/* --- Tables ----------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  background: var(--surface);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: left;
  padding: 0.55rem 0.875rem;
  border: 1px solid var(--border);
}

td {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  vertical-align: top;
}

tr:nth-child(even) td {
  background: var(--table-stripe);
}

.failure-matrix th,
.failure-matrix td {
  font-family: var(--mono);
  font-size: 0.78rem;
}

/* --- Asides / call-outs ---------------------------------------- */
/* No border-left stripes — full border + tinted background.     */
.status {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  font-size: 0.88rem;
  border: 1px solid;
}

.status--planned {
  background: var(--planned-bg);
  border-color: var(--planned-border);
  color: var(--planned-fg);
}

.status--planned strong.label {
  display: block;
  font-family: var(--font-head);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
  color: var(--planned-border);
}

.status--info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-fg);
}

.status--warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning-fg);
}

.status--danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-fg);
}

/* --- Hero (index page) ----------------------------------------- */
.hero {
  padding: 3rem 0 2rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  color: var(--fg);
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0.5rem 0 0;
  max-width: 62ch;
  line-height: 1.7;
}

.hero .hero-meta {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.2em 0.65em;
  border-radius: 2px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
}

/* --- Card grid (site map) --------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 1.5rem 0;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card {
  background: var(--surface);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--fg);
  display: block;
  transition: background 0.1s;
}

.card:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.card:active {
  background: var(--surface-2);
}

.card h3 {
  color: var(--accent);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
  letter-spacing: 0.02em;
}

.card p {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 0;
  line-height: 1.55;
  font-family: var(--font-body);
}

.card--primary {
  grid-column: 1 / -1;
}

/* --- Quick-facts table ----------------------------------------- */
.quick-facts {
  margin: 1.5rem 0;
}
.quick-facts th {
  width: 38%;
}

/* --- Section spacing ------------------------------------------- */
section + section {
  margin-top: 2.5rem;
}
article + article {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

/* --- Definition lists ------------------------------------------ */
dl {
  margin: 0.75rem 0;
}
dt {
  font-weight: 600;
  margin-top: 0.75rem;
}
dd {
  margin-left: 1.5rem;
  color: var(--muted);
}

/* --- Footer ---------------------------------------------------- */
.site-footer {
  background: var(--nav-bg);
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  padding: 1rem 1.5rem;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.site-footer code {
  color: var(--muted);
  background: transparent;
  border: none;
  font-size: inherit;
  padding: 0;
}

/* --- Responsive ------------------------------------------------ */

/* Intermediate breakpoint: tablet / small desktop (≤64rem / 1024px) */
@media (max-width: 64rem) {
  main {
    margin: 2rem auto;
    padding: 0 1.25rem 3rem;
  }
  .hero {
    padding: 2.5rem 0 1.75rem;
  }
  .site-nav ul li a {
    padding: 0.875rem 0.625rem;
  }
}

@media (max-width: 40rem) {
  .site-header::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2.5rem;
    pointer-events: none;
    background: linear-gradient(to right, transparent, var(--nav-bg));
    z-index: 2;
  }
  .site-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 0 0.75rem;
  }
  .site-nav::-webkit-scrollbar {
    display: none;
  }
  .site-nav .nav-home {
    flex-shrink: 0;
    font-size: 0.875rem;
  }
  .site-nav ul {
    flex-wrap: nowrap;
    padding-right: 1rem;
  }
  .site-nav ul li a {
    padding: 0.875rem 0.75rem;
    font-size: 0.8rem;
  }
  main {
    padding: 0 1rem 2rem;
  }
  .hero {
    padding: 1.75rem 0 1.25rem;
  }
}

@media (max-width: 50rem) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Reduced motion ------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* --- Architecture Diagram --------------------------------------- */
.arch-diagram {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.5rem 0;
}

.arch-diagram > figcaption {
  background: var(--nav-bg);
  color: var(--fg);
  text-align: center;
  padding: 0.65rem 1rem;
  font-family: var(--font-head);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-style: normal;
  margin-top: 0;
}

.ad-layer {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}
.ad-layer:last-child {
  border-bottom: none;
}

.ad-layer--ui {
  background: var(--surface);
}
.ad-layer--agents {
  background: var(--bg);
}
.ad-layer--mcp {
  background: oklch(14% 0.018 280);
}
.ad-layer--storage {
  background: oklch(14% 0.018 55);
}

@media (prefers-color-scheme: light) {
  .ad-layer--ui {
    background: oklch(98% 0.005 240);
  }
  .ad-layer--agents {
    background: oklch(27% 0.018 241);
  }
  .ad-layer--mcp {
    background: oklch(97% 0.008 290);
  }
  .ad-layer--storage {
    background: oklch(98% 0.01 60);
  }
}

.ad-layer-header {
  text-align: center;
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 0.7rem;
  color: var(--muted);
}

.ad-layer--agents .ad-layer-header {
  color: var(--accent);
  border: 1px solid color-mix(in oklch, var(--accent) 35%, transparent);
  border-radius: 2px;
  padding: 0.2rem 0.75rem;
  display: inline-block;
}
.ad-layer--mcp .ad-layer-header {
  color: oklch(70% 0.14 285);
}
.ad-layer--storage .ad-layer-header {
  color: oklch(72% 0.12 60);
}

@media (prefers-color-scheme: light) {
  .ad-layer--mcp .ad-layer-header {
    color: oklch(42% 0.18 290);
  }
  .ad-layer--storage .ad-layer-header {
    color: oklch(42% 0.14 55);
  }
}

.ad-flow-row {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.ad-connector {
  display: flex;
  align-items: center;
  padding: 0 0.15rem;
  font-size: 1rem;
  flex-shrink: 0;
  min-width: 2.5rem;
  color: var(--muted);
}
.ad-layer--agents .ad-connector {
  color: var(--accent);
}

.ad-box {
  flex: 1;
  border-radius: var(--radius);
  padding: 0.625rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.5;
  min-width: 0;
  border: 1px solid var(--border);
}

.ad-box ul {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
  list-style: disc;
}
.ad-box ul li {
  margin: 0;
  font-size: 0.74rem;
}

.ad-box-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  letter-spacing: 0.02em;
}
.ad-box-sub {
  font-size: 0.73rem;
  font-style: italic;
  margin-bottom: 0.3rem;
}
.ad-box-label {
  font-size: 0.73rem;
  font-weight: 600;
  display: block;
  margin-top: 0.3rem;
}
.ad-box-output {
  margin-top: 0.5rem;
  font-size: 0.73rem;
  font-weight: 600;
  border-top: 1px solid;
  padding-top: 0.35rem;
}

/* UI layer box variants */
.ad-box--user {
  background: oklch(18% 0.018 75);
  border-color: oklch(55% 0.13 75);
  color: var(--fg);
}
.ad-box--frontend,
.ad-box--api {
  background: oklch(16% 0.015 155);
  border-color: oklch(50% 0.15 155);
  color: var(--fg);
}
.ad-box--temporal {
  background: oklch(16% 0.015 241);
  border-color: oklch(50% 0.18 241);
  color: var(--fg);
}

@media (prefers-color-scheme: light) {
  .ad-box--user {
    background: oklch(97% 0.015 75);
    border-color: oklch(58% 0.14 75);
  }
  .ad-box--frontend,
  .ad-box--api {
    background: oklch(96% 0.012 155);
    border-color: oklch(50% 0.18 155);
  }
  .ad-box--temporal {
    background: oklch(95% 0.012 241);
    border-color: oklch(48% 0.2 248);
  }
}

.ad-box--user .ad-box-output,
.ad-box--frontend .ad-box-output,
.ad-box--api .ad-box-output,
.ad-box--temporal .ad-box-output {
  border-color: var(--border);
  color: var(--muted);
}

/* Agent boxes */
.ad-box--agent {
  background: oklch(18% 0.022 241);
  border-color: var(--accent);
  color: oklch(88% 0.008 240);
}
.ad-box--agent .ad-box-title {
  color: oklch(82% 0.14 241);
}
.ad-box--agent .ad-box-sub {
  color: oklch(70% 0.12 241);
}
.ad-box--agent .ad-box-label {
  color: oklch(80% 0.12 241);
}
.ad-box--agent ul {
  color: oklch(75% 0.08 240);
}
.ad-box--agent .ad-box-output {
  color: oklch(72% 0.16 200);
  border-color: oklch(35% 0.08 240);
}

/* MCP & Storage tool grid */
.ad-tools-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.ad-tool {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  line-height: 1.5;
}
.ad-tool-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
  color: var(--fg);
  letter-spacing: 0.02em;
}
.ad-tool-detail {
  color: var(--muted);
  font-size: 0.71rem;
}

.ad-layer--mcp .ad-tool {
  border-color: oklch(45% 0.14 285);
}
.ad-layer--storage .ad-tool {
  border-color: oklch(55% 0.12 60);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: oklch(72% 0.12 60);
}

@media (prefers-color-scheme: light) {
  .ad-tool {
    background: var(--surface);
  }
  .ad-layer--mcp .ad-tool {
    border-color: oklch(70% 0.1 285);
  }
  .ad-layer--storage .ad-tool {
    border-color: oklch(68% 0.12 60);
    color: oklch(40% 0.14 58);
  }
}

/* Responsive */
@media (max-width: 56rem) {
  .ad-flow-row {
    flex-direction: column;
    gap: 0.5rem;
  }
  .ad-connector {
    transform: rotate(90deg);
    align-self: center;
    min-height: 1.5rem;
    min-width: 2rem;
  }
  .ad-tools-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 32rem) {
  .ad-tools-row {
    grid-template-columns: 1fr;
  }
}

/* --- GitHub MCP Service Topology Diagram ───────────────────────── */
.mcp-topo {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.5rem 0;
  font-size: 0.78rem;
}
.mcp-topo-caller {
  padding: 0.75rem 1rem;
  background: var(--bg);
}
.mcp-topo-box--future {
  border: 1px dashed color-mix(in oklch, var(--muted) 60%, transparent);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
}
.mcp-topo-box-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.mcp-topo-box-detail {
  font-size: 0.71rem;
  color: var(--muted);
  margin-top: 0.1rem;
}
.mcp-topo-arrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 2rem;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.72rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.mcp-topo-arrow::before {
  content: "▼";
  color: var(--accent);
  flex-shrink: 0;
}
.mcp-topo-service {
  padding: 0.75rem 1rem;
  background: oklch(15% 0.02 241);
  border-bottom: 1px solid var(--border);
}
.mcp-topo-service-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: oklch(82% 0.14 241);
  margin-bottom: 0.5rem;
}
.mcp-topo-internals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}
.mcp-topo-group {
  background: oklch(12% 0.015 241);
  border: 1px solid oklch(28% 0.06 241);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}
.mcp-topo-group-label {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.mcp-topo-group-sub {
  font-size: 0.72rem;
  color: var(--fg);
  margin-bottom: 0.25rem;
}
.mcp-topo-items {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: oklch(68% 0.05 240);
}
.mcp-topo-fanout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg);
}
.mcp-topo-fanout-col {
  padding: 0.5rem 0.75rem;
  border-right: 1px solid var(--border);
}
.mcp-topo-fanout-col:last-child {
  border-right: none;
}
.mcp-topo-wire {
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  padding-bottom: 0.4rem;
}
.mcp-topo-wire::before {
  display: block;
  content: "↓";
  color: var(--accent);
  font-size: 0.85rem;
}
.mcp-topo-ext {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.625rem;
  background: var(--surface);
}
.mcp-topo-ext-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.mcp-topo-ext-detail {
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 0.1rem;
}
.mcp-topo-ext--github {
  background: oklch(14% 0.015 155);
  border-color: oklch(40% 0.12 155);
}
.mcp-topo-ext--github .mcp-topo-ext-title {
  color: oklch(72% 0.12 155);
}
.mcp-topo-ext--valkey {
  background: oklch(14% 0.016 55);
  border-color: oklch(48% 0.14 55);
}
.mcp-topo-ext--valkey .mcp-topo-ext-title {
  color: oklch(74% 0.13 55);
}
.mcp-topo-ext--otel {
  background: oklch(14% 0.018 280);
  border-color: oklch(38% 0.13 285);
}
.mcp-topo-ext--otel .mcp-topo-ext-title {
  color: oklch(70% 0.11 280);
}
@media (prefers-color-scheme: light) {
  .mcp-topo-box-title {
    color: var(--fg);
  }
  .mcp-topo-service {
    background: oklch(95% 0.012 241);
  }
  .mcp-topo-service-title {
    color: oklch(38% 0.2 241);
  }
  .mcp-topo-group {
    background: oklch(98% 0.005 241);
    border-color: oklch(82% 0.06 241);
  }
  .mcp-topo-items {
    color: oklch(38% 0.04 240);
  }
  .mcp-topo-ext--github {
    background: oklch(96% 0.01 155);
    border-color: oklch(58% 0.12 155);
  }
  .mcp-topo-ext--github .mcp-topo-ext-title {
    color: oklch(36% 0.14 155);
  }
  .mcp-topo-ext--valkey {
    background: oklch(97% 0.012 55);
    border-color: oklch(62% 0.13 55);
  }
  .mcp-topo-ext--valkey .mcp-topo-ext-title {
    color: oklch(38% 0.14 55);
  }
  .mcp-topo-ext--otel {
    background: oklch(97% 0.008 280);
    border-color: oklch(58% 0.11 285);
  }
  .mcp-topo-ext--otel .mcp-topo-ext-title {
    color: oklch(36% 0.12 280);
  }
}
@media (max-width: 40rem) {
  .mcp-topo-internals {
    grid-template-columns: 1fr;
  }
  .mcp-topo-fanout {
    grid-template-columns: 1fr;
  }
  .mcp-topo-fanout-col {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .mcp-topo-fanout-col:last-child {
    border-bottom: none;
  }
}

/* --- Four-Layer Filter Pipeline Diagram ────────────────────────── */
.filter-pipeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 1.5rem 0;
}
.filter-pipeline-io {
  padding: 0.4rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.filter-pipeline-io::before {
  content: "▼";
  color: var(--accent);
  font-size: 0.85rem;
}
.filter-pipeline-io--output::before {
  display: none;
}
.filter-pipeline-io-label {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--fg);
}
.filter-pipeline-stage {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
}
.filter-pipeline-box {
  padding: 0.55rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-pipeline-box-label {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 0.15rem;
}
.filter-pipeline-box-detail {
  font-size: 0.71rem;
  color: var(--muted);
}
.filter-pipeline-exit {
  font-size: 0.71rem;
  color: var(--muted);
  white-space: nowrap;
}
.filter-pipeline-sep {
  padding: 0.15rem 1.25rem;
  font-size: 0.9rem;
  color: var(--accent);
}
.filter-pipeline-box--l2 {
  background: oklch(14% 0.014 155);
  border-color: oklch(40% 0.12 155);
}
.filter-pipeline-box--l2 .filter-pipeline-box-label {
  color: oklch(72% 0.12 155);
}
.filter-pipeline-box--l1 {
  background: oklch(14% 0.018 241);
  border-color: oklch(40% 0.15 241);
}
.filter-pipeline-box--l1 .filter-pipeline-box-label {
  color: oklch(75% 0.14 241);
}
.filter-pipeline-box--user {
  background: oklch(14% 0.015 75);
  border-color: oklch(48% 0.15 75);
}
.filter-pipeline-box--user .filter-pipeline-box-label {
  color: oklch(72% 0.12 75);
}
.filter-pipeline-box--l3 {
  background: oklch(14% 0.015 20);
  border-color: oklch(45% 0.14 20);
}
.filter-pipeline-box--l3 .filter-pipeline-box-label {
  color: oklch(72% 0.13 20);
}
@media (prefers-color-scheme: light) {
  .filter-pipeline-box--l2 {
    background: oklch(96% 0.01 155);
    border-color: oklch(58% 0.12 155);
  }
  .filter-pipeline-box--l2 .filter-pipeline-box-label {
    color: oklch(36% 0.14 155);
  }
  .filter-pipeline-box--l1 {
    background: oklch(96% 0.01 241);
    border-color: oklch(55% 0.14 241);
  }
  .filter-pipeline-box--l1 .filter-pipeline-box-label {
    color: oklch(34% 0.2 241);
  }
  .filter-pipeline-box--user {
    background: oklch(97% 0.012 75);
    border-color: oklch(62% 0.14 75);
  }
  .filter-pipeline-box--user .filter-pipeline-box-label {
    color: oklch(36% 0.15 75);
  }
  .filter-pipeline-box--l3 {
    background: oklch(97% 0.012 20);
    border-color: oklch(58% 0.13 20);
  }
  .filter-pipeline-box--l3 .filter-pipeline-box-label {
    color: oklch(36% 0.14 20);
  }
}
@media (max-width: 40rem) {
  .filter-pipeline-stage {
    grid-template-columns: 1fr;
  }
  .filter-pipeline-exit {
    padding: 0 1rem 0.5rem;
    white-space: normal;
  }
}

/* --- Pipeline Flow Diagram -------------------------------------- */
.pf-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.82rem;
  margin: 1.5rem 0;
}

.pf-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 1px solid;
  border-radius: var(--radius);
  padding: 0.6rem 1.5rem;
  width: 100%;
  max-width: 34rem;
}
.pf-step-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.pf-step--trigger {
  background: oklch(16% 0.015 241);
  border-color: oklch(50% 0.18 241);
  color: var(--fg);
}
.pf-step--check {
  background: oklch(17% 0.016 80);
  border-color: oklch(58% 0.13 80);
  color: var(--fg);
}

@media (prefers-color-scheme: light) {
  .pf-step--trigger {
    background: oklch(95% 0.01 241);
    border-color: oklch(48% 0.2 248);
  }
  .pf-step--check {
    background: oklch(97% 0.012 88);
    border-color: oklch(58% 0.13 82);
  }
}

.pf-v-arrow {
  font-size: 1.5rem;
  color: var(--muted);
  line-height: 1;
  padding: 0.15rem 0;
  text-align: center;
}

.pf-temporal {
  border: 1px dashed oklch(45% 0.12 265);
  border-radius: var(--radius);
  padding: 0.875rem 1.25rem;
  width: 100%;
  background: var(--surface);
}
.pf-temporal-header {
  text-align: center;
  font-family: var(--font-head);
  font-size: 0.75rem;
  color: oklch(65% 0.14 265);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid oklch(30% 0.08 265);
}

@media (prefers-color-scheme: light) {
  .pf-temporal {
    background: oklch(99% 0.004 265);
    border-color: oklch(70% 0.1 265);
  }
  .pf-temporal-header {
    color: oklch(38% 0.18 265);
    border-bottom-color: oklch(85% 0.06 265);
  }
}

.pf-stages {
  border-left: 1px solid oklch(30% 0.08 265);
  margin-left: 0.5rem;
  display: flex;
  flex-direction: column;
}
.pf-stage-group {
  padding-left: 1.5rem;
  padding-bottom: 0.875rem;
  position: relative;
}
.pf-stage-group:last-child {
  padding-bottom: 0;
}
.pf-stage-group::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 1rem;
  width: 1.5rem;
  height: 1px;
  background: oklch(30% 0.08 265);
}

.pf-stage-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 0.4rem;
}
.pf-h-arrow {
  font-size: 1.05rem;
  color: var(--muted);
  padding: 0 0.3rem;
  flex-shrink: 0;
}

.pf-node {
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  border: 1px solid;
  line-height: 1.45;
}
.pf-node--stage {
  background: oklch(17% 0.018 265);
  border-color: oklch(45% 0.14 265);
  color: var(--fg);
  min-width: 13rem;
}
.pf-node--agent {
  background: oklch(18% 0.022 241);
  border-color: var(--accent);
  color: oklch(82% 0.14 241);
}
.pf-node--artifact {
  background: oklch(15% 0.015 155);
  border-color: oklch(45% 0.16 155);
  color: oklch(68% 0.14 155);
  font-size: 0.72rem;
}
.pf-node--action {
  background: oklch(16% 0.014 290);
  border-color: oklch(48% 0.16 290);
  color: var(--fg);
  min-width: 13rem;
}
.pf-node--github {
  background: var(--nav-bg);
  border-color: oklch(35% 0.012 240);
  color: var(--fg);
}

@media (prefers-color-scheme: light) {
  .pf-node--stage {
    background: oklch(95% 0.008 265);
    border-color: oklch(52% 0.16 265);
  }
  .pf-node--agent {
    background: oklch(22% 0.025 241);
    border-color: var(--accent);
  }
  .pf-node--artifact {
    background: oklch(95% 0.012 155);
    border-color: oklch(48% 0.18 155);
    color: oklch(35% 0.18 155);
  }
  .pf-node--action {
    background: oklch(96% 0.01 290);
    border-color: oklch(52% 0.18 290);
  }
  .pf-node--github {
    background: oklch(16% 0.012 240);
    border-color: oklch(32% 0.01 240);
    color: oklch(88% 0.008 240);
  }
}

.pf-tag {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1em 0.4em;
  border-radius: 2px;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.pf-tag--blue {
  background: oklch(30% 0.08 241);
  color: oklch(72% 0.16 241);
}
.pf-tag--green {
  background: oklch(22% 0.08 155);
  color: oklch(68% 0.14 155);
}

.pf-annotations {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.45rem;
  padding-left: 0.35rem;
  flex-wrap: wrap;
}
.pf-ann {
  font-size: 0.71rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.65rem;
  line-height: 1.5;
}
.pf-ann--valkey {
  background: oklch(16% 0.016 82);
  border-color: oklch(38% 0.12 80);
}
.pf-ann--github {
  background: oklch(15% 0.012 220);
  border-color: oklch(38% 0.12 220);
}
.pf-ann--lock {
  background: oklch(15% 0.014 285);
  border-color: oklch(38% 0.12 285);
}
.pf-ann--done {
  background: oklch(15% 0.015 155);
  border-color: oklch(45% 0.16 155);
  color: oklch(65% 0.14 155);
  font-weight: 600;
  border-style: solid;
}

@media (prefers-color-scheme: light) {
  .pf-ann {
    background: oklch(99% 0.003 240);
    border-color: oklch(82% 0.01 240);
  }
  .pf-ann--valkey {
    background: oklch(98% 0.014 88);
    border-color: oklch(78% 0.1 80);
  }
  .pf-ann--github {
    background: oklch(97% 0.01 220);
    border-color: oklch(78% 0.1 220);
  }
  .pf-ann--lock {
    background: oklch(97% 0.01 285);
    border-color: oklch(78% 0.08 285);
  }
  .pf-ann--done {
    background: oklch(95% 0.015 155);
    border-color: oklch(60% 0.18 155);
    color: oklch(32% 0.18 155);
  }
}

@media (max-width: 48rem) {
  .pf-step {
    max-width: 100%;
  }
  .pf-node {
    font-size: 0.75rem;
    min-width: 0 !important;
  }
  .pf-stage-row {
    row-gap: 0.35rem;
  }
}

/* --- File Tree ------------------------------------------------- */
.ft-tree {
  font: 0.82rem/1.9 var(--mono);
  background: var(--nav-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.ft-root {
  color: var(--accent);
  font-weight: 700;
  display: block;
  margin-bottom: 0.1rem;
}

.ft-tree ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ft-tree > ul {
  padding-left: 0.5rem;
}
.ft-tree ul ul {
  margin-left: 1rem;
  border-left: 1px solid var(--border);
  padding-left: 0;
}
.ft-tree li {
  position: relative;
  padding-left: 1.4rem;
}
.ft-tree li::before {
  content: "├─ ";
  position: absolute;
  left: 0;
  color: var(--border);
}
.ft-tree li.ft-last::before {
  content: "└─ ";
}

.ft-nd {
  color: var(--accent);
  font-weight: 600;
}
.ft-nf {
  color: var(--muted);
}
.ft-a {
  color: oklch(55% 0.012 240);
  font-size: 0.74rem;
  margin-left: 1rem;
}
.ft-a::before {
  content: "# ";
  color: var(--muted);
}

@media (prefers-color-scheme: light) {
  .ft-tree {
    background: oklch(96% 0.007 240);
    color: var(--fg);
  }
  .ft-a {
    color: var(--muted);
  }
  .ft-a::before {
    color: oklch(65% 0.012 240);
  }
}

/* --- ER Diagram ------------------------------------------------ */
.er-diagram {
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin: 1rem 0;
}

.er-chain {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.er-h-rel {
  color: oklch(60% 0.16 265);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 0 0.15rem;
}

.er-entity {
  border: 1px solid;
  border-radius: var(--radius);
  padding: 0.45rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 6rem;
  text-align: center;
}
.er-entity b {
  display: block;
  font-size: 0.85rem;
}
.er-entity code {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--mono);
}
.er-opt-code {
  color: oklch(62% 0.16 290) !important;
}

.er-entity--projects {
  background: oklch(16% 0.015 241);
  border-color: oklch(48% 0.18 241);
}
.er-entity--runs {
  background: oklch(16% 0.015 265);
  border-color: oklch(46% 0.14 265);
}
.er-entity--stages {
  background: oklch(15% 0.015 155);
  border-color: oklch(45% 0.17 155);
}
.er-entity--artifacts {
  background: oklch(16% 0.016 78);
  border-color: oklch(52% 0.14 78);
}
.er-entity--approvals {
  background: oklch(15% 0.014 290);
  border-color: oklch(46% 0.16 290);
}

@media (prefers-color-scheme: light) {
  .er-h-rel {
    color: oklch(42% 0.18 265);
  }
  .er-entity--projects {
    background: oklch(95% 0.01 241);
    border-color: oklch(48% 0.2 248);
  }
  .er-entity--runs {
    background: oklch(96% 0.008 265);
    border-color: oklch(48% 0.16 265);
  }
  .er-entity--stages {
    background: oklch(96% 0.012 155);
    border-color: oklch(48% 0.18 155);
  }
  .er-entity--artifacts {
    background: oklch(97% 0.014 78);
    border-color: oklch(55% 0.16 78);
  }
  .er-entity--approvals {
    background: oklch(96% 0.01 290);
    border-color: oklch(48% 0.18 290);
  }
}

.er-fk-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.er-fk-group {
  flex: 1;
  min-width: 14rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.er-fk-label {
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.1rem;
}
.er-fk-label--runs {
  color: oklch(58% 0.14 265);
}
.er-fk-label--stages {
  color: oklch(55% 0.16 155);
}

.er-opt-note {
  font-size: 0.74rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
  padding: 0.25rem 0;
}

/* --- State Machine Diagrams ------------------------------------ */
.sm-diagram {
  margin: 1.25rem 0;
  padding: 0.875rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.sm-path-label {
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.sm-path-label + .sm-rail {
  margin-bottom: 0.875rem;
}

.sm-path-label--alt {
  margin-top: 0.875rem;
  color: oklch(55% 0.14 290);
}

.sm-rail {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.sm-edge {
  color: var(--muted);
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}

.sm-terminals {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-left: 0.625rem;
  border-left: 1px solid var(--border);
}

.sm-node {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid;
  border-radius: var(--radius);
  white-space: nowrap;
  line-height: 1.5;
}

.sm-node--init {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
}

.sm-node--active {
  background: oklch(18% 0.022 241);
  border-color: var(--accent);
  color: oklch(82% 0.14 241);
}

.sm-node--pass {
  background: oklch(15% 0.015 155);
  border-color: oklch(45% 0.17 155);
  color: oklch(68% 0.14 155);
}

.sm-node--fail {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-fg);
}

.sm-node--cancel {
  background: var(--planned-bg);
  border-color: var(--planned-border);
  color: var(--planned-fg);
}

.sm-node--pause {
  background: oklch(16% 0.014 290);
  border-color: oklch(48% 0.16 290);
  color: oklch(68% 0.14 290);
}

.sm-node--skip {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
  font-style: italic;
}

@media (prefers-color-scheme: light) {
  .sm-node--active {
    background: oklch(22% 0.025 241);
    border-color: var(--accent);
    color: oklch(82% 0.14 241);
  }
  .sm-node--pass {
    background: oklch(95% 0.012 155);
    border-color: oklch(48% 0.18 155);
    color: oklch(32% 0.18 155);
  }
  .sm-node--pause {
    background: oklch(96% 0.01 290);
    border-color: oklch(48% 0.18 290);
    color: oklch(32% 0.18 290);
  }
}

/* --- Activity Pipeline ---------------------------------------- */
.pipe-flow {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 1rem 0;
  overflow-x: auto;
  padding: 0.25rem 0 0.5rem;
}

.pipe-arrow {
  color: var(--muted);
  font-size: 0.9rem;
  flex-shrink: 0;
  padding: 0 0.25rem;
  line-height: 1;
}

.pipe-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.875rem;
  min-width: 9.5rem;
  flex-shrink: 0;
  gap: 0.2rem;
}

.pipe-step--final {
  background: oklch(15% 0.015 155);
  border-color: oklch(45% 0.17 155);
}

.pipe-step-num {
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.pipe-step-name {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg);
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
}

.pipe-step-out {
  font-size: 0.72rem;
  color: var(--muted);
  font-style: italic;
  white-space: nowrap;
}

.pipe-step-err {
  font-size: 0.72rem;
  color: var(--danger-fg);
  white-space: nowrap;
}

.pipe-step--final .pipe-step-name {
  color: oklch(68% 0.14 155);
}

.pipe-step--final .pipe-step-num {
  color: oklch(50% 0.12 155);
}

.pipe-step--final .pipe-step-out {
  color: oklch(52% 0.12 155);
}

@media (prefers-color-scheme: light) {
  .pipe-step--final {
    background: oklch(95% 0.012 155);
    border-color: oklch(48% 0.18 155);
  }
  .pipe-step--final .pipe-step-name {
    color: oklch(28% 0.18 155);
  }
  .pipe-step--final .pipe-step-num,
  .pipe-step--final .pipe-step-out {
    color: oklch(42% 0.14 155);
  }
}

/* --- Retryable badges ----------------------------------------- */
.badge--yes {
  background: oklch(15% 0.015 155);
  border: 1px solid oklch(45% 0.17 155);
  color: oklch(68% 0.14 155);
}

.badge--no {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-fg);
}

@media (prefers-color-scheme: light) {
  .badge--yes {
    background: oklch(95% 0.012 155);
    border-color: oklch(48% 0.18 155);
    color: oklch(32% 0.18 155);
  }
}

/* --- Status badges (Implemented / Planned) -------------------- */
.badge--implemented {
  background: oklch(15% 0.015 155);
  border: 1px solid oklch(45% 0.17 155);
  color: oklch(68% 0.14 155);
}

.badge--planned {
  background: var(--planned-bg);
  border: 1px solid var(--planned-border);
  color: var(--planned-fg);
}

@media (prefers-color-scheme: light) {
  .badge--implemented {
    background: oklch(95% 0.012 155);
    border-color: oklch(48% 0.18 155);
    color: oklch(32% 0.18 155);
  }
}

/* --- Workflow tree diagram (CI/CD topology) -------------------- */
.wf-tree {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 1rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.wf-root-node {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  background: oklch(18% 0.022 241);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.3rem 0.875rem;
  width: fit-content;
}

.wf-dispatch-label {
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.5rem 0 0.25rem 1.75rem;
}

.wf-children {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.25rem 0 0 1.25rem;
  border-left: 1px solid var(--border);
  margin-left: 0.875rem;
}

.wf-child {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.625rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.wf-child-name {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg);
}

.wf-child-trigger {
  font-size: 0.72rem;
  color: var(--muted);
  font-style: italic;
}

.wf-jobs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.1rem;
}

.wf-job {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

@media (prefers-color-scheme: light) {
  .wf-root-node {
    background: oklch(93% 0.018 241);
  }
}

/* --- Scroll overflow fade -------------------------------------- */
.scroll-fade {
  position: relative;
}

.scroll-fade::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3rem;
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--bg));
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* --- Print ----------------------------------------------------- */
@media print {
  .site-header,
  .site-footer {
    display: none;
  }
  main {
    max-width: none;
    margin: 0;
    padding: 0;
  }
  pre {
    border: 1px solid oklch(80% 0 0);
    page-break-inside: avoid;
  }
  table {
    page-break-inside: avoid;
  }
  h2,
  h3 {
    page-break-after: avoid;
  }
  a {
    color: var(--fg);
    text-decoration: none;
  }
}

/* --- Light-mode nav contrast ----------------------------------- */
@media (prefers-color-scheme: light) {
  .site-nav .nav-home {
    color: var(--accent-nav-light);
  }
  .site-nav ul li a[aria-current="page"] {
    color: var(--accent-nav-light);
    box-shadow: inset 0 -2px 0 var(--accent-nav-light);
  }
}

/* --- Page breadcrumb ------------------------------------------- */
.page-breadcrumb {
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
}

.page-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.page-breadcrumb a:hover {
  color: var(--fg);
  text-decoration: none;
}

.page-breadcrumb .sep {
  margin: 0 0.45em;
  opacity: 0.45;
}

/* --- In-page TOC block ----------------------------------------- */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1.125rem;
  margin: 1.5rem 0;
}

.toc-title {
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 0.6rem;
  padding: 0;
  border: none;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.toc ol li a {
  font-family: var(--font-body);
  font-size: 0.84rem;
  color: var(--muted);
  text-decoration: none;
  display: block;
  padding: 0.2rem 0;
  transition: color 0.1s;
}

.toc ol li a:hover {
  color: var(--fg);
  text-decoration: none;
}

/* --- Section anchor links -------------------------------------- */
.anchor-link {
  font-family: var(--font-head);
  font-weight: 400;
  color: var(--muted);
  opacity: 0;
  text-decoration: none;
  margin-left: 0.45em;
  font-size: 0.75em;
  transition:
    opacity 0.1s,
    color 0.1s;
  user-select: none;
}

h2:hover .anchor-link,
h3:hover .anchor-link {
  opacity: 1;
}

.anchor-link:hover {
  color: var(--accent);
  opacity: 1;
  text-decoration: none;
}

.anchor-link:focus {
  opacity: 1;
}

@media (hover: none) {
  .anchor-link {
    opacity: 0.4;
  }
}

/* --- Prev / Next page navigation ------------------------------- */
.page-nav {
  display: flex;
  gap: 1px;
  margin: 3rem 0 0;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.page-nav-prev,
.page-nav-next {
  flex: 1;
  background: var(--surface);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--fg);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: background 0.1s;
  min-width: 0;
}

.page-nav-prev:hover,
.page-nav-next:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.page-nav-prev:active,
.page-nav-next:active {
  background: var(--surface-2);
}

.page-nav-next {
  text-align: right;
}

.page-nav-dir {
  font-family: var(--font-head);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

.page-nav-title {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--accent);
}

@media (max-width: 36rem) {
  .page-nav {
    flex-direction: column;
  }
  .page-nav-next {
    text-align: left;
  }
}
