/* ==========================================================================
   Kryptonim Docs — Independent Theme
   Design system ported from the Kryptonim checkout project (DM Sans, indigo
   primary #240dd2, pill buttons, 24px cards, soft shadows).
   ========================================================================== */

/* ---------- Fonts ---------- */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/DMSans-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/DMSans-Medium.ttf") format("truetype");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/DMSans-Bold.ttf") format("truetype");
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/DMMono-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/DMMono-Medium.ttf") format("truetype");
}

/* ---------- Design tokens (Kryptonim light) ---------- */
:root {
  /* brand */
  --primary: #240dd2;
  --primary-hover: #3f27f2;
  --primary-soft: rgba(36, 13, 210, 0.08);
  --primary-ring: rgba(36, 13, 210, 0.15);

  /* surfaces */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-hover: #f3f3f3;

  /* text */
  --text: #0e0e0e;
  --text-secondary: #4b4d5d;
  --text-muted: #818288;

  /* lines */
  --border: #e8e8e8;
  --border-strong: #d0d5dd;

  /* status */
  --success: #33bb88;
  --success-soft: #ebf8f3;
  --success-text: #1f7052;
  --error: #c90000;
  --error-soft: #ffebed;
  --warning-soft: #fffae9;
  --warning-text: #856404;
  --info-soft: #ebf8ff;
  --info-text: #3c4e68;

  /* radius */
  --r-card: 24px;
  --r-card-sm: 12px;
  --r-pill: 999px;
  --r-input: 8px;

  /* shadow */
  --shadow-card: 0 5px 11px 0 hsla(0, 0%, 0%, 0.04),
    0 20px 20px 0 hsla(0, 0%, 0%, 0.03), 0 45px 27px 0 hsla(0, 0%, 0%, 0.02);
  --shadow-btn: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
  --shadow-pop: 0 4px 16px rgba(16, 24, 40, 0.08);

  --font-sans: "DM Sans", Helvetica, Arial, sans-serif;
  --font-mono: "DM Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --nav-h: 64px;
  --side-w: 280px;
  --page-pad: 48px;          /* shared left/right indent for navbar, content, footer */
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

::selection { background: var(--primary-soft); }

/* scrollbars */
.k-scroll, .wy-nav-content, .k-side__inner { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.k-scroll::-webkit-scrollbar, .wy-nav-content::-webkit-scrollbar, .k-side__inner::-webkit-scrollbar { width: 8px; height: 8px; }
.k-scroll::-webkit-scrollbar-thumb, .wy-nav-content::-webkit-scrollbar-thumb, .k-side__inner::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 999px;
}

/* ==========================================================================
   Layout shell
   ========================================================================== */
.wy-grid-for-nav { background: var(--bg); }
.wy-body-for-nav { background: var(--bg); }

/* ---------- Top navbar ---------- */
.k-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 60;
  display: flex;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--page-pad);
  transition: padding .2s ease;
}
.k-topbar__inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.k-topbar__left { display: flex; align-items: center; gap: 12px; }
.k-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.k-brand img { height: 30px; width: auto; display: block; }
.k-brand:hover { color: var(--primary); }
.k-brand__badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: var(--r-pill);
}
.k-topbar__nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.k-topbar__link {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s ease;
}
.k-topbar__link:hover { color: var(--text); }

/* ghost link with logo + animated arrow (kryptonim.com) */
.k-topbar__link--ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.k-topbar__logo {
  width: 22px;
  height: 22px;
  color: var(--text);
  transition: color .15s ease;
}
.k-topbar__link--ghost:hover .k-topbar__logo { color: var(--primary); }
.k-topbar__link-arrow {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform .24s cubic-bezier(.22, 1, .36, 1), color .15s ease;
  will-change: transform;
}
.k-topbar__link--ghost:hover .k-topbar__link-arrow {
  transform: translateX(3px);
  color: var(--primary);
}

