/* ==========================================================================
   Kllivo API documentation
   Flat, quiet, content-first. Solid colors, hairline borders, no effects.
   Drop-in replacement for assets/css/dev-docs.css
   ========================================================================== */

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

:root {
  color-scheme: light;

  --brand: #1f4b5c;
  --brand-2: #163842;
  --mint-ink: #0f6b5c;

  --bg: #ffffff;
  --soft: #f6f8f8;
  --hover: #f0f3f4;

  --ink: #0d1418;
  --ink-2: #3b484f;
  --muted: #66757d;
  --subtle: #97a3a9;

  --line: #e7eaec;
  --line-2: #d5dde0;

  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --nav-h: 56px;
  --side-w: 232px;
  --r: 8px;
}

/* ---------- Base ---------- */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 24px); -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  width: 100%; max-width: 100%; overflow-x: hidden; overflow-x: clip;
}
::selection { background: #d8ece8; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button { font-family: inherit; }
svg { display: block; }
img { max-width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  font: 500 14px/1 var(--font);
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line-2); border-radius: var(--r);
  cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--soft); border-color: #c3cdd1; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 15px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.primary { color: #fff; background: var(--brand); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }

/* ---------- Top navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 14px;
  height: var(--nav-h); padding: 0 max(24px, calc((100vw - 1180px) / 2 + 28px));
  background: #fff; border-bottom: 1px solid var(--line);
}
.nav .logo { display: flex; align-items: center; }
.nav .logo img { height: 24px; width: auto; display: block; }
.nav .sep { width: 1px; height: 16px; background: var(--line-2); }
.nav .tag { font-size: 14px; color: var(--muted); }
.nav .links { display: flex; gap: 4px; margin-left: 20px; }
.nav .links a { padding: 6px 10px; border-radius: 6px; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.nav .links a:hover { background: var(--hover); color: var(--ink); }
.nav .grow { flex: 1; }
.menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-left: -8px;
  background: none; border: 0; border-radius: 6px; color: var(--ink); cursor: pointer;
}
.menu-btn:hover { background: var(--hover); }

/* ---------- Hero ---------- */
.hero { background: var(--bg); border-bottom: 1px solid var(--line); }
.hero-in {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 64px; align-items: center;
  max-width: 1240px; margin: 0 auto; padding: 80px 34px 84px;
}
.hero-eyebrow { margin-bottom: 18px; font-size: 14px; font-weight: 500; color: var(--muted); }
.hero-eyebrow span:first-child { display: none; }
.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(36px, 4.4vw, 54px); line-height: 1.08; font-weight: 600; letter-spacing: -.035em;
  color: var(--ink); text-wrap: balance;
}
.hero h1 span:last-child { color: var(--ink); }
.hero p.lead { max-width: 500px; font-size: 18px; line-height: 1.6; color: var(--ink-2); }
.hero .cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 32px; }
.facts div { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); }
.facts svg { width: 15px; height: 15px; flex: none; color: var(--mint-ink); }

/* ---------- Code windows ---------- */
.win {
  margin: 0; background: var(--bg);
  border: 1px solid var(--line-2); border-radius: 10px;
  overflow: hidden; text-align: left;
}
main .win { margin: 18px 0 24px; }
.win-bar {
  display: flex; align-items: center; gap: 4px;
  min-height: 42px; padding: 0 8px 0 10px;
  background: var(--soft); border-bottom: 1px solid var(--line); min-width: 0;
}
.win-bar .dots { display: none; }
.tabs { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  padding: 6px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted);
  font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line-2); }
