/* Styles the manual. The page shell (nav, footer strip, buttons, fonts, palette) comes
   from the site's own /static/css/site.css — this file only adds what the book itself needs:
   the two-column layout, the contents sidebar, search, and article typography.
   mdBook's chrome.css / general.css / book.js are not loaded. */

:root {
  --docs-nav-height: 56px; /* remeasured from the real nav by manual.js */
  --docs-sidebar-width: 296px;
}

/* ----------------------------------------------------------------- layout -- */

/* Same centred column as .nav-inner, so the sidebar's masthead starts where the logo does. */
.docs-layout {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: var(--docs-sidebar-width) minmax(0, 1fr);
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: var(--docs-nav-height);
  height: calc(100vh - var(--docs-nav-height));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: var(--border);
}

.docs-main {
  min-width: 0;
  padding: 48px 0 80px 48px;
}

.docs-article {
  max-width: 78ch;
}

/* ---------------------------------------------------------------- sidebar -- */

.docs-sidebar-head {
  padding: 20px 24px 22px 0;
  border-bottom: var(--border);
}

.docs-sidebar-eyebrow {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-stretch: 87.5%;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--blue-200);
  margin-bottom: 8px;
}

.docs-sidebar-title {
  font-family: var(--mono);
  font-stretch: 75%;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 18px;
}

.docs-toc {
  padding: 18px 24px 60px 0;
}

.docs-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-toc li.chapter-item {
  font-size: 0.95rem;
  line-height: 1.35;
  margin: 1px 0;
}

.docs-toc li.chapter-item a {
  display: block;
  padding: 7px 10px;
  color: var(--black);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.docs-toc li.chapter-item a:hover {
  background: var(--sky);
}

.docs-toc li.chapter-item a.active {
  background: var(--grass);
  border-left-color: var(--black);
  font-weight: 700;
}

.docs-toc li.part-title {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-stretch: 87.5%;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin: 26px 0 8px;
  padding: 14px 10px 0;
  border-top: 1.4px solid rgba(12, 11, 11, 0.12);
}

.docs-toc li.spacer {
  display: none;
}

/* ----------------------------------------------------------------- search -- */

.hidden {
  display: none;
}

/* searcher.js collapses the search box on load and on Escape, because mdBook keeps it behind a
   toggle. Ours lives in the sidebar and is always there. */
#search-wrapper.hidden {
  display: block;
}

#searchbar {
  width: 100%;
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.78rem;
  padding: 10px 12px;
  border: var(--border);
  background: var(--white);
  color: var(--black);
}

#searchbar::placeholder {
  color: rgba(12, 11, 11, 0.45);
}

.searchresults-header {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-stretch: 87.5%;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin: 16px 0 8px;
}

#searchresults {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
}

#searchresults li {
  padding: 10px 0;
  border-top: 1px solid rgba(12, 11, 11, 0.15);
}

#searchresults li.focus {
  background: var(--sky);
}

#searchresults span.teaser {
  display: block;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.4;
  margin-top: 4px;
}

mark {
  background: var(--grass);
  color: var(--black);
}

/* ---------------------------------------------------------------- article -- */

.docs-article h1,
.docs-article h2,
.docs-article h3,
.docs-article h4 {
  line-height: 1.15;
  scroll-margin-top: calc(var(--docs-nav-height) + 16px);
}

.docs-article h1 {
  font-size: clamp(1.9rem, 3.4vw, 2.5rem);
  padding-bottom: 16px;
  margin-bottom: 28px;
  border-bottom: var(--border);
}

.docs-article h2 {
  font-size: 1.45rem;
  margin: 2.4em 0 0.7em;
}

.docs-article h3 {
  font-size: 1.08rem;
  font-stretch: 87.5%;
  margin: 2em 0 0.6em;
}

.docs-article h4 {
  font-size: 0.92rem;
  font-stretch: 87.5%;
  margin: 1.8em 0 0.5em;
}