/* sidebar collapse toggle (desktop) - hamburger icon, same size as search (40px) */
.k-side-toggle {
  flex-shrink: 0;
  width: 40px; height: 40px;
  margin-right: calc(-1 * var(--page-pad) + 10px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s ease;
}
.k-side-toggle:hover { background: var(--surface-hover); }
.k-side-toggle .k-burger__inner { width: 15px; height: 12px; display: flex; flex-direction: column; justify-content: space-between; }
.k-side-toggle .k-burger__line { display: block; width: 100%; height: 2px; background: var(--text); border-radius: 2px; transition: all .3s ease-in-out; }
/* X when sidebar is open (default), hamburger when collapsed */
.k-side-toggle .k-burger__line:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.k-side-toggle .k-burger__line:nth-child(2) { opacity: 0; }
.k-side-toggle .k-burger__line:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }
body.k-side-collapsed .k-side-toggle .k-burger__line:nth-child(1) { transform: none; }
body.k-side-collapsed .k-side-toggle .k-burger__line:nth-child(2) { opacity: 1; }
body.k-side-collapsed .k-side-toggle .k-burger__line:nth-child(3) { transform: none; }

/* mobile burger — ported from Kryptonim Hamburger component */
.k-burger {
  display: none;
  position: relative;
  width: 40px; height: 40px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s ease;
}
.k-burger:hover { background: var(--surface-hover); }
.k-burger__inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 15px;
  height: 12px;
}
.k-burger__line {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text);
  border-radius: 2px;
  transition: all .3s ease-in-out;
}
.k-burger.is-open .k-burger__line:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.k-burger.is-open .k-burger__line:nth-child(2) { opacity: 0; }
.k-burger.is-open .k-burger__line:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* ---------- Layout: main left, sidebar right (collapsible) ---------- */
.k-layout {
  display: block;
  background: var(--bg);
}
.k-main {
  margin-left: 0 !important;
  margin-right: var(--side-w);
  margin-top: var(--nav-h);
  background: var(--bg) !important;
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  flex-direction: column;
  transition: margin-right .25s ease;
}
.k-main > .k-scroll { flex: 1; }
body.k-side-collapsed .k-main { margin-right: 0; }

/* ---------- Sidebar (right, collapsible) ---------- */
.k-side {
  position: fixed;
  top: var(--nav-h);
  right: 0;
  bottom: 0;
  width: var(--side-w);
  z-index: 50;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform .25s ease, width .25s ease;
}
body.k-side-collapsed .k-side {
  transform: translateX(100%);
  width: 0;
  border-left: none;
}
.k-side__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 10px;
  border-bottom: 1px solid var(--border);
}
.k-side__label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.k-side__close {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.k-side__close:hover { background: var(--surface-hover); color: var(--primary); }
.k-side__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.k-side__scroll::-webkit-scrollbar { width: 8px; }
.k-side__scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* ---------- Icon (currentColor via mask) ---------- */
.k-icon {
  display: inline-block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask: var(--k-icon-url) center / contain no-repeat;
  mask: var(--k-icon-url) center / contain no-repeat;
  vertical-align: middle;
}
.k-icon--rot90 { transform: rotate(90deg); }
.k-icon--rot180 { transform: rotate(180deg); }

/* ==========================================================================
   Sidebar navigation tree — custom component (not RTD toctree)
   ========================================================================== */
.k-sidenav { display: flex; flex-direction: column; gap: 4px; }

.k-sidenav__group { position: relative; }
.k-sidenav__group .k-sidenav__group { margin-left: 12px; }

.k-sidenav__head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--r-input);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: background .12s ease, color .12s ease;
}
.k-sidenav__head--leaf { cursor: pointer; }
.k-sidenav__head:hover { background: var(--surface-hover); color: var(--text); }
.k-sidenav__head:hover .k-icon { color: var(--primary); }
.k-sidenav__head .k-icon { color: var(--text-muted); transition: color .12s ease; }

.k-sidenav__title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: inherit;
  text-decoration: none;
  line-height: 1.3;
}
.k-sidenav__title:hover { color: inherit; }
.k-sidenav__group.is-active > .k-sidenav__head { color: var(--primary); }
.k-sidenav__group.is-active > .k-sidenav__head .k-icon { color: var(--primary); }

