/* OpenCarMind colours on top of pydata-sphinx-theme. Brand blue #2F5FD0 and navy #15202D, as on the landing page. */
html[data-theme="light"] {
  --pst-color-primary: #2f5fd0;
  --pst-color-secondary: #a85a00;
  --pst-color-link: #2f5fd0;
  --pst-color-link-hover: #17212e;
  --pst-color-background: #ffffff;
  --pst-color-on-background: #f5f2eb;
  --pst-color-surface: #f5f2eb;
  --pst-color-text-base: #17212e;
  --pst-color-text-muted: #57616f;
  --pst-color-link-higher-contrast: #2a54b8;
  --pst-color-inline-code: #8a3d00;
  --pst-color-table-row-hover-bg: #e3e9f8;
  --pst-color-primary-bg: #e3e9f8;
  --pst-color-target: #fbe3c2;
}
html[data-theme="dark"] {
  --pst-color-primary: #7fa2f0;
  --pst-color-secondary: #f59a2e;
  --pst-color-link: #8fb0f5;
  --pst-color-link-hover: #f2ece1;
  --pst-color-background: #15202d;
  --pst-color-on-background: #1e2b3b;
  --pst-color-surface: #1e2b3b;
  --pst-color-text-base: #f2ece1;
  --pst-color-text-muted: #9da8b8;
  --pst-color-border: #2a3a4e;
  --pst-color-link-higher-contrast: #a9c1f7;
  --pst-color-inline-code: #f5b56a;
  --pst-color-table-row-hover-bg: #26364a;
  --pst-color-primary-bg: #24365a;
  --pst-color-target: #4a3a1e;
}

/* Board captures and renders: screens sit side by side, wide figures fill the column. */
.ocm-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-start; margin: 1rem 0; }
.ocm-row img.ocm-shot { margin: 0; }
img.ocm-shot { max-width: 100%; height: auto; border-radius: 6px; }
img.ocm-figure { width: 100%; height: auto; border-radius: 6px; margin: 0.5rem 0 1rem; }
html[data-theme="light"] img.ocm-figure, html[data-theme="light"] img.ocm-shot { border: 1px solid #c9c1b3; }
p.ocm-caption { font-size: 0.9rem; color: var(--pst-color-text-muted); }

/* Tables: the theme already scrolls a wide table inside the page on a phone. */
.bd-article table td, .bd-article table th { vertical-align: top; }

/* The firmware versions menu in the top bar */
.version-switcher__menu { min-width: 17rem; }
.version-switcher__menu a { white-space: nowrap; }

/* Home page cards */
.ocm-hero { font-size: 1.15rem; line-height: 1.6; }
.sd-card .sd-card-title { font-weight: 600; }
.bd-article h1 { font-weight: 700; }

/* Header comments and protocol listings wrap instead of scrolling sideways. */
div.highlight-text pre { white-space: pre-wrap; }

/* Top bar: keep it on one row from the theme's desktop breakpoint (992px) up.
   The theme lets the header items wrap, which pushed search, versions and the
   icons onto a second row on iPad landscape and small laptops. */
@media (min-width: 992px) {
  .bd-header .navbar-header-items { flex-wrap: nowrap; }
  .bd-header .navbar-header-items__center { min-width: 0; }
  .bd-header .navbar-header-items__center .navbar-nav { flex-wrap: nowrap; }
  .bd-header .navbar-header-items__center .nav-link { white-space: nowrap; }
  .bd-header .navbar-header-items__end { flex-shrink: 0; flex-wrap: nowrap; }
}

/* Under 1280px the search field shrinks to its icon. Ctrl+K still opens it. */
@media (min-width: 992px) and (max-width: 1279.98px) {
  .bd-header .search-button-field { width: 2.4rem; height: 2.4rem; padding: 0; justify-content: center; border-radius: 0.5rem; }
  .bd-header .search-button-field .search-button__default-text,
  .bd-header .search-button-field .search-button__kbd-shortcut { display: none; }
}

/* Between 992px and 1100px the links sit a little closer, so the row never touches the edge. */
@media (min-width: 992px) and (max-width: 1099.98px) {
  .bd-header .navbar-header-items__center ul.navbar-nav > li.nav-item > .nav-link { padding-inline: 0.25rem; }
}

/* The collapse-sidebar control is a quiet button, not an underlined link. */
.bd-sidebar-primary #pst-collapse-sidebar-button { gap: 0.45rem; padding: 0.2rem 0.5rem; border-radius: 0.4rem; color: var(--pst-color-text-muted); font-size: 0.85rem; }
.bd-sidebar-primary #pst-collapse-sidebar-button .pst-icon,
.bd-sidebar-primary #pst-collapse-sidebar-button .pst-collapse-sidebar-label,
.bd-sidebar-primary #pst-collapse-sidebar-button .pst-expand-sidebar-label { color: inherit; text-decoration: none; }
.bd-sidebar-primary #pst-collapse-sidebar-button:hover { color: var(--pst-color-text-base); background-color: var(--pst-color-surface); }
