/* agentsdiagram site. Tokens mirror packages/viewer/src/styles.css so site and tool match. */

:root {
  --canvas: #f5f6f8;
  --surface: #ffffff;
  --raised: #fbfbfc;
  --line: #dde1e7;
  --line-strong: #c4cad3;
  --ink: #1b1f24;
  --muted: #646d7a;
  --accent: #5b5bd6;
  --accent-ink: #ffffff;
  --accent-soft: rgb(91 91 214 / 10%);
  --warn: #b26b00;
  --k-agent: #5b5bd6;
  --k-tool: #0f9f78;
  --k-toolset: #5f8f14;
  --k-mcp_server: #d9680f;
  --k-native_tool: #9447d1;
  --k-capability: #cf3f86;
  --k-workflow: #b88600;
  --k-graph: #0b93a8;
  /* syntax */
  --sy-k: #9447d1;
  --sy-s: #0f7a5c;
  --sy-f: #4646b8;
  --sy-d: #b85c0a;
  --sy-c: #7a828e;
  --sy-v: #1b1f24;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --radius: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #15171b;
    --surface: #1e2127;
    --raised: #23272e;
    --line: #2f343d;
    --line-strong: #414855;
    --ink: #e5e8ec;
    --muted: #8d96a5;
    --accent: #9090f8;
    --accent-ink: #15171b;
    --accent-soft: rgb(144 144 248 / 14%);
    --warn: #e3a53b;
    --k-agent: #9090f8;
    --k-tool: #3fd3a4;
    --k-toolset: #a6d256;
    --k-mcp_server: #ff9d57;
    --k-native_tool: #c58cf6;
    --k-capability: #f47fb6;
    --k-workflow: #ecc045;
    --k-graph: #4ccbe0;
    --sy-k: #c58cf6;
    --sy-s: #6fd9b0;
    --sy-f: #a9a9fb;
    --sy-d: #ff9d57;
    --sy-c: #7d8696;
    --sy-v: #e5e8ec;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --canvas: #15171b;
  --surface: #1e2127;
  --raised: #23272e;
  --line: #2f343d;
  --line-strong: #414855;
  --ink: #e5e8ec;
  --muted: #8d96a5;
  --accent: #9090f8;
  --accent-ink: #15171b;
  --accent-soft: rgb(144 144 248 / 14%);
  --warn: #e3a53b;
  --k-agent: #9090f8;
  --k-tool: #3fd3a4;
  --k-toolset: #a6d256;
  --k-mcp_server: #ff9d57;
  --k-native_tool: #c58cf6;
  --k-capability: #f47fb6;
  --k-workflow: #ecc045;
  --k-graph: #4ccbe0;
  --sy-k: #c58cf6;
  --sy-s: #6fd9b0;
  --sy-f: #a9a9fb;
  --sy-d: #ff9d57;
  --sy-c: #7d8696;
  --sy-v: #e5e8ec;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.9em;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
  color: var(--muted);
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  padding: 6px 12px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 6px;
  z-index: 10;
}

.skip:focus {
  top: 12px;
}

/* Header */

.top {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 15px;
}

.mark {
  width: 24px;
  height: 24px;
  flex: none;
}

.mark rect {
  fill: var(--accent);
}

.mark path {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 2;
}

.mark circle {
  fill: var(--accent-ink);
}

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
}

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

.nav a:hover {
  color: var(--ink);
}

.theme {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
}

.theme:hover {
  border-color: var(--line-strong);
}

.theme svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.i-sun {
  display: none;
}

:root[data-theme="dark"] .i-sun {
  display: block;
}

:root[data-theme="dark"] .i-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .i-moon {
    display: none;
  }
}

/* Hero */

.hero {
  padding-top: 52px;
  padding-bottom: 28px;
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.lede {
  max-width: 44rem;
  margin: 16px 0 28px;
  font-size: 1.125rem;
  color: var(--muted);
}

.lede strong {
  color: var(--ink);
  font-weight: 600;
}

.cmd {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 14px;
}

.cmd code {
  font-size: inherit;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}

.cmd .prompt {
  color: var(--muted);
  user-select: none;
}

.copy {
  flex: none;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raised);
  color: var(--ink);
  font: 500 13px var(--sans);
  cursor: pointer;
  min-width: 64px;
}

.copy:hover {
  border-color: var(--line-strong);
}

.copy.done {
  color: var(--k-tool);
  border-color: currentColor;
}

/* Demo */

.demo {
  padding-bottom: 40px;
}

.demo-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tabs {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.tabs button {
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 14px var(--sans);
  cursor: pointer;
}

.tabs button:hover {
  color: var(--ink);
}

.tabs button[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--ink);
}

