/* docs.kanutus.com — tokens from tokens.css (copy of packages/ui/src/tokens.css). Dark only, iOS-like surfaces. */
@font-face {
  font-family: "Space Grotesk";
  src: url("./fonts/SpaceGrotesk-wght.ttf") format("truetype-variations"), url("./fonts/SpaceGrotesk-wght.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-xs); }
img { display: block; max-width: 100%; }
code { font-family: var(--font-mono); font-size: 0.88em; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); z-index: 50; }
.skip:focus { left: 8px; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 20px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand span { font-family: var(--font-head); font-weight: 600; font-size: 15px; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line-strong); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.lang { display: flex; background: var(--surface); border-radius: var(--r-pill); padding: 3px; }
.lang a { color: var(--muted); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); }
.lang a:hover { text-decoration: none; color: var(--ink); }
.lang a[aria-current] { background: var(--surface-3); color: var(--ink); }
.top-link { color: var(--ink-2); font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px;
  border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 14px;
}
.btn:hover { text-decoration: none; background: var(--accent-2); }
.btn { white-space: nowrap; }
.btn .short { display: none; }
.menu-btn { display: none; }

/* shell */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr) 220px; max-width: 1440px; margin: 0 auto; }
.sidebar {
  position: sticky; top: 60px; align-self: start; height: calc(100vh - 60px); overflow-y: auto;
  padding: 24px 12px 40px 20px; border-right: 1px solid var(--line);
}
.nav-group + .nav-group { margin-top: 22px; }
.nav-group p { margin: 0 0 6px 10px; font-size: 12px; font-weight: 600; color: var(--subtle); text-transform: uppercase; letter-spacing: 0.06em; }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group a { display: block; padding: 6px 10px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 14px; line-height: 1.35; }
.nav-group a.sub { padding-left: 22px; font-size: 13.5px; }
.nav-group a:hover { background: var(--surface); text-decoration: none; color: var(--ink); }
.nav-group a[aria-current="page"] { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.content { min-width: 0; padding: 40px 48px 64px; }
.toc { position: sticky; top: 60px; align-self: start; padding: 40px 20px 0 0; max-height: calc(100vh - 60px); overflow-y: auto; }
.toc p { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--subtle); text-transform: uppercase; letter-spacing: 0.06em; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 12px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a.on { color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }

/* prose */
.prose { max-width: 780px; }
.prose h1, .prose h2, .prose h3 { font-family: var(--font-head); letter-spacing: -0.02em; line-height: 1.15; position: relative; }
.prose h1 { font-size: clamp(30px, 4vw, 40px); margin: 0 0 16px; font-weight: 600; }
.prose h2 { font-size: 24px; margin: 44px 0 12px; font-weight: 600; }
.prose h3 { font-size: 18px; margin: 28px 0 8px; font-weight: 600; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; color: var(--ink-2); }
.prose ul { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose strong { color: var(--ink); }
.prose :not(pre) > code { background: var(--surface-2); padding: 0.12em 0.4em; border-radius: var(--r-xs); color: var(--ink); white-space: nowrap; }
.prose td code { white-space: normal; word-break: break-word; }
.anchor { position: absolute; left: -22px; color: var(--subtle); opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; text-decoration: none; }
.prose > p:first-of-type { font-size: 18px; color: var(--ink-2); }

ol.steps { list-style: none; padding: 0; counter-reset: s; }
ol.steps > li { counter-increment: s; position: relative; padding: 0 0 18px 46px; margin: 0; }
ol.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: -1px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--ink);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; font-family: var(--font-head);
}
ol.steps > li::after { content: ""; position: absolute; left: 14.5px; top: 34px; bottom: 4px; width: 1px; background: var(--line); }
ol.steps > li:last-child::after { display: none; }
ol.steps .code { margin-top: 10px; }

