:root { --bg:#f7f8fa; --panel:#fff; --ink:#1c1f24; --muted:#5f6b7a; --line:#e2e6eb; --accent:#1d6f78; --accent2:#e8891a; --teal-ink:#0f3e45; --code:#f0f2f5; --max: 980px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg:#14161a; --panel:#1d2026; --ink:#e8eaed; --muted:#9aa3ad; --line:#2c3138; --accent:#4fb3bf; --accent2:#f0a040; --teal-ink:#bfe6ea; --code:#0f1114; } }
:root[data-theme="dark"] { --bg:#14161a; --panel:#1d2026; --ink:#e8eaed; --muted:#9aa3ad; --line:#2c3138; --accent:#4fb3bf; --accent2:#f0a040; --teal-ink:#bfe6ea; --code:#0f1114; }
@media (prefers-reduced-motion: reduce) { .blink { animation: none; } html { scroll-behavior: auto; } }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.6 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
pre { background: var(--code); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
code { background: var(--code); padding: 1px 5px; border-radius: 4px; }
pre code { background: none; padding: 0; }
img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 0.95em; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--code); }
blockquote { margin: 8px 0; padding: 6px 14px; border-left: 3px solid var(--accent); color: var(--muted); background: var(--panel); border-radius: 0 6px 6px 0; }
h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 1.4rem; margin: 40px 0 10px; padding-top: 8px; border-top: 1px solid var(--line); }
h2::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--accent2); margin-right: 10px; vertical-align: 2px; }
h3 { font-size: 1.1rem; margin: 26px 0 8px; }
.nav { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
.nav .in { max-width: var(--max); margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; }
.nav .brand img { width: 30px; height: 30px; border: none; border-radius: 8px; }
.nav a.link { color: var(--muted); text-decoration: none; padding: 4px 2px; border-bottom: 2px solid transparent; }
.nav a.link.active, .nav a.link:hover { color: var(--ink); border-color: var(--accent2); }
.nav .spacer { flex: 1; }
.nav .gh { font-size: 0.9em; }
.nav .theme { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 50%; width: 30px; height: 30px; cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
.nav .theme:hover { color: var(--ink); border-color: var(--accent2); }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.steps li { counter-increment: step; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px 16px 54px; position: relative; color: var(--muted); }
.steps li b { color: var(--ink); display: block; margin-bottom: 4px; }
.steps li::before { content: counter(step); position: absolute; left: 16px; top: 14px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 0.9em; }
main { max-width: var(--max); margin: 0 auto; padding: 28px 20px 80px; }
.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; }
.doc > article, .doc > nav { min-width: 0; }
.toc { position: sticky; top: 64px; align-self: start; font-size: 0.9em; }
.toc summary { display: none; }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 4px 0; }
.toc li li { margin-left: 12px; font-size: 0.93em; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }
@media (max-width: 820px) { .doc { grid-template-columns: 1fr; } .toc { position: static; border-bottom: 1px solid var(--line); padding-bottom: 12px; } .toc summary { display: list-item; cursor: pointer; font-weight: 600; color: var(--ink); padding: 6px 0; } .toc details[open] summary { margin-bottom: 6px; } }
.hero { display: grid; grid-template-columns: 1fr; gap: 28px; padding: 26px 0 10px; width: min(1180px, 100vw - 40px); margin-left: 50%; transform: translateX(-50%); }
.hero > div:first-child { max-width: 760px; margin: 0 auto; text-align: center; }
.hero .cmdbox { max-width: 720px; margin: 16px auto; }
.hero .btns { justify-content: center; }
.hero h1 { text-wrap: balance; }
.hero-gif { padding: 10px; }
.hero-gif img { width: 100%; border-radius: 8px; display: block; }
.hero-gif p.small { margin: 8px 4px 0; text-align: center; }
.hero h1 { font-size: 2.4rem; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); }
.cmdbox { display: flex; gap: 8px; align-items: stretch; margin: 16px 0; }
.cmdbox pre { flex: 1; margin: 0; white-space: pre-wrap; word-break: break-all; }
.cmdbox button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 0 14px; cursor: pointer; }
.cmdbox button:hover { border-color: var(--accent); }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.btn { display: inline-block; padding: 10px 16px; border-radius: 10px; text-decoration: none; font-weight: 600; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); border-color: var(--accent2); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.95em; }
.shot { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.shot img { border: none; }
a.shot { display: block; text-decoration: none; }
.group { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 24px; align-items: center; margin: 14px 0; }
.group h3 { margin: 0 0 6px; }
.group p { margin: 0; color: var(--muted); font-size: 0.95em; }
.group .shot { padding: 6px; }
.group .shot img { display: block; width: 100%; max-height: 250px; object-fit: contain; border: none; }
.howdet { margin: 10px 0 4px; }
.howdet > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 6px 0; }
.example { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--code); border-left: 3px solid var(--accent); border-radius: 8px; padding: 8px 12px; margin: 6px 0; }
.small { color: var(--muted); font-size: 0.9em; }
figure { margin: 18px 0; }
figure img { display: block; }
figcaption { color: var(--muted); font-size: 0.88em; margin-top: 6px; }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9em; }
footer .in { max-width: var(--max); margin: 0 auto; padding: 16px 20px; }