.copy {
  margin-left: auto; padding: 6px 10px;
  font: 500 12.5px/1 var(--font); color: var(--muted);
  background: transparent; border: 0; border-radius: 6px; cursor: pointer;
}
.copy:hover { background: var(--hover); color: var(--ink); }
.win pre {
  margin: 0; padding: 18px 20px; max-height: 540px;
  overflow: auto; white-space: pre; tab-size: 2;
  font: 400 13px/1.7 var(--mono); color: #24323a; background: var(--bg);
  scrollbar-width: thin; scrollbar-color: #d3dcdf transparent;
}
.win pre[hidden] { display: none; }
.win pre code { background: none; border: 0; padding: 0; border-radius: 0; font-size: inherit; color: inherit; }
.k { color: #0f6b5c; }
.s { color: #a15c07; }
.n { color: #2a5f9e; }
.c { color: #8a979e; }
.f { color: #6b46b8; }

/* ---------- Docs layout ---------- */
.layout {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  gap: 64px; max-width: 1180px; margin: 0 auto; padding: 0 28px; min-width: 0;
}
.side {
  position: sticky; top: var(--nav-h); align-self: start;
  height: calc(100vh - var(--nav-h)); overflow-y: auto;
  padding: 32px 0 48px; scrollbar-width: thin; scrollbar-color: #d9e1e3 transparent;
}
.side h6 { margin: 24px 0 6px; padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--ink); }
.side h6:first-child { margin-top: 0; }
.side a {
  display: block; margin: 0; padding: 5px 10px;
  font-size: 14px; line-height: 1.45; color: var(--muted);
  border-radius: 6px; text-decoration: none;
}
.side a:hover { color: var(--ink); background: var(--hover); }
.side a.on { color: var(--brand); font-weight: 500; background: var(--hover); }

main { min-width: 0; max-width: 760px; padding: 24px 0 120px; }
main p, main li, .callout p, .card, .ai-prompt-preview { overflow-wrap: anywhere; }
section { padding: 56px 0; border-top: 1px solid var(--line); }
section:first-child { padding-top: 32px; border-top: 0; }

/* ---------- Typography ---------- */
.sec-eyebrow { margin-bottom: 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
h2 { margin-bottom: 16px; font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.025em; color: var(--ink); }
h3 { margin: 36px 0 10px; font-size: 18px; line-height: 1.3; font-weight: 600; letter-spacing: -.012em; color: var(--ink); }
main p { margin-bottom: 14px; font-size: 16px; line-height: 1.7; color: var(--ink-2); }
main strong { font-weight: 600; color: var(--ink); }
main ul, main ol { margin: 0 0 16px 20px; padding-left: 4px; }
main li { margin-bottom: 8px; font-size: 16px; line-height: 1.7; color: var(--ink-2); }
main li::marker { color: var(--subtle); }
code {
  font: 400 .87em/1.4 var(--mono);
  padding: 1px 5px; border-radius: 4px;
  background: var(--soft); border: 1px solid var(--line); color: var(--ink);
}

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 24px 0 8px; }
#products .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { display: block; padding: 18px 20px; color: inherit; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; }
a.card:hover { border-color: var(--brand); text-decoration: none; color: inherit; }
.card .ic { display: block; width: 20px; height: 20px; margin-bottom: 14px; color: var(--brand); }
.card .ic svg { width: 20px; height: 20px; }
.card b { display: block; margin-bottom: 4px; font-size: 15px; font-weight: 600; color: var(--ink); }
.card span { display: block; font-size: 14px; line-height: 1.6; color: var(--muted); }

/* ---------- Steps ---------- */
.steps { counter-reset: s; list-style: none; margin: 24px 0 0 !important; padding: 0 !important; }
.steps li { position: relative; margin: 0; padding: 0 0 26px 40px; counter-increment: s; }
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: 0;
  display: grid; place-items: center; width: 26px; height: 26px;
  font: 500 13px/1 var(--font); color: var(--ink-2);
  background: #fff; border: 1px solid var(--line-2); border-radius: 50%;
}
.steps li::after { content: ''; position: absolute; left: 12.5px; top: 32px; bottom: 6px; width: 1px; background: var(--line); }
.steps li:last-child { padding-bottom: 0; }
.steps li:last-child::after { display: none; }
.steps b { display: block; margin-bottom: 2px; font-size: 16px; font-weight: 600; color: var(--ink); }
.steps span { display: block; font-size: 15px; line-height: 1.65; color: var(--muted); }

/* ---------- Endpoints ---------- */
.endpoint {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin: 28px 0 12px; padding: 10px 14px;
  font: 400 14px/1.4 var(--mono); color: var(--ink);
  background: var(--soft); border: 1px solid var(--line); border-radius: var(--r);
}
.verb { font: 600 12px/1 var(--mono); color: var(--brand); }
.verb.get { color: var(--mint-ink); }
.verb.del { color: #b4453a; }
.endpoint .sc { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font: 400 12.5px/1 var(--font); color: var(--subtle); }
.endpoint .sc code { font-size: 12px; background: #fff; }

/* ---------- Callouts ---------- */
.callout {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 20px 0; padding: 14px 16px;
  background: var(--soft); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 6px;
}
.callout svg { flex: none; width: 16px; height: 16px; margin-top: 4px; color: var(--brand); }
.callout p { margin: 0; font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }
.callout.warn { border-left-color: #c58a1b; }
.callout.warn svg { color: #c58a1b; }

/* ---------- Tables ---------- */
table { width: 100%; margin: 20px 0 22px; border-collapse: collapse; font-size: 14.5px; }
th {
  padding: 9px 12px; text-align: left;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--line-2);
}
td { padding: 12px; vertical-align: top; line-height: 1.6; color: var(--ink-2); border-bottom: 1px solid var(--line); }
td:first-child { white-space: nowrap; }

.soon {
  display: inline-block; margin-left: 10px; padding: 3px 8px; vertical-align: middle;
  font: 500 12px/1 var(--font); color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 4px;
}

/* ---------- AI integration brief ---------- */
.ai-section { border-top: 0; padding-top: 24px; }
.ai-prompt-card {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: center;
  padding: 28px; background: var(--soft); border: 1px solid var(--line-2); border-radius: 12px;
}
.ai-prompt-mark { display: none; }
.ai-prompt-copy h2 { margin: 0 0 8px; font-size: 24px; }
.ai-prompt-copy p { max-width: 480px; margin: 0; font-size: 15px; line-height: 1.65; color: var(--muted); }
.ai-prompt-tags { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 16px; }
.ai-prompt-tags span { font-size: 13px; color: var(--ink-2); }
.ai-prompt-tags span + span::before { content: '/'; margin-right: 16px; color: var(--line-2); }
.ai-prompt-action { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ai-prompt-preview {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  font: 400 12px/1.6 var(--mono); color: var(--muted);
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--r);
}
.ai-prompt-preview span { display: block; }
.ai-copy-btn { width: 100%; height: 42px; font-size: 14.5px; color: #fff; background: var(--brand); border-color: var(--brand); }
.ai-copy-btn:hover { background: var(--brand-2); border-color: var(--brand-2); }
.ai-copy-btn svg { width: 16px; height: 16px; }
.ai-copy-status { display: block; text-align: center; font-size: 12.5px; color: var(--mint-ink); }
.ai-copy-status:empty { display: none; }
.ai-prompt-action small { display: block; text-align: center; font-size: 12.5px; line-height: 1.5; color: var(--subtle); }

/* ---------- Footer ---------- */
.foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px;
  padding: 24px max(28px, calc((100vw - 1180px) / 2 + 28px));
  font-size: 13.5px; color: var(--subtle); border-top: 1px solid var(--line); text-align: left;
}
.foot > span { margin-right: auto; }
.foot a { margin: 0; color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1150px) {
  .nav .links { gap: 0; margin-left: 8px; }
  .layout { gap: 44px; }
}
@media (max-width: 1000px) {
  .hero-in { grid-template-columns: minmax(0, 1fr); gap: 40px; padding: 56px 22px 60px; }
  .layout { display: block; padding: 0 22px; }
  .side {
    position: fixed; z-index: 55; top: var(--nav-h); left: 0; bottom: 0;
    width: min(290px, 84vw); height: auto; padding: 20px 14px 40px;
    background: #fff; border-right: 1px solid var(--line-2);
    transform: translateX(-102%); transition: transform .22s ease;
  }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .nav { padding: 0 18px; }
  .nav .links, .nav .tag, .nav .sep { display: none; }
  main { padding-top: 8px; }
  .ai-prompt-card { grid-template-columns: 1fr; gap: 22px; padding: 22px; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 34px; }
  .hero p.lead { font-size: 17px; }
  h2 { font-size: 26px; }
  section { padding: 44px 0; }
  .cards, #products .cards { grid-template-columns: 1fr; }
  .win pre { padding: 14px; font-size: 12.5px; }
  .ai-prompt-action .btn { height: auto; min-height: 42px; padding-top: 10px; padding-bottom: 10px; line-height: 1.35; white-space: normal; text-align: center; }
  .endpoint .sc { margin-left: 0; width: 100%; }
  table { display: block; overflow-x: auto; }
  td:first-child { white-space: normal; }
  .nav .btn.ghost { display: none; }
  .foot > span { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
