/* SpeedCrunch website, on every page: the colors and fonts the whole site
   shares, the top bar (templates navbar.html, globaltoc.html and
   navbarsearchbox.html; behavior in site-nav.js) and the footer (in
   layout.html). Most pages also load Bootstrap and Sphinx's basic.css (the
   home page does not), so the bar and footer set their own font, colors and
   sizes instead of inheriting them from the page. Each link color also covers
   :visited, which basic.css otherwise turns purple. */

:root {
  --ink: #17141f;
  --ink-2: #4b4759;
  --muted: #6f6a7e;
  --paper: #ffffff;
  --paper-2: #f6f5fa;
  --line: #e6e3ee;
  --night: #15121e;
  --night-2: #1d1929;
  --night-ink: #eceaf4;
  --night-muted: #a7a2b8;
  --night-line: rgba(255, 255, 255, 0.09);
  --accent: #7c6cff;
  --accent-ink: #5a49e6;    /* the accent on light backgrounds (links) */
  --accent-light: #b5abff;  /* the accent on dark backgrounds */
  /* The darkest top bar (home page, dark mode): #171421 made 20%, 20%, 30%
     and 30% darker (0.8 x 0.8 x 0.7 x 0.7 = 31.36% of it), about #07060a. */
  --night-bar: color-mix(in srgb, #171421 31.36%, #000);
  --site-bar: #171421;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

:root[data-theme="dark"], .site-home {
  --site-bar: var(--night-bar);
}

/* Under the footer of a short page, and when scrolling past either end. */
html { background-color: var(--night); }

/* ---------------------------------------------------------------- Top bar */

.site-nav {
  position: sticky; top: 0; z-index: 50;
  font-family: var(--font);
  font-size: 16px; line-height: 1.55; text-align: left;
  -webkit-font-smoothing: antialiased;
  background: var(--site-bar);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--night-line);
}
/* On the home page the bar lies over the dark hero, which shows through. */
.site-nav-over-hero { background: color-mix(in srgb, var(--site-bar) 78%, transparent); }

.site-nav *, .site-nav *::before, .site-nav *::after { box-sizing: border-box; }
.site-nav a, .site-nav a:hover, .site-nav a:focus { text-decoration: none; }
.site-nav :focus { outline: none; }
.site-nav :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.site-nav-inner { position: relative; display: flex; align-items: center; gap: 24px; height: 60px; width: min(1200px, 100% - 32px); margin-inline: auto; }

.site-brand { display: flex; align-items: center; gap: 10px; flex: none; color: #fff; font-weight: 650; font-size: 17px; }
.site-brand:visited, .site-brand:hover, .site-brand:focus { color: #fff; }
.site-brand img { display: block; width: 32px; height: 32px; border-radius: 8px; }
.site-version { font-size: 12px; font-weight: 600; color: var(--night-muted); border: 1px solid var(--night-line); border-radius: 999px; padding: 1px 8px; }

.site-menu { display: flex; align-items: center; gap: 24px; min-width: 0; margin-left: auto; }
.site-nav-links { display: flex; align-items: center; gap: 4px; }
.site-nav-links > a, .site-chapters-toggle {
  display: block; margin: 0; padding: 6px 12px; border: 0; border-radius: 8px;
  font: inherit; font-size: 15px; white-space: nowrap;
  color: var(--night-ink); opacity: 0.82; background: none; cursor: pointer;
}
.site-nav-links > a:visited, .site-nav-links > a:hover, .site-nav-links > a:focus, .site-chapters-toggle:hover { color: var(--night-ink); }
.site-nav-links > a:hover, .site-chapters-toggle:hover, .site-chapters-toggle[aria-expanded="true"] { opacity: 1; background: rgba(255, 255, 255, 0.07); }
.site-nav-links > a[aria-current="page"], .site-chapters-toggle.site-current { opacity: 1; color: #fff; }

/* The manual's chapters, in a menu under "User Manual". */
.site-chapters { position: relative; }
.site-chapters-toggle .fa-angle-down { margin-left: 5px; font-size: 13px; transition: transform 0.2s; }
.site-chapters-toggle[aria-expanded="true"] .fa-angle-down { transform: rotate(180deg); }
.site-chapters-menu {
  display: none; position: absolute; top: calc(100% + 12px); left: 0;
  width: 330px; max-height: calc(100vh - 90px); overflow-y: auto;
  padding: 8px; background: var(--night-2);
  border: 1px solid var(--night-line); border-radius: 12px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
}
.site-chapters-toggle[aria-expanded="true"] + .site-chapters-menu { display: block; }
.site-chapters-menu ul { list-style: none; margin: 0; padding: 0; }
.site-chapters-menu a, .site-chapters-menu a:visited { display: block; padding: 6px 10px; border-radius: 7px; font-size: 14.5px; line-height: 1.35; color: var(--night-ink); }
.site-chapters-menu a:hover, .site-chapters-menu a:focus { color: #fff; background: rgba(255, 255, 255, 0.07); }
.site-chapters-menu .toctree-l2 > a { padding-left: 22px; font-size: 13.5px; color: var(--night-muted); }
.site-chapters-menu .toctree-l2 > a:hover, .site-chapters-menu .toctree-l2 > a:focus { color: #fff; }
.site-chapters-menu li.current > a, .site-chapters-menu a.current { color: var(--accent-light); }
.site-chapters-menu .site-chapters-all, .site-chapters-menu .toctree-l1 { border-bottom: 1px solid var(--night-line); padding-bottom: 4px; margin-bottom: 4px; }
.site-chapters-menu .toctree-l1:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.site-chapters-menu .site-chapters-all { font-weight: 600; }

/* Search field for the manual. */
.site-search { position: relative; flex: 0 1 200px; min-width: 120px; margin: 0; }
.site-search .fa-magnifying-glass { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--night-muted); pointer-events: none; }
.site-search input {
  display: block; width: 100%; height: 34px; margin: 0; padding: 0 10px 0 32px;
  font: inherit; font-size: 14px; line-height: normal; color: var(--night-ink);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--night-line); border-radius: 8px;
  box-shadow: none; -webkit-appearance: none; appearance: none;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.site-search input::placeholder { color: var(--night-muted); opacity: 1; }
.site-search input:focus { outline: none; border-color: rgba(181, 171, 255, 0.6); background: rgba(255, 255, 255, 0.09); box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.25); }

/* Light, dark or system mode (not on the home page): the current setting. */
.site-theme-toggle {
  order: 1; display: grid; place-items: center; flex: none;
  width: 36px; height: 34px; margin: 0 0 0 -8px; padding: 0;
  font-size: 16px; color: var(--night-ink); opacity: 0.82;
  background: none; border: 1px solid var(--night-line); border-radius: 8px; cursor: pointer;
}
.site-theme-toggle:hover { opacity: 1; background: rgba(255, 255, 255, 0.07); }
.site-theme-toggle i { display: none; }
[data-theme-choice="light"] .site-theme-toggle .fa-sun,
[data-theme-choice="dark"] .site-theme-toggle .fa-moon,
[data-theme-choice="system"] .site-theme-toggle .fa-desktop { display: block; }

/* Narrow windows: the links (and the search field) open from a menu button. */
.site-menu-toggle {
  display: none; place-items: center; flex: none; width: 40px; height: 36px; margin: 0 0 0 auto; padding: 0;
  font-size: 18px; color: var(--night-ink); background: none; border: 1px solid var(--night-line); border-radius: 8px; cursor: pointer;
}
.site-menu-toggle:hover, .site-menu-toggle[aria-expanded="true"] { background: rgba(255, 255, 255, 0.07); }
.site-menu-toggle[aria-expanded="false"] .fa-xmark,
.site-menu-toggle[aria-expanded="true"] .fa-bars { display: none; }

@media (max-width: 860px) {
  .site-menu-toggle { display: grid; }
  /* The mode toggle stays in the bar, just before the menu button. */
  .site-theme-toggle { order: 0; width: 40px; height: 36px; margin-left: auto; }
  .site-theme-toggle + .site-menu-toggle { margin-left: -14px; }
  .site-menu {
    display: none; position: absolute; top: 100%; left: -16px; right: -16px;
    flex-direction: column; align-items: stretch; gap: 12px;
    max-height: calc(100vh - 61px); overflow-y: auto;
    padding: 12px 16px 18px; background: var(--night); border-bottom: 1px solid var(--night-line);
    box-shadow: 0 24px 40px -20px rgba(0, 0, 0, 0.6);
  }
  .site-menu-toggle[aria-expanded="true"] + .site-menu { display: flex; }
  .site-nav-links { flex-direction: column; align-items: stretch; gap: 2px; }
  .site-nav-links > a, .site-chapters-toggle { width: 100%; padding: 10px 12px; text-align: left; }
  .site-chapters-menu { position: static; width: auto; max-height: none; margin: 4px 0 6px; box-shadow: none; }
  .site-search { order: -1; flex: none; }
  .site-search input { height: 40px; font-size: 16px; }
}

/* On the darkest bar (home page, dark mode) its menus take the bar's color. */
.site-nav-over-hero .site-chapters-menu,
[data-theme="dark"] .site-chapters-menu { background: var(--night-bar); }
@media (max-width: 860px) {
  .site-nav-over-hero .site-menu,
  [data-theme="dark"] .site-menu { background: var(--night-bar); }
}

/* ----------------------------------------------------------------- Footer */

/* It keeps the "footer" class: the theme's sidebar code reads its height. */
.site-footer {
  width: auto; margin: 0; padding: 0;
  font-family: var(--font); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  color: var(--night-muted); background: var(--site-bar);
  border-top: 1px solid var(--night-line);
}
.site-footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; width: min(1200px, 100% - 32px); margin-inline: auto; padding: 22px 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }
.site-footer a, .site-footer a:visited { color: var(--night-muted); text-decoration: none; }
.site-footer a:hover, .site-footer a:focus { color: var(--night-ink); text-decoration: underline; }
.site-footer :focus { outline: none; }
.site-footer :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