/* code */
.code { margin: 0 0 18px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.copy { font: inherit; font-family: var(--font-body); font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 0; border-radius: var(--r-pill); padding: 3px 10px; cursor: pointer; }
.copy:hover { background: var(--surface-3); color: var(--ink); }
.code pre { margin: 0; padding: 14px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.code pre code { font-size: inherit; }
.tabs { margin: 0 0 18px; }
.tab-list { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.tab-list button { font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: var(--r-pill); padding: 5px 12px; cursor: pointer; }
.tab-list button[aria-selected="true"] { background: var(--surface-2); color: var(--ink); }

/* tables, callouts, cards, badges */
.table { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface); }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
tr:last-child td { border-bottom: 0; }
.req { font-size: 11px; color: var(--warning-ink); font-weight: 600; }
code.type { color: var(--info-ink); background: transparent !important; padding: 0 !important; }
.callout { border-radius: var(--r-md); padding: 12px 16px; margin: 0 0 18px; background: var(--surface); border: 1px solid var(--line); }
.callout p { margin: 0; color: var(--ink-2); }
.callout p + p { margin-top: 6px; }
.callout-note { background: var(--info-soft); border-color: transparent; }
.callout-warn { background: var(--warning-soft); border-color: transparent; }
.callout-warn p { color: var(--warning-ink); }
.callout-soon { background: var(--accent-soft); border-color: transparent; }
.callout-tip { background: var(--accent-soft); border-color: transparent; }
.badge { display: inline-block; vertical-align: middle; font-family: var(--font-body); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; line-height: 1; padding: 4px 8px; border-radius: var(--r-pill); margin-left: 4px; }
.badge-soon { background: var(--info-soft); color: var(--info-ink); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0 0 24px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.card strong { color: var(--ink); font-size: 15px; font-family: var(--font-head); }
.card:hover { text-decoration: none; border-color: var(--line-strong); background: var(--surface-2); }
.logos { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; }
.logos img { width: 28px; height: 28px; }

/* reference */
.op { padding-top: 8px; border-top: 1px solid var(--line); margin-top: 36px; }
.op h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 20px; margin-top: 20px; }
.op .path { font-size: 17px; background: transparent !important; padding: 0 !important; white-space: normal !important; word-break: break-all; }
.method { font-family: var(--font-mono); font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: var(--r-xs); letter-spacing: 0.02em; }
.method-get { background: var(--info-soft); color: var(--info-ink); }
.method-post { background: var(--accent-soft); color: var(--accent-ink); }
.method-delete { background: var(--danger-soft); color: var(--danger); }
.method-patch { background: var(--warning-soft); color: var(--warning-ink); }
.op-summary { font-size: 16px !important; color: var(--ink) !important; }
.op-meta, .op-errors { font-size: 14px; color: var(--muted) !important; }

/* endpoint search */
.ref-search { position: relative; margin: 0 0 8px; max-width: 780px; }
.ref-search input { width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; }
.ref-search input:focus { outline: none; box-shadow: var(--focus); }
.ref-search ul { position: absolute; z-index: 20; left: 0; right: 0; top: 50px; list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow); max-height: 60vh; overflow-y: auto; }
.ref-search li a { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink); }
.ref-search li a:hover, .ref-search li a:focus { background: var(--surface-2); text-decoration: none; }
.ref-search li code { font-size: 13px; overflow-wrap: anywhere; background: transparent !important; padding: 0 !important; white-space: normal !important; }
.ref-search li small { grid-column: 2; color: var(--muted); font-size: 12.5px; }
.ref-search li.empty { padding: 10px; color: var(--muted); font-size: 14px; }

/* try it, statuses */
.try { margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.try > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; color: var(--accent-ink); list-style: none; }
.try > summary::before { content: "▸ "; }
.try[open] > summary::before { content: "▾ "; }
.try-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.try-note { font-size: 13px; color: var(--muted) !important; margin: 0 !important; }
.try label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.try label small { color: var(--subtle); }
.try input, .try textarea { font: inherit; font-family: var(--font-mono); font-size: 13px; color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 8px 10px; width: 100%; }
.try textarea { resize: vertical; line-height: 1.5; }
.try input:focus, .try textarea:focus { outline: none; box-shadow: var(--focus); }
.try-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.try-actions .btn { border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px; }
.try-url { font-size: 12.5px; color: var(--muted); background: transparent !important; overflow-wrap: anywhere; white-space: normal !important; }
.try-out .code { margin: 0; }
.statuses { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.status { border: 1px solid var(--line); border-radius: var(--r-sm); }
.status > summary { cursor: pointer; padding: 8px 12px; font-size: 14px; color: var(--ink-2); }
.status[open] { padding-bottom: 8px; }
.status .code, .status .op-meta { margin: 0 10px 6px; }
.st { font-weight: 700; background: transparent !important; padding: 0 !important; }
.st-2 { color: var(--accent-ink); }
.st-4 { color: var(--warning-ink); }
.st-5 { color: var(--danger); }

/* pager, footer */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 780px; margin-top: 48px; }
.pager a { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--ink); }
.pager a:hover { text-decoration: none; background: var(--surface); }
.pager span { font-size: 12px; color: var(--muted); }
.pager .next { text-align: right; grid-column: 2; }
.foot { max-width: 780px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.foot p { margin: 0; }

@media (max-width: 1180px) {
  .shell { grid-template-columns: 248px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .menu-btn { display: inline-flex; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); background: var(--surface-2); border: 0; border-radius: var(--r-pill); padding: 6px 12px; cursor: pointer; }
  .sidebar { display: none; position: fixed; inset: 60px 0 0 0; height: auto; z-index: 25; background: var(--bg); border: 0; padding: 16px 16px 40px; }
  body.nav-open .sidebar { display: block; }
  body.nav-open { overflow: hidden; }
  .content { padding: 28px 16px 48px; }
  .top { padding: 0 16px; gap: 10px; }
  .top-link { display: none; }
  .brand img { width: 84px; height: auto; }
  .anchor { display: none; }
}
@media (max-width: 420px) {
  .top .btn { height: 30px; padding: 0 12px; font-size: 13px; }
  .top .btn .long { display: none; }
  .top .btn .short { display: inline; }
  .brand span { display: none; }
  .top-right { gap: 8px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
