/* RTD-RAX custom color scheme */
:root {
  --primary-color: #1f7a8c;
  --primary-dark-color: #115a68;
  --primary-light-color: #5aacbd;
  --side-nav-background: #d6dfe8;
  --page-background-color: #f0e9db;
  --fragment-background: #f7f2e8;
  --fragment-keyword: #8a2be2;
  --fragment-string: #0a7d57;
}

/* Dark mode overrides */
html.dark-mode {
  --primary-color: #4dc8d9;
  --primary-dark-color: #2eaabd;
  --primary-light-color: #7ae0ec;
  --side-nav-background: #1b1c22;
  --page-background-color: #252628;
  --fragment-background: #20212a;
  --fragment-keyword: #b76ffa;
  --fragment-string: #42d998;
}

@media screen and (min-width: 768px) {
  html {
    --page-font-size: 17.2px;
    --navigation-font-size: 15.8px;
    --toc-font-size: 14.7px;
    --code-font-size: 15.4px;
    --title-font-size: 24px;
    --content-maxwidth: 960px;
  }
}

/* Project name in monospace (texttt style) */
#projectname {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Version number styling */
#projectnumber {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-weight: 400;
  opacity: 0.7;
}

#projectlogo a,
#projectname a {
  color: inherit;
  text-decoration: none;
}

#projectnavlinks {
  margin-top: 0.35rem;
}

.projectnavlink {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--primary-color);
  color: #fff;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.projectnavlink:hover,
.projectnavlink:focus {
  background: var(--primary-dark-color);
  color: #fff;
}

/* Make search bar + dark mode toggle sit side by side in sidebar */
@media screen and (min-width: 768px) {
  /* Flex the parent of MSearchBox so the toggle appears beside it */
  *:has(> #MSearchBox):has(> doxygen-awesome-dark-mode-toggle) {
    display: flex !important;
    align-items: center;
    flex-wrap: nowrap;
    padding: 0 var(--spacing-medium);
  }

  /* Let search box fill remaining space beside the toggle */
  *:has(> doxygen-awesome-dark-mode-toggle) > #MSearchBox {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
  }

  /* Prevent toggle from shrinking */
  *:has(> #MSearchBox) > doxygen-awesome-dark-mode-toggle {
    flex-shrink: 0;
  }
}

/* Shared docs figure treatment. Individual figures can override these defaults below. */
.contents .image:has(img) {
  width: min(100%, 44rem);
  margin: 1rem auto 0.4rem;
  box-sizing: border-box;
  padding: 0.85rem 0.85rem 0.7rem;
  overflow: hidden;
  background: var(--fragment-background);
  border: 1px solid var(--separator-color);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

.contents .image:has(img) img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: none;
}

.contents .image:has(img) .caption {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--separator-color);
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--page-foreground-color);
  font-weight: 600;
}

.contents .image:has(img) + p:has(> em) {
  max-width: min(100%, 44rem);
  margin: 0 auto 1.25rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--page-foreground-color);
  opacity: 0.8;
}

.contents .image:has(img) + p:has(> em) em {
  display: block;
}

.image:has(img[src$="gif_final_screenshot_1.png"]) {
  width: min(100%, 50rem);
}

.image:has(img[src$="gap_compare.gif"]) {
  width: min(100%, 47rem);
}

.image:has(img[src$="angled_animate.gif"]) {
  width: min(100%, 52rem);
}

.image:has(img[src$="angled_animate.gif"]) img {
  width: 112%;
  max-width: none;
  margin-left: -6%;
}

.image:has(img[src$="disturbance_compare.gif"]) {
  width: min(100%, 47rem);
}

.image:has(img[src$="disturbance_compare.gif"]) img {
  aspect-ratio: 3.7 / 1;
  object-fit: cover;
  object-position: center;
}

/* Tone down the RTD-RAX repair GIF and crop its empty border in-place. */
.image:has(img[src$="angled_repair_view.gif"]) {
  width: min(100%, 30rem);
}

.image:has(img[src$="gif_final_screenshot_1.png"]) + p:has(> em) {
  max-width: min(100%, 50rem);
}

.image:has(img[src$="gap_compare.gif"]) + p:has(> em),
.image:has(img[src$="disturbance_compare.gif"]) + p:has(> em) {
  max-width: min(100%, 47rem);
}

.image:has(img[src$="angled_animate.gif"]) + p:has(> em) {
  max-width: min(100%, 52rem);
}

.image:has(img[src$="angled_repair_view.gif"]) + p:has(> em) {
  max-width: min(100%, 30rem);
}

.image:has(img[src$="angled_repair_view.gif"]) img {
  width: 122%;
  max-width: none;
  margin-left: -11%;
}

@media screen and (max-width: 767px) {
  #titlearea table,
  #titlearea tbody,
  #titlearea tr {
    display: block;
    width: 100%;
  }

  #projectlogo,
  #projectalign {
    display: block;
    width: 100%;
    text-align: left;
  }

  #projectlogo {
    padding-bottom: 0.35rem;
  }
}
