/* ═══════════════════════════════════════════════
   DOCUMENTATION PAGE
   ═══════════════════════════════════════════════ */

/* ── Shared eyebrow ── */
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--c-teal);
  margin-bottom: var(--sp-2);
}

/* ─────────────────────────────────────────────────────────────────
   SCROLL ISOLATION
   The navbar is position:sticky and part of normal flow (68px tall).
   We make main.main-content fill the remaining viewport height and
   stop it from scrolling. The two columns inside scroll on their own.
   footer/cookie are hidden on this page — they're unreachable anyway
   since main fills the screen.
───────────────────────────────────────────────────────────────── */

/* Target main.main-content only on the docs page via the layout child */
main.main-content:has(.docs-layout) {
  height: calc(100vh - 68px); /* fill exactly below the sticky navbar */
  overflow: hidden;            /* main itself must NOT scroll          */
  display: flex;               /* let .docs-layout fill it             */
}

/* ── Layout ── */
#docs-sidebar-toggle { display: none; }

.docs-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  width: 100%;
  height: 100%;   /* fill main.main-content completely */
  overflow: hidden;
}

/* ── Sidebar — scrolls independently ── */
.docs-sidebar {
  height: 100%;
  overflow-y: auto;
  border-right: 1px solid var(--c-border);
  padding: var(--sp-8) var(--sp-6);
  background: var(--c-surface);
}

.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 2px; }

.docs-sidebar__header {
  margin-bottom: var(--sp-8);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--c-border-light);
}

.docs-sidebar__header p {
  font-size: 0.8125rem;
  color: var(--c-muted);
  font-family: var(--font-mono);
  margin-top: var(--sp-1);
}

.docs-nav__section { margin-bottom: var(--sp-6); }

.docs-nav__heading {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: var(--sp-2);
  padding: 0 var(--sp-3);
}

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

.docs-nav__link {
  display: block;
  padding: 0.4rem var(--sp-3);
  font-size: 0.875rem;
  color: var(--c-text-2);
  text-decoration: none;
  border-radius: var(--r-sm);
  border-left: 2px solid transparent;
  transition: all var(--t-fast) var(--ease-out);
}

.docs-nav__link:hover {
  color: var(--c-text);
  background: var(--c-surface-2);
}

.docs-nav__link.active {
  color: var(--c-teal);
  border-left-color: var(--c-teal);
  background: var(--c-teal-light);
  font-weight: 600;
}

/* ── Mobile toggle button ── */
.docs-sidebar-toggle-btn {
  display: none;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.5rem 1rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-text-2);
  cursor: pointer;
  margin-bottom: var(--sp-8);
}

/* ── Content column — the ONLY thing that scrolls ── */
.docs-content {
  height: 100%;
  overflow-y: auto;
  padding: var(--sp-12) var(--sp-12) var(--sp-20);
  scroll-behavior: smooth;
}

.docs-content::-webkit-scrollbar { width: 6px; }
.docs-content::-webkit-scrollbar-track { background: transparent; }
.docs-content::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }

/* Max width wrapper inside the scroll column */
.docs-content > * { max-width: 740px; }

/* ── Sections ── */
.docs-section {
  padding-top: var(--sp-12);
  margin-bottom: var(--sp-8);
  border-bottom: 1px solid var(--c-border-light);
  padding-bottom: var(--sp-8);
}

.docs-section:last-child { border-bottom: none; }

.docs-section__header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}

.docs-section__header h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0;
}

.docs-section h2 {
  font-size: 1.5rem;
  margin-bottom: var(--sp-5);
  padding-top: var(--sp-2);
}

.docs-section h4 {
  font-size: 1rem;
  margin-bottom: var(--sp-2);
  color: var(--c-text);
}

.docs-section p {
  color: var(--c-text-2);
  margin-bottom: var(--sp-4);
}

.docs-lead {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--c-text-2);
}

/* ── Badge ── */
.docs-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}

.docs-badge--new {
  background: var(--c-teal-light);
  color: var(--c-teal);
}

/* ── Callouts ── */
.docs-callout {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  border-left: 3px solid;
  margin: var(--sp-6) 0;
}

.docs-callout > svg { flex-shrink: 0; margin-top: 3px; }

.docs-callout div p {
  margin: var(--sp-1) 0 0;
  font-size: 0.9rem;
  color: var(--c-text-2);
}

.docs-callout div strong {
  font-size: 0.9375rem;
  color: var(--c-text);
}

.docs-callout--info {
  background: var(--c-teal-light);
  border-color: var(--c-teal);
}
.docs-callout--info > svg { color: var(--c-teal); }

