/* Dimensions brand palette for pydata-sphinx-theme 0.20 / sphinx-book-theme 1.4.
   Set every variant PST derives from primary/secondary (bg, highlight) so admonitions,
   sidebar highlights and buttons do not fall back to the default teal / purple.
   Light mode uses a darker brand blue: #40BBEE on white is ~2.3:1, below WCAG AA. */
html[data-theme="light"] {
  --pst-color-primary: #1a7fa8;
  --pst-color-primary-bg: #e3f4fc;
  --pst-color-primary-highlight: #156a8c;
  --pst-color-secondary: #0d4667;
  --pst-color-secondary-bg: #dde8ef;
  --pst-color-secondary-highlight: #0a3550;
  --pst-color-link-higher-contrast: #0d4667;
}

html[data-theme="dark"] {
  --pst-color-primary: #40bbee;
  --pst-color-primary-bg: #0b2f3f;
  --pst-color-primary-highlight: #6cccf2;
  --pst-color-secondary: #8ad4f5;
  --pst-color-secondary-bg: #12354a;
  --pst-color-secondary-highlight: #b0e2f8;
  --pst-color-link-higher-contrast: #8ad4f5;
}

/* Full width: data-source / field tables are wide. PST caps the page at 88rem
   and the article at 60em. */
.bd-page-width,
.bd-container,
.bd-container .bd-container__inner,
.bd-main .bd-content,
.bd-main .bd-content .bd-article-container {
  max-width: none;
  width: 100%;
}

/* Logo is 320x142. Size by width only and keep the intrinsic ratio. */
.navbar-brand img,
.navbar-brand .logo__image {
  width: 160px;
  max-width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}

/* Reference tables (fields, entities, deprecations) span the article and wrap
   long descriptions instead of scrolling sideways. */
.bd-article .pst-scrollable-table-container > table {
  width: 100%;
}

.bd-article table td {
  white-space: normal;
}

/* Function signatures in functions.rst are long one-liners. */
#functions-syntax pre {
  white-space: pre-wrap;
}

/* `.. exercise::` (docs/_ext/exercise.py), used in the DSL tour. */
.admonition.exercise {
  border-color: var(--pst-color-primary);
}

.admonition.exercise > .admonition-title {
  background-color: var(--pst-color-primary-bg);
}

.admonition.exercise > .admonition-title::after {
  color: var(--pst-color-primary);
  content: var(--pst-icon-pencil);
}

/* Railroad diagrams (language.rst) have a light background; keep them legible
   and scrollable in dark mode and on narrow screens. */
svg.railroad-diagram {
  max-width: 100%;
  height: auto;
}

center:has(> svg.railroad-diagram) {
  overflow-x: auto;
}
