/* docs.css — Developer Documentation & Interactive Walkthrough
   Tokens from ds/tokens/logmem.css and components from ds/components/bundle.css */

.docs-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar rail */
.docs-rail {
  width: 280px;
  flex: 0 0 280px;
  position: sticky;
  top: 86px;
  height: calc(100vh - 86px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: var(--space-4);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.docs-rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.docs-rail-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

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

.docs-nav-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 6px 8px;
}

.docs-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 18px;
  transition: background var(--duration-instant), color var(--duration-instant);
}

.docs-nav-link:hover {
  background: var(--surface-sunken);
  color: var(--brand-hover);
}

.docs-nav-link.active {
  background: var(--brand-subtle);
  color: var(--brand);
  font-weight: 600;
}

.docs-nav-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-sunken);
  color: var(--text-muted);
}

/* Main Content Area */
.docs-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--space-6) var(--space-6) var(--space-8);
  max-width: 960px;
  margin: 0 auto;
}

.docs-header {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.docs-section {
  scroll-margin-top: 24px;
  margin-bottom: var(--space-8);
}

.docs-prose {
  font-size: 15px;
  line-height: 24px;
  color: var(--text);
}

.docs-prose p {
  margin: 0 0 16px;
}

.docs-prose code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 2px 5px;
  border-radius: var(--radius-xs);
  background: var(--surface-sunken);
  color: var(--brand);
  border: 1px solid var(--border);
}

/* Callout cards */
.docs-callout {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--brand);
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 20px 0;
}

.docs-callout--decision {
  border-left-color: var(--decision);
  background: var(--surface);
}

.docs-callout--warning {
  border-left-color: var(--warning);
  background: var(--surface);
}

.docs-callout-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tool card deep dive */
.tool-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  transition: border-color var(--duration-instant), box-shadow var(--duration-instant);
}

.tool-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
}

.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tool-name {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.tool-tags {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tool-desc {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.tool-box {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}

.tool-box-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 6px;
}

/* Interactive Tabs for personas */
.persona-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-3);
  background: var(--surface-sunken);
  padding: 4px 4px 0;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.persona-tab {
  padding: 8px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.persona-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.4);
}

.persona-tab.active {
  background: var(--surface);
  color: var(--brand);
  font-weight: 600;
  border-color: var(--border);
  border-bottom: 1px solid var(--surface);
  margin-bottom: -1px;
}

.persona-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--surface-sunken);
}

/* Persona Code Block Container */
.persona-panel {
  display: none;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: var(--surface);
  padding: var(--space-4);
  margin-bottom: 24px;
}

.persona-panel.active {
  display: block;
}

pre.code-block {
  margin: 0;
  padding: 14px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 20px;
  overflow-x: auto;
  white-space: pre;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.code-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Search bar */
.docs-search {
  position: relative;
  margin-bottom: var(--space-2);
}

.docs-search input {
  width: 100%;
  padding: 8px 12px 8px 30px;
  font-size: 13px;
  font-family: var(--font-sans);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
}

.docs-search input:focus {
  border-color: var(--brand);
  background: var(--surface);
}

.docs-search-icon {
  position: absolute;
  left: 10px;
  top: 9px;
  width: 14px;
  height: 14px;
  color: var(--text-subtle);
}

@media (max-width: 900px) {
  .docs-shell {
    flex-direction: column;
  }
  .docs-rail {
    width: 100%;
    height: auto;
    top: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* Phones: let the content shrink to the screen. Wide tables scroll inside their own box. */
.docs-main { min-width: 0; }
@media (max-width: 900px) {
  .docs-main { margin: 0; width: 100%; box-sizing: border-box; padding-left: 16px; padding-right: 16px; }
  .docs-main pre.code-block { overflow-x: auto; }
  .docs-main .lm-table-wrap { max-width: 100%; overflow-x: auto; }
  .persona-tabs { flex-wrap: wrap; }
}