/* nested parent (level 2+) — identical spacing to child links */
.k-sidenav__head--l2, .k-sidenav__head--l3 {
  padding: 6px 8px;
  margin: 1px 0;
  gap: 8px;
}
.k-sidenav__title--l2, .k-sidenav__title--l3 {
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text-secondary);
}
.k-sidenav__head--l2 .k-icon, .k-sidenav__head--l3 .k-icon { width: 15px; height: 15px; }
.k-sidenav__head--l2 .k-sidenav__chev, .k-sidenav__head--l3 .k-sidenav__chev { width: 20px; height: 20px; }
.k-sidenav__head--l2 .k-sidenav__chev svg, .k-sidenav__head--l3 .k-sidenav__chev svg { width: 12px; height: 12px; }

.k-sidenav__chev {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: transform .2s ease, background .12s ease, color .12s ease;
}
.k-sidenav__chev:hover { background: var(--surface-hover); color: var(--text); }
.k-sidenav__group.is-open > .k-sidenav__head .k-sidenav__chev { transform: rotate(180deg); }

.k-sidenav__list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 10px;
  border-left: 1.5px solid var(--border);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .28s ease, opacity .2s ease, padding .28s ease;
}
.k-sidenav__list > li { margin: 0; padding: 0; }
.k-sidenav__group.is-open > .k-sidenav__list {
  max-height: 800px;
  opacity: 1;
}

.k-sidenav__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin: 1px 0;
  border-radius: var(--r-input);
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 1.3;
  transition: background .12s ease, color .12s ease;
}
.k-sidenav__link .k-icon { width: 15px; height: 15px; color: var(--text-muted); transition: color .12s ease; }
.k-sidenav__link:hover { background: var(--surface-hover); color: var(--text); }
.k-sidenav__link:hover .k-icon { color: var(--primary); }
.k-sidenav__link.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 500;
}
.k-sidenav__link.is-active .k-icon { color: var(--primary); }

/* "General" link - navigates to parent page */
.k-sidenav__general { color: var(--text-secondary); }
.k-sidenav__general.is-active { pointer-events: none; cursor: default; }

/* nest level tweaks */
.k-sidenav__link--l2 { padding-left: 10px; }
.k-sidenav__link--l3 { padding-left: 14px; font-size: 13px; }
.k-content {
  width: 100%;
  padding: 0 var(--page-pad) 24px;
}
.wy-nav-content {
  background: transparent !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
  overflow: visible !important;
}
.rst-content { padding: 24px 0 0; }

/* ==========================================================================
   Search box
   ========================================================================== */
.k-search { position: relative; width: 240px; max-width: 40vw; }
.k-search input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.k-search input::placeholder { color: var(--text-muted); }
.k-search input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-ring);
}
.k-search__btn {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
}
.k-search__btn:hover { color: var(--primary); background: var(--primary-soft); }
.k-search__btn .k-icon { width: 16px; height: 16px; }

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */
.k-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 4px 0 0;
}
.k-crumbs a, .k-crumbs span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}
.k-crumbs a:hover { color: var(--primary); }
.k-crumbs__home {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.k-crumbs__home .k-icon { width: 15px; height: 15px; }
.k-crumbs__home:hover { color: var(--primary); }
.k-crumbs__sep { color: var(--border-strong); }
.k-crumbs__current {
  color: var(--text) !important;
}

/* ==========================================================================
   Typography (rst content)
   ========================================================================== */
.rst-content h1, .rst-content h2, .rst-content h3, .rst-content h4, .rst-content h5, .rst-content h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin: 1.6em 0 .6em;
  scroll-margin-top: calc(var(--nav-h) + 24px);
}
.rst-content h1 {
  font-size: 38px;
  letter-spacing: -.02em;
  margin-top: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.rst-content h2 { font-size: 26px; letter-spacing: -.01em; }
.rst-content h3 { font-size: 20px; }
.rst-content h4 { font-size: 17px; }
.rst-content p { margin: 0 0 1em; color: var(--text); }
.rst-content p.lead { font-size: 18px; color: var(--text-secondary); }

.rst-content ul, .rst-content ol { margin: 0 0 1em; padding-left: 1.4em; }
.rst-content li { margin: .3em 0; }
.rst-content li > p { margin: .2em 0; }

.rst-content strong { font-weight: 700; color: var(--text); }
.rst-content em { font-style: italic; }

.rst-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

.rst-content code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(36, 13, 210, 0.12);
}
.rst-content pre {
  font-family: var(--font-mono);
  background: #151620;
  color: #e6e6e8;
  border-radius: var(--r-card-sm);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 1.2em;
  line-height: 1.55;
  font-size: 13.5px;
  border: 1px solid rgba(255,255,255,.06);
}
.rst-content pre code {
  background: none;
  color: inherit;
  border: none;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}
