/* PilotKYC documentation — styles. One accent colour, system fonts, light/dark tokens. */

:root {
  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --bg-code: #f6f8fa;
  --border: #e2e6ea;
  --text: #1c2128;
  --text-muted: #5b6672;
  --accent: #2a55e5;
  --accent-soft: #eaeffd;
  --accent-contrast: #ffffff;
  --ok: #1a7f4b;
  --ok-soft: #e6f4ec;
  --warn: #9a6700;
  --warn-soft: #fff4d6;
  --danger: #c0352b;
  --danger-soft: #fdeceb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar-w: 288px;
  --header-h: 56px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419;
    --bg-subtle: #161c23;
    --bg-code: #131920;
    --border: #28313b;
    --text: #e6ebf0;
    --text-muted: #96a2ae;
    --accent: #7c9dff;
    --accent-soft: #172641;
    --accent-contrast: #0b1220;
    --ok: #4cc38a;
    --ok-soft: #12291f;
    --warn: #e3b341;
    --warn-soft: #2e2410;
    --danger: #ff7b72;
    --danger-soft: #331a18;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1419;
  --bg-subtle: #161c23;
  --bg-code: #131920;
  --border: #28313b;
  --text: #e6ebf0;
  --text-muted: #96a2ae;
  --accent: #7c9dff;
  --accent-soft: #172641;
  --accent-contrast: #0b1220;
  --ok: #4cc38a;
  --ok-soft: #12291f;
  --warn: #e3b341;
  --warn-soft: #2e2410;
  --danger: #ff7b72;
  --danger-soft: #331a18;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-contrast);
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 20px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
}
.brand-mark svg { width: 18px; height: 18px; display: block; }
.badge.muted { background: var(--bg-subtle); color: var(--text-muted); border-color: var(--border); }
.spacer { flex: 1; }
.search { position: relative; width: min(340px, 36vw); }
.search input {
  width: 100%; height: 36px; padding: 0 34px 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-subtle); color: var(--text); font: inherit; font-size: 14px;
}
.search input::placeholder { color: var(--text-muted); }
.search kbd {
  position: absolute; right: 8px; top: 7px; font: 12px/20px var(--mono);
  padding: 0 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); background: var(--bg);
}
.icon-btn {
  height: 36px; min-width: 36px; padding: 0 8px; display: inline-grid; place-items: center;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
}
.icon-btn:hover { background: var(--bg-subtle); }
#menu-btn { display: none; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 20px 12px 40px var(--gutter);
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.nav-group { margin-bottom: 20px; }
.nav-group h4 {
  margin: 0 0 6px; padding: 0 10px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); font-weight: 650;
}
.nav-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 10px; border-radius: 6px; color: var(--text); font-size: 14px; line-height: 1.4;
}
.nav-link:hover { background: var(--bg-subtle); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-link .tag { font: 600 10px/16px var(--mono); padding: 0 6px; border-radius: 4px; flex: none; }
.tag.get { background: var(--ok-soft); color: var(--ok); }
.tag.post { background: var(--accent-soft); color: var(--accent); }
.tag.soon { background: var(--warn-soft); color: var(--warn); }
.nav-link.active .tag.get, .nav-link.active .tag.post { background: var(--bg); }

.search-results .res { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); font-size: 14px; }
.search-results .res:hover { background: var(--bg-subtle); text-decoration: none; }
.search-results .res small { display: block; color: var(--text-muted); font-size: 12px; }
.search-results mark { background: var(--warn-soft); color: inherit; border-radius: 2px; }
.search-results .empty { padding: 10px; color: var(--text-muted); font-size: 14px; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 40px; padding: 32px 40px 80px; max-width: 1240px; }
.content { min-width: 0; max-width: 820px; }
.toc { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; font-size: 13px; }
.toc h5 { margin: 0 0 8px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.toc a { display: block; padding: 3px 0 3px 10px; color: var(--text-muted); border-left: 2px solid var(--border); line-height: 1.4; }
.toc a.l3 { padding-left: 22px; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }

/* ---------- prose ---------- */
.content h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 8px; letter-spacing: -0.01em; }
.content h2 { font-size: 1.4rem; margin: 2.2em 0 .6em; padding-top: .4em; border-top: 1px solid var(--border); letter-spacing: -0.005em; }
.content h1 + h2, .content .lead + h2 { border-top: 0; margin-top: 1.4em; }
.content h3 { font-size: 1.1rem; margin: 1.8em 0 .5em; }
.content h4 { font-size: 1rem; margin: 1.4em 0 .4em; }
.content h2 .anchor, .content h3 .anchor { margin-left: 6px; color: var(--text-muted); opacity: 0; font-weight: 400; }
.content h2:hover .anchor, .content h3:hover .anchor, .content .anchor:focus { opacity: 1; text-decoration: none; }
.content p, .content ul, .content ol { margin: 0 0 1em; }
.content li { margin: .25em 0; }
.content .lead { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 1.4em; }
.content hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.content code {
  font-family: var(--mono); font-size: .86em; padding: .12em .4em;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 5px;
  overflow-wrap: anywhere;
}
.content pre code { padding: 0; border: 0; background: none; font-size: inherit; overflow-wrap: normal; }
.content h1 code, .content h2 code, .content h3 code { font-size: .8em; }

