/* =========================================================================
   KivoxData — documentation site.
   Loads after styles.css and reuses its navy tokens; everything here is
   scoped to the docs shell so the two pages can never fight.
   ========================================================================= */

.docs-body {
  overflow-x: hidden;
}

/* ------------------------------------------------------------- top bars */

.dtop {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  border-bottom: 1px solid var(--line);
}
.dtop-inner {
  max-width: 1520px;
  margin-inline: auto;
  height: 58px;
  padding-inline: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dsearch {
  flex: 1;
  max-width: 520px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.75rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  color: var(--ink-3);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.18s;
}
.dsearch:hover {
  border-color: var(--line-2);
}
.dsearch svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.dsearch kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  color: var(--ink-3);
}

.dtop-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.dtop-link {
  font-size: 0.86rem;
  color: var(--ink-2);
  padding: 0.35rem 0.5rem;
  transition: color 0.18s;
}
.dtop-link:hover {
  color: var(--ink);
}

.dtabs {
  position: sticky;
  top: 58px;
  z-index: 39;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.dtabs-inner {
  max-width: 1520px;
  margin-inline: auto;
  padding-inline: 1.5rem;
  display: flex;
  gap: 1.6rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.dtabs-inner::-webkit-scrollbar {
  display: none;
}
.dtab {
  padding: 0.7rem 0;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.18s;
}
.dtab:hover {
  color: var(--ink);
}
.dtab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* --------------------------------------------------------------- layout */

.dbody {
  max-width: 1520px;
  margin-inline: auto;
  padding-inline: 1.5rem;
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr) 210px;
  gap: 0 2.75rem;
  align-items: start;
}

.dside,
.dtoc {
  position: sticky;
  top: 102px;
  max-height: calc(100vh - 102px);
  overflow-y: auto;
  padding: 1.75rem 0 3rem;
  scrollbar-width: thin;
}
.dside::-webkit-scrollbar,
.dtoc::-webkit-scrollbar {
  width: 6px;
}
.dside::-webkit-scrollbar-thumb,
.dtoc::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 3px;
}

.dmain {
  padding: 1.75rem 0 4rem;
  min-width: 0;
}

@media (max-width: 1180px) {
  .dbody {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 0 2.25rem;
  }
  .dtoc {
    display: none;
  }
}
@media (max-width: 900px) {
  .dbody {
    grid-template-columns: minmax(0, 1fr);
  }
  .dside {
    position: fixed;
    inset: 102px auto 0 0;
    width: 280px;
    max-height: none;
    height: calc(100vh - 102px);
    background: var(--bg-1);
    border-right: 1px solid var(--line);
    padding: 1.5rem 1.25rem 3rem;
    transform: translateX(-102%);
    transition: transform 0.25s var(--ease);
    z-index: 38;
  }
  .dside.open {
    transform: none;
    box-shadow: var(--shadow-lg);
  }
}
.dside-toggle {
  display: none;
}
@media (max-width: 900px) {
  .dside-toggle {
    display: grid;
  }
}

/* ------------------------------------------------------------- side nav */

.dgroup + .dgroup {
  margin-top: 1.5rem;
}
.dgroup-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  padding: 0 0.65rem;
  margin-bottom: 0.5rem;
}
.dnav-link {
  display: block;
  padding: 0.4rem 0.65rem;
  border-radius: var(--r-sm);
  font-size: 0.855rem;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
  line-height: 1.45;
}
.dnav-link:hover {
  color: var(--ink);
  background: var(--bg-2);
}
.dnav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.dnav-link .m {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--ink-3);
  margin-right: 0.4rem;
}
.dnav-link.active .m {
  color: var(--accent);
}

/* --------------------------------------------------------------- article */

.dcrumb {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.6rem;
}

.dmain h1 {
  font-size: clamp(1.9rem, 3.4vw, 2.5rem);
  letter-spacing: -0.032em;
  margin-bottom: 0.7rem;
}
.dlede {
  font-size: 1.02rem;
  color: var(--ink-2);
  line-height: 1.65;
  margin-bottom: 2.25rem;
}

.darticle h2 {
  font-size: 1.3rem;
  margin: 2.6rem 0 0.85rem;
  scroll-margin-top: 120px;
}
.darticle h2:first-child {
  margin-top: 0;
}
.darticle h3 {
  font-size: 1.02rem;
  margin: 1.8rem 0 0.6rem;
  scroll-margin-top: 120px;
}
.darticle p {
  color: var(--ink-2);
  margin: 0.85rem 0;
  line-height: 1.7;
}
.darticle ul,
.darticle ol {
  margin: 0.85rem 0 0.85rem 1.15rem;
}
.darticle li {
  color: var(--ink-2);
  margin: 0.4rem 0;
  line-height: 1.65;
}
.darticle li::marker {
  color: var(--ink-3);
}
.darticle strong {
  color: var(--ink);
  font-weight: 600;
}
.darticle a:not(.btn) {
  color: var(--accent);
  font-weight: 500;
}
.darticle a:not(.btn):hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.darticle hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4rem 0;
}