.rst-content .highlight { margin: 0 0 1.2em; border-radius: var(--r-card-sm); }

/* code copy button */
.copybutton {
  position: absolute;
  top: 10px; right: 10px;
  border: 1px solid rgba(255,255,255,.12) !important;
  background: rgba(255,255,255,.06) !important;
  color: #c9c9d4 !important;
  border-radius: 8px !important;
  padding: 4px 8px !important;
  font-size: 12px !important;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease;
}
.rst-content .highlight:hover .copybutton { opacity: 1; }
.copybutton:hover { background: rgba(255,255,255,.12) !important; }
.rst-content .highlight { position: relative; }

/* anchors */
.rst-content h1, .rst-content h2, .rst-content h3, .rst-content h4, .rst-content dl dt {
  scroll-margin-top: calc(var(--nav-h) + 24px);
}
.rst-content .headerlink {
  color: var(--text-muted) !important;
  font-size: .7em;
  margin-left: 10px;
  opacity: 0;
  transition: opacity .15s ease;
}
.rst-content h1:hover .headerlink,
.rst-content h2:hover .headerlink,
.rst-content h3:hover .headerlink,
.rst-content h4:hover .headerlink,
.rst-content dl dt:hover .headerlink { opacity: 1; }
.rst-content .headerlink:hover { color: var(--primary) !important; }

/* ==========================================================================
   Tables
   ========================================================================== */
.rst-content table.docutils, .rst-content table.field-list {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0 0 1.4em;
  border: 1px solid var(--border);
  border-radius: var(--r-card-sm);
  overflow: hidden;
  background: var(--surface);
  font-size: 14.5px;
}
.rst-content table.docutils thead, .rst-content table.field-list thead {
  background: var(--surface-2);
}
.rst-content table.docutils th, .rst-content table.field-list th {
  text-align: left;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.rst-content table.docutils td, .rst-content table.field-list td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
}
.rst-content table.docutils tr:last-child td, .rst-content table.field-list tr:last-child td { border-bottom: none; }
.rst-content table.docutils tr:hover td { background: var(--surface-2); }
.rst-content table.docutils td > p:first-child { margin-top: 0; }
.rst-content table.docutils td > p:last-child { margin-bottom: 0; }
.rst-content table.docutils code { white-space: nowrap; }

/* ==========================================================================
   Cards (overview tiles)
   ========================================================================== */
