/* Project docs theme: small overrides on top of Asciidoctor's built-in
   HTML5 stylesheet. No project-specific names; reusable across repos. */

/* --- Sidebar independence: TOC scrolls on its own ---------------------- */
#toc.toc2 {
  overflow-y: auto;
  max-height: 100vh;
}

/* --- Collapse/expand toolbar ------------------------------------------- */
.toc-toolbar {
  display: flex;
  gap: 0.5em;
  padding: 0.4em 0.75em;
  border-bottom: 1px solid #ddd;
  margin-bottom: 0.4em;
  position: sticky;
  top: 0;
  background: inherit;
}

.toc-toolbar button {
  background: none;
  border: 1px solid #ccc;
  border-radius: 3px;
  color: #555;
  cursor: pointer;
  font-size: 0.72em;
  padding: 0.15em 0.5em;
}

.toc-toolbar button:hover {
  background: #f0f0f0;
  color: #111;
}

/* --- Disclosure controls ------------------------------------------------ */
#toc ul {
  list-style: none;
}

#toc li {
  position: relative;
}

/* Hide children of collapsed nodes (JS toggles .toc-collapsed).
   Without JS this class is never added, so the full TOC stays visible. */
#toc li.toc-collapsed > ul {
  display: none;
}

.toc-toggle {
  background: none;
  border: none;
  color: #777;
  cursor: pointer;
  font-size: 0.75em;
  line-height: 1;
  padding: 0.2em 0.25em;
  margin-left: -1.4em;
  margin-right: 0.1em;
  vertical-align: baseline;
  min-width: 1.4em;
}

/* Arrow glyph follows state for sighted users; aria-expanded covers
   assistive technology (set by nav.js). */
.toc-toggle::before {
  content: "\25B8"; /* right-pointing: collapsed */
}

.toc-toggle[aria-expanded="true"]::before {
  content: "\25BE"; /* down-pointing: expanded */
}

.toc-toggle:hover {
  color: #111;
}

.toc-toggle:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 1px;
}

/* --- Active section: subtle, keeps the engineering-manual feel ---------- */
#toc a.toc-active {
  font-weight: bold;
  color: #111;
  border-left: 2px solid #999;
  padding-left: 0.4em;
}

#toc a {
  border-left: 2px solid transparent;
}

/* --- Docs search box (injected by search.js; hidden without JS) -------- */
.docs-search {
  margin: 0.4em 0.75em 0.6em 0.75em;
}

.docs-search input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 0.85em;
  padding: 0.4em 0.55em;
}

.docs-search input:focus {
  border-color: #1a73e8;
  outline: 2px solid #1a73e8;
  outline-offset: 0;
}

.docs-search-results {
  list-style: none;
  margin: 0.3em 0 0 0;
  padding: 0;
  font-size: 0.85em;
  max-height: 40vh;
  overflow-y: auto;
}

.docs-search-results li a {
  display: block;
  padding: 0.25em 0.3em;
  text-decoration: none;
}

.docs-search-results li a:hover {
  text-decoration: underline;
}

.docs-search-empty {
  color: #777;
  font-size: 0.82em;
  padding: 0.3em 0;
}

/* Filtered-out TOC entries while searching */
#toc.toc-searching li.toc-no-match {
  display: none;
}

#toc.toc-searching li.toc-match > a {
  font-weight: bold;
}

/* --- Readability: dense but not cramped -------------------------------- */
#content {
  max-width: 62em;
}

#content .literalblock pre,
#content .listingblock pre {
  overflow-x: auto;
}

#content table.tableblock {
  display: block;
  overflow-x: auto;
  width: 100%;
}

#content .imageblock {
  text-align: center;
  margin: 1.5em 0;
}

/* --- Narrow screens: sidebar stacks above content ---------------------- */
@media screen and (max-width: 768px) {
  body.toc2 #toc.toc2 {
    position: static;
    width: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid #ddd;
  }

  body.toc2 #content {
    margin-left: 0;
  }
}

/* --- Print: engineering-manual hard copy --------------------------------
   Hide navigation chrome and force collapsed sections open so the
   printout is complete. */
@media print {
  #toc.toc2,
  .toc-toolbar,
  .docs-search,
  #toc .toc-toggle {
    display: none !important;
  }

  #toc li.toc-collapsed > ul {
    display: block !important;
  }

  body.toc2 #content {
    margin-left: 0;
    max-width: none;
  }

  #content a {
    color: #111;
    text-decoration: none;
  }
}
