/* ── CrewDesk Docs Layout & Editorial Prose (omp.sh/docs hairline-rail grammar) ── */

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-nav-btn {
  display: none;
  border: 1px solid var(--hairline);
  background: var(--panel);
  color: var(--ink);
  border-radius: 7px;
  width: 32px;
  height: 32px;
  font-size: 14px;
  cursor: pointer;
}

.nav-links a.nav-active {
  color: var(--primary);
  font-weight: 550;
}

.lang-toggle {
  white-space: nowrap;
  flex-shrink: 0;
}

.lang-toggle a {
  display: inline-block;
  white-space: nowrap;
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 5px;
  transition:
    background 140ms ease,
    color 140ms ease;
}

.lang-toggle a[aria-current="true"] {
  background: var(--panel2);
  color: var(--ink-strong);
  font-weight: 600;
}

.docs-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 204px;
  gap: 40px;
  padding: 36px 0 64px;
  align-items: start;
}

/* ── Left Hairline-Rail Sidebar (omp.sh/docs style) ── */

.docs-sidebar {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding-right: 10px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-soft) transparent;
}

.docs-sidebar-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--faint);
}

.docs-search-box {
  position: relative;
}

.docs-search-box input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--ink);
  font-size: 12.5px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 140ms ease;
}

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

.docs-search-box input:focus {
  border-color: rgba(180, 241, 209, 0.55);
}

.docs-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--panel2);
  border: 1px solid var(--hairline-soft);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

.docs-search-results[hidden] {
  display: none;
}

.docs-search-hit {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 9px;
  border-radius: 6px;
  transition: background 120ms ease;
}

.docs-search-hit:hover {
  background: var(--primary-soft);
}

.docs-search-hit strong {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-strong);
}

.docs-search-hit span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--mute);
}

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

.docs-nav-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
}

.docs-nav-title-muted {
  color: var(--faint);
}

.docs-rail-list,
.docs-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-rail-list a {
  display: block;
  margin-left: -1px;
  border-left: 1.5px solid transparent;
  padding: 4px 0 4px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--mute);
  transition:
    color 140ms ease,
    border-color 140ms ease;
}

.docs-rail-list a:hover {
  color: var(--ink-strong);
  border-left-color: var(--hairline-soft);
}

.docs-rail-list a.active {
  color: var(--ink-strong);
  font-weight: 550;
  border-left-color: var(--primary);
}

/* ── Right TOC ── */

.docs-toc {
  position: sticky;
  top: 80px;
}

.docs-toc-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
}

.docs-toc-list a {
  display: block;
  margin-left: -1px;
  border-left: 1.5px solid transparent;
  padding: 3px 0 3px 12px;
  font-size: 12px;
  color: var(--faint);
  line-height: 1.45;
  transition:
    color 140ms ease,
    border-color 140ms ease;
}

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

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

/* ── Breadcrumb & Prose Content ── */

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

.docs-crumb {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary-deep);
  margin-bottom: 12px;
}

.docs-crumb span {
  color: var(--faint);
  margin: 0 4px;
}

.docs-prose {
  max-width: 740px;
}

.docs-prose h1 {
  margin: 0 0 18px;
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.22;
  text-wrap: balance;
  color: var(--ink-strong);
}

.docs-prose h2 {
  margin: 40px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
  scroll-margin-top: 80px;
}

.docs-prose h3 {
  margin: 24px 0 10px;
  font-size: 1.03rem;
  font-weight: 600;
  color: var(--ink-strong);
  scroll-margin-top: 80px;
}

.docs-prose p {
  margin: 0 0 14px;
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.75;
}

.docs-prose a {
  color: var(--primary-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.docs-prose a:hover {
  color: var(--primary);
}

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

.docs-prose ul,
.docs-prose ol {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.75;
}

.docs-prose li {
  margin-bottom: 6px;
}

.docs-prose blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 2px solid var(--primary);
  border-radius: 0 8px 8px 0;
  background: var(--panel);
  color: var(--ink);
}

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

.prose-code-block {
  margin: 14px 0 18px;
  border-radius: 10px;
  border: 1px solid var(--hairline-soft);
  background: var(--panel);
  overflow: hidden;
}

.prose-code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 6px 14px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.02);
}

.prose-code-lang {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.docs-prose pre {
  margin: 14px 0 18px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--hairline-soft);
  background: var(--panel);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-soft) transparent;
}

.prose-code-block pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--canvas);
}

.prose-table-wrap {
  margin: 18px 0 22px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow-x: auto;
  background: var(--canvas);
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-soft) transparent;
}

.docs-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
}

.docs-prose thead {
  background: var(--panel);
}

.docs-prose th,
.docs-prose td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
  min-width: 120px;
  word-break: break-word;
}

.docs-prose th {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--mute);
  white-space: normal;
  line-height: 1.45;
}

.docs-prose th:first-child,
.docs-prose td:first-child {
  min-width: 124px;
  width: 21%;
  color: var(--ink-strong);
  font-weight: 550;
}

.docs-prose td {
  color: var(--body);
}

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

.docs-prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 18px 0 22px;
  border-radius: 12px;
  border: 1px solid var(--hairline-soft);
  background: var(--panel);
}

.docs-prose img[src$=".svg"] {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: transparent;
}

/* ── Pagination & Footer Meta ── */

.docs-pager {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 740px;
}

.docs-pager-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  background: var(--panel);
  transition:
    border-color 140ms ease,
    background 140ms ease;
}

.docs-pager-card:hover {
  border-color: rgba(180, 241, 209, 0.45);
  background: var(--panel2);
}

.docs-pager-next {
  text-align: right;
}

.docs-pager-dir {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
}

.docs-pager-title {
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink-strong);
}

.docs-meta-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  max-width: 740px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--mute);
}

.docs-meta-footer a {
  color: var(--primary-deep);
}

.docs-meta-footer a:hover {
  color: var(--primary);
}

@media (max-width: 1120px) {
  .docs-shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 820px) {
  .mobile-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .docs-shell {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 0 48px;
  }

  .docs-sidebar {
    display: none;
    position: static;
    max-height: none;
    border: 1px solid var(--hairline);
    border-radius: 10px;
    background: var(--panel);
    padding: 16px;
  }

  .docs-sidebar.open {
    display: flex;
  }

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