/*
 * Dark-mode bridge for the embedded Doxygen (doxygen-awesome) pages.
 *
 * doxysphinx leaves doxygen-awesome's light variables on the global `html {}`
 * selector but scopes its dark block to the impossible selector
 * `.doxygen-content html.dark-mode`, so the C++ API pages always render with the
 * light palette — white boxes on the dark pydata page.
 *
 * pydata marks dark mode with `html[data-theme="dark"]` (explicit) and
 * `html[data-mode="dark"]` (auto-resolved). Re-declaring doxygen-awesome's dark
 * palette under those selectors makes the variable-driven doxygen styles follow
 * the site theme. These variables only affect doxygen-awesome elements, so other
 * pages are unaffected.
 */
html[data-theme="dark"],
html[data-mode="dark"] {
  color-scheme: dark;

  --primary-color: #1982d2;
  --primary-dark-color: #86a9c4;
  --primary-light-color: #4779ac;

  --box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.30);

  --odd-color: rgba(100, 100, 100, 0.06);

  --menu-selected-background: rgba(0, 0, 0, 0.4);

  --page-background-color: #1C1D1F;
  --page-foreground-color: #d2dbde;
  --page-secondary-foreground-color: #859399;
  --separator-color: #38393b;
  --side-nav-background: #252628;

  --code-background: #2a2c2f;

  --tablehead-background: #2a2c2f;

  --blockquote-background: #222325;
  --blockquote-foreground: #7e8c92;

  --warning-color: #3b2e04;
  --warning-color-dark: #f1b602;
  --warning-color-darker: #ceb670;
  --note-color: #163750;
  --note-color-dark: #1982D2;
  --note-color-darker: #dcf0fa;
  --todo-color: #2a2536;
  --todo-color-dark: #7661b3;
  --todo-color-darker: #ae9ed6;
  --deprecated-color: #2e323b;
  --deprecated-color-dark: #738396;
  --deprecated-color-darker: #abb0bd;
  --bug-color: #2e1917;
  --bug-color-dark: #ad2617;
  --bug-color-darker: #f5b1aa;
  --invariant-color: #303a35;
  --invariant-color-dark: #76ce96;
  --invariant-color-darker: #cceed5;

  --fragment-background: #282c34;
  --fragment-foreground: #dbe4eb;
  --fragment-keyword: #cc99cd;
  --fragment-keywordtype: #ab99cd;
  --fragment-keywordflow: #e08000;
  --fragment-token: #7ec699;
  --fragment-comment: #999999;
  --fragment-link: #98c0e3;
  --fragment-preprocessor: #65cabe;
  --fragment-linenumber-color: #cccccc;
  --fragment-linenumber-background: #35393c;
  --fragment-linenumber-border: #1f1f1f;

  --section-code-background: rgba(255, 255, 255, 0.08);
  --section-code-border: rgba(255, 255, 255, 0.18);
}

/*
 * Without the sidebar-only stylesheet the Doxygen project banner (`#titlearea`,
 * the empty "DiFfRG ___" block) shows as a stray left column. Hide it and let
 * the content use the full width.
 */
.doxygen-content #top,
.doxygen-content #titlearea {
  display: none;
}

/* Soften pydata's in-page target highlight (the olive flash on `:target`). */
html[data-theme="dark"] :target,
html[data-mode="dark"] :target {
  background-color: rgba(25, 130, 210, 0.18);
}

/*
 * Footer logo.
 *
 * pydata gives every content image a white backdrop in dark mode
 * (`[data-theme=dark] .bd-content img { background-color: #fff }`) so that the
 * dark line-art class diagrams stay legible. That backdrop looks wrong behind
 * the doxygen.svg footer logo (whose text is already light), so drop it just
 * for the footer logo and let it sit on the dark footer.
 */
html[data-theme="dark"] .doxygen-content img.footer,
html[data-mode="dark"] .doxygen-content img.footer {
  background-color: transparent;
  border-radius: 0;
  padding: 0;
}

/*
 * Class diagrams are Graphviz SVGs (dark lines and text on a transparent
 * background), embedded as <iframe>. In dark mode, invert them and rotate the
 * hue back so the accent colours keep their meaning. `color-scheme: light`
 * matches the iframe's own document; with a mismatch the browser paints an
 * opaque canvas behind it.
 */
html[data-theme="dark"] .doxygen-content .dotgraph iframe,
html[data-theme="dark"] .doxygen-content div.dyncontent iframe,
html[data-theme="dark"] .doxygen-content div.center iframe,
html[data-mode="dark"] .doxygen-content .dotgraph iframe,
html[data-mode="dark"] .doxygen-content div.dyncontent iframe,
html[data-mode="dark"] .doxygen-content div.center iframe {
  filter: invert(1) hue-rotate(180deg) brightness(0.9);
  color-scheme: light;
}

/*
 * Parameter tables: doxygen-awesome makes every table body horizontally
 * scrollable, which also turns on a vertical scrollbar as soon as inline math
 * reaches a few pixels below the row. These tables are short, so let them grow.
 * (!important: the doxygen-awesome selector chains four :not() clauses.)
 */
.doxygen-content dl.params table tbody,
.doxygen-content dl.tparams table tbody,
.doxygen-content dl.retval table tbody,
.doxygen-content dl.exception table tbody {
  overflow: visible !important;
}

/* "Parameters", "Returns", ... headings: doxygen.css hard-codes black, and is loaded after this file. */
.doxygen-content div.memitem div.memdoc dl.params dt,
.doxygen-content div.memitem div.memdoc dl.tparams dt,
.doxygen-content div.memitem div.memdoc dl.retval dt,
.doxygen-content div.memitem div.memdoc dl.exception dt,
.doxygen-content div.memitem div.memdoc dl.return dt,
.doxygen-content div.memitem div.memdoc dl.see dt {
  color: inherit !important;
}

/* Function prototypes: Doxygen puts no space between a parameter's type cell and its name cell. */
.doxygen-content table.memname td.paramtype {
  padding-right: 0.6em;
}
