/* ── Docs layout ────────────────────────────────────────── */

.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-top: var(--nav-height);
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */

.docs-sidebar {
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  scrollbar-width: none;
  padding: 1.5rem 1.25rem 2rem 1.25rem;
  border-right: 1px solid var(--border-subtle);
}

.docs-sidebar::-webkit-scrollbar {
  display: none;
}

.docs-nav h4 {
  margin: 1.6rem 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-left: 0;
  border-left: 3px solid transparent;
}

.docs-nav h4:first-child {
  margin-top: 0;
}

.docs-nav h4[data-stage="1"] {
  border-left-color: var(--accent-teal);
  padding-left: 8px;
}

.docs-nav h4[data-stage="2"] {
  border-left-color: var(--accent-amber);
  padding-left: 8px;
}

.docs-nav h4[data-stage="3"] {
  border-left-color: var(--code-function);
  padding-left: 8px;
}

.docs-nav a {
  display: block;
  padding: 0.25rem 0 0.25rem 12px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.docs-nav a:hover {
  color: var(--accent-teal);
}

.docs-nav a.is-active {
  color: var(--accent-teal);
  font-weight: 600;
}

/* ── Content typography ─────────────────────────────────── */

.docs-content {
  padding: 32px 48px;
  max-width: 800px;
}

.docs-content h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.docs-lead {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.docs-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 3rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--nav-height) + 24px);
}

.docs-content h2:first-of-type {
  margin-top: 2rem;
}

.docs-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
  scroll-margin-top: calc(var(--nav-height) + 24px);
}

.docs-content p {
  line-height: 1.7;
  margin: 0.75rem 0;
}

.docs-content ul,
.docs-content ol {
  line-height: 1.7;
  padding-left: 1.5rem;
  margin: 0.75rem 0;
}

.docs-content li {
  margin: 0.35rem 0;
}

.docs-content a {
  color: var(--accent-teal);
  text-decoration: none;
}

.docs-content a:hover {
  text-decoration: underline;
}

.docs-content strong {
  font-weight: 600;
}

.docs-content code {
  font-family: 'JetBrains Mono', 'SFMono-Regular', 'Menlo', monospace;
  font-size: 0.85em;
  background: rgba(45, 212, 168, 0.08);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.docs-content pre code {
  background: none;
  padding: 0;
}

.docs-problem {
  color: var(--text-muted);
  font-style: italic;
  margin: 0.75rem 0;
  line-height: 1.7;
}

/* ── Tables ─────────────────────────────────────────────── */

.docs-table-wrap {
  margin: 1rem 0;
  overflow-x: auto;
}

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

.docs-content th {
  text-align: left;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-bottom: 2px solid var(--border-subtle);
  white-space: nowrap;
}

.docs-content td {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.docs-content td code {
  font-size: 0.82em;
  white-space: nowrap;
}

/* ── Mobile drawer ──────────────────────────────────────── */

.docs-drawer-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-teal);
  color: var(--bg-deep);
  border: none;
  cursor: pointer;
  z-index: 200;
  font-size: 1.2rem;
  line-height: 1;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: background 0.2s;
}

.docs-drawer-toggle:hover {
  background: var(--accent-teal-dark);
}

.docs-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 149;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.docs-drawer-overlay.is-open {
  opacity: 1;
}

/* ── Stage banners ──────────────────────────────────────── */

.stage-banner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  margin: 48px 0 24px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.stage-banner:first-of-type {
  margin-top: 32px;
}

.stage-banner-num {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  min-width: 40px;
  text-align: center;
}

.stage-banner-1 {
  border-left: 3px solid var(--accent-teal);
}

.stage-banner-1 .stage-banner-num {
  color: var(--accent-teal);
}

.stage-banner-2 {
  border-left: 3px solid var(--accent-amber);
}

.stage-banner-2 .stage-banner-num {
  color: var(--accent-amber);
}

.stage-banner-3 {
  border-left: 3px solid var(--code-function);
}

.stage-banner-3 .stage-banner-num {
  color: var(--code-function);
}

.stage-banner-deep {
  border-left: 3px solid var(--text-muted);
  margin-top: 48px;
}

.stage-banner-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.stage-banner-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ── Callout boxes ──────────────────────────────────────── */

.docs-callout {
  padding: 20px 24px;
  border-radius: var(--radius-md);
  margin: 24px 0;
  font-size: 0.92rem;
  line-height: 1.6;
}

.docs-callout-success {
  background: rgba(45, 212, 168, 0.06);
  border: 1px solid rgba(45, 212, 168, 0.2);
  color: var(--text-primary);
}

.docs-callout-success strong {
  color: var(--accent-teal);
}

/* ── Code comparison panels ────────────────────────────── */

.code-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
}

.code-compare-panel {
  min-width: 0;
}

.code-compare-label {
  display: block;
  padding: 8px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg-surface);
  color: var(--text-muted);
}

.code-compare-label--fl {
  background: rgba(45, 212, 168, 0.06);
  color: var(--accent-teal);
}

.code-compare-panel .code-block {
  border: none;
  border-radius: 0;
  margin: 0;
}

@media (max-width: 980px) {
  .code-compare {
    grid-template-columns: 1fr;
  }
}

/* ── Responsive ≤980px ──────────────────────────────────── */

@media (max-width: 980px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 150;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    padding-top: calc(var(--nav-height) + 1rem);
  }

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

  .docs-drawer-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .docs-drawer-overlay {
    display: block;
    pointer-events: none;
  }

  .docs-drawer-overlay.is-open {
    pointer-events: auto;
  }

  .docs-content {
    padding: 24px 20px;
    max-width: 100%;
  }

  .docs-content h1 {
    font-size: 1.6rem;
  }

  .docs-content h2 {
    font-size: 1.25rem;
  }
}