.k-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 8px 0 28px;
}
.k-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  color: var(--text);
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  min-height: 140px;
}
.k-tile:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(36, 13, 210, 0.08);
  color: var(--text);
}
.k-tile__icon {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  border-radius: var(--r-card-sm);
  margin-bottom: 6px;
  color: var(--primary);
  transition: background .2s ease, color .2s ease;
}
.k-tile__icon .k-icon { width: 22px; height: 22px; color: var(--primary); }
.k-tile:hover .k-tile__icon { background: var(--primary); color: #fff; }
.k-tile:hover .k-tile__icon .k-icon { color: #fff; }
.k-tile__title { font-size: 18px; font-weight: 500; }
.k-tile__desc { font-size: 14px; color: var(--text-muted); margin: 0; }
.k-tile__arrow { 
  margin-top: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.k-tile__arrow svg, .k-tile__arrow-icon {
  transition: transform .24s cubic-bezier(.22, 1, .36, 1);
  will-change: transform;
}
.k-tile:hover .k-tile__arrow svg, .k-tile:hover .k-tile__arrow-icon { transform: translateX(6px); }
.k-tile__arrow-icon { width: 14px; height: 14px; }

/* ==========================================================================
   CTA card (ported from kryptonim.com)
   ========================================================================== */
.k-cta {
  position: relative;
  border-radius: 2rem;
  overflow: hidden;
  margin: 8px 0 28px;
}
.k-cta__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("cta-bg.webp");
  background-position: 0 0;
  background-size: cover;
  background-repeat: no-repeat;
}
.k-cta__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 3rem;
  min-height: auto;
}
.k-cta__tag {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #b5b5b9 !important;
  margin-bottom: 10px;
}
.k-cta__title {
  font-size: 32px;
  font-weight: 700;
  color: #fff !important;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0 0 10px !important;
  max-width: 520px;
  border: none !important;
  padding: 0 !important;
}
.k-cta__text {
  color: rgba(255,255,255,.8) !important;
  font-size: 16px;
  margin: 0 0 20px;
  max-width: 460px;
  line-height: 1.5;
}
.k-cta__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  background: #fff;
  color: #0e0e0e;
  border-radius: var(--r-pill);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s ease, transform .1s ease;
}
.k-cta__btn:hover { background: #f3f3f3; color: #0e0e0e; }
.k-cta__btn:active { transform: translateY(1px); }
.k-cta__3d {
  position: absolute;
  z-index: 1;
  max-width: 44%;
  right: -16rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
@media (max-width: 991px) {
  .k-cta__inner { padding: 2rem 2.5rem; }
  .k-cta__3d { max-width: 48%; right: -10rem; }
  .k-cta__title { font-size: 28px; }
}
@media (max-width: 767px) {
  .k-cta__inner { padding: 1.5rem 2rem; }
  .k-cta__3d { max-width: 52%; opacity: .6; right: -6rem; }
  .k-cta__title { font-size: 24px; }
  .k-cta__text { font-size: 14px; }
}
@media (max-width: 479px) {
  .k-cta__inner { padding: 1.5rem 1.5rem 11rem; }
  .k-cta__3d { max-width: 85%; right: auto; left: 50%; transform: translateX(-50%); top: auto; bottom: 1rem; opacity: .5; }
  .k-cta__title { font-size: 22px; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.k-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color .2s ease,
    border-color .2s ease,
    box-shadow .2s ease,
    color .2s ease;
}
.k-btn:active { transform: translateY(1px); }

/* primary: indigo with inner highlight + focus ring */
.k-btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: inset 0 1px 1px 0 rgba(255,255,255,.3), 0 1px 2px 0 rgba(16,24,40,.05);
}
.k-btn--primary:hover, .k-btn--primary:active {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}
.k-btn--primary:focus-visible {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(36,13,210,.15), inset 0 1px 1px 0 rgba(255,255,255,.3), 0 1px 2px 0 rgba(16,24,40,.05);
}

/* secondary: white with gray border */
.k-btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: 0 1px 2px 0 rgba(16,24,40,.05);
}
.k-btn--secondary:hover, .k-btn--secondary:active {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}
.k-btn--secondary:focus-visible {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: 0 0 0 4px rgba(152,162,179,.14), 0 1px 2px 0 rgba(16,24,40,.05);
}

/* ghost: transparent, no border */
.k-btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  height: 36px;
  padding: 0 12px;
  box-shadow: none;
}
.k-btn--ghost:hover { background: var(--surface-hover); color: var(--text); }
.k-btn--ghost:focus-visible { background: var(--surface-hover); color: var(--text); box-shadow: none; }

