/* Railyard API reference — self-contained, same-origin stylesheet.
   No @import, no CDN. Fully CSP-safe under style-src 'self' / font-src 'self'.

   This page is hand-built static HTML rather than part of the React app, so it can't share
   src/index.css. The palette below therefore MIRRORS the app's design tokens by hand — keep it in
   step with :root in frontend/src/index.css if those change. Railyard is a single dark theme, so
   there is deliberately no prefers-color-scheme branch: this page used to go white in light mode,
   which made it the only surface that didn't look like the product. */

/* IBM Plex Sans, the app's typeface. Vite content-hashes the fontsource files it bundles, so a
   static page can't reference those; these are copies under public/ (served verbatim, stable URLs).
   font-display: swap keeps text visible while they load. */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/api-docs/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/api-docs/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/api-docs/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2");
}

:root {
  --bg: #080b11;
  --bg-alt: #141b25;
  --bg-code: #0d1219;
  --sidebar-bg: #0d1219;
  --text: #eaf1f8;
  --text-muted: #899aac;
  --border: #212c39;
  --border-strong: #33414f;
  --accent: #1f8bff;
  --accent-soft: rgba(31, 139, 255, 0.14);
  --link: #5aa9ff;
  --glow: #12233f;

  /* HTTP method chips, mapped onto the app's semantic tokens where one exists. */
  --get: #2ec46b;
  --get-bg: #052e1a;
  --post: #1f8bff;
  --post-bg: #12233f;
  --put: #f5a524;
  --put-bg: #2a1f05;
  --patch: #b892f6;
  --patch-bg: #221733;
  --delete: #e5484d;
  --delete-bg: #2a0d10;

  --req: #f5a524;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 300px;
  --nav-h: 57px; /* the sticky header, so the sidebar can sit below it */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  /* The same two-gradient wash as the marketing page and the docs (.landing / .legal). */
  background:
    radial-gradient(1100px 480px at 72% -8%, var(--accent-soft) 0%, transparent 60%),
    radial-gradient(circle at 30% 0%, var(--glow) 0%, var(--bg) 55%);
  background-attachment: fixed; /* one wash over the whole page, not per-scroll */
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---- Site header ----------------------------------------------------------
   Mirrors .landing__nav / .legal__nav in src/index.css so this page reads as part of the same
   site. Hand-written rather than shared because this page is static HTML outside the React
   bundle — keep the two in step. */
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(16px, 5vw, 56px);
  padding-top: calc(14px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topnav__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
}
.topnav__brand:hover { text-decoration: none; }
.topnav__mark { display: block; width: 24px; height: 24px; border-radius: 6px; }
.topnav__wordmark { font-weight: 800; font-size: 17px; letter-spacing: 0.01em; }
.topnav__accent { color: var(--accent); }
.topnav__links { display: flex; align-items: center; gap: 14px; }
.topnav__link { color: var(--text-muted); font-size: 14px; }
.topnav__link:hover { color: var(--text); text-decoration: none; }
.topnav__btn {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}
.topnav__btn:hover { filter: brightness(1.08); text-decoration: none; }

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

code, pre { font-family: var(--mono); }

/* ---- Layout ---- */
.layout { display: flex; align-items: flex-start; }

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  /* Sits below the sticky header rather than under it, so the topic list is never occluded. */
  height: calc(100vh - var(--nav-h));
  position: sticky;
  top: var(--nav-h);
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 20px 0 60px;
}

.sidebar-head { padding: 4px 20px 14px; }
.sidebar-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.sidebar-title .ver {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--mono);
}
.sidebar-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.filter-wrap { padding: 4px 16px 12px; }
.filter {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  outline: none;
}
.filter:focus { border-color: var(--accent); }

.nav-group { margin-top: 6px; }
.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-muted);
  padding: 10px 20px 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 20px 4px 20px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.nav-link:hover { background: var(--accent-soft); text-decoration: none; }
.nav-link .m {
  font-size: 9.5px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.03em;
  min-width: 42px;
  text-align: right;
  color: var(--text-muted);
}
.nav-link .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link.hidden { display: none; }
.nav-group.hidden { display: none; }

/* ---- Content ---- */
.content {
  flex: 1;
  min-width: 0;
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 48px 120px;
}

.doc-title { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.doc-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 20px; }
.badge {
  font-size: 12px;
  font-family: var(--mono);
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge strong { color: var(--text); font-weight: 600; }

.prose { color: var(--text); }
.prose p { margin: 0 0 12px; }
.prose h2 { font-size: 15px; margin: 20px 0 8px; }
.prose ul { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin: 3px 0; }
.prose code {
  background: var(--bg-code);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.86em;
  border: 1px solid var(--border);
}

.divider { height: 1px; background: var(--border); border: 0; margin: 36px 0; }

/* ---- Tag section ---- */
.tag-section { margin-top: 48px; scroll-margin-top: 12px; }
.tag-heading {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-strong);
  margin: 0 0 6px;
}
.tag-desc { color: var(--text-muted); font-size: 14px; margin: 6px 0 8px; }

/* ---- Operation ---- */
.op {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 22px 0;
  overflow: hidden;
  background: var(--bg);
}
.op-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  scroll-margin-top: 12px;
}
.op-method {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 6px;
  min-width: 62px;
  text-align: center;
  text-transform: uppercase;
}
.m-get { color: var(--get); background: var(--get-bg); }
.m-post { color: var(--post); background: var(--post-bg); }
.m-put { color: var(--put); background: var(--put-bg); }
.m-patch { color: var(--patch); background: var(--patch-bg); }
.m-delete { color: var(--delete); background: var(--delete-bg); }