.method { display: inline-block; font: 700 12px/20px var(--mono); padding: 0 8px; border-radius: 5px; margin-right: 6px; vertical-align: middle; }
.method.get { background: var(--ok-soft); color: var(--ok); }
.method.post { background: var(--accent-soft); color: var(--accent); }
.endpoint {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 14px; margin: 0 0 1.2em; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-subtle);
  font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere;
}
.endpoint .method { margin: 0; }

.table-wrap { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--border); border-radius: 8px; }
.content table { border-collapse: collapse; width: 100%; font-size: 14px; }
.content th, .content td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.content th { background: var(--bg-subtle); font-weight: 600; white-space: nowrap; font-size: 13px; color: var(--text-muted); }
.content tr:last-child td { border-bottom: 0; }
.content td:first-child code { white-space: nowrap; }

blockquote.callout {
  margin: 0 0 1.2em; padding: 12px 16px; border-radius: 8px; border: 1px solid var(--border); border-left-width: 4px;
  background: var(--bg-subtle);
}
blockquote.callout > :last-child { margin-bottom: 0; }
blockquote.callout .callout-title { font-weight: 650; margin-bottom: 4px; font-size: 14px; }
blockquote.callout.note { border-left-color: var(--accent); background: var(--accent-soft); }
blockquote.callout.warning { border-left-color: var(--warn); background: var(--warn-soft); }
blockquote.callout.danger { border-left-color: var(--danger); background: var(--danger-soft); }
blockquote.callout.tip { border-left-color: var(--ok); background: var(--ok-soft); }
.content blockquote:not(.callout) { margin: 0 0 1em; padding-left: 14px; border-left: 3px solid var(--border); color: var(--text-muted); }

li > input[type="checkbox"] { margin: 0 8px 0 -20px; }

/* code blocks */
.codeblock { margin: 0 0 1.2em; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-code); overflow: hidden; }
.codebar { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--border); background: var(--bg-subtle); min-height: 36px; }
.codebar .label { font: 600 12px/1 var(--mono); color: var(--text-muted); margin-right: auto; text-transform: lowercase; }
.codebar .tabs { display: flex; gap: 2px; margin-right: auto; flex-wrap: wrap; }
.tab-btn { border: 0; background: none; padding: 5px 10px; border-radius: 6px; font-size: 13px; color: var(--text-muted); }
.tab-btn:hover { color: var(--text); background: var(--bg); }
.tab-btn[aria-selected="true"] { background: var(--bg); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }
.copy-btn { border: 1px solid var(--border); background: var(--bg); border-radius: 6px; padding: 3px 10px; font-size: 12px; color: var(--text-muted); }
.copy-btn:hover { color: var(--text); }
.copy-btn.done { color: var(--ok); border-color: var(--ok); }
.codeblock pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 13px/1.6 var(--mono); tab-size: 2; }
.codeblock pre[hidden] { display: none; }

/* widget */
.widget { border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin: 0 0 1.4em; background: var(--bg-subtle); }
.widget h4 { margin: 0 0 12px; }
.widget label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin: 10px 0 4px; }
.widget input, .widget select, .widget textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: 13px var(--mono);
}
.widget .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
.widget .out { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.widget .out.sig { color: var(--ok); font-weight: 600; }
.widget .btn { margin-top: 8px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); font-size: 13px; }

/* pager + footer */
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); }
.pager a { display: block; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); min-width: 0; max-width: 48%; }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager small { display: block; color: var(--text-muted); font-size: 12px; }
.pager .next { margin-left: auto; text-align: right; }
.footer-note { margin-top: 24px; color: var(--text-muted); font-size: 13px; }

.error-box { padding: 24px; border: 1px solid var(--danger); border-radius: 8px; background: var(--danger-soft); }
.scrim { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .main { grid-template-columns: minmax(0, 1fr); padding: 28px 28px 72px; }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  #menu-btn { display: inline-grid; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; z-index: 25; width: min(86vw, 320px); height: auto;
    transform: translateX(-102%); transition: transform .18s ease; box-shadow: 0 8px 30px rgba(0,0,0,.25);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 20; background: rgba(0,0,0,.35); }
  .main { padding: 20px var(--gutter) 64px; }
  .spacer { display: none; }
  .search { width: auto; flex: 1; min-width: 0; }
  .search kbd { display: none; }
  .brand .brand-name { display: none; }
  .content h1 { font-size: 1.6rem; }
  .pager a { max-width: 100%; }
  .pager { flex-direction: column; }
  .pager .next { margin-left: 0; text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------- PilotKYC additions ---------- */
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; padding: 8px 12px; background: var(--accent); color: var(--accent-contrast); }
.skip:focus { left: 8px; top: 8px; }
.top-link { font-size: 14px; color: var(--text-muted); padding: 6px 8px; border-radius: 6px; }
.top-link:hover { color: var(--text); background: var(--bg-subtle); text-decoration: none; }
.brand-mark { background: linear-gradient(135deg, #3b6bff, #12b3a4); }
.widget p { margin: 0 0 8px; font-size: 14px; color: var(--text-muted); }
.status-chip { display: inline-block; font: 600 12px/20px var(--mono); padding: 0 8px; border-radius: 5px; background: var(--bg-subtle); border: 1px solid var(--border); }
@media (max-width: 520px) { .top-link { display: none; } }
