/* Runnev — documentation layout. Loaded after base.css on /docs pages. */

.docs-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-6);
  align-items: start;
  padding-block: var(--sp-6) var(--sp-8);
}

@media (min-width: 900px) {
  .docs-layout {
    grid-template-columns: 15rem minmax(0, 1fr);
  }
}

@media (min-width: 1240px) {
  .docs-layout {
    grid-template-columns: 15rem minmax(0, 1fr) 13rem;
    max-width: 1340px;
  }
}

/* ----------------------------------------------------------- sidebar nav */

.docs-sidebar {
  font-size: var(--step-0);
}

@media (min-width: 900px) {
  .docs-sidebar {
    position: sticky;
    top: 4.5rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    padding-right: var(--sp-3);
  }
}

.docs-sidebar h2 {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-faint);
  margin: var(--sp-5) 0 var(--sp-2);
  font-weight: 600;
}

.docs-sidebar h2:first-child {
  margin-top: 0;
}

.docs-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-2);
}

.docs-sidebar li {
  margin: 0;
}

.docs-sidebar a {
  display: block;
  padding: 0.28rem 0.6rem;
  margin-left: -0.6rem;
  border-radius: var(--radius);
  color: var(--fg-muted);
  text-decoration: none;
  line-height: 1.45;
}

.docs-sidebar a:hover {
  color: var(--fg);
  background: var(--bg-inline);
}

.docs-sidebar a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-bg);
  font-weight: 550;
}

.docs-nav-toggle {
  display: none;
}

@media (max-width: 899px) {
  .docs-sidebar {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 0;
    overflow: hidden;
  }
  .docs-nav-toggle {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--bg-sunk);
    border: 0;
    border-bottom: 1px solid transparent;
    color: var(--fg);
    font: inherit;
    font-weight: 550;
    padding: 0.6rem var(--sp-4);
    cursor: pointer;
  }
  .docs-sidebar[data-open="true"] .docs-nav-toggle {
    border-bottom-color: var(--line);
  }
  .docs-sidebar-inner {
    display: none;
    padding: var(--sp-4);
  }
  .docs-sidebar[data-open="true"] .docs-sidebar-inner {
    display: block;
  }
}

/* --------------------------------------------------------------- content */

.docs-content {
  min-width: 0;
}

.docs-content > * {
  max-width: var(--prose);
}

.docs-content > .table-scroll,
.docs-content > .codeblock,
.docs-content > .grid {
  max-width: 100%;
}

.docs-content h1 {
  font-size: var(--step-3);
  margin-bottom: var(--sp-3);
}

.docs-content h2 {
  font-size: var(--step-2);
  padding-top: var(--sp-3);
  margin-top: var(--sp-7);
  border-top: 1px solid var(--line);
}

.docs-content h3 {
  font-size: var(--step-1);
}

.docs-content h2:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.breadcrumb {
  font-size: var(--step--1);
  color: var(--fg-faint);
  font-family: var(--font-mono);
  margin-bottom: var(--sp-3);
}

.breadcrumb a {
  color: var(--fg-muted);
  text-decoration: none;
}

.anchor {
  color: var(--fg-faint);
  text-decoration: none;
  opacity: 0;
  margin-left: 0.4rem;
  font-weight: 400;
}

h2:hover .anchor,
h3:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

/* ------------------------------------------------------------- on-page toc */

.docs-toc {
  display: none;
  font-size: var(--step--1);
}

@media (min-width: 1240px) {
  .docs-toc {
    display: block;
    position: sticky;
    top: 4.5rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
  }
}

.docs-toc h2 {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-faint);
  margin: 0 0 var(--sp-3);
  font-weight: 600;
}

.docs-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--line);
}

.docs-toc li {
  margin: 0;
}

.docs-toc a {
  display: block;
  padding: 0.2rem 0 0.2rem var(--sp-4);
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--fg-muted);
  text-decoration: none;
  line-height: 1.5;
}

.docs-toc a:hover {
  color: var(--fg);
}

.docs-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.docs-toc .lvl-3 a {
  padding-left: calc(var(--sp-4) + 0.75rem);
  font-size: 0.9em;
}

/* --------------------------------------------------------- endpoint blocks */

.endpoint {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin: 0 0 var(--sp-6);
  overflow: hidden;
  max-width: 100%;
}

.endpoint > summary,
.endpoint-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.6rem var(--sp-4);
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  overflow-x: auto;
}

.endpoint-head .path {
  color: var(--fg);
  font-weight: 550;
  white-space: nowrap;
}

.endpoint-head .desc {
  color: var(--fg-muted);
  margin-left: auto;
  white-space: nowrap;
  font-family: var(--font-sans);
}

.endpoint-body {
  padding: var(--sp-5) var(--sp-5) var(--sp-1);
}

.endpoint-body > :last-child {
  margin-bottom: var(--sp-4);
}

/* ----------------------------------------------------------- prev/next nav */

.docs-pagination {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  border-top: 1px solid var(--line);
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  max-width: 100%;
}

.docs-pagination a {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  text-decoration: none;
  color: var(--fg);
}

.docs-pagination a:hover {
  border-color: var(--accent-line);
}

.docs-pagination .dir {
  display: block;
  font-size: var(--step--1);
  color: var(--fg-faint);
  margin-bottom: 0.2rem;
}

.docs-pagination .next {
  text-align: right;
  grid-column: -2;
}

/* ------------------------------------------------------------------- misc */

.lang-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-5);
  overflow-x: auto;
}

.lang-tabs button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--fg-muted);
  font: inherit;
  font-size: var(--step-0);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.lang-tabs button[aria-selected="true"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
  font-weight: 550;
}

.lang-panel[hidden] {
  display: none;
}

.param-table td:first-child {
  white-space: nowrap;
}

.param-table .req {
  color: var(--danger);
  font-size: var(--step--1);
  font-family: var(--font-mono);
}