.docs-article a.header {
  color: inherit;
  text-decoration: none;
}

.docs-article a.header:hover::after {
  content: " #";
  color: var(--blue-100);
}

.docs-article p,
.docs-article ul,
.docs-article ol,
.docs-article blockquote,
.docs-article pre,
.docs-article .table-wrapper {
  margin: 0 0 1.15em;
}

.docs-article li {
  margin-bottom: 0.4em;
}

.docs-article li > ul,
.docs-article li > ol {
  margin: 0.4em 0 0.4em;
}

.docs-article hr {
  border: 0;
  border-top: 1.4px solid rgba(12, 11, 11, 0.15);
  margin: 2.5em 0;
}

.docs-article img {
  max-width: 100%;
  height: auto;
  border: var(--border);
}

.docs-article blockquote {
  padding: 14px 20px;
  background: #eaf6ff;
  border-left: 6px solid var(--blue-100);
}

.docs-article blockquote > :last-child {
  margin-bottom: 0;
}

/* tables */

.docs-article .table-wrapper {
  overflow-x: auto;
}

.docs-article table {
  border-collapse: collapse;
  border: var(--border);
  font-size: 0.92rem;
}

.docs-article th,
.docs-article td {
  border: 1px solid rgba(12, 11, 11, 0.25);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}

.docs-article thead th {
  background: var(--sky);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: var(--border);
}

/* Field-name column: never hyphenate an identifier. Anything too wide scrolls the wrapper. */
.docs-article td:first-child {
  white-space: nowrap;
}

/* code */

/* No border: the spec pages put a dozen of these in a paragraph and boxes make it a mess. */
.docs-article :not(pre) > code {
  background: #e8f3ff;
  color: var(--blue-200);
  font-size: 0.86em;
  padding: 1px 4px;
  overflow-wrap: anywhere;
}

.docs-article pre {
  position: relative;
  background: var(--black);
  border: var(--border);
  box-shadow: var(--shadow-raised);
  padding: 0;
  overflow: hidden;
}

.docs-article pre > code {
  display: block;
  padding: 18px 20px;
  overflow-x: auto;
  background: transparent;
  color: #e6e6e6;
  font-size: 0.8rem;
  line-height: 1.7;
}

.docs-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-stretch: 87.5%;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--black);
  background: var(--sky);
  border: var(--border);
  padding: 3px 8px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s;
}

.docs-article pre:hover .docs-copy,
.docs-copy:focus-visible {
  opacity: 1;
}

/* ------------------------------------------------------- pager + footnote -- */

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

.docs-pager-forward {
  margin-left: auto;
}

.docs-pager-link {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-stretch: 87.5%;
  font-weight: 600;
  text-decoration: none;
  color: var(--black);
  background: var(--paper);
  border: var(--border);
  padding: 10px 16px;
  box-shadow: var(--shadow-button);
}

.docs-pager-link:hover {
  color: var(--black);
  background: var(--sky);
}

.docs-source {
  margin-top: 34px;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.docs-toc-toggle {
  display: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-stretch: 87.5%;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--paper);
  color: var(--black);
  border: var(--border);
  box-shadow: var(--shadow-button);
  padding: 10px 16px;
  margin-bottom: 28px;
  cursor: pointer;
}

/* --------------------------------------------------------------- narrow  -- */

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

  .docs-sidebar {
    display: none;
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: var(--border);
  }

  .docs-sidebar-head {
    padding-right: 0;
  }

  .docs-toc-open .docs-sidebar {
    display: block;
  }

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

  .docs-main {
    padding: 28px 0 64px;
  }
}

@media print {
  .nav,
  .docs-sidebar,
  .docs-pager,
  .docs-toc-toggle,
  .footer-base,
  .docs-copy {
    display: none;
  }

  .docs-main {
    padding: 0;
  }

  .docs-article pre {
    box-shadow: none;
  }
}