/* bounce-hover arrow animation (ported from Kryptonim) */
.k-btn--arrow .k-btn__arrow {
  display: inline-flex;
  transition: transform .24s cubic-bezier(.22, 1, .36, 1);
  will-change: transform;
}
.k-btn--arrow:hover .k-btn__arrow { transform: translateX(6px); }

/* prev/next footer buttons */
.rst-footer-buttons { display: flex; gap: 12px; margin-top: 40px; }
.rst-footer-buttons .btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-sans); font-weight: 500; font-size: 14px;
  text-decoration: none;
}
.rst-footer-buttons .btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--primary); }
.rst-footer-buttons .fa { display: none; }

/* ==========================================================================
   Badges / pills
   ========================================================================== */
.k-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--success-soft);
  color: var(--success-text);
  margin-left: 8px;
  vertical-align: middle;
}
.k-badge--primary { background: var(--primary-soft); color: var(--primary); }
.k-badge--error { background: var(--error-soft); color: var(--error); }
.k-badge--warning { background: var(--warning-soft); color: var(--warning-text); }

/* ==========================================================================
   Alerts (admonitions)
   ========================================================================== */
.rst-content .admonition {
  border-radius: var(--r-card-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 18px 14px 16px;
  margin: 0 0 1.2em;
  border-left: 4px solid var(--primary);
}
.rst-content .admonition-title {
  font-weight: 500;
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--text);
}
.rst-content .admonition.note { border-left-color: var(--primary); background: var(--info-soft); }
.rst-content .admonition.warning { border-left-color: #f5a623; background: var(--warning-soft); }
.rst-content .admonition.danger, .rst-content .admonition.error { border-left-color: var(--error); background: var(--error-soft); }
.rst-content .admonition.tip, .rst-content .admonition.hint { border-left-color: var(--success); background: var(--success-soft); }

/* ==========================================================================
   Legacy RTD toctree — neutralised (sidebar now uses .k-sidenav)
   ========================================================================== */
.wy-menu-vertical { display: none; }
.wy-nav-side { display: none; }
.wy-nav-content { background: transparent !important; }

/* ==========================================================================
   Explore the documentation — collapsible sections with tile grids
   ========================================================================== */
.k-explore { display: flex; flex-direction: column; gap: 12px; }

.k-explore__group { position: relative; }

/* section header (collapsible, no card) */
.k-explore__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  cursor: pointer;
  user-select: none;
  transition: color .12s ease;
}
.k-explore__head:hover { color: var(--text); }
.k-explore__head-icon {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: color .12s ease;
}
.k-explore__head-icon .k-icon { width: 20px; height: 20px; }
.k-explore__head:hover .k-explore__head-icon { color: var(--primary); }
.k-explore__head-title { flex: 1; font-size: 16px; font-weight: 500; color: var(--text); }
.k-explore__chev {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: transform .2s ease;
}
.k-explore__group.is-open > .k-explore__head .k-explore__chev { transform: rotate(180deg); }

/* collapsible body — animate via max-height, overflow visible when open */
.k-explore__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
}
.k-explore__group.is-open > .k-explore__body {
  max-height: 5000px;
  overflow: visible;
}

/* tile grid — padding gives room for tile shadows */
.k-explore__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 160px);
  gap: 12px;
  padding: 14px 12px 16px;
}

