/*
 * Keep mdBook's native Rust-by-Example-like reading interface. This stylesheet
 * adds only the compact identity elements used by the guidebook.
 */

.chapter-subtitle {
  margin-block-end: 1.5em;
  font-size: 1.08em;
  color: var(--icons);
}

.chapter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 1.25em;
  margin-block: 1.5em 3em;
  padding-block: 0.75em;
  border-block: 1px solid var(--table-border-color);
  color: var(--icons);
  font-size: 0.8em;
}

.chapter-meta span:not(:last-child) {
  padding-inline-end: 1.25em;
  border-inline-end: 1px solid var(--table-border-color);
}

.content main {
  text-wrap: pretty;
}

/* Terminal-inspired Rust palette: high contrast without making punctuation
 * compete with the parts of the signature a reader is trying to identify. */
.content pre,
.content pre code.hljs {
  background-color: #303030;
  color: #eeeeee;
}

.content pre code.hljs .hljs-comment,
.content pre code.hljs .hljs-quote {
  color: #7ac7e3;
}

.content pre code.hljs .hljs-keyword,
.content pre code.hljs .hljs-selector-tag,
.content pre code.hljs .hljs-type,
.content pre code.hljs .hljs-built_in,
.content pre code.hljs .hljs-builtin-name,
.content pre code.hljs .hljs-literal {
  color: #e7df78;
}

.content pre code.hljs .hljs-string,
.content pre code.hljs .hljs-regexp,
.content pre code.hljs .hljs-meta,
.content pre code.hljs .hljs-meta .hljs-keyword {
  color: #ef9a9a;
}

.content pre code.hljs .hljs-title,
.content pre code.hljs .hljs-title.function_,
.content pre code.hljs .hljs-function .hljs-title {
  color: #8fe895;
}

.content pre code.hljs .hljs-number,
.content pre code.hljs .hljs-symbol {
  color: #d7cd80;
}

.content pre code.hljs .hljs-params,
.content pre code.hljs .hljs-variable,
.content pre code.hljs .hljs-attr,
.content pre code.hljs .hljs-attribute {
  color: #eeeeee;
}

/* Rustdoc-style disclosure for supporting code that would otherwise interrupt
 * the API's central signature or expression. */
.code-details {
  margin-block: 1.25em 2em;
  border-radius: 6px;
  background: #292929;
  color: #eeeeee;
}

.code-details summary {
  padding: 0.9em 1.1em;
  color: #b8b8b8;
  font-family: var(--mono-font);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.code-details summary:hover,
.code-details[open] summary {
  color: #eeeeee;
}

.code-details[open] summary {
  border-block-end: 1px solid #414141;
}

.code-details pre {
  margin: 0;
  border-radius: 0 0 6px 6px;
}

.source-details {
  border-inline-start: 3px solid #d49b32;
}

.source-details summary::after {
  content: "folded";
  float: right;
  margin-inline-start: 1em;
  color: #858585;
  font-family: var(--mono-font);
  font-size: 0.8em;
  font-weight: normal;
}

.source-details[open] > summary::after {
  content: "open";
}

.nested-details {
  margin: 0.75em 1em 1.25em;
  background: #242424;
  border-inline-start-color: #7ac7e3;
}

.nested-details > p,
.source-details > p,
.source-details > ul {
  margin-inline: 1.1em;
}

/*
 * Treat chapter navigation like the edges of a physical page: on wide
 * screens, the entire gutter below the menu bar is a previous/next target.
 * mdBook supplies the links, keyboard shortcuts, and responsive fallback.
 */
@media only screen and (min-width: 801px) {
  /* Override mdBook's intermediate-width fallback, including when the
   * sidebar is open. The fixed edge controls remain usable without scrolling.
   */
  .nav-wide-wrapper,
  #mdbook-sidebar-toggle-anchor:checked ~ .page-wrapper .nav-wide-wrapper {
    display: block;
  }

  .nav-wrapper,
  #mdbook-sidebar-toggle-anchor:checked ~ .page-wrapper .nav-wrapper {
    display: none;
  }

  .nav-chapters {
    top: var(--menu-bar-height);
    bottom: 0;
    min-width: 90px;
    height: auto;
    border-radius: 0;
    cursor: pointer;
  }

  .nav-chapters .fa-svg {
    transition: transform 0.15s ease;
  }

  .nav-chapters:hover .fa-svg {
    transform: scale(1.12);
  }
}

@media (max-width: 700px) {
  .chapter-meta span {
    border-inline-end: 0 !important;
  }
}