.term { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: #39d353; background: #0f1319; border: 1px solid #2c3138; border-radius: 8px; padding: 8px 12px; display: inline-block; margin-bottom: 14px; }
.term .path { color: #4fb3bf; }
.term { color: #f0a040; }
.blink { animation: blink 1.1s steps(2, start) infinite; }
.pill { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 5px 14px; border: 1px solid var(--accent2); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 0.9em; }
.pill b { color: var(--accent2); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.85em; }
.pill a { color: var(--ink); }
@keyframes blink { to { visibility: hidden; } }

footer .credits { color: var(--muted); font-size: 0.95em; display: inline-flex; align-items: center; gap: 16px; margin-top: 14px; }
footer .credits img.lab { width: 128px; height: 128px; border: none; border-radius: 50%; background: #fff; transition: box-shadow .2s; }
footer .credits a:hover img.lab, footer .credits img.lab:hover { opacity: 1; box-shadow: 0 0 0 2px var(--accent2); }
footer .credits a { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
footer .credits a:has(img) { border-bottom: 0; }

/* how-it-works diagram */
.howwrap { overflow-x: auto; margin: 14px 0 8px; }
.how { display: block; width: 100%; min-width: 760px; max-width: 1180px; margin: 0 auto; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.how .node rect { fill: var(--panel); stroke: var(--line); stroke-width: 1.2; }
.how .node rect.acc { fill: var(--accent2); stroke: none; }
.how .nb { box-sizing: border-box; padding: 12px 16px; font-size: 12.5px; line-height: 1.32; color: var(--muted); display: flex; flex-direction: column; gap: 6px; height: 100%; overflow: hidden; }
.how .nb b { color: var(--ink); font-size: 15px; }
.how .lab { fill: var(--accent2); font-size: 12px; font-style: italic; }
.how .wires path { fill: none; stroke: var(--accent); stroke-width: 2; marker-end: url(#ah); stroke-dasharray: 7 7; animation: howflow 1.1s linear infinite; }
.how .wires path.loop { stroke: var(--accent2); }
.how .wires path.next { opacity: 0.55; }
.how .node { animation: howglow 14s ease-in-out infinite; }
.how .n1 { animation-delay: 0s; } .how .n2 { animation-delay: 2s; } .how .n3 { animation-delay: 4s; } .how .n4 { animation-delay: 6s; }
.how .n5 { animation-delay: 8s; } .how .n6 { animation-delay: 10s; } .how .n7 { animation-delay: 12s; }
@keyframes howflow { to { stroke-dashoffset: -14; } }
@keyframes howglow { 0%, 10%, 100% { filter: none; } 5% { filter: drop-shadow(0 0 6px var(--accent)); } }
@media (prefers-reduced-motion: reduce) { .how .wires path, .how .node { animation: none; } }
.howwrap-v { display: none; }
.how.how-v { min-width: 0; max-width: 420px; }
.how-v .wires path { marker-end: url(#ahv); }
.how-v .wires path.loop { marker-end: url(#ah2v); }
@media (max-width: 700px) { .howwrap { display: none; } .howwrap-v { display: block; } .nav { position: static; } }

/* tables and code never widen the page */
.table-wrap { overflow-x: auto; margin: 12px 0; }
.table-wrap table { margin: 0; min-width: 600px; }
.table-wrap th, .table-wrap td { overflow-wrap: normal; word-break: normal; hyphens: none; }
.table-wrap th:first-child, .table-wrap td:first-child { white-space: nowrap; }
body { overflow-wrap: anywhere; }
figure img { max-height: 78vh; width: auto; max-width: 100%; margin: 0 auto; }

/* phones */
@media (max-width: 700px) {
  html { font-size: 15px; }
  .nav .in { flex-wrap: nowrap; overflow-x: auto; gap: 14px; padding: 8px 14px; scrollbar-width: none; }
  .nav .in::-webkit-scrollbar { display: none; }
  .nav a.link, .nav .brand { white-space: nowrap; flex: none; }
  .nav .spacer { display: none; }
  .nav .theme { flex: none; }
  main { padding: 18px 16px 60px; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.2rem; margin-top: 30px; }
  .hero { width: auto; margin-left: 0; transform: none; padding-top: 10px; gap: 18px; }
  .hero h1 { font-size: 1.9rem; }
  .hero p.lead { font-size: 1rem; }
  .hero > div:first-child { text-align: left; }
  .hero .btns { justify-content: flex-start; }
  .cmdbox { flex-direction: column; }
  .cmdbox button { padding: 8px; }
  pre { white-space: pre-wrap; word-break: break-word; font-size: 0.85em; }
  .example { white-space: normal; font-size: 0.9em; }
  .steps { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .group { grid-template-columns: 1fr; gap: 12px; }
  .toc { position: static; font-size: 0.95em; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 4px; }
  .toc summary { display: list-item; cursor: pointer; font-weight: 600; color: var(--ink); padding: 6px 0; }
  .toc details[open] summary { margin-bottom: 6px; }
  figure img { max-height: 60vh; }
  .shot { padding: 6px; }
  footer .in { padding: 14px 16px; }
}

/* recorded demonstrations */
.demo-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.demo-tab { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.demo-tab:hover { color: var(--ink); border-color: var(--accent); }
.demo-tab.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.demo-tab:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.demo-panel { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.demo-panel[hidden] { display: none; }
.demo-panel figcaption { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 4px; }
.demo-panel .req { font-weight: 600; }
.demo-panel .res { color: var(--muted); font-size: 0.92em; }
.demo-play { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 8px; overflow: hidden; }
.demo-play img { display: block; width: 100%; height: auto; }
.demo-play:focus-visible { outline: 2px solid var(--accent2); }
.demo-panel pre { font-size: 0.78em; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; }
/* command explainer */
.cmd { font-family: ui-monospace, "UbuntuMono Nerd Font Mono", Menlo, monospace; font-size: 1.35em; background: var(--code); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; display: inline-block; }
.cmd span { border-bottom: 2px solid var(--accent2); padding: 0 1px; cursor: help; }
.cmd span:hover, .cmd span:focus { background: var(--accent); color: #fff; outline: none; border-radius: 3px; }

/* recordings: the control sits under the picture, never on it */
.demo-tab { font-size: 1.02em; }
.howwrap, .howwrap-v { margin-top: 6px; }
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 12px; }
.demo-bar figcaption { margin: 0; }
.demo-ctl { display: inline-flex; align-items: center; gap: 9px; font: inherit; font-weight: 600; font-size: 1.02em; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
.demo-ctl:hover { filter: brightness(1.1); }
.demo-ctl:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.demo-ctl .tri { width: 0; height: 0; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent #fff; }
.demo-ctl[data-playing="1"] .tri { border: 0; width: 10px; height: 10px; background: #fff; border-radius: 2px; }
.demo-ctl[data-playing="1"] { background: var(--panel); color: var(--ink); border-color: var(--line); }
.demo-ctl[data-playing="1"] .tri { background: var(--ink); }

/* Pellaeon vs mcp diagram: two lanes, one shared node */
.how-mcp .lanet { fill: var(--ink); font-size: 17px; font-weight: 700; text-anchor: middle; }
.how-mcp .wires path { marker-end: var(--mk); }
.how-mcp .wires path.loop { marker-end: var(--mk2); }
.how.how-mcp { min-width: 700px; max-width: 900px; }
.how.how-v.how-mcp { min-width: 0; max-width: 440px; }
.how-mcp .node.shared rect { stroke: var(--accent2); stroke-width: 1.6; }
.how-mcp .node.shared { animation: none; }
.hero-logo { margin: 0 auto 6px; }
.hero-logo img { width: 190px; height: auto; border: none; }
.hero-logo .on-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-logo .on-light { display: none; } :root:not([data-theme="light"]) .hero-logo .on-dark { display: inline; } }
:root[data-theme="dark"] .hero-logo .on-light { display: none; }
:root[data-theme="dark"] .hero-logo .on-dark { display: inline; }
@media (max-width: 720px) { .hero-logo { margin: 0 0 4px; } .hero-logo img { width: 140px; } }


.subnav { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: -4px 0 18px; font-size: 0.92em; color: var(--muted); }
.subnav a { color: var(--muted); text-decoration: none; padding: 2px 0; border-bottom: 2px solid transparent; }
.subnav a.active, .subnav a:hover { color: var(--ink); border-color: var(--accent2); }
