/* Documentation site chrome. Reuses the live site's CSS custom properties
   (colors, fonts) from custom.css for brand consistency, but everything
   sidebar/content/TOC-shaped below is specific to the docs layout. */

.docs-body {
  margin: 0;
  background: var(--nk-c4);
  color: var(--nk-c0);
  font-family: 'Inter', sans-serif;
}

/* ---------- top bar ---------- */

.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--nk-c0);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.docs-topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
}
.docs-brand {
  color: var(--nk-c4);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docs-brand:hover { color: var(--nk-c4); }
.docs-brand-mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--nk-c1);
  flex-shrink: 0;
}
.docs-topbar-live {
  color: var(--nk-c1);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.docs-topbar-live:hover { color: var(--nk-c1); opacity: 0.8; }

.docs-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.docs-nav-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  margin: 0 auto;
  background: var(--nk-c4);
}

/* ---------- shell / grid ---------- */

.docs-shell {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 200px;
  gap: 44px;
  padding: 36px 24px 100px;
  align-items: start;
}

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

.docs-sidebar {
  position: sticky;
  top: 76px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding-right: 6px;
}
.docs-nav-group { margin-bottom: 22px; }
.docs-nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: var(--nk-text-faint);
  margin-bottom: 8px;
  padding: 0 10px;
}
.docs-nav-link {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--nk-text-muted);
  margin-bottom: 1px;
  transition: background-color .15s ease, color .15s ease;
}
.docs-nav-link:hover { background: rgba(16, 20, 31, 0.05); color: var(--nk-c0); }
.docs-nav-link.is-active {
  background: var(--nk-sel);
  color: var(--nk-c2h);
  font-weight: 600;
}

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

.docs-content { min-width: 0; }
.docs-content article { max-width: 740px; }
.docs-eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--nk-c2);
  margin-bottom: 10px;
}
.docs-content h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 18px;
}
.docs-content h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 23px;
  font-weight: 600;
  margin: 52px 0 16px;
  padding-top: 20px;
  border-top: 1px solid rgba(16, 20, 31, 0.08);
  scroll-margin-top: 84px;
}
.docs-content h2:first-of-type { margin-top: 8px; padding-top: 0; border-top: none; }
.docs-content h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 600;
  margin: 30px 0 10px;
  scroll-margin-top: 84px;
}
.docs-content p { font-size: 15.5px; line-height: 1.75; color: var(--nk-text-body-dark); margin: 0 0 16px; }
.docs-content ul, .docs-content ol { font-size: 15.5px; line-height: 1.75; color: var(--nk-text-body-dark); padding-left: 22px; margin: 0 0 16px; }
.docs-content li { margin-bottom: 6px; }
.docs-content li > p { margin-bottom: 6px; }
.docs-content strong { color: var(--nk-c0); }
.docs-content a { font-weight: 500; text-decoration: underline; text-decoration-color: rgba(38, 83, 217, 0.35); text-underline-offset: 2px; }
.docs-content a:hover { text-decoration-color: var(--nk-c2h); }

.docs-content code {
  background: rgba(16, 20, 31, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.87em;
  color: var(--nk-c2h);
}
.docs-content pre {
  background: var(--nk-c0);
  color: var(--nk-text-cream-strong);
  padding: 18px 20px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.65;
  margin: 4px 0 22px;
  position: relative;
}
.docs-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 1em;
}
.docs-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--nk-text-cream);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  padding: 4px 9px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background-color .15s ease;
}
.docs-copy-btn:hover { background: rgba(255, 255, 255, 0.16); }

.docs-content table { width: 100%; border-collapse: collapse; margin: 8px 0 24px; font-size: 14px; }
.docs-content th, .docs-content td { text-align: left; padding: 10px 14px; border-bottom: 1px solid rgba(16, 20, 31, 0.08); vertical-align: top; }
.docs-content th { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--nk-text-muted); }
.docs-content td code { white-space: nowrap; }

