/* The look shared by prospicio's three docs sites: this R site (pkgdown),
   the Python site (python/docs-site.css) and the landing page
   (xtask/site/index.html). The tokens below are repeated in each of those
   files; change all three together. pkgdown loads this file after
   Bootstrap. The face, ground, ink and accent are also given to bslib in
   _pkgdown.yml so that Bootstrap's own components start from them. */

:root,
html[data-bs-theme="light"] {
  --p-font: "Jost", "Segoe UI", system-ui, sans-serif;
  --p-bg: #eef0f3;
  --p-surface: #e2e5ea;
  --p-ink: #0b0c0e;
  --p-muted: #4f5662;
  --p-accent: #1f2de6;
  --p-accent-ink: #ffffff;
  --p-rule: #d3d7de;
  --bs-body-color-rgb: 11, 12, 14;
  --bs-emphasis-color-rgb: 11, 12, 14;
}

html[data-bs-theme="dark"] {
  --p-bg: #101216;
  --p-surface: #1b1e24;
  --p-ink: #e9ebef;
  --p-muted: #a6acb7;
  --p-accent: #8f97ff;
  --p-accent-ink: #0b0c0e;
  --p-rule: #2c3038;
  --bs-body-color-rgb: 233, 235, 239;
  --bs-emphasis-color-rgb: 233, 235, 239;
}

[data-bs-theme] {
  --bs-body-font-family: var(--p-font);
  --bs-body-bg: var(--p-bg);
  --bs-body-color: var(--p-ink);
  --bs-emphasis-color: var(--p-ink);
  --bs-secondary-color: var(--p-muted);
  --bs-link-color: var(--p-accent);
  --bs-link-hover-color: var(--p-ink);
  --bs-border-color: var(--p-rule);
  --bs-tertiary-bg: var(--p-surface);
}

html[data-bs-theme="light"] [data-bs-theme], html[data-bs-theme="light"] { --bs-link-color-rgb: 31, 45, 230; }
html[data-bs-theme="dark"] [data-bs-theme], html[data-bs-theme="dark"] { --bs-link-color-rgb: 143, 151, 255; }

body {
  background-color: var(--p-bg);
  color: var(--p-ink);
  font-family: var(--p-font);
  font-size: 1.0625rem;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--p-ink);
  font-family: var(--p-font);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.page-header h1, h1.title {
  font-weight: 700;
  letter-spacing: -0.03em;
}

a {
  color: var(--p-accent);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--p-ink);
}

/* The bar: the page's ground, the wordmark plain, as on the Python site. */
.navbar,
.navbar.bg-light,
.navbar.bg-body-tertiary,
.navbar[data-bs-theme] {
  background-color: var(--p-bg) !important;
  box-shadow: none;
  border-bottom: 0;
}

.navbar .navbar-brand {
  color: var(--p-ink);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.navbar .nav-link {
  color: var(--p-ink);
}

.navbar .nav-link.active,
.navbar .nav-item.active > .nav-link {
  color: var(--p-accent);
}

.navbar .form-control,
.navbar input[type="search"] {
  background-color: var(--p-surface);
  border-color: transparent;
  border-radius: 0;
  color: var(--p-ink);
}

/* Code on a tone step instead of a border. */
pre,
[data-bs-theme] pre,
[data-bs-theme] :not(pre) > code,
div.sourceCode,
pre.sourceCode {
  background-color: var(--p-surface);
  border: 0;
  border-radius: 0;
}

code {
  color: var(--p-ink);
}

/* The footer: no rule, the muted ink. */
footer {
  border-top: 0;
  color: var(--p-muted);
}

/* Tables wrap to the text column; one whose cells cannot wrap still
   scrolls inside its own box rather than widening the page. */
.section table,
main table,
.contents table {
  width: 100%;
  --bs-table-bg: transparent;
  --bs-table-color: var(--p-ink);
  --bs-table-border-color: var(--p-rule);
}

main .table-responsive {
  overflow-x: auto;
}

main table td, main table th {
  vertical-align: top;
}

/* The open menu's link: the accent, no box behind it. */
.navbar .nav-link.show,
.navbar .dropdown-toggle.show,
.navbar .nav-link:focus:not(:focus-visible) {
  background-color: transparent;
}

.dropdown-menu {
  --bs-dropdown-bg: var(--p-bg);
  --bs-dropdown-link-color: var(--p-ink);
  --bs-dropdown-link-hover-bg: var(--p-surface);
  --bs-dropdown-link-active-bg: var(--p-accent);
  --bs-dropdown-link-active-color: var(--p-accent-ink);
  border-radius: 0;
}

/* The current page: the accent and an underline in the bar, a rule in the
   page's contents, as on the Python site; no grey pills. */
.navbar .nav-item.active > .nav-link,
.navbar .nav-link.active {
  background: transparent !important;
  color: var(--p-accent);
  text-decoration: underline 2px var(--p-accent);
  text-underline-offset: 0.4em;
}

.navbar .nav-link {
  font-weight: 500;
}

nav#toc .nav-link {
  border-left: 2px solid transparent;
  border-radius: 0;
  color: var(--p-muted);
}

nav#toc .nav-link.active {
  background: none !important;
  color: var(--p-accent);
  border-left-color: var(--p-accent);
}

/* Figures and tables of the guides that run on the site
   (docs/guides/site/figures.R). The figures are inline SVG whose colours
   are these variables, so they follow the mode. The series are the Python
   site's three hues (python/docs-site.css), checked for colour-vision
   separation on each ground; a figure uses at most three. */
:root,
html[data-bs-theme="light"] {
  --p-series-1: #1f2de6;
  --p-series-2: #eb6834;
  --p-series-3: #1baf7a;
}

html[data-bs-theme="dark"] {
  --p-series-1: #7a83ff;
  --p-series-2: #d95926;
  --p-series-3: #199e70;
}

figure.p-figure {
  margin: 1.25rem 0 1.75rem;
}

figure.p-figure svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* gt writes its own colours on the table; the page's win. */
.gt_table,
.gt_table th,
.gt_table td,
.gt_heading,
.gt_title,
.gt_subtitle,
.gt_col_headings,
.gt_col_heading,
.gt_column_spanner,
.gt_table_body,
.gt_row,
.gt_sourcenotes,
.gt_sourcenote,
.gt_footnotes,
.gt_footnote,
.gt_stub,
.gt_group_heading {
  background-color: transparent !important;
  color: var(--p-ink) !important;
  border-color: var(--p-rule) !important;
  font-family: var(--p-font) !important;
}

.gt_col_heading,
.gt_subtitle,
.gt_sourcenote {
  color: var(--p-muted) !important;
}
