/* Documentation pages. Shares the top bar, fonts and colours with site.css. */
.doc-body { --bar2: 3.25rem; --side: 16.5rem; --toc: 13.5rem; }
html { scroll-padding-top: calc(var(--bar) + 3.25rem + 1rem); }

.doc-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: var(--bar); padding-inline: 1.25rem;
}

/* Search and chapter bar */
.doc-bar {
  position: sticky; top: var(--bar); z-index: 15;
  display: flex; align-items: center; gap: 1rem;
  min-height: var(--bar2); padding: .5rem 1.25rem;
  background: var(--tile); border-bottom: 1px solid var(--line);
}
.doc-ver { margin: 0 0 0 auto; font-size: .8125rem; color: var(--muted); white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.search { position: relative; flex: 0 1 28rem; min-width: 0; }
@media (min-width: 62rem) { .search { margin-left: calc(var(--side) - 1.25rem); } }
.search input {
  width: 100%; height: 2.25rem; padding: 0 2.25rem 0 .75rem;
  font: inherit; font-size: .9375rem; color: var(--ink); caret-color: var(--orange-deep);
  background: var(--paper); border: 1px solid #b9b9b5; border-radius: 3px;
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:focus { outline: 2px solid var(--orange); outline-offset: 0; border-color: transparent; }
.search input::-webkit-search-cancel-button { display: none; }
.search-key { position: absolute; right: .5rem; top: .45rem; pointer-events: none; }
.search input:focus ~ .search-key { display: none; }
.results {
  position: absolute; left: 0; top: calc(100% + .25rem); width: min(36rem, calc(100vw - 2.5rem));
  max-height: min(70vh, 32rem); overflow-y: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 3px;
  box-shadow: 0 8px 28px rgba(22, 23, 29, .22);
}
.results a { display: block; padding: .625rem .875rem; text-decoration: none; border-bottom: 1px solid var(--line); color: var(--text); }
.results a:last-child { border-bottom: 0; }
.results a:hover, .results a.on { background: var(--tile); }
.results small { display: block; font-size: .75rem; color: var(--muted); }
.results b { display: block; color: var(--ink); font-weight: 500; }
.results span { display: block; font-size: .875rem; line-height: 1.4; }
.results mark { background: #ffd9c2; color: inherit; }
.results p { margin: 0; padding: 1rem; font-size: .9375rem; }

/* Three columns: chapters, page, on this page */
.doc-grid {
  display: grid; align-items: start;
  grid-template-columns: var(--side) minmax(0, 1fr) var(--toc);
  max-width: 90rem; margin-inline: auto;
}
@media (max-width: 75rem) { .doc-grid { grid-template-columns: var(--side) minmax(0, 1fr); } .toc { display: none; } .doc-grid > span { display: none; } }

.side, .toc {
  position: sticky; top: calc(var(--bar) + var(--bar2));
  max-height: calc(100vh - var(--bar) - var(--bar2)); overflow-y: auto;
  padding: 1.5rem 1.25rem 2rem; font-size: .9375rem; scrollbar-width: thin;
}
.side { border-right: 1px solid var(--line); }
.side ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.side a, .toc a { display: block; text-decoration: none; color: var(--text); border-radius: 2px; }
.side a { padding: .3rem .625rem; margin-left: -.625rem; line-height: 1.3; }
.side a:hover { background: var(--tile); }
.side a.on { background: var(--ink); color: #f3f1ee; font-weight: 500; }
.side-group {
  margin: 1.25rem 0 .375rem; font: 700 .9375rem "Roboto Condensed", sans-serif; color: var(--ink);
}
.side-toggle { display: none; }

.toc { font-size: .875rem; }
.toc > p { margin: 0 0 .5rem; font: 700 .9375rem "Roboto Condensed", sans-serif; color: var(--ink); }
.toc a { padding: .2rem 0 .2rem .75rem; border-left: 2px solid var(--line); line-height: 1.3; color: var(--muted); }
.toc a:hover { color: var(--ink); }
.toc a.on { border-left-color: var(--orange); color: var(--ink); font-weight: 500; }
.toc .lv3 a { padding-left: 1.5rem; }

/* The page itself */
.doc { padding: 1.5rem 2.5rem 3rem; min-width: 0; }
.doc > * { max-width: 48rem; }
.crumbs { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .8125rem; color: var(--muted); margin-bottom: 1rem; }
.crumbs a { color: inherit; }
.doc h1 { font: 700 clamp(2rem, 3.4vw, 2.75rem)/1.1 "Roboto Condensed", sans-serif; color: var(--ink); margin-bottom: 1.25rem; }
.doc h2 {
  font: 700 1.625rem/1.2 "Roboto Condensed", sans-serif; text-align: left;
  margin: 2.5rem 0 .75rem; padding-top: .25rem; border-top: 1px solid var(--line); padding-top: 1.25rem;
}
.doc h3 { font: 700 1.25rem/1.25 "Roboto Condensed", sans-serif; margin: 1.75rem 0 .5rem; }
.anchor { margin-left: .4rem; color: var(--muted); font-weight: 400; text-decoration: none; opacity: 0; transition: opacity .12s; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.doc p { margin: 0 0 1rem; max-width: 46rem; }
.doc ul, .doc ol { margin: 0 0 1rem; padding-left: 1.5rem; max-width: 46rem; }
.doc li { margin-bottom: .375rem; }
.doc li > p { margin: 0 0 .375rem; }
.doc li > ul, .doc li > ol { margin: .375rem 0; }
.doc a { color: #a83e06; text-decoration: underline; text-underline-offset: .15em; text-decoration-thickness: 1px; }
.doc a:hover { color: var(--ink); text-decoration-thickness: 2px; }
.doc .anchor { color: var(--muted); text-decoration: none; }
.doc strong { color: var(--ink); font-weight: 500; }
.doc code { font: .875em ui-monospace, Consolas, monospace; padding: .05em .3em; background: var(--tile); border-radius: 2px; overflow-wrap: anywhere; }
kbd {
  display: inline-block; padding: .05rem .4rem;
  font: 500 .8125rem ui-monospace, Consolas, monospace;
  color: var(--ink); background: var(--paper);
  border: 1px solid #b9b9b5; border-bottom-width: 2px; border-radius: 3px; white-space: nowrap;
}
.doc pre { position: relative; margin: 0 0 1rem; padding: 1rem 1rem; overflow-x: auto; background: var(--ink); color: #f3f1ee; border-radius: 3px; font-size: .9375rem; line-height: 1.55; }
.doc pre code { padding: 0; background: none; font: inherit; font-family: ui-monospace, Consolas, monospace; overflow-wrap: normal; }
.copy {
  position: absolute; right: .5rem; top: .5rem; padding: .25rem .625rem; cursor: pointer;
  font: 500 .75rem "Roboto", sans-serif; color: #f3f1ee;
  background: #2a2b30; border: 1px solid #5d5f66; border-radius: 3px;
}
.copy:hover { background: #3a3b42; }

.doc .shot { margin: .25rem 0 1.5rem; max-width: 48rem; }
.doc .shot img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 3px; background: #202227; }
.doc .shot figcaption { margin-top: .5rem; font-size: .875rem; line-height: 1.45; color: var(--muted); }
.table-wrap { max-width: 48rem; overflow-x: auto; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 3px; }
.doc table { width: 100%; border-collapse: collapse; font-size: .9375rem; line-height: 1.45; }
.doc th, .doc td { padding: .5rem .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.doc thead th { background: var(--tile); color: var(--ink); font-weight: 700; white-space: nowrap; }
.doc tbody tr:last-child td { border-bottom: 0; }

.doc .meta { color: var(--muted); font-size: .875rem; }
.doc .related { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .9375rem; }
.doc .related strong { margin-right: .5rem; }

/* Chapter list on the manual home */
.doc .chapters { list-style: none; padding: 0; display: grid; gap: .75rem; max-width: 48rem; }
@media (min-width: 44rem) { .doc .chapters { grid-template-columns: 1fr 1fr; } }
.doc .chapters li { margin: 0; padding: .875rem 1rem; border: 1px solid var(--line); border-radius: 3px; font-size: .9375rem; line-height: 1.4; }
.doc .chapters a { display: block; font: 700 1.125rem/1.25 "Roboto Condensed", sans-serif; margin-bottom: .125rem; color: var(--ink); text-decoration: none; }
.doc .chapters a:hover { color: #a83e06; text-decoration: underline; }

.toc-inline { display: none; margin-bottom: 1.5rem; padding: .5rem .875rem; background: var(--tile); border-radius: 3px; }
.toc-inline summary { cursor: pointer; font-weight: 500; color: var(--ink); padding-block: .25rem; }
.toc-inline ul { list-style: none; padding: 0; margin: .5rem 0 .25rem; }
.toc-inline li { margin: 0; }
.toc-inline a { display: block; padding: .25rem 0; }
.toc-inline .lv3 a { padding-left: 1rem; }
@media (max-width: 75rem) { .toc-inline { display: block; } }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 2.5rem; max-width: 48rem; }
.doc .pager a { display: block; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); font-weight: 500; text-decoration: none; line-height: 1.3; }
.doc .pager a:hover { border-color: var(--ink); }
.pager span { display: block; font-size: .8125rem; font-weight: 400; color: var(--muted); }
.pager .next { text-align: right; }

/* Legal pages: one column, no chapter list */
.doc.legal { max-width: 53rem; margin-inline: auto; }
.legal-nav { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-bottom: 1.5rem; padding-bottom: .75rem; border-bottom: 1px solid var(--line); font-size: .9375rem; }
.legal-nav a { color: var(--muted); text-decoration: none; }
.legal-nav a:hover, .legal-nav a[aria-current] { color: var(--ink); }
.legal-nav a[aria-current] { font-weight: 500; }
.legal-draft { padding: .75rem 1rem; border-left: 3px solid var(--orange); background: #fff4ec; color: var(--ink); }
.doc blockquote { margin: 1rem 0; padding: .25rem 1rem; border-left: 3px solid var(--line); color: var(--muted); }

.doc-foot { margin-top: 0; padding-block: 1.75rem; }
.doc-foot p { margin: 0; }

/* Narrow screens: chapters open from a button */
@media (max-width: 62rem) {
  .doc-grid { grid-template-columns: minmax(0, 1fr); }
  .doc-ver { display: none; }
  .side-toggle {
    display: block; flex: none; height: 2.25rem; padding-inline: .75rem; cursor: pointer;
    font: 500 .875rem "Roboto", sans-serif; color: var(--ink);
    background: var(--paper); border: 1px solid #b9b9b5; border-radius: 3px;
  }
  .search { flex: 1; }
  .search-key { display: none; }
  .side {
    display: none; position: fixed; z-index: 14; left: 0; right: 0; bottom: 0;
    top: calc(var(--bar) + var(--bar2)); max-height: none;
    background: var(--paper); border-right: 0;
  }
  .side.open { display: block; }
  .side a { padding-block: .625rem; }
  .doc { padding: 1.25rem 1.25rem 2.5rem; }
  .results { width: calc(100vw - 2.5rem); left: auto; right: 0; }
}

@media print {
  .top, .doc-bar, .side, .toc, .toc-inline, .pager, .copy, .anchor, .doc-foot { display: none !important; }
  .doc-grid { display: block; }
  .doc > * { max-width: none; }
}
