/* Palette and Material styling adapted from yamaa (MIT):
 * https://github.com/elong0527/yamaa/blob/3e8d5f6b5d2af223fba6aa29fa7209699123f706/docs/stylesheets/extra.css
 * Original copyright and license: LICENSE-yamaa.txt.
 */

:root {
  --yamaa-navy: #1f3a5c;
  --yamaa-navy-deep: #16293f;
  --yamaa-blue: #2d5f8a;
  --yamaa-blue-bright: #3d7cb8;
  --yamaa-blue-light: #78a0c8;
  --yamaa-blue-pale: #eef3f8;
}

/* The palette is declared as `custom` in mkdocs.yml, which leaves every
 * primary and accent variable for this file to define.
 *
 * Material paints the top bar with the primary *foreground* color and the
 * text on it with the primary *background* color, so a white bar is the pair
 * inverted: white behind, ink in front. These are the values Material's own
 * built-in `white` primary uses, which is why the rules further down that
 * re-point the search field and the buttons are the ones Material ships for
 * `white` too. Dark mode takes the bar back to navy. */
[data-md-color-primary="custom"] {
  --md-primary-fg-color: #fff;
  --md-primary-fg-color--light: rgba(255, 255, 255, 0.7);
  --md-primary-fg-color--dark: rgba(0, 0, 0, 0.07);
  --md-primary-bg-color: rgba(0, 0, 0, 0.87);
  --md-primary-bg-color--light: rgba(0, 0, 0, 0.54);
}

[data-md-color-accent="custom"] {
  --md-accent-fg-color: var(--yamaa-blue-bright);
  --md-accent-fg-color--transparent: rgba(61, 124, 184, 0.1);
  --md-accent-bg-color: #fff;
  --md-accent-bg-color--light: rgba(255, 255, 255, 0.7);
}

[data-md-color-scheme="default"] {
  --md-typeset-a-color: var(--yamaa-blue);
}

/* Dark mode keeps the brand hue: a deeper navy bar over the slate page. The
 * bar is dark here, so the foreground/background pair goes back the usual way
 * round -- white text on navy. */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color: var(--yamaa-navy-deep);
  --md-primary-fg-color--light: var(--yamaa-blue);
  --md-primary-fg-color--dark: var(--yamaa-navy-deep);
  --md-primary-bg-color: #fff;
  --md-primary-bg-color--light: rgba(255, 255, 255, 0.7);
  --md-typeset-a-color: #8ab4de;
}

/* A white bar on a white page needs a hairline of its own to read as a bar.
 * Material only draws the header shadow once the page has scrolled. */
[data-md-color-scheme="default"] .md-header {
  border-bottom: 0.05rem solid rgba(0, 0, 0, 0.07);
}

/* Material keys the search field, its icon and the buttons to the primary
 * color on the assumption that the bar is dark. With a white bar they are
 * re-pointed at the ink colors, which is what Material does for `white`. */
@media screen and (min-width: 60em) {
  [data-md-color-scheme="default"] .md-search__form {
    background-color: rgba(0, 0, 0, 0.05);
  }

  [data-md-color-scheme="default"] .md-search__form:hover {
    background-color: rgba(0, 0, 0, 0.1);
  }

  [data-md-color-scheme="default"] .md-search__input + .md-search__icon {
    color: rgba(0, 0, 0, 0.87);
  }
}

[data-md-color-scheme="default"] .md-typeset .md-button {
  color: var(--md-typeset-a-color);
}

[data-md-color-scheme="default"] .md-typeset .md-button--primary {
  background-color: var(--md-typeset-a-color);
  border-color: var(--md-typeset-a-color);
  color: #fff;
}

.md-header__title {
  font-weight: 600;
}

/* Keep wide derivation tables readable without breaking the layout. */
.md-typeset table:not([class]) {
  font-size: 0.85em;
}

/* Keep each study's metrics on one line; narrow screens scroll the table. */
.md-typeset .pilot-metrics {
  overflow-x: auto;
}

.md-typeset .pilot-metrics .md-typeset__scrollwrap {
  margin: 0;
  overflow-x: visible;
}

.md-typeset .pilot-metrics .md-typeset__table {
  display: block;
  margin: 0;
  padding: 0;
}

.md-typeset .pilot-metrics table:not([class]) {
  display: table;
  width: 100%;
}

.md-typeset .pilot-metrics table:not([class]) :is(th, td) {
  min-width: 0;
  padding: 0.6em 0.75em;
  white-space: nowrap;
}

.md-typeset .pilot-metrics table:not([class]) :is(th, td):nth-child(n + 3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