/* Docs code blocks scroll rather than clip. */
.darticle pre.code,
.tabs pre.code {
  max-height: none;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin: 1rem 0;
}
.tabs pre.code {
  border: 0;
  border-radius: 0;
  margin: 0;
}

.codewrap {
  position: relative;
}
.code-copy {
  position: absolute;
  top: 1.45rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--ink-3);
  opacity: 0;
  transition: opacity 0.18s, color 0.18s, border-color 0.18s;
}
.codewrap:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
}
.code-copy:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.code-copy svg {
  width: 13px;
  height: 13px;
}
.tabs-pane .code-copy {
  top: 0.5rem;
}

.endpoint-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  overflow-wrap: anywhere;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 1rem 0;
}
table.tbl th,
table.tbl td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink-2);
}
table.tbl th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  font-weight: 700;
  border-bottom-color: var(--line-2);
}
table.tbl td:first-child {
  font-family: var(--font-mono);
  color: var(--accent);
  white-space: nowrap;
}
table.tbl td.plain:first-child {
  font-family: var(--font-body);
  color: var(--ink-2);
}
.tbl-scroll {
  overflow-x: auto;
}

.note,
.warn {
  display: flex;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: var(--r-md);
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 1.25rem 0;
  border: 1px solid;
}
.note {
  background: var(--accent-soft);
  border-color: rgba(59, 125, 255, 0.28);
  color: var(--ink-2);
}
.warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.32);
  color: var(--ink-2);
}
.note::before,
.warn::before {
  font-family: var(--font-mono);
  font-weight: 700;
  flex-shrink: 0;
}
.note::before {
  content: 'i';
  color: var(--accent);
}
.warn::before {
  content: '!';
  color: #f59e0b;
}
.note p,
.warn p {
  margin: 0;
  color: inherit;
}

/* ------------------------------------------------------------ code tabs */

.tabs {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin: 1.1rem 0;
  background: var(--bg-1);
}
.tabs-bar {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.tabs-btn {
  padding: 0.3rem 0.65rem;
  border-radius: var(--r-sm);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: all 0.16s;
}
.tabs-btn:hover {
  color: var(--ink);
}
.tabs-btn.active {
  background: var(--bg-1);
  color: var(--accent);
}
.tabs-pane {
  display: none;
}
.tabs-pane.active {
  display: block;
}

/* --------------------------------------------------------------- pager */

.dpager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}
.dpager a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  min-width: 0;
  transition: border-color 0.18s;
}
.dpager a:hover {
  border-color: var(--accent);
}
.dpager .next {
  margin-left: auto;
  text-align: right;
}
.dpager small {
  font-size: 0.72rem;
  color: var(--ink-3);
}
.dpager span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.dfoot {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding: 1.5rem 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--ink-3);
}
.dfoot a {
  color: var(--ink-2);
}
.dfoot a:hover {
  color: var(--accent);
}

/* ------------------------------------------------------------ toc panel */

.dtoc-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 0.75rem;
}
.dtoc-title svg {
  width: 13px;
  height: 13px;
}
.dtoc a {
  display: block;
  padding: 0.28rem 0 0.28rem 0.7rem;
  border-left: 2px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink-3);
  line-height: 1.45;
  transition: color 0.15s, border-color 0.15s;
}
.dtoc a:hover {
  color: var(--ink);
}
.dtoc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}
.dtoc a.sub {
  padding-left: 1.5rem;
  font-size: 0.79rem;
}

/* ------------------------------------------------------------ search UI */

.smodal[hidden] {
  display: none;
}
.smodal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 10, 20, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 1.25rem 2rem;
}
.sbox {
  width: min(620px, 100%);
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
.sbox-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.sbox-head svg {
  width: 16px;
  height: 16px;
  color: var(--ink-3);
  flex-shrink: 0;
}
.sbox-head input {
  flex: 1;
  background: none;
  border: 0;
  outline: none;
  font-size: 0.95rem;
}
.sbox-results {
  overflow-y: auto;
  padding: 0.4rem;
}
.sres {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-radius: var(--r-sm);
}
.sres:hover,
.sres.sel {
  background: var(--bg-2);
}
.sres b {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}
.sres small {
  display: block;
  font-size: 0.77rem;
  color: var(--ink-3);
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sres mark {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 2px;
  padding: 0 1px;
}
.sempty {
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.86rem;
  color: var(--ink-3);
}
