/* Reduce whitespace in menu */
a.md-nav__link { padding: .1rem .8rem !important; }
li.md-nav__item--section { padding: .1rem !important; }
label.md-nav__link { padding: .1rem .8rem !important; }

/* use like <div markdown="1" class="table-code-nowrap"> ..... </div> */
.table-code-nowrap > div > div > table > tbody > tr > td > code,
.table-code-nowrap > div > div > table > tbody > tr > td > a > code { white-space: nowrap; }

.table-bold-nowrap > div > div > table > tbody > tr > td > strong { white-space: nowrap; }
.table-bold-nowrap > div > div > table > tbody > tr > td > b { white-space: nowrap; }

.table-head-nowrap > div > div > table > thead > tr > th { white-space: nowrap; }

/* keep everything in the first column on one line, e.g. several small images side by side */
.table-first-nowrap > div > div > table > tbody > tr > td:first-child { white-space: nowrap; }

/* start below any floated image, so the contents aren't narrowed. Use like <div markdown="1" class="clear-float"> ..... </div> */
.clear-float { clear: both; }

/* A row of screenshot thumbnails of the same size, cropped from the top left, each with a caption.
   Use like <div class="grid thumbnails" markdown> <figure markdown="span"> ... </figure> ... </div> */
.md-typeset .grid.thumbnails { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.md-typeset .grid.thumbnails figure { width: 100%; margin: 0; }
.md-typeset .grid.thumbnails figure a:has(img) { display: block; width: 100%; }
.md-typeset .grid.thumbnails img { width: 100%; height: 10rem; object-fit: cover; object-position: top left; border: 1px solid var(--md-default-fg-color--lightest); border-radius: 0.2rem; }
.md-typeset .grid.thumbnails figcaption { margin-top: 0.4rem; }
.md-typeset .grid.thumbnails figure > br { display: none; }

/* Narrower minimum card width, so that three cards fit in one row (they still stack on small screens).
   Use like <div class="grid cards three-columns" markdown> ..... </div> */
.md-typeset .grid.cards.three-columns { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.table-less-padding > div > div > table > thead > tr > th { padding: 0.25rem 0.25rem !important; }
.table-less-padding > div > div > table > tbody > tr > td { padding: 0.25rem 0.25rem !important; }

/* Let lists wrap around a floated image, then continue at full width below it. The theme makes
   lists "display: flow-root", which squeezes the whole list into the space beside the image.
   Use like <div markdown="1" class="list-wrap-float"> ..... </div> */
.list-wrap-float ul:not([hidden]),
.list-wrap-float ol:not([hidden]) { display: block; }

/* Wider table of contents (1.5x) on API pages generated by mkdocstrings, whose entries are long
   function names. Only on screens wide enough to show it as a column, not as a pop-up. */
@media screen and (min-width: 60em) {
  .md-main__inner:has(.doc-heading) .md-sidebar--secondary { width: 18.15rem; }
}

/* ---- C++ API docs (mkdocstrings "cxx" handler) ----
   Zensical does not load the CSS that comes with mkdocstrings handlers, so the C++ styles live here. */

/* Badges for the C++ kinds that the theme has no badge for (it already has function, method,
   class, attribute and type). As in the theme: full word in page headings, short form in the
   side menus. Colours reuse the theme's where the kind is similar; groups and macros get their own. */
:root, [data-md-color-scheme="default"] {
  --doc-symbol-group-fg-color: #0a7e8c;
  --doc-symbol-macro-fg-color: #cf222e;
}
[data-md-color-scheme="slate"] {
  --doc-symbol-group-fg-color: #56d4dd;
  --doc-symbol-macro-fg-color: #ff7b72;
}
a code.doc-symbol-group, code.doc-symbol-group { color: var(--doc-symbol-group-fg-color); }
a code.doc-symbol-macro, code.doc-symbol-macro { color: var(--doc-symbol-macro-fg-color); }
a code.doc-symbol-file, code.doc-symbol-file,
a code.doc-symbol-namespace, code.doc-symbol-namespace { color: var(--doc-symbol-module-fg-color); }
a code.doc-symbol-struct, code.doc-symbol-struct,
a code.doc-symbol-union, code.doc-symbol-union,
a code.doc-symbol-enum, code.doc-symbol-enum { color: var(--doc-symbol-class-fg-color); }
a code.doc-symbol-variable, code.doc-symbol-variable { color: var(--doc-symbol-attribute-fg-color); }

.md-content code.doc-symbol-group::after { content: "group"; }
.md-sidebar code.doc-symbol-group::after { content: "grp"; }
.md-content code.doc-symbol-macro::after { content: "macro"; }
.md-sidebar code.doc-symbol-macro::after { content: "mac"; }
.md-content code.doc-symbol-file::after { content: "file"; }
.md-sidebar code.doc-symbol-file::after { content: "file"; }
.md-content code.doc-symbol-namespace::after { content: "namespace"; }
.md-sidebar code.doc-symbol-namespace::after { content: "ns"; }
.md-content code.doc-symbol-struct::after { content: "struct"; }
.md-sidebar code.doc-symbol-struct::after { content: "s"; }
.md-content code.doc-symbol-union::after { content: "union"; }
.md-sidebar code.doc-symbol-union::after { content: "u"; }
.md-content code.doc-symbol-enum::after { content: "enum"; }
.md-sidebar code.doc-symbol-enum::after { content: "e"; }
.md-content code.doc-symbol-variable::after { content: "variable"; }
.md-sidebar code.doc-symbol-variable::after { content: "v"; }

/* Category headings ("Functions", "Macros", ...) are less prominent than entry headings. */
.md-typeset .doc-category-heading { color: var(--md-default-fg-color--light); }

/* "Declared in ..., defined in ..." line. */
.doc-cxx-location { margin-top: .2em; color: var(--md-default-fg-color--light); }

/* ---- end of C++ API docs ---- */

/* make function names larger in API docs */
.doc-function > h4 > code.doc-symbol { font-size: large; }
.doc-function > h4 > code > span:first-of-type { font-size: large; }

/* Built-in web pages reference: each short section has a floated screenshot, so start each
   heading below the previous screenshot. Only that page has a "#pages-in-the-side-menu" heading. */
.md-typeset:has(#pages-in-the-side-menu) :is(h2, h3, h4) { clear: both; }

/* C++ API menu groups: a small label above the first page of each group in the C++ menu.
   The order of the pages is set in the nav of common.yml. A menu entry is found by its link,
   which is "cm.html" or ".../cm.html" in local.yml builds and ".../cm/" in web.yml builds.
   On the page itself, the web build links to "./", so the entry is found by the page's first
   table-of-contents anchor instead.
   Other sections can have pages with the same file names (e.g. features/.../slow_control/mscb.md),
   so the rules only apply in the menu list that also links to cm or odbxx. You can't be on both
   pages at once, so the C++ list always has a real link to at least one of them. */
.md-nav__list:is(:has(> .md-nav__item > a[href="cm.html"]), :has(> .md-nav__item > a[href$="/cm.html"]),
                 :has(> .md-nav__item > a[href$="/cm/"]), :has(> .md-nav__item > a[href="odbxx.html"]),
                 :has(> .md-nav__item > a[href$="/odbxx.html"]), :has(> .md-nav__item > a[href$="/odbxx/"])) > .md-nav__item {
  &:is(:has(> a[href="cm.html"]), :has(> a[href$="/cm.html"]), :has(> a[href$="/cm/"]),
       :has(> nav.md-nav--secondary a[href="#cmfunctionc"]))::before { content: "Core library"; }
  &:is(:has(> a[href="odbxx.html"]), :has(> a[href$="/odbxx.html"]), :has(> a[href$="/odbxx/"]),
       :has(> nav.md-nav--secondary a[href="#using-midasodb"]))::before { content: "Higher-level interfaces"; }
  &:is(:has(> a[href="mscb.html"]), :has(> a[href$="/mscb.html"]), :has(> a[href$="/mscb/"]),
       :has(> nav.md-nav--secondary a[href="#c-interface-midasmscb"]))::before { content: "Other libraries"; }
  &:is(:has(> a[href="definitions.html"]), :has(> a[href$="/definitions.html"]), :has(> a[href$="/definitions/"]),
       :has(> nav.md-nav--secondary a[href="#mdefineh"]))::before { content: "Definitions"; }
}
/* Entries without a label above have no "content", so they don't get a ::before */
.md-nav__list:is(:has(> .md-nav__item > a[href="cm.html"]), :has(> .md-nav__item > a[href$="/cm.html"]),
                 :has(> .md-nav__item > a[href$="/cm/"]), :has(> .md-nav__item > a[href="odbxx.html"]),
                 :has(> .md-nav__item > a[href$="/odbxx.html"]), :has(> .md-nav__item > a[href$="/odbxx/"])) > .md-nav__item::before {
  display: block;
  margin: .9em .8rem .2em;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--md-default-fg-color);
}

/* "Related pages" blocks: use like !!! abstract related "Related pages" */
.admonition.related > p:not(.admonition-title) {
  display: flex;
  flex-wrap: wrap;
  column-gap: 2em;
  row-gap: 0.25em;
}

/* Version menu of the versioned docs (versioned.yml): show the "latest" alias as "2026-08-a (latest release)".
   CSS can't change the text itself, so hide it and show the new text with ::before. "latest" is our only alias. */
.md-version__alias {
  font-size: 0;
}
.md-version__alias::before {
  content: "(latest release)";
  font-size: .8rem;
}
