/* === Tasked Docs — Layout & Prose === */

/* Three-column layout: sidebar | content | ToC */
.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 200px;
  min-height: 100vh;
  padding-top: 60px; /* nav height */
}

/* Hidden by default — only shown on mobile when sidebar is open */
.docs-sidebar-overlay {
  display: none;
}

/* --- Sidebar --- */

.docs-sidebar {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 32px 0 32px 24px;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

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

.sidebar-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 16px;
  margin: 20px 0 8px;
}

.sidebar-label:first-child { margin-top: 0; }

.sidebar-nav {
  list-style: none;
}

.sidebar-nav a {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 5px 16px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-nav a.active {
  color: var(--text-bright);
  background: rgba(206, 65, 43, 0.08);
  font-weight: 500;
}

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

.docs-content {
  max-width: 720px;
  min-width: 0; /* allow grid item to shrink below content size */
  padding: 40px 48px 80px;
  overflow-wrap: break-word;
}

.docs-breadcrumb {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

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

.docs-breadcrumb a:hover { color: var(--text); }
.docs-breadcrumb span { margin: 0 6px; }

.docs-page-header h1 {
  font-family: var(--font-body);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  line-height: 1.2;
}

.docs-lead {
  font-size: 16px;
  color: var(--text-dim);
  line-height: 1.65;
  margin-bottom: 40px;
  max-width: 600px;
}

/* --- Prose --- */

.docs-body h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-bright);
  margin: 48px 0 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  letter-spacing: -0.01em;
}

.docs-body h2:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.docs-body h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 32px 0 12px;
}

.docs-body p {
  font-size: 15px;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 16px;
}

.docs-body ul, .docs-body ol {
  margin: 0 0 16px 20px;
  font-size: 15px;
  color: var(--text);
  line-height: 1.7;
}

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

.docs-body a {
  color: var(--text-bright);
  text-decoration: underline;
  text-decoration-color: var(--border-bright);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}

.docs-body a:hover { text-decoration-color: var(--text-dim); }

.docs-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--text-bright);
}

.docs-body pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  overflow-x: auto;
  margin-bottom: 20px;
}

.docs-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Syntax colors (matching main site) */
.docs-body pre .k { color: #7DCFFF; }
.docs-body pre .s { color: #9ECE6A; }
.docs-body pre .n { color: #FF9E64; }
.docs-body pre .c { color: var(--text-dim); }
.docs-body pre .d { color: var(--text-dim); }

/* --- Callouts --- */

.docs-callout {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.docs-callout-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.docs-callout-info {
  border-color: rgba(126, 140, 255, 0.2);
  background: rgba(126, 140, 255, 0.04);
}
.docs-callout-info .docs-callout-title { color: #7E8CFF; }

.docs-callout-warn {
  border-color: rgba(210, 153, 34, 0.2);
  background: rgba(210, 153, 34, 0.04);
}
.docs-callout-warn .docs-callout-title { color: var(--orange); }

.docs-callout-soon {
  border-color: rgba(107, 122, 141, 0.2);
  background: rgba(107, 122, 141, 0.04);
}
.docs-callout-soon .docs-callout-title { color: var(--text-dim); }

/* --- Tables --- */

.docs-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 20px;
  display: block;
  overflow-x: auto;
}

.docs-body th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}

.docs-body td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

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

.docs-body td code {
  font-size: 12px;
}

/* --- On-page ToC (right column) --- */

.docs-toc {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 32px 16px 32px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.docs-toc-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.docs-toc-list {
  list-style: none;
}

.docs-toc-list a {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 3px 0 3px 12px;
  border-left: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}

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

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

/* --- Page navigation (prev/next) --- */

.docs-page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.docs-page-nav a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.2s;
  min-width: 0;
  flex: 1;
}

.docs-page-nav a:hover { border-color: var(--border-bright); }

.docs-page-nav a:last-child { text-align: right; }

.docs-page-nav-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.docs-page-nav-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-bright);
}

/* --- Mobile sidebar toggle --- */

.docs-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* --- Responsive --- */

@media (max-width: 1200px) {
  .docs-layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .docs-toc { display: none; }
}

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

  .docs-sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 150;
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    border-right: 1px solid var(--border);
  }

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

  .docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 60px;
    z-index: 149;
    background: rgba(0, 0, 0, 0.5);
  }

  .docs-sidebar.open + .docs-sidebar-overlay {
    display: block;
  }

  .docs-sidebar-toggle { display: block; }

  .docs-content {
    padding: 24px 20px 80px;
  }

  .docs-page-nav {
    flex-direction: column;
  }
}