.op-path { font-family: var(--mono); font-size: 14px; font-weight: 600; word-break: break-all; }
.op-summary { color: var(--text-muted); font-size: 13px; margin-left: auto; text-align: right; }

.op-body { padding: 18px 18px 6px; }
.op-body.collapsed { display: none; }

.op-desc { margin-bottom: 14px; font-size: 14px; }

.op-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
  font-family: var(--mono);
}
.chip.auth { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.chip.public { color: var(--get); border-color: var(--get); background: var(--get-bg); }

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-muted);
  margin: 18px 0 8px;
}

/* ---- Tables ---- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 6px; }
.tbl-wrap { overflow-x: auto; }
table.tbl th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-strong);
  font-weight: 700;
}
table.tbl td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.tbl tr:last-child td { border-bottom: 0; }
.pname { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.ptype { font-family: var(--mono); color: var(--accent); font-size: 12px; white-space: nowrap; }
.req-tag { color: var(--req); font-size: 10px; font-weight: 700; text-transform: uppercase; margin-left: 6px; }
.pdesc { color: var(--text); }
.pdesc .enum { display: block; margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.pin {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-muted);
  background: var(--bg-code);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ---- Responses ---- */
.resp { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); }
.resp:last-child { border-bottom: 0; }
.status {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  min-width: 42px;
  padding: 2px 8px;
  border-radius: 6px;
  text-align: center;
}
.s-2 { color: var(--get); background: var(--get-bg); }
.s-3 { color: var(--patch); background: var(--patch-bg); }
.s-4 { color: var(--put); background: var(--put-bg); }
.s-5 { color: var(--delete); background: var(--delete-bg); }
.s-1 { color: var(--post); background: var(--post-bg); }
.resp-body { flex: 1; min-width: 0; }
.resp-desc { font-size: 13px; }
.resp-schema { margin-top: 5px; font-size: 12px; font-family: var(--mono); color: var(--text-muted); }
.schema-link { color: var(--link); font-family: var(--mono); }

/* ---- Example blocks (pretty-printed JSON) ---- */
.example {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-code);
  margin: 8px 0 6px;
}
.example-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 7px 12px;
}
.example-head:hover { color: var(--text); }
.example-caret {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}
.example-pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  tab-size: 2;
}
.example-pre code { font-family: var(--mono); white-space: pre; }
.example.collapsed { position: relative; }
.example.collapsed .example-pre { max-height: 280px; overflow-y: hidden; }
.example.collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--bg-code));
}

/* ---- Schemas section ---- */
.schema-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 18px 0;
  overflow: hidden;
  scroll-margin-top: 12px;
}
.schema-card-head {
  padding: 11px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
}
.schema-card-body { padding: 4px 16px 8px; }
.schema-card-desc { color: var(--text-muted); font-size: 13px; margin: 10px 0 4px; }

.msg { padding: 60px; text-align: center; color: var(--text-muted); }
.msg.error { color: var(--delete); }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { padding: 28px 20px 100px; }
  .op-summary { display: none; }
}

/* ---- Try-it console -------------------------------------------------------
   A third column beside the reference. Only ever shown to a signed-in visitor (app.js reveals it
   after /api/me), because every request it sends hits that person's real account. */
.topnav__link.is-current { color: var(--text); }

.op-try {
  margin-left: 12px;
  flex: none;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.op-try:hover { background: var(--accent-soft); }
/* op-summary takes the slack, so the button sits hard right without pushing the path around. */
.op-head .op-summary { margin-left: auto; }

.console {
  width: 400px;
  min-width: 400px;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  padding: 18px 18px 60px;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--border);
}
.console__idle { color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.console__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.console__path { font-family: var(--mono); font-size: 13px; font-weight: 600; word-break: break-all; }
.console__warn {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--put-bg);
  border: 1px solid var(--put);
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 14px;
}
.console__form { display: flex; flex-direction: column; gap: 12px; }
.cfield { display: flex; flex-direction: column; gap: 4px; }
.cfield__label { font-size: 12px; font-weight: 600; font-family: var(--mono); color: var(--text); }
.cfield__hint { font-size: 11.5px; color: var(--text-muted); }
.cinput, .ctextarea {
  width: 100%;
  padding: 7px 9px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  outline: none;
}
.ctextarea { resize: vertical; line-height: 1.5; }
.cinput:focus, .ctextarea:focus { border-color: var(--accent); }

.cconfirm {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 10px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}

.cbtn {
  width: 100%;
  margin-top: 14px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.cbtn:hover:not(:disabled) { filter: brightness(1.08); }
.cbtn:disabled { opacity: 0.45; cursor: not-allowed; }

.console__out { margin-top: 16px; }
.console__status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.console__ms { font-size: 11.5px; color: var(--text-muted); font-family: var(--mono); word-break: break-all; }
.console__body {
  margin: 0;
  padding: 10px 12px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  max-height: 46vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.console__err {
  font-size: 12.5px;
  color: var(--delete);
  background: var(--delete-bg);
  border: 1px solid var(--delete);
  border-radius: 8px;
  padding: 9px 11px;
}

/* Not enough room for a third column — the reference itself is the priority. */
@media (max-width: 1400px) {
  .console { display: none; }
  .op-try { display: none; }
}
