/* ==========================================================================
   Documentation pages (/docs/**)
   ========================================================================== */

.docs-page {
  background: #fff;
}

.docs-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  gap: clamp(24px, 2.8vw, 52px);
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 32px clamp(16px, 2.5vw, 40px) 0;
  align-items: start;
}

/* Sidebar ------------------------------------------------------------------ */

.docs-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  padding-right: 6px;
  padding-bottom: 24px;
  scrollbar-width: thin;
}

.docs-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
  padding: 0 11px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.docs-search:focus-within {
  border-color: #bfdbfe;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.docs-search > svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--faint);
}

.docs-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
}

.docs-search input::placeholder {
  color: var(--faint);
}

.docs-search input::-webkit-search-cancel-button {
  display: none;
}

.docs-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-md);
  z-index: 40;
}

.docs-search-results a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
}

.docs-search-results a:hover,
.docs-search-results a:focus-visible {
  background: var(--bg-mute);
  color: var(--ink);
}

.docs-search-results .result-title {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}

.docs-search-results .result-section {
  display: block;
  margin-top: 1px;
  color: var(--faint);
  font-size: 11.5px;
}

.docs-search-empty {
  padding: 12px 10px;
  color: var(--muted);
  font-size: 13px;
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.docs-link {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 1.45;
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.docs-link:hover {
  background: var(--bg-mute);
  color: var(--ink);
}

.docs-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.docs-link-home {
  margin-bottom: 6px;
  color: var(--ink);
  font-weight: 600;
}

.docs-group {
  border-top: 1px solid var(--line-soft);
  padding-top: 6px;
  margin-top: 6px;
}

.docs-group:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.docs-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}

.docs-group-title:hover {
  background: var(--bg-mute);
}

.docs-group-caret {
  width: 13px;
  height: 13px;
  color: var(--faint);
  transition: transform 0.15s ease;
}

.docs-group[data-open="true"] .docs-group-caret {
  transform: rotate(180deg);
}

.docs-group-body {
  padding: 2px 0 8px;
}

.docs-sub {
  padding: 2px 0;
}

.docs-sub-title {
  display: block;
  padding: 7px 10px 4px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.docs-sub .docs-link {
  padding-left: 18px;
}

.docs-console {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 24px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.docs-console:hover {
  border-color: #cbd5e1;
  background: #fff;
  color: var(--ink);
}

.docs-console svg {
  width: 15px;
  height: 15px;
  color: var(--faint);
}

/* Main --------------------------------------------------------------------- */

.docs-main {
  min-width: 0;
  padding-bottom: 40px;
}

.docs-toolbar {
  display: none;
  margin-bottom: 18px;
}

.docs-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.docs-menu-btn svg {
  width: 16px;
  height: 16px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 18px;
  color: var(--faint);
  font-size: 12.5px;
}

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

.breadcrumb a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.breadcrumb-current {
  color: var(--ink-3);
}

/* Prose -------------------------------------------------------------------- */

.prose {
  max-width: 880px;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.78;
}

.prose > h1 {
  margin: 0 0 26px;
  color: var(--ink);
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.prose h2 {
  position: relative;
  margin: 52px 0 16px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.prose h3 {
  margin: 32px 0 10px;
  color: var(--ink);
  font-size: 17.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.prose h4 {
  margin: 26px 0 8px;
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 650;
}

.prose p {
  margin: 0 0 18px;
}

.prose strong {
  color: var(--ink);
  font-weight: 650;
}

.prose a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-color: rgba(37, 99, 235, 0.3);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}

.prose a:hover {
  text-decoration-color: currentColor;
}

.prose ul,
.prose ol {
  margin: 0 0 18px;
  padding-left: 24px;
}

.prose li {
  margin: 6px 0;
}

.prose li > ul,
.prose li > ol {
  margin: 6px 0;
}

.prose hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose blockquote {
  margin: 0 0 20px;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose :not(pre) > code {
  padding: 2px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--bg-mute);
  color: #b91c1c;
  font-family: var(--font-mono);
  font-size: 0.86em;
  white-space: nowrap;
}

.heading-anchor {
  margin-left: 8px;
  color: #cbd5e1;
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

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

/* Tables ------------------------------------------------------------------- */

.table-wrap {
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.prose th,
.prose td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--bg-soft);
  color: var(--ink);
  font-weight: 650;
  white-space: nowrap;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose td code {
  white-space: nowrap;
}

/* Code --------------------------------------------------------------------- */

.code-block {
  position: relative;
  margin: 0 0 22px;
  border: 1px solid #1f2937;
  border-radius: 12px;
  background: #0b0f17;
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px 9px 16px;
  border-bottom: 1px solid #1f2937;
  background: #0e1420;
}

.code-lang {
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
}

.code-copy {
  display: inline-flex;
  align-items: center;
  height: 25px;
  padding: 0 9px;
  border: 1px solid #334155;
  border-radius: 6px;
  background: transparent;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.code-copy:hover {
  border-color: #475569;
  background: #1e293b;
  color: #fff;
}

.code-copy[data-copied="true"] {
  border-color: #065f46;
  color: #6ee7b7;
}

.code-block > pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  tab-size: 2;
}

.code-block code {
  font-family: inherit;
  white-space: pre;
}

.code-block:not(.has-head) .code-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0;
}

.code-block:not(.has-head):hover .code-copy,
.code-block:not(.has-head) .code-copy:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .code-block:not(.has-head) .code-copy {
    opacity: 0.85;
  }
}

.code-group {
  margin: 0 0 22px;
  border: 1px solid #1f2937;
  border-radius: 12px;
  background: #0b0f17;
  overflow: hidden;
}

.code-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 10px 0;
  border-bottom: 1px solid #1f2937;
  background: #0e1420;
  overflow-x: auto;
}

.code-tabs button {
  padding: 7px 12px 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #94a3b8;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.code-tabs button:hover {
  color: #e2e8f0;
}

.code-tabs button[aria-selected="true"] {
  border-bottom-color: #60a5fa;
  color: #fff;
}

.code-panels .code-block {
  margin: 0;
  border: 0;
  border-radius: 0;
}

/* Callouts ----------------------------------------------------------------- */

.callout {
  margin: 0 0 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 10px;
  background: var(--bg-soft);
  font-size: 14.5px;
}

.callout-title {
  margin: 0 0 6px !important;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.callout-body > :last-child {
  margin-bottom: 0;
}

.callout-tip {
  border-left-color: #10b981;
  background: #f0fdf4;
}

.callout-warning {
  border-left-color: #f59e0b;
  background: #fffbeb;
}

.callout-danger {
  border-left-color: #ef4444;
  background: #fef2f2;
}

.callout-info {
  border-left-color: #3b82f6;
  background: #eff6ff;
}

/* TOC ---------------------------------------------------------------------- */

.docs-toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  padding-bottom: 24px;
  font-size: 13px;
}

.docs-toc-title {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.docs-toc-links {
  border-left: 1px solid var(--line);
}

.docs-toc-link {
  display: block;
  padding: 5px 0 5px 14px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--muted);
  line-height: 1.45;
  text-decoration: none;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.docs-toc-h3 {
  padding-left: 26px;
  font-size: 12.5px;
}

.docs-toc-link:hover {
  color: var(--ink);
}

.docs-toc-link.is-active {
  border-left-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 600;
}

/* Pager -------------------------------------------------------------------- */

.docs-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line-soft);
}

.docs-pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.docs-pager-link:hover {
  border-color: #cbd5e1;
  background: var(--bg-soft);
}

.docs-pager-link.next {
  text-align: right;
  align-items: flex-end;
}

.docs-pager-label {
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.docs-pager-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

/* Docs home ---------------------------------------------------------------- */

.docs-home {
  max-width: 900px;
  padding: 24px 0 0;
}

.docs-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.docs-home-head h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 750;
  letter-spacing: -0.03em;
}

.docs-home-intro {
  max-width: 620px;
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.docs-home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 44px;
}

.docs-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
}

.docs-card {
  padding: 24px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.docs-card:hover {
  border-color: #dbe1e8;
  box-shadow: var(--shadow-sm);
}

.docs-card h2 {
  margin: 0 0 12px;
  font-size: 16.5px;
  font-weight: 700;
}

.docs-card h2 a {
  color: var(--ink);
  text-decoration: none;
}

.docs-card h2 a:hover {
  color: var(--accent-strong);
}

.docs-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-card li a {
  display: block;
  padding: 5px 0;
  color: var(--ink-3);
  font-size: 13.5px;
  text-decoration: none;
}

.docs-card li a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Mobile ------------------------------------------------------------------- */

.docs-mobile-backdrop {
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: 44;
  background: rgba(15, 23, 42, 0.32);
  -webkit-backdrop-filter: blur(1px);
  backdrop-filter: blur(1px);
}

@media (max-width: 1200px) {
  .docs-shell {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 36px;
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 980px) {
  .docs-shell {
    display: block;
    padding: 22px 20px 0;
  }

  .docs-toolbar {
    display: block;
  }

  .docs-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    z-index: 45;
    width: min(320px, 86vw);
    max-height: none;
    padding: 20px 18px 32px;
    border-right: 1px solid var(--line);
    background: #fff;
    box-shadow: 24px 0 48px -32px rgba(15, 23, 42, 0.35);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    overflow-y: auto;
  }

  .docs-sidebar.is-open {
    transform: translateX(0);
  }

  .prose {
    max-width: none;
  }

  .docs-home {
    padding-top: 8px;
  }

  .docs-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .prose {
    font-size: 15px;
  }

  .prose h2 {
    margin-top: 40px;
    font-size: 20px;
  }

  .docs-pager {
    grid-template-columns: 1fr;
  }

  .docs-pager-spacer {
    display: none;
  }

  .docs-pager-link.next {
    text-align: left;
    align-items: flex-start;
  }

  .code-block > pre {
    padding: 16px;
    font-size: 12.5px;
  }
}

body.docs-nav-open {
  overflow: hidden;
}