.docs-content img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(16, 20, 31, 0.1);
  box-shadow: var(--nk-shadow-card);
  margin: 6px 0 22px;
  display: block;
}
.docs-content figure { margin: 6px 0 26px; }
.docs-content figure img { margin-bottom: 8px; }
.docs-content figcaption { font-size: 13px; color: var(--nk-text-faint); text-align: center; }

.docs-content blockquote {
  border-left: 3px solid var(--nk-c2);
  margin: 20px 0;
  padding: 2px 0 2px 18px;
  color: var(--nk-text-muted);
}
.docs-content blockquote p:last-child { margin-bottom: 0; }

.docs-content hr { border: none; border-top: 1px solid rgba(16, 20, 31, 0.1); margin: 36px 0; }

/* callout box for tips/warnings, used sparingly in content via a fenced div */
.docs-note {
  background: var(--nk-c3);
  border-left: 3px solid var(--nk-gold);
  border-radius: 6px;
  padding: 14px 18px;
  font-size: 14.5px;
  margin: 4px 0 24px;
}
.docs-note p:last-child { margin-bottom: 0; }

/* color / spacing swatches, used on the design-system page */
.docs-swatch-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 24px; }
.docs-swatch { width: 128px; }
.docs-swatch-color { height: 64px; border-radius: 8px; border: 1px solid rgba(16, 20, 31, 0.1); }
.docs-swatch-name { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; margin-top: 7px; color: var(--nk-c0); }
.docs-swatch-hex { font-size: 11.5px; color: var(--nk-text-faint); }

.docs-fs-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 18px; margin: 8px 0 24px; }
.docs-fs-row > div { color: var(--nk-c0); font-family: 'Space Grotesk', sans-serif; }
.docs-fs-row .docs-fs-tag { display: block; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--nk-text-faint); margin-top: 4px; }

/* next-page footer link */
.docs-pagenav { margin-top: 56px; padding-top: 24px; border-top: 1px solid rgba(16, 20, 31, 0.08); }
.docs-content .docs-pagenav-next {
  display: block;
  padding: 16px 20px;
  border: 1px solid rgba(16, 20, 31, 0.1);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color .2s ease, transform .2s ease;
}
.docs-pagenav-next:hover { border-color: var(--nk-c2); transform: translateY(-2px); }
.docs-pagenav-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--nk-text-faint); font-weight: 700; margin-bottom: 4px; }
.docs-pagenav-title { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 15.5px; color: var(--nk-c0); text-decoration: none; }

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

.docs-toc {
  position: sticky;
  top: 76px;
  align-self: start;
  font-size: 13px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}
.docs-toc-label {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: var(--nk-text-faint);
  margin-bottom: 10px;
}
.docs-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-toc li.docs-toc-h3 { padding-left: 12px; }
.docs-toc a {
  display: block;
  padding: 5px 0 5px 12px;
  color: var(--nk-text-muted);
  border-left: 2px solid rgba(16, 20, 31, 0.08);
  line-height: 1.4;
}
.docs-toc a:hover { color: var(--nk-c0); }
.docs-toc a.is-active { color: var(--nk-c2h); border-left-color: var(--nk-c2); font-weight: 600; }

/* mobile nav overlay backdrop */
.docs-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 20, 31, 0.4);
  z-index: 54;
}
.docs-nav-backdrop.is-open { display: block; }

/* ---------- responsive overrides ----------
   Kept last in the file (rather than inline with each base rule above) so
   they win the cascade purely by appearing after it - same specificity,
   later source order. Splitting a responsive override across two places
   in the file is an easy way to have the media query "match" but still
   lose to a same-specificity rule declared further down. */

@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 840px) {
  .docs-shell { grid-template-columns: 1fr; padding-top: 24px; }
  .docs-nav-toggle { display: flex; }
  .docs-sidebar {
    position: fixed;
    top: 59px;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 82vw;
    background: var(--nk-c4);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 55;
    padding: 20px 20px 40px;
    max-height: none;
    overflow-y: auto;
  }
  .docs-sidebar.is-open { transform: translateX(0); }
}