.tabs .mono {
  font-size: 13px;
}

.tabs .fw {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
}

.tabs button[aria-selected="true"] .mono {
  color: var(--accent);
  font-weight: 600;
}

.full {
  font-size: 14px;
}

.demo-body {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  height: 640px;
}

.code {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--raised);
}

.code-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.code-head .mono {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.src {
  flex: 1;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  font: 12px/1.65 var(--mono);
  color: var(--sy-v);
  tab-size: 4;
}

.src code {
  font-size: inherit;
}

.src[hidden] {
  display: none;
}

.src .k { color: var(--sy-k); }
.src .s { color: var(--sy-s); }
.src .f { color: var(--sy-f); }
.src .d { color: var(--sy-d); }
.src .c { color: var(--sy-c); font-style: italic; }
.src .v { color: var(--k-agent); font-weight: 600; }

.code-foot {
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.code-foot .mono {
  font-size: 12px;
  color: var(--ink);
}

.frame {
  min-width: 0;
  min-height: 0;
  background: var(--canvas);
}

.frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.demo-note {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* Sections */

.sec {
  padding-top: 56px;
  padding-bottom: 8px;
}

h2 {
  margin: 0 0 20px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

h3 {
  margin: 0 0 6px;
  font-size: 1.0625rem;
  line-height: 1.35;
}

.how {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 48px;
  align-items: start;
}

.how-text p {
  margin: 0 0 14px;
  max-width: 40rem;
}

.pipe {
  margin: 0;
}

.pipe ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pipe li {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
}

.pipe li + li {
  margin-top: 22px;
}

.pipe li + li::before {
  content: "";
  position: absolute;
  left: 22px;
  top: -23px;
  height: 22px;
  border-left: 1.5px solid var(--line-strong);
}

.pipe li:nth-child(2) { border-left-color: var(--k-tool); }
.pipe li:nth-child(3) { border-left-color: var(--k-graph); }
.pipe li.outs { border-left-color: var(--accent); }

.pipe .mono {
  font-size: 13.5px;
  font-weight: 600;
}

.pipe .muted {
  font-size: 13px;
}

.truth {
  margin: 28px 0 0;
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  font-weight: 500;
}

/* Coverage table */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

thead th {
  background: var(--raised);
  font-size: 13px;
  font-weight: 600;
}

tbody th {
  width: 9.5rem;
  font-weight: 600;
  white-space: nowrap;
}

td code {
  font-size: 12.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--raised);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--c);
  vertical-align: 1px;
}

/* Get it */

.steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  margin: 0;
  padding: 0;
}

.steps li {
  counter-increment: step;
  min-width: 0;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 8px;
  font: 600 13px var(--mono);
  color: var(--accent);
}

.steps p {
  margin: 0 0 12px;
}

.steps .cmd {
  display: flex;
  margin-bottom: 10px;
}

.steps .cmd code {
  flex: 1;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-block;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Roadmap */

.road {
  margin: 0;
}

.road > div {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.road > div:last-child {
  border-bottom: 0;
}

.road dt {
  font-weight: 600;
}

.road dd {
  margin: 0;
  color: var(--muted);
  max-width: 44rem;
}

.ver {
  display: inline-block;
  min-width: 3.4rem;
  margin-right: 8px;
  font: 500 12.5px var(--mono);
  color: var(--accent);
}

/* Footer */

.foot {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px;
  color: var(--muted);
}

.foot-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 20px;
  padding-bottom: 20px;
}

.foot-links {
  display: flex;
  gap: 18px;
}

.foot a {
  color: var(--muted);
}

.foot a:hover {
  color: var(--ink);
}

/* Responsive */

@media (max-width: 960px) {
  .demo-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 560px auto;
    height: auto;
  }
  .frame {
    order: -1; /* the diagram first, the code that produced it below */
  }
  .code {
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .src {
    max-height: 300px;
  }
  .how {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

@media (max-width: 640px) {
  .wrap {
    padding-left: 16px;
    padding-right: 16px;
  }
  .nav a:not([href^="http"]) {
    display: none;
  }
  .hero {
    padding-top: 40px;
  }
  .lede {
    font-size: 1.0625rem;
  }
  .cmd {
    display: flex;
  }
  .cmd code {
    flex: 1;
  }
  .demo-body {
    grid-template-rows: 500px auto;
  }
  .tabs {
    width: 100%;
  }
  .tabs button {
    flex: 1;
    padding: 6px 8px;
  }
  .tabs .fw {
    display: block;
    margin: 0;
  }
  .road > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
