/* The C reference (tools/c_reference.py writes the pages). It sits on the book's book.css,
   which gives it the four themes, the sidebar, the top bar and the page; this is what's its own:
   the tree of modules and functions down the left, the filter, and how a function is shown. */
:root, [data-theme="light"], [data-theme="paper"] { --fn: #8a5a14; --mod: #2c5fa8; --ty: #8a2f6d; }
[data-theme="night"], [data-theme="navy"] { --fn: #e8b85c; --mod: #8db4f0; --ty: #e59ccc; }

.ref #sidebar { font-size: 0.9rem; padding-top: 14px; }
.ref .book-home { margin-bottom: 12px; }

/* the filter */
.filter { position: sticky; top: -14px; padding: 2px 0 10px; background: var(--side-bg); z-index: 2; }
#filter {
  width: 100%; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--side-line);
  border-radius: 8px; padding: 7px 10px;
}
#found { list-style: none; margin: 0; padding: 0; }
#found li a { display: block; padding: 5px 8px; border-radius: 6px; color: var(--side-fg); }
#found li a:hover, #found li a.first { background: var(--side-line); text-decoration: none; }
#found .nm { font-family: "Source Code Pro", ui-monospace, Menlo, Consolas, monospace; color: var(--fn); font-weight: 600; }
#found .in { display: block; font-size: 0.8rem; opacity: 0.7; }
#found .none { padding: 6px 8px; opacity: 0.7; }

/* the tree: parts, their modules, their functions */
.ref #sidebar ul { list-style: none; margin: 0; padding: 0; }
.ref #sidebar .all { margin: 0 0 6px; }
.ref #sidebar .all a { color: var(--side-fg); padding: 4px 6px; display: block; border-radius: 6px; }
.part { margin: 0 0 6px; }
.part h3 { font-size: 0.95rem; margin: 12px 0 4px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.part h3 a { color: var(--side-fg); padding: 2px 6px; border-radius: 6px; }
.hdr { font-size: 0.78em; color: var(--dim); font-weight: 400; background: none !important; padding: 0 !important; }
.mods > li { margin: 0; }
.mods details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 4px; padding: 2px 6px 2px 2px; border-radius: 6px; }
.mods details > summary::-webkit-details-marker { display: none; }
.mods details > summary::before {
  content: ""; flex: none; width: 14px; height: 14px; margin: 0 2px;
  background: currentColor; opacity: 0.45;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m9 5 7 7-7 7' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m9 5 7 7-7 7' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.15s;
}
.mods details[open] > summary::before { transform: rotate(90deg); }
.mods summary a, .mods .note a { color: var(--side-fg); flex: 1; padding: 2px 0; }
.mods .note a { display: block; padding: 4px 6px 4px 22px; opacity: 0.8; font-style: italic; }
.mods .count { font-size: 0.75rem; opacity: 0.5; }
.fns { margin: 0 0 6px 15px !important; border-left: 2px solid var(--side-line); }
.fns a {
  display: block; padding: 2px 10px; margin-left: -2px; border-left: 3px solid transparent; color: var(--side-fg);
  font-family: "Source Code Pro", ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; opacity: 0.85;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ref #sidebar a:hover { color: var(--side-here); text-decoration: none; opacity: 1; }
.ref #sidebar a.here { color: var(--side-here); font-weight: 700; opacity: 1; }
.fns a.here { border-left-color: var(--side-here); }

/* the page */
.crumbs { font-size: 0.85rem; color: var(--dim); margin: 6px 0 0; }
.crumbs a { color: var(--dim); }
.crumbs .sep { opacity: 0.5; margin: 0 2px; }
.title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap;
         border-bottom: 1px solid var(--line); margin: 0 0 1.2em; }
.title h1 { font-size: 2rem; margin: 0.3em 0 0.4em; font-weight: 400; }
.title h1 .fn, .title h1 .mod { font-weight: 700; }
.title .hdr { font-size: 0.9rem; }
.fn, a.fn { color: var(--fn); font-family: "Source Code Pro", ui-monospace, Menlo, Consolas, monospace; }
.title h1 .fn { font-size: 0.95em; }
.mod, a.mod { color: var(--mod); }
a.fn, a.mod { font-weight: 600; }
main h2 { font-size: 1.35rem; margin: 1.6em 0 0.5em; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
main h2 a { color: inherit; }
main h2 .hdr, main h2 .muted { font-size: 0.8rem; font-weight: 400; margin-left: 6px; }

pre.decl { font-size: 1rem; line-height: 1.6; margin-bottom: 1.4em; }
pre.decl .fname { color: var(--fn); font-weight: 700; }
pre.decl .k { color: var(--ty); font-weight: 400; }

/* lists of things and what each is: rustdoc's two columns */
dl.items { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: 0 22px; margin: 0 0 1.4em; }
dl.items dt, dl.items dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--line); }
dl.items dt { white-space: nowrap; }
dl.items dd { color: var(--fg); font-size: 0.95rem; line-height: 1.5; }
dl.items dd p { margin: 0; }

/* parameters */
dl.params { margin: 0 0 1.4em; }
dl.params dt { margin: 14px 0 2px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
dl.params dd { margin: 0 0 0 18px; }
.pname { font-weight: 700; font-size: 0.95em !important; }
.ptype { color: var(--ty); background: none !important; padding: 0 !important; font-size: 0.85em; }
main h2 .ptype { font-size: 0.8em; margin-left: 4px; }
.none { color: var(--dim); }
.also { margin-top: 2.4em; padding-top: 1em; border-top: 1px solid var(--line); color: var(--dim); font-size: 0.92rem; }
a.fnlink { text-decoration: none; }
a.fnlink code { color: var(--fn); }
a.fnlink:hover code { text-decoration: underline; }

@media (max-width: 900px) {
  dl.items { grid-template-columns: 1fr; }
  dl.items dt { border-bottom: 0; padding-bottom: 0; }
  dl.items dd { padding-top: 2px; }
  .title h1 { font-size: 1.6rem; }
  pre.decl { font-size: 0.85rem; }
}
@media print {
  .filter, #found { display: none !important; }
}