.docs-callout--warning {
  background: rgba(251,191,36,.12);
  border-color: #fbbf24;
}
.docs-callout--warning > svg { color: #fbbf24; }

/* ── Feature grid ── */
.docs-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-4);
  margin: var(--sp-6) 0;
}

.docs-feature {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-5);
}

.docs-feature__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: var(--sp-3);
}

.docs-feature strong {
  display: block;
  font-size: 0.9375rem;
  margin-bottom: var(--sp-1);
  color: var(--c-text);
}

.docs-feature p {
  font-size: 0.8125rem;
  color: var(--c-muted);
  margin: 0;
}

/* ── Steps ── */
.docs-steps {
  display: flex;
  flex-direction: column;
  border-left: 2px solid var(--c-border);
  margin: var(--sp-6) 0 var(--sp-6) var(--sp-4);
  padding-left: var(--sp-8);
}

.docs-step {
  position: relative;
  padding-bottom: var(--sp-8);
  display: flex;
  gap: var(--sp-4);
}

.docs-step:last-child { padding-bottom: 0; }

.docs-step__num {
  position: absolute;
  left: calc(-1 * var(--sp-8) - 1px);
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-teal);
  color: #0a2222;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.docs-step__body h4 { margin-top: var(--sp-1); }
.docs-step__body p  { margin: var(--sp-2) 0 0; font-size: 0.9rem; }

/* ── Ordered list ── */
.docs-ol {
  margin: var(--sp-4) 0;
  padding-left: var(--sp-6);
  color: var(--c-text-2);
}

.docs-ol li {
  margin-bottom: var(--sp-2);
  font-size: 0.9375rem;
  line-height: 1.7;
}

/* ── Table ── */
.docs-table-wrap {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  overflow-x: auto;
  margin: var(--sp-5) 0;
  max-width: 90vw;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.docs-table thead { background: var(--c-surface-2); }

.docs-table th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
}

.docs-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-border-light);
  color: var(--c-text-2);
}

.docs-table tr:last-child td { border-bottom: none; }

.docs-table code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--c-surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--c-border);
}

/* ── HTTP method badges ── */
.method-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.method-badge--get    { background: rgba(34,197,94,.12);  color: #22c55e; }
.method-badge--post   { background: var(--c-teal-light);  color: var(--c-teal); }
.method-badge--patch  { background: rgba(251,191,36,.15); color: #fbbf24; }
.method-badge--delete { background: rgba(235,84,6,.12);   color: var(--c-orange); }

/* ── Code blocks ── */
.code-block {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin: var(--sp-5) 0;
}

.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}

.code-block__lang {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--c-muted);
  font-family: var(--font-mono);
}

.code-block__copy {
  background: none;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--c-muted);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--t-fast) var(--ease-out);
}

.code-block__copy:hover { border-color: var(--c-teal); color: var(--c-teal); }

.code-block pre {
  padding: var(--sp-5) var(--sp-6);
  overflow-x: auto;
  margin: 0;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--c-text-2);
  line-height: 1.7;
  white-space: pre;
  background: none;
  border: none;
  padding: 0;
}

/* ── Inline badge ── */
.inline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 0.8em;
  font-weight: 600;
  vertical-align: middle;
}

.inline-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.inline-badge--active { background: rgba(34,197,94,.12); color: #22c55e; }
.inline-badge--active::before { background: #22c55e; }

/* ── FAQ ── */
.faq-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}

/* ── Changelog ── */
.changelog { display: flex; flex-direction: column; gap: var(--sp-6); }

.changelog__entry {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-6);
}

.changelog__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

.changelog__version {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--c-text);
}

.changelog__date { font-size: 0.8125rem; color: var(--c-muted); }

.changelog__list { padding-left: var(--sp-5); color: var(--c-text-2); }

.changelog__list li {
  margin-bottom: var(--sp-2);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── Status badge ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-badge--active { background: rgba(34,197,94,.12); color: #22c55e; }
.status-badge--active::before { background: #22c55e; }

/* ─────────────────────────────────────────────────────────────────
   MOBILE — restore normal page scroll, stack sidebar above content
───────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {

  main.main-content:has(.docs-layout) {
    height: auto;
    overflow: visible;
    display: block;
  }

  .docs-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .docs-sidebar {
    height: auto;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--c-border);
    display: none;
  }

  #docs-sidebar-toggle:checked ~ main .docs-sidebar,
  #docs-sidebar-toggle:checked ~ .docs-layout .docs-sidebar {
    display: block;
  }

  .docs-sidebar-toggle-btn { display: inline-flex; }

  .docs-content {
    height: auto;
    overflow-y: visible;
    padding: var(--sp-8) var(--sp-6) var(--sp-16);
  }
}

@media (max-width: 480px) {
  .docs-content { padding: var(--sp-6) var(--sp-4) var(--sp-12); }
}