/* individual tile — fixed size, centered content */
.k-explore-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 160px;
  height: 160px;
  padding: 14px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card-sm);
  box-shadow: var(--shadow-card);
  color: var(--text);
  text-decoration: none;
  text-align: center;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.k-explore-tile:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(36, 13, 210, 0.08);
  color: var(--text);
}
.k-explore-tile__icon {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px;
  background: var(--primary-soft);
  border-radius: var(--r-card-sm);
  color: var(--primary);
  transition: background .2s ease, color .2s ease;
}
.k-explore-tile__icon .k-icon { width: 32px; height: 32px; color: var(--primary); }
.k-explore-tile:hover .k-explore-tile__icon { background: var(--primary); color: #fff; }
.k-explore-tile:hover .k-explore-tile__icon .k-icon { color: #fff; }
.k-explore-tile__label {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  word-break: break-word;
}
/* General tile when active (on parent page) — disabled, not clickable */
.k-explore-tile--general.is-active { pointer-events: none; cursor: default; border-color: var(--primary); background: var(--primary-soft); }
.k-explore-tile--general.is-active .k-explore-tile__icon { background: var(--primary); color: #fff; }
.k-explore-tile--general.is-active .k-explore-tile__icon .k-icon { color: #fff; }

/* ==========================================================================
   HTTP endpoint block (custom directive)
   ========================================================================== */
.k-http {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 10px 0 4px;
  border-radius: var(--r-input);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 14px;
}
.k-http__method {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .04em;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
}
.k-http__method--post   { background: #1f7052; }
.k-http__method--get    { background: #2563eb; }
.k-http__method--put    { background: #d97706; }
.k-http__method--delete { background: #c90000; }
.k-http__url { color: var(--text); font-weight: 500; word-break: break-all; }

/* sphinx httpdomain cleanup */
.rst-content dl.http { margin: 0 0 1.4em; }
.rst-content dl.http dt.sig {
  display: none !important;
}
.rst-content dl.http > dd { margin: 0; padding: 0; }

/* ==========================================================================
   Sphinx misc
   ========================================================================== */
.rst-content .section { padding-bottom: 8px; }
.rst-content .section .section .section { padding-bottom: 0; }
.rst-content dl { margin: 0 0 1.2em; }
.rst-content dl dt { font-weight: 500; color: var(--text); }
.rst-content dl dd { margin-left: 1.4em; }

.rst-content .genindex-jumpbox, .rst-content .genindextable { margin: 1em 0; }

/* search results */
.rst-content .toctree-wrapper { display: none; }
.k-search-results ul { list-style: none; padding: 0; }
.k-search-results li { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--r-card-sm); margin-bottom: 8px; background: var(--surface); }
.k-search-results a { font-weight: 500; }

/* footer — copyright pinned right, slides with sidebar */
.k-footer {
  padding: 20px var(--page-pad) 32px;
  text-align: right;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.k-footer a { color: var(--text-secondary); }

/* spacing helper used by rst raw blocks */
.k-spacer { height: 120px; }

/* ==========================================================================
   Mobile nav
   ========================================================================== */
.wy-nav-top { display: none; }

@media (max-width: 1024px) {
  :root { --side-w: 260px; --page-pad: 32px; }
}
@media (max-width: 860px) {
  :root { --page-pad: 16px; }
  .k-topbar__link { display: none; }
  .k-side-toggle { display: none; }
  .k-burger { display: inline-flex; }
  .k-search { width: 160px; }
  .k-main { margin-right: 0; }
  body.k-side-collapsed .k-main { margin-right: 0; }
  .k-side {
    transform: translateX(100%);
    transition: transform .25s ease;
    width: 86vw;
    max-width: 320px;
    border-left: none;
    box-shadow: -10px 0 30px rgba(14,14,14,.08);
    z-index: 70;
  }
  body.k-side-collapsed .k-side { width: 86vw; transform: translateX(100%); border-left: none; }
  .k-side.is-open { transform: translateX(0) !important; }
  .k-content { padding: 0 var(--page-pad) 20px; }
  .rst-content h1 { font-size: 30px; }
  .rst-content h2 { font-size: 22px; }
}
@media (max-width: 480px) {
  .rst-content table.docutils { font-size: 13px; }
  .rst-content table.docutils th, .rst-content table.docutils td { padding: 10px 10px; }
  .k-brand img { height: 26px; }
  .k-brand__badge { display: none; }
}

/* backdrop when sidebar open on mobile */
.k-backdrop {
  position: fixed; inset: var(--nav-h) 0 0 0;
  background: rgba(14,14,14,.4);
  z-index: 65;
  display: none;
}
.k-backdrop.is-open { display: block; }
