/* Styles for docs/mcp.html, served at /mcp/docs/, and docs/open-api/index.html,
   served at /mcp/docs/open-api/. Palette and fonts follow the
   POEMS sign-in pages. The light header is white with the blue logo, as on
   poems.com.sg; the dark one switches to the white logo (see the <picture>). */

:root {
  --navy: #1a2a3a;
  --orange: #f99428;
  --bg: #ffffff;
  --fg: #1f2933;
  --muted: #5b6875;
  --line: #dde3e9;
  --soft: #f5f7f9;
  --link: #0077b3;
  --code-bg: #f5f7f9;
  --code-fg: #1f2933;
  --header-bg: #ffffff;
  --header-fg: var(--navy);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: rgb(11, 11, 11);
    --fg: #e6e6e6;
    --muted: #a3a3a3;
    --line: #2b2b2b;
    --soft: #161616;
    --link: #6cb8f0;
    --code-bg: #1a1a1a;
    --code-fg: #e6e6e6;
    --header-bg: #111111;
    --header-fg: #ffffff;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", Manrope, sans-serif;
  letter-spacing: .01em;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---- Header */

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 72px;
  padding: 0 24px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--header-fg);
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  display: block;
}

.brand-label {
  padding-left: 14px;
  border-left: 1px solid var(--line);
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .02em;
}

/* Links between the guides (mcp.html and open-api/index.html). */
.topnav {
  display: flex;
  gap: 24px;
  margin-left: auto;
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
  font-weight: 500;
}

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

.topnav a[aria-current="page"] {
  color: var(--header-fg);
  box-shadow: inset 0 -2px 0 var(--orange);
}

/* ---- Layout */

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 56px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.toc {
  position: sticky;
  top: 104px;
  align-self: start;
  max-height: calc(100vh - 128px);
  overflow: auto;
  font-size: 14px;
}

/* Held open on wide screens (docs.js), so the summary is only a label there. */
.toc summary {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  list-style: none;
  pointer-events: none;
}

.toc summary::-webkit-details-marker {
  display: none;
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a {
  display: block;
  padding: 5px 0 5px 14px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

.toc a:hover,
.toc a.active {
  border-left-color: var(--orange);
  color: var(--fg);
  text-decoration: none;
}

/* The OpenAPI guide's operations, nested under "Endpoints" by docs.js. */
.toc ul ul a {
  padding-left: 28px;
  font-size: .92em;
}

main {
  min-width: 0;
  max-width: 800px;
}

section {
  margin-top: 56px;
}

h1 {
  margin: 0 0 12px;
  font-size: 2.5rem;
  line-height: 1.15;
}

h2 {
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 1.6rem;
}

h3 {
  margin: 28px 0 8px;
  font-size: 1.15rem;
}

/* ---- Hero */

.lead {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 1.15rem;
}

/* ---- Code */

code {
  padding: .1em .35em;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--soft);
  font: .875em/1.5 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  overflow-wrap: anywhere;
}

pre {
  position: relative;
  margin: 12px 0;
  padding: 16px 18px;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--code-bg);
  color: var(--code-fg);
}

pre code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  overflow-wrap: normal;
}

.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--code-fg);
  font: 600 12px Manrope, sans-serif;
  cursor: pointer;
}

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

/* ---- Client cards */

.clients {
  display: grid;
  gap: 16px;
}

.client {
  /* Lets the card shrink below its code block, which then scrolls on its own. */
  min-width: 0;
  padding: 4px 20px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.client h3 {
  margin-top: 16px;
}

/* ---- Endpoint reference (docs/open-api, rendered by docs.js from openapi.json) */

section.operation {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

section.operation h3 {
  margin-top: 0;
}

section.operation h4 {
  margin: 20px 0 8px;
  font-family: "Space Grotesk", Manrope, sans-serif;
  font-size: 1rem;
}

.route {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.method {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--navy);
  color: #ffffff;
  font-family: "Space Grotesk", sans-serif;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
}

.route code {
  overflow-wrap: anywhere;
}

/* Keep field and parameter names whole; the description column takes the rest. */
section.operation td:first-child {
  width: 1%;
  white-space: nowrap;
}

section.operation td:first-child code {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

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

/* ---- Diagrams (inline SVG, so they follow the light/dark palette) */

.diagram {
  margin: 20px 0;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.diagram svg {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
}

/* Phone versions of the diagrams; shown instead of the wide ones below 600px. */
.diagram svg.narrow {
  display: none;
  min-width: 0;
}

.diagram .node {
  fill: var(--bg);
  stroke: var(--line);
  stroke-width: 1.5;
}

.diagram .node.accent {
  stroke: var(--orange);
  stroke-width: 2;
}

.diagram .node.muted {
  fill: var(--soft);
}

.diagram .node-title {
  fill: var(--fg);
  font: 700 14px "Space Grotesk", sans-serif;
  text-anchor: middle;
}

.diagram .node-sub {
  fill: var(--muted);
  font: 500 12px Manrope, sans-serif;
  text-anchor: middle;
}

.diagram .edge {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
}

.diagram .edge.dashed {
  stroke-dasharray: 5 4;
}

.diagram .arrowhead {
  fill: var(--muted);
}

.diagram .edge-label {
  fill: var(--fg);
  font: 600 12.5px Manrope, sans-serif;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--soft);
  stroke-width: 5px;
  stroke-linejoin: round;
}

.diagram .edge-label.start {
  text-anchor: start;
}

.diagram .lifeline {
  stroke: var(--line);
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
}

/* ---- Tables */

table {
  display: block;
  width: 100%;
  margin: 16px 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 15px;
}

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

th {
  background: var(--soft);
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

td:first-child {
  white-space: nowrap;
}

/* ---- Prompts */

.prompts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.prompts li {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.prompts li::before {
  content: "\201C";
  margin-right: 2px;
  color: var(--orange);
  font-weight: 700;
}

.prompts li::after {
  content: "\201D";
  color: var(--orange);
  font-weight: 700;
}

/* ---- Narrow screens */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 24px;
  }

  /* "On this page" becomes a drop-down above the title (closed by docs.js). */
  .toc {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .toc details {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
  }

  .toc summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    padding: 12px 16px;
    color: var(--fg);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    pointer-events: auto;
    cursor: pointer;
  }

  .toc summary::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 4px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
  }

  .toc details[open] summary::after {
    transform: rotate(-135deg);
  }

  .toc ul {
    padding: 0 16px 12px;
  }

  h1 {
    font-size: 2rem;
  }

  td:first-child {
    white-space: normal;
  }
}

/* ---- Phones: vertical diagrams, and table rows as cards */

@media (max-width: 600px) {
  .layout {
    padding: 20px 16px 64px;
  }

  .topbar {
    padding: 0 16px;
  }

  .brand-label {
    display: none;
  }

  .topnav {
    gap: 16px;
    font-size: 14px;
  }

  section {
    margin-top: 44px;
  }

  .diagram {
    padding: 12px;
  }

  .diagram svg.wide {
    display: none;
  }

  .diagram svg.narrow {
    display: block;
    max-width: 420px;
    margin: 0 auto;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  table {
    overflow: visible;
    border-top: 1px solid var(--line);
  }

  thead {
    display: none;
  }

  tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  td {
    padding: 2px 0;
    border: 0;
  }

  td:first-child {
    margin-bottom: 4px;
    font-weight: 600;
  }

  td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
}
