/* HEBI overrides on top of the default Antora UI.
 *
 * Palette taken from the hebirobotics.com theme (Squarespace colour variables):
 *   slate  #2a3a42  header background and body text
 *   orange #e86d39  accent: headings, links, buttons and decorative lines
 *   #c94c17, #a83f12  darker shades of the orange, used only for hover states
 *   grey   #778687  secondary accent
 *   light  #f2f2f2  light background accent
 * The site's text face (Basic Gothic) is licensed to the Squarespace site only, so headings
 * and UI chrome use Poppins (the site's button face, SIL OFL, self-hosted in ../font) and body
 * text keeps the UI's Roboto.
 */

@font-face {
  font-family: Poppins;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../font/poppins-latin-500.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: Poppins;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../font/poppins-latin-600.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --hebi-slate: #2a3a42;
  --hebi-orange: #e86d39;
  --hebi-orange-text: #c94c17;
  --hebi-orange-dark: #a83f12;
  --hebi-grey: #778687;
  --hebi-light: #f2f2f2;
  --hebi-heading-font: Poppins, Roboto, sans-serif;
}

/* ---- Text and links ---- */

body,
.doc {
  color: var(--hebi-slate);
}

.doc a,
.doc a:visited {
  color: var(--hebi-orange);
}

.doc a:hover {
  color: var(--hebi-orange-dark);
}

::selection {
  background: rgb(232 109 57 / 20%);
}

/* ---- Headings: page title and h3+ in slate, h2 in brand orange as on hebirobotics.com ---- */

.doc h1,
.doc h2,
.doc h3,
.doc h4,
.doc h5,
.doc h6 {
  color: var(--hebi-slate);
  font-family: var(--hebi-heading-font);
  font-weight: 500;
}

.doc h3:not(.discrete),
.doc h4:not(.discrete) {
  font-weight: 600;
}

.doc h2 {
  color: var(--hebi-orange);
}

.doc h2:not(.discrete) {
  border-bottom-color: var(--hebi-light);
}

/* ---- Header bar ---- */

.navbar {
  background: var(--hebi-slate);
}

/* Poppins only for the header's own labels; the search dropdown lives inside .navbar and
   its snippets read better in the body face. */
.hebi-brand-label,
.navbar-end > a.navbar-item {
  font-family: var(--hebi-heading-font);
}

/* Phones: the logo alone, so the brand doesn't wrap under the search box. */
@media screen and (max-width: 768px) {
  .hebi-brand .hebi-brand-label {
    display: none;
  }
}

.navbar-brand > a.hebi-brand {
  align-items: center;
  display: flex;
  gap: 0.75rem;
}

.hebi-brand img {
  display: block;
  height: 2.25rem;
  padding: 0;
  width: auto;
}

.hebi-brand .hebi-brand-label {
  border-left: 1px solid rgb(242 242 242 / 35%);
  color: var(--hebi-light);
  font-size: 1rem;
  font-weight: 500;
  padding-left: 0.75rem;
}

.navbar-end > a.navbar-item {
  font-weight: 500;
}

@media screen and (min-width: 1024px) {
  .navbar-end > a.navbar-item {
    color: var(--hebi-light);
  }

  .navbar-end > a.navbar-item:hover {
    background: none;
    color: var(--hebi-orange);
  }

  .navbar-end > a.navbar-item.hebi-cta {
    align-self: center;
    background: var(--hebi-orange);
    color: #fff;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    margin-left: 0.75rem;
    padding: 0.5rem 1.25rem;
    text-transform: uppercase;
  }

  .navbar-end > a.navbar-item.hebi-cta:hover {
    background: var(--hebi-orange-dark);
    color: #fff;
  }
}

/* ---- Left navigation and "Contents" sidebar ---- */

.nav-item.is-current-page > .nav-link {
  color: var(--hebi-orange);
}

.toc .toc-menu a:hover {
  color: var(--hebi-orange-text);
}

/* Tint plus a wider rail; the inset shadow widens the 2px border without shifting the text.
   No bold: wrapped entries would re-wrap and move the list on every scroll step. */
.toc .toc-menu a.is-active {
  background: rgb(232 109 57 / 10%);
  border-left-color: var(--hebi-orange);
  border-radius: 0 3px 3px 0;
  box-shadow: inset 2px 0 0 var(--hebi-orange);
  color: var(--hebi-orange);
}

/* ---- Search results (search.css from @antora/lunr-extension uses blue) ----
   search-ui.js injects search.css after this file, so these need the extra "body". */

body .search-result-document-hit > a:hover {
  background-color: rgb(232 109 57 / 6%);
}

body .search-result-document-hit .search-result-highlight {
  background: rgb(232 109 57 / 12%);
  color: var(--hebi-orange);
}

/* ---- Admonitions: NOTE was the UI's blue ---- */

.doc .admonitionblock td.icon i.icon-note {
  background-color: var(--hebi-slate);
}

/* ---- Tabs extension ---- */

.doc .tabs .tabpanel > .listingblock:first-child {
  margin-top: 0;
}

.doc .tabs .tablist li {
  font-family: var(--hebi-heading-font);
  font-weight: 500;
}

.doc .tabs:not(.is-loading) .tablist li.is-selected {
  box-shadow: inset 0 3px 0 var(--hebi-orange);
}

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

/* "footer.footer" to beat the UI's own footer.footer rule */
footer.footer {
  background: var(--hebi-slate);
  color: var(--hebi-light);
}

footer.footer a {
  color: var(--hebi-light);
}

footer.footer a:hover {
  color: var(--hebi-orange);
}

/* "Contents" sidebar: below the top level, entries only show for the sections in view
   (js/toc-expand.js). They slide open and closed: display can't be animated, so collapse with max-height
   instead. The open height is set per entry by the script. visibility switches at the
   end of the close so hidden links leave the tab order. */
.toc.sidebar .toc-menu li.is-collapsible {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  visibility: hidden;
  transition: max-height 0.2s ease-out, opacity 0.15s ease-out, visibility 0s linear 0.2s;
}

.toc.sidebar .toc-menu li.is-collapsible.is-expanded {
  opacity: 1;
  visibility: visible;
  transition: max-height 0.2s ease-out, opacity 0.2s ease-in 0.05s, visibility 0s;
}

@media (prefers-reduced-motion: reduce) {
  .toc.sidebar .toc-menu li.is-collapsible,
  .toc.sidebar .toc-menu li.is-collapsible.is-expanded {
    transition: none;
  }
}

.toc.sidebar .toc-menu li.is-current-section > a:not(.is-active) {
  color: var(--hebi-slate);
}

/* ---- Wide screens ----
   The default UI caps the article at 46rem and left-aligns it, so on a large monitor
   everything right of the "Contents" column is empty. From the width where the Contents
   column reaches its full 12rem, allow a wider article (tables and side-by-side images
   need it) and center article + Contents in the space right of the left nav. The
   breadcrumb bar is padded by the same amount so it lines up with the article. */
@media screen and (min-width: 1216px) {
  :root {
    --hebi-doc-max-width: 56rem;
    /* article + its 2rem side margins + the Contents column */
    --hebi-content-max-width: calc(var(--hebi-doc-max-width) + 4rem + 12rem);
  }

  .doc {
    max-width: var(--hebi-doc-max-width);
  }

  main > .content {
    max-width: var(--hebi-content-max-width);
    margin-left: auto;
    margin-right: auto;
  }

  .toolbar {
    padding-left: max(0px, calc((100% - var(--hebi-content-max-width)) / 2));
  }
}
