/* The site's colors, drawn from the Syside brand book: blue #0197cd and
   orange #f78e27, on white and black.

   The theme (pydata-sphinx-theme) paints everything from --pst-color-*
   variables, but defines each as a literal per color theme, and derives
   nothing at runtime: setting --pst-color-primary alone leaves its -bg,
   -highlight and -text companions at the theme's teal, and leaves dark
   mode untouched. So every family a brand color enters is set whole,
   for both themes.

   Neither brand color can be used as-is for text on white: the blue
   measures 3.3:1 and the orange 2.4:1, where text needs 4.5:1 and a
   focus ring or state bar 3:1. Each value below is the brand hue at the
   depth that passes for its use, so the site reads as the brand without
   failing the reader who needs the contrast. On the dark background the
   orange passes as it is (7.5:1) and the blue is lifted one step so it
   also passes on the raised surfaces (4.6:1).

   Roles. Blue is what a reader acts on: links, the current entry's
   text, the primary button, the note admonition. Orange is where the
   reader is: the bar beside the current navbar, sidebar, TOC and tab
   entry (--syside-marker), the focus ring (the theme's accent), and the
   flash where a jump landed (the theme's target). Orange is never text.

   Two homes serve this file: conf.py loads it into the current build,
   and scripts/tasks/normalize_archive.py links every archived version
   to the same copy, so the chrome agrees across versions. */

html[data-theme="light"] {
    --pst-color-primary: #0178a2;
    --pst-color-primary-highlight: #015a7a;
    --pst-color-primary-bg: #d6f4ff;
    --pst-color-primary-text: #fff;
    --pst-color-primary-highlight-text: #fff;

    /* the hover color of every link and navbar item: a step deeper */
    --pst-color-secondary: #015a7a;
    --pst-color-secondary-highlight: #004b66;
    --pst-color-secondary-bg: #d6f4ff;
    --pst-color-secondary-text: #fff;
    --pst-color-secondary-highlight-text: #fff;

    /* focus rings; the orange at the depth a 3px ring needs on white */
    --pst-color-accent: #d86f08;
    --pst-color-accent-bg: #feead8;
    --pst-color-target: #fde0c4;

    --pst-color-link-higher-contrast: #01698e;
    --pst-color-table-row-hover-bg: #d6f4ff;

    /* the note admonition and guilabel chips, from the same blue */
    --pst-color-info: #0178a2;
    --pst-color-info-bg: #e8f7ff;

    /* Inline code is set apart by its face and its surface already;
       the theme's pink on top of them is its accent, not the brand's,
       and on a page of code names it was the loudest color. */
    --pst-color-inline-code: var(--pst-color-text-base);

    --syside-marker: #d86f08;
}

html[data-theme="dark"] {
    --pst-color-primary: #01a4df;
    --pst-color-primary-highlight: #34c9fe;
    --pst-color-primary-bg: #003a4f;
    --pst-color-primary-text: #14181e;
    --pst-color-primary-highlight-text: #14181e;

    --pst-color-secondary: #48cefe;
    --pst-color-secondary-highlight: #71d9fe;
    --pst-color-secondary-bg: #003a4f;
    --pst-color-secondary-text: #14181e;
    --pst-color-secondary-highlight-text: #14181e;

    --pst-color-accent: #f78e27;
    --pst-color-accent-bg: #623304;
    --pst-color-target: #4a2703;

    --pst-color-link-higher-contrast: #34c9fe;
    --pst-color-table-row-hover-bg: #003a4f;

    --pst-color-info: #01a4df;
    --pst-color-info-bg: #003a4f;
    --pst-color-inline-code: var(--pst-color-text-base);

    --syside-marker: #f78e27;
}

/* The theme draws the bar beside a current entry and that entry's text
   from one variable, --pst-color-primary. The bar is what says "you are
   here", and it is orange; the text stays blue like every other link,
   so the same rules are restated with the two roles apart. */
html[data-theme] {
    --syside-current-text: var(--pst-color-primary);
}

.bd-header ul.navbar-nav > li.nav-item.current > .nav-link {
    color: var(--syside-current-text);
}

.bd-header ul.navbar-nav > li.nav-item.current > .nav-link:before {
    border-bottom-color: var(--syside-marker);
}

nav.bd-links .current > a,
.toc-entry a.nav-link.active,
.toc-entry a.nav-link[aria-current="true"],
.version-switcher__menu a.list-group-item.active {
    box-shadow: inset max(3px, 0.1875rem, 0.12em) 0 0 var(--syside-marker);
    color: var(--syside-current-text);
}
