/* API documentation. Public page: brand.css and public.css supply the
   tokens, navbar and buttons; this is the two-column reading layout. */

.docs {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 3rem;
}

/* "On this page": a card of links, one per line, the current section marked.
   docs.js sets .is-active as the reader scrolls. */
.docs-nav {
  position: sticky;
  top: 4.5rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.9rem;
  padding: 0.9rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-1);
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
}

.docs-nav-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0.6rem 0.5rem;
}

.docs-nav a {
  display: block;
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.38rem 0.6rem 0.38rem 0.75rem;
  border-left: 2px solid transparent;
  border-radius: 6px;
  line-height: 1.3;
}

.docs-nav a:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

.docs-nav a.is-active {
  color: var(--brand-strong, var(--brand));
  background: var(--brand-soft);
  border-left-color: var(--mark);
  font-weight: 600;
}

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

.docs-body h1 {
  font-size: 2.25rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.docs-lead {
  font-size: 1.1rem;
  color: var(--ink-2);
  max-width: 60ch;
  margin-bottom: 2.5rem;
}

.docs-body section {
  margin-bottom: 3rem;
  scroll-margin-top: 5rem;
}

.docs-body h2 {
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
  padding-top: 0.5rem;
}

.docs-body h2::after {
  content: "";
  display: block;
  width: 2rem;
  height: 3px;
  border-radius: 2px;
  background: var(--mark);
  margin-top: 0.5rem;
}

.docs-body h3 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.5rem;
}

.docs-body p,
.docs-body li {
  color: var(--ink-2);
  max-width: 72ch;
}

.docs-body p {
  margin: 0.6rem 0;
}

.docs-body ol,
.docs-body ul {
  padding-left: 1.4rem;
  margin: 0.6rem 0;
}

.docs-body li {
  margin-bottom: 0.4rem;
}

.docs-body strong {
  color: var(--ink);
}

.docs-body a {
  color: var(--brand);
}

.docs-body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface-3);
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  color: var(--ink);
}

.docs-body pre {
  position: relative;
  margin: 0.75rem 0;
  padding: 1rem 2.75rem 1rem 1.1rem;
  background: var(--ink);
  color: #e8eaf6;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  tab-size: 4;
}

.docs-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.docs-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  color: #c5c9e6;
}

.docs-copy:hover {
  color: #fff;
}

/* language tabs */
.code-tabs {
  margin: 1rem 0;
}

.code-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: -1px;
}

.code-tabs-bar [role="tab"] {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-3);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
}

.code-tabs-bar [role="tab"]:hover {
  color: var(--ink);
}

.code-tabs-bar [role="tab"][aria-selected="true"] {
  color: var(--brand-strong);
  border-bottom-color: var(--brand);
}

.code-panel pre {
  margin-top: 0.75rem;
  border-top-left-radius: 0;
}

/* tables */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1rem;
  font-size: 0.9rem;
}

.docs-table th,
.docs-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-2);
}

.docs-table th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
}

.docs-table td:first-child {
  white-space: nowrap;
  color: var(--ink);
}

/* Tables whose first column is a sentence, not a code or a status */
.docs-table--prose td:first-child {
  white-space: normal;
  width: 40%;
}

.docs-table--prose td {
  min-width: 9rem;
}

.docs-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--ink-3);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

.docs-footer a {
  color: var(--ink-2);
}

@media (max-width: 800px) {
  .docs {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem 1rem 3rem;
  }

  /* Still a list on a phone, just not pinned; capped so the content is
     one scroll away */
  .docs-nav {
    position: static;
    max-height: 14rem;
  }
}
