/* =============================================
   Atlas Docs — Documentation Stylesheet
   Supplements /assets/style.css
   ============================================= */

/* ── LAYOUT ── */
.docs-wrap {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto;
  min-height: calc(100vh - 60px);
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ── SIDEBAR ── */
.docs-sidebar {
  border-right: 1px solid var(--border);
  padding: 2rem 0;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  background: var(--navy-mid);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

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

.sidebar-section { margin-bottom: 0.5rem; }

.sidebar-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: .65rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  padding: 1rem 1.5rem 0.4rem;
  display: block;
}

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

.sidebar-nav li { line-height: 1; }

.sidebar-nav a {
  display: block;
  padding: .35rem 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s, background .15s;
  border-left: 2px solid transparent;
  line-height: 1.5;
}

.sidebar-nav a:hover {
  color: var(--cream);
  background: var(--border-light);
  text-decoration: none;
}

.sidebar-nav a.active {
  color: var(--gold-light);
  border-left-color: var(--gold);
  background: var(--border-light);
}

/* indentation levels */
.sidebar-nav .l1 > a { padding-left: 1.5rem; font-size: .72rem; }
.sidebar-nav .l2 > a { padding-left: 2.5rem; font-size: .69rem; }
.sidebar-nav .l3 > a { padding-left: 3.5rem; font-size: .66rem; color: var(--text-muted); }

/* collapsible sections */
.sidebar-group > .sidebar-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .35rem 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: color .15s;
  border-left: 2px solid transparent;
}

.sidebar-group > .sidebar-group-toggle:hover { color: var(--cream); }
.sidebar-group > .sidebar-group-toggle.active { color: var(--gold-light); border-left-color: var(--gold); }

.sidebar-group-toggle .chevron {
  font-size: .6rem;
  transition: transform .2s;
  opacity: .5;
}

.sidebar-group.open .chevron { transform: rotate(90deg); }

.sidebar-group-children {
  display: none;
  list-style: none;
}

.sidebar-group.open .sidebar-group-children { display: block; }

/* ── MAIN CONTENT ── */
.docs-main {
  padding: 3rem 4rem;
  max-width: 860px;
  min-width: 0;
}

.docs-main .section-label { margin-bottom: .5rem; }

.docs-main h1 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.docs-main h2 {
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  margin-top: 2.5rem;
  margin-bottom: .8rem;
  padding-top: .5rem;
}

.docs-main h3 {
  font-size: 1.15rem;
  margin-top: 1.8rem;
  margin-bottom: .6rem;
  color: var(--cream);
}

.docs-main p {
  font-size: .97rem;
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 1rem;
}

.docs-main p strong { color: var(--cream); font-weight: 600; }

.docs-main a { color: var(--gold-light); }
.docs-main a:hover { text-decoration: underline; }

/* ── CODE BLOCKS ── */
pre {
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold-dim);
  padding: 1.2rem 1.5rem;
  border-radius: 2px;
  overflow-x: auto;
  margin: 1.2rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: .82rem;
  line-height: 1.7;
}

/* Atlas session: prompt lines vs output lines */
.atlas-session { background: #0e1a14; border-left-color: #3a7a4a; }
.atlas-prompt { color: #6ab07a; }      /* atlas> prompt */
.atlas-output { color: #c8d8c0; }      /* output */
.atlas-comment { color: #556655; font-style: italic; } /* comments */

/* shell commands */
.shell-session { background: #0e1419; border-left-color: #4a7aaa; }
.shell-prompt { color: #6a9ac8; }      /* $ prompt */
.shell-output { color: #b8ccd8; }

/* inline code */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: .84em;
  background: var(--navy-light);
  color: var(--gold-light);
  padding: .1em .4em;
  border-radius: 2px;
  border: 1px solid var(--border-light);
}

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

/* code block header/label */
.code-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: .65rem;
  letter-spacing: .1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: .3rem;
}

.code-label .lang-tag {
  background: var(--navy-light);
  border: 1px solid var(--border);
  padding: .2rem .6rem;
  border-radius: 2px;
  color: var(--gold-dim);
}

/* ── CALLOUT BOXES ── */
.callout {
  padding: 1rem 1.4rem;
  border-left: 3px solid;
  margin: 1.4rem 0;
  border-radius: 0 2px 2px 0;
}

.callout p { margin: 0; font-size: .92rem; }
.callout-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: .65rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-bottom: .4rem;
}

.callout.note {
  background: rgba(74,122,170,.08);
  border-color: var(--gold);
}
.callout.note .callout-title { color: var(--gold); }
.callout.note p { color: var(--text-muted); }

.callout.warning {
  background: rgba(180,100,40,.08);
  border-color: #b46428;
}
.callout.warning .callout-title { color: #b46428; }
.callout.warning p { color: var(--text-muted); }

.callout.tip {
  background: rgba(60,140,80,.08);
  border-color: #3c8c50;
}
.callout.tip .callout-title { color: #3c8c50; }
.callout.tip p { color: var(--text-muted); }

/* ── IN-PAGE TOC ── */
.page-toc {
  float: right;
  margin: 0 0 2rem 2rem;
  width: 220px;
  background: var(--navy-mid);
  border: 1px solid var(--border-light);
  padding: 1rem;
  font-size: .82rem;
}

.page-toc-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: .63rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: .7rem;
}

.page-toc ul { list-style: none; }
.page-toc li { margin-bottom: .3rem; }
.page-toc a { color: var(--text-muted); text-decoration: none; font-size: .8rem; }
.page-toc a:hover { color: var(--gold-light); }
.page-toc .toc-l2 { padding-left: .8rem; font-size: .75rem; }

/* ── PREV / NEXT NAV ── */
.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
}

.page-nav-btn {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border-light);
  text-decoration: none;
  background: var(--navy-mid);
  transition: border-color .2s, background .2s;
}

.page-nav-btn:hover {
  border-color: var(--border);
  background: var(--navy-light);
  text-decoration: none;
}

.page-nav-btn.next { text-align: right; }

.page-nav-direction {
  font-family: 'JetBrains Mono', monospace;
  font-size: .63rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: .3rem;
}

.page-nav-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  color: var(--cream);
}

/* ── DEFINITION LIST (for function/command reference) ── */
.def-list { margin: 1.2rem 0; }

.def-item {
  border-bottom: 1px solid var(--border-light);
  padding: 1rem 0;
}

.def-item:last-child { border-bottom: none; }

.def-term {
  font-family: 'JetBrains Mono', monospace;
  font-size: .85rem;
  color: var(--gold-light);
  margin-bottom: .4rem;
}

.def-term .type-sig {
  color: var(--text-muted);
  font-size: .78rem;
}

.def-desc {
  font-size: .92rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin: 0;
}

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .docs-main { padding: 2.5rem 2.5rem; }
}

@media (max-width: 900px) {
  .docs-wrap { grid-template-columns: 1fr; }
  .docs-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .docs-main { padding: 2rem 1.5rem; }
  .page-toc { float: none; width: 100%; margin: 0 0 1.5rem; }
}

@media (max-width: 600px) {
  .page-nav { grid-template-columns: 1fr; }
  .docs-main { padding: 1.5rem 1rem; }
}
