/*
 * Browserforce documentation theme: the look of the Salesforce Lightning Design System (SLDS), like
 * https://amtrack.github.io/sf-plugin-explorer/ - white header underlined in brand blue, light blue page,
 * content on a white card, system fonts.
 *
 * To change the look, edit the variables below: they are the only colors used. mkdocs.yml declares the palettes
 * (`primary: custom`, `accent: custom`) and `font: false` (system fonts, as SLDS).
 */

:root {
  --bf-brand: #1b96ff;
  --bf-brand-dark: #0176d3;
  --bf-link: #0b5cab;
  --bf-text: #181818;
  --bf-page-bg: #eef4ff;
  --bf-card-bg: #ffffff;
  --bf-active-bg: rgba(21, 137, 238, 0.1);
  --bf-table-header-bg: #f3f3f3;
  --bf-table-header-fg: #444444;
  --bf-border: #e5e5e5;
  --bf-radius: 0.25rem;
}

[data-md-color-scheme="slate"] {
  --bf-link: #78b0fd;
  --bf-text: #f3f3f3;
  --bf-page-bg: #1a1b1e;
  --bf-card-bg: #242629;
  --bf-active-bg: rgba(27, 150, 255, 0.18);
  --bf-table-header-bg: #2e3034;
  --bf-table-header-fg: #c9c9c9;
  --bf-border: #3a3c40;
}

/* Material / Zensical variables mapped to the colors above */
[data-md-color-primary="custom"] {
  --md-primary-fg-color: var(--bf-brand-dark);
  --md-primary-fg-color--light: var(--bf-brand);
  --md-primary-fg-color--dark: var(--bf-brand-dark);
  --md-primary-bg-color: #ffffff;
  --md-primary-bg-color--light: rgba(255, 255, 255, 0.7);
}

[data-md-color-accent="custom"] {
  --md-accent-fg-color: var(--bf-brand);
  --md-accent-fg-color--transparent: var(--bf-active-bg);
  --md-accent-bg-color: #ffffff;
}

[data-md-color-scheme="default"],
[data-md-color-scheme="slate"] {
  --md-default-bg-color: var(--bf-page-bg);
  --md-typeset-a-color: var(--bf-link);
}

[data-md-color-scheme="default"] {
  --md-default-fg-color: var(--bf-text);
}

/* Header: white bar underlined in brand blue, like the SLDS context bar */
.md-header {
  background-color: var(--bf-card-bg);
  color: var(--bf-text);
  border-bottom: 3px solid var(--bf-brand);
  box-shadow: none;
}

.md-header__title {
  font-size: 1.125rem;
}

/* Wider pages on large screens, so tables of fields fit in the card */
.md-grid {
  max-width: 90rem;
}

/*
 * Content on a white card, 12px under the header like the SLDS context bar of SF Plugin Explorer; the navigation and
 * the table of contents start at the same height as the card.
 */
.md-main__inner {
  margin-top: 12px;
}

.md-sidebar {
  padding-top: 0;
}

.md-content__inner {
  background-color: var(--bf-card-bg);
  border-radius: var(--bf-radius);
  padding: 1.25rem 1.5rem 1.5rem;
  margin-top: 0;
}

.md-content__inner::before {
  display: none;
}

/* Navigation: the current page is tinted like the active SLDS tab */
.md-nav__link--active {
  background-color: var(--bf-active-bg);
  border-left: 3px solid var(--bf-brand);
  border-radius: 0 var(--bf-radius) var(--bf-radius) 0;
  color: var(--bf-text);
}

/* Headings with the SLDS sizes */
.md-typeset h1 {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--bf-text);
}

.md-typeset h2 {
  font-size: 1.125rem;
  font-weight: 700;
}

.md-typeset h3 {
  font-size: 1rem;
  font-weight: 700;
}

/* Links are underlined only on hover, as in SLDS */
.md-typeset a {
  text-decoration: none;
}

.md-typeset a:hover,
.md-typeset a:focus {
  text-decoration: underline;
}

/*
 * Tables: sortable (docs/javascripts/tables.js), SLDS header. The theme keeps a table inside the card and scrolls
 * it horizontally when it is too wide: only its look changes here.
 */
.md-typeset table:not([class]) {
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius);
}

/* the card already has padding: the table wrapper does not need its own side margins */
.md-typeset__scrollwrap {
  margin-left: 0;
  margin-right: 0;
}

.md-typeset__table {
  padding-left: 0;
  padding-right: 0;
}

/* code in a table is never cut in the middle of a name: field paths wrap after a dot (<wbr>), values between values */
.md-typeset table:not([class]) code {
  word-break: normal;
  overflow-wrap: normal;
}

.md-typeset table:not([class]) td:first-child code {
  white-space: normal;
}

.md-typeset table:not([class]) td:not(:first-child) code {
  white-space: nowrap;
}

.md-typeset table:not([class]) th {
  background-color: var(--bf-table-header-bg);
  color: var(--bf-table-header-fg);
}

.md-typeset table:not([class]) th,
.md-typeset table:not([class]) td {
  padding: 0.75em 0.8em;
}

/* rows on the card color, tinted on hover like the active SLDS item */
.md-typeset table:not([class]) tr,
.md-typeset table:not([class]) td {
  background-color: var(--bf-card-bg);
}

.md-typeset table:not([class]) tbody tr:hover td {
  background-color: var(--bf-active-bg);
}

/* Screenshots of the Salesforce Setup pages */
.md-typeset img {
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius);
}

/* Badges of the home page stay inline and without a frame */
.md-typeset a > img[src*="badge"],
.md-typeset a > img[src*="shields.io"] {
  border: none;
  border-radius: 0;
}
