/*
 * Brass on stone: the look of Beffroi, on top of Material for MkDocs.
 *
 * Everything the eye reads first is a token of the two blocks below, light then dark. Change the brass,
 * the stone or the radius there and the whole site follows; no colour is written anywhere else.
 *
 * Two rules this file exists to keep:
 *   - the brass that carries text is darker than the brass that draws a border, because a 3:1 colour is
 *     fine under a line and unreadable in a sentence;
 *   - --md-primary-fg-color is never painted with the colour of the header, the theme deriving the colour
 *     of a link in the text from it. The header is painted by its own rules, further down.
 */

:root {
  --bf-brass: #8a6316;
  --bf-brass-strong: #6d4d0e;
  --bf-brass-bright: #c08a2e;
  --bf-brass-soft: rgba(192, 138, 46, 0.12);
  --bf-on-brass: #ffffff;

  --bf-fg: #1a1d21;
  --bf-fg-muted: #5c6269;
  --bf-fg-faint: #878d94;
  --bf-bg: #ffffff;
  --bf-bg-soft: #f5f4f1;
  --bf-border: #e4e3dd;
  --bf-border-strong: #d2d1c9;

  /* The header is the same slate in both schemes: it is the one band that never changes. */
  --bf-slate: #22262b;
  --bf-slate-fg: #eceae5;
  --bf-slate-muted: #9ba1a8;
  --bf-slate-line: rgba(236, 234, 229, 0.14);
  --bf-slate-fill: rgba(236, 234, 229, 0.07);

  --bf-radius: 8px;
  --bf-radius-sm: 6px;
  --bf-sidebar-width: 15.5rem;
  --bf-content-width: 46rem;

  --bf-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
}

[data-md-color-scheme="slate"] {
  --bf-brass: #e2b55a;
  --bf-brass-strong: #f0cd84;
  --bf-brass-bright: #e2b55a;
  --bf-brass-soft: rgba(226, 181, 90, 0.14);
  --bf-on-brass: #1a1d21;

  --bf-fg: #e8e6e1;
  --bf-fg-muted: #a2a5a1;
  --bf-fg-faint: #80837f;
  --bf-bg: #16181b;
  --bf-bg-soft: #1e2125;
  --bf-border: #2c3035;
  --bf-border-strong: #3b4047;
}

[data-md-color-scheme="default"],
[data-md-color-scheme="slate"] {
  --md-default-fg-color: var(--bf-fg);
  --md-default-fg-color--light: var(--bf-fg-muted);
  --md-default-fg-color--lighter: var(--bf-fg-faint);
  --md-default-bg-color: var(--bf-bg);
  --md-primary-fg-color: var(--bf-brass);
  --md-primary-bg-color: #ffffff;
  --md-primary-bg-color--light: rgba(255, 255, 255, 0.7);
  --md-accent-fg-color: var(--bf-brass-strong);
  --md-typeset-a-color: var(--bf-brass);
  --md-code-bg-color: var(--bf-bg-soft);
  --md-footer-bg-color: var(--bf-bg);
  --md-footer-fg-color: var(--bf-fg);
  --md-footer-fg-color--light: var(--bf-fg-muted);
  --md-footer-fg-color--lighter: var(--bf-fg-faint);
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------------------------------------------------------------- Header */

.md-header,
.md-header--shadow {
  background-color: var(--bf-slate);
  color: var(--bf-slate-fg);
  box-shadow: none;
}

.md-header__title {
  font-family: var(--bf-serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-left: 0.4rem;
}

.md-header__button,
.md-header__topic,
.md-header__option,
.md-header__source {
  color: var(--bf-slate-fg);
}

.md-header__source {
  color: var(--bf-slate-muted);
}

/* The bell is the one brass thing in the band. */
.md-header__button.md-logo :is(img, svg) {
  color: var(--bf-brass-bright);
  height: 1.4rem;
  width: 1.4rem;
}

.md-search__form {
  background-color: var(--bf-slate-fill);
  border: 1px solid var(--bf-slate-line);
  border-radius: var(--bf-radius);
  box-shadow: none;
  height: 2rem;
}

.md-search__form:hover {
  background-color: var(--bf-slate-fill);
  border-color: var(--bf-brass-bright);
}

.md-search__input,
.md-search__icon,
.md-search__options .md-icon {
  color: var(--bf-slate-fg);
}

.md-search__input::placeholder {
  color: var(--bf-slate-muted);
}

[data-md-toggle="search"]:checked ~ .md-header .md-search__form {
  background-color: var(--bf-slate-fill);
  border-radius: var(--bf-radius) var(--bf-radius) 0 0;
}

.md-search__output {
  border-radius: 0 0 var(--bf-radius) var(--bf-radius);
}

.md-search-result__meta {
  color: var(--bf-fg-muted);
  font-size: 0.65rem;
}

/* The version, a pill in the band. */
.md-version__current {
  border: 1px solid var(--bf-slate-line);
  border-radius: 999px;
  color: var(--bf-slate-muted);
  font-size: 0.68rem;
  margin: 0 0 0 0.6rem;
  padding: 0.05rem 0.55rem;
}

.md-version__current:hover {
  border-color: var(--bf-brass-bright);
  color: var(--bf-slate-fg);
}

.md-version__list {
  border-radius: var(--bf-radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

/* The drawer of a narrow screen carries the same band. */
.md-nav--primary > .md-nav__title,
.md-nav--primary > .md-nav__title .md-nav__button {
  background-color: var(--bf-slate);
  color: var(--bf-slate-fg);
}

/* ---------------------------------------------------------------- Sidebars */

.md-nav {
  font-size: 0.72rem;
  line-height: 1.5;
}

.md-sidebar--primary {
  border-right: 1px solid var(--bf-border);
}

@media screen and (min-width: 76.25em) {
  .md-sidebar--primary {
    width: var(--bf-sidebar-width);
  }
  .md-sidebar--secondary {
    width: 12rem;
  }
}

/* A section title: small, spaced, quiet, under a short brass rule. */
.md-nav--primary .md-nav__item--section > .md-nav__link {
  color: var(--bf-fg-faint);
  cursor: default;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
  margin-top: 1.3rem;
  padding-bottom: 0.1rem;
  position: relative;
  text-transform: uppercase;
}

.md-nav--primary .md-nav__item--section > .md-nav__link::before {
  background-color: var(--bf-brass-bright);
  content: "";
  height: 2px;
  left: 0.5rem;
  position: absolute;
  top: -0.45rem;
  width: 1.1rem;
}

/* A section whose title is also a page nests a link inside the title, which would indent it twice. */
.md-nav--primary .md-nav__item--section > .md-nav__container > a.md-nav__link {
  padding-left: 0;
}

.md-nav--primary .md-nav__item--section > .md-nav__link--active,
.md-nav--primary .md-nav__item--section > .md-nav__container > .md-nav__link--active {
  background-color: transparent;
  color: var(--bf-brass);
}

.md-nav__item .md-nav__link {
  border-radius: var(--bf-radius-sm);
  color: var(--bf-fg-muted);
  margin: 0.05rem 0;
  padding: 0.28rem 0.5rem;
  transition: background-color 120ms, color 120ms;
}

.md-nav__item .md-nav__link:hover {
  background-color: var(--bf-bg-soft);
  color: var(--bf-fg);
}

.md-nav__link--active,
.md-nav__item .md-nav__link--active:hover {
  background-color: var(--bf-brass-soft);
  color: var(--bf-brass);
  font-weight: 500;
}

.md-nav--primary .md-nav__title {
  box-shadow: none;
  font-size: 0.75rem;
  font-weight: 600;
}

@media screen and (min-width: 76.25em) {
  .md-nav--primary > .md-nav__title {
    display: none;
  }
  .md-nav--primary > .md-nav__list {
    padding-top: 0.6rem;
  }
}

/* "On this page", on the right. */
.md-nav--secondary .md-nav__title {
  background: transparent;
  box-shadow: none;
  color: var(--bf-fg-faint);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.md-nav--secondary .md-nav__list {
  border-left: 1px solid var(--bf-border);
  margin-left: 0.6rem;
  padding-left: 0.2rem;
}

.md-nav--secondary .md-nav__link {
  padding-left: 0.5rem;
}

/* A section that is a page and a parent at once holds three elements that are all .md-nav__link: the
   container, the link and the label carrying the chevron. Only the link is painted. */
.md-nav__container,
.md-nav__container > label.md-nav__link,
.md-nav__container > label.md-nav__link:hover {
  background-color: transparent;
  margin: 0;
  padding: 0;
}

.md-nav__container > a.md-nav__link {
  flex: 1;
}

/* The pencil a stub carries, from the "status" metadata; the theme has no icon for a status of our own
   and falls back to an information circle, which says the opposite of what a stub is. */
:root {
  --md-status--draft: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75z"/></svg>');
}

.md-status--draft::after {
  -webkit-mask-image: var(--md-status--draft);
  mask-image: var(--md-status--draft);
}

.md-status::after {
  opacity: 0.5;
}

/* ---------------------------------------------------------------- Content */

.md-content {
  padding-bottom: 2rem;
}

@media screen and (min-width: 60em) {
  .md-content__inner {
    margin-left: auto;
    margin-right: auto;
    max-width: var(--bf-content-width);
  }
}

.md-typeset {
  color: var(--bf-fg);
  font-size: 0.8rem;
  line-height: 1.72;
}

/* The serif is the voice of the thing: titles only, never a paragraph, never a label. */
.md-typeset h1,
.md-typeset h2 {
  color: var(--bf-fg);
  font-family: var(--bf-serif);
  font-weight: 600;
}

.md-typeset h1 {
  font-size: 2.1rem;
  letter-spacing: -0.012em;
  line-height: 1.2;
  margin-bottom: 0.9rem;
}

.md-typeset h2 {
  border-top: 1px solid var(--bf-border);
  font-size: 1.45rem;
  letter-spacing: -0.008em;
  line-height: 1.3;
  margin-top: 2.6rem;
  padding-top: 1.7rem;
}

.md-typeset h3 {
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.004em;
  margin-top: 1.7rem;
}

.md-typeset h4 {
  font-size: 0.88rem;
  font-weight: 650;
  margin-top: 1.2rem;
}

.md-typeset a {
  text-decoration-color: var(--bf-brass-soft);
  text-underline-offset: 0.18em;
}

.md-typeset a:hover {
  text-decoration-color: currentcolor;
}

.md-typeset hr {
  border-bottom-color: var(--bf-border);
}

.md-typeset blockquote {
  border-left: 3px solid var(--bf-brass-bright);
  color: var(--bf-fg-muted);
}

.md-source-file,
.md-typeset .md-source-file__fact {
  color: var(--bf-fg-faint);
  font-size: 0.64rem;
}

/* ---------------------------------------------------------------- Code */

.md-typeset code {
  background-color: var(--bf-bg-soft);
  border: 1px solid var(--bf-border);
  border-radius: 4px;
  font-size: 0.84em;
  padding: 0.05em 0.33em;
}

.md-typeset pre > code {
  border: 0;
  padding: 0.77rem 1rem;
}

/* A code span that is a link reads as a link; the theme would paint it with the colours of the header. */
.md-typeset a code {
  background-color: var(--bf-brass-soft);
  border-color: transparent;
  color: var(--bf-brass);
}

.md-typeset a:hover code {
  background-color: var(--bf-brass-soft);
  color: var(--bf-brass-strong);
}

.md-typeset .highlight,
.md-typeset .highlighttable {
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius);
  overflow: hidden;
}

.md-typeset pre {
  margin: 0;
}

.md-typeset .highlight > pre > code,
.md-typeset .highlighttable code {
  font-size: 0.72rem;
  line-height: 1.65;
}

/* The filename of a block, the tab above the code, marked with the brass. */
.md-typeset .highlight span.filename {
  background-color: var(--bf-bg-soft);
  border-bottom: 1px solid var(--bf-border);
  box-shadow: inset 2px 0 0 var(--bf-brass-bright);
  color: var(--bf-fg-muted);
  font-family: var(--md-code-font-family);
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
}

.md-clipboard {
  color: var(--bf-fg-faint);
}

.md-clipboard:hover {
  color: var(--bf-brass);
}

.md-typeset .tabbed-set > input:checked + label {
  border-color: var(--bf-brass-bright);
  color: var(--bf-brass);
}

.md-typeset .tabbed-labels > label {
  font-size: 0.7rem;
  font-weight: 500;
}

/* ---------------------------------------------------------------- Hints */

.md-typeset .admonition,
.md-typeset details {
  border: 1px solid var(--bf-border);
  border-left-width: 3px;
  border-radius: var(--bf-radius);
  box-shadow: none;
  font-size: 0.76rem;
  padding: 0.1rem 0.75rem;
}

.md-typeset .admonition-title,
.md-typeset summary {
  background-color: transparent !important;
  border: 0;
  border-radius: 0;
  font-weight: 650;
  margin: 0.55rem 0 0.1rem;
  padding: 0 0 0 1.5rem;
}

.md-typeset .admonition-title::before,
.md-typeset summary::before {
  left: 0;
  top: 0.18rem;
}

.md-typeset .admonition > :last-child,
.md-typeset details > :last-child {
  margin-bottom: 0.6rem;
}

/* What tells something is painted with the brass; what warns is kept well away from it. */
.md-typeset .admonition:is(.note, .abstract, .info, .tip),
.md-typeset details:is(.note, .abstract, .info, .tip) {
  background-color: var(--bf-brass-soft);
  border-color: var(--bf-border);
  border-left-color: var(--bf-brass-bright);
}

.md-typeset .admonition:is(.note, .abstract, .info, .tip) > .admonition-title::before,
.md-typeset details:is(.note, .abstract, .info, .tip) > summary::before {
  background-color: var(--bf-brass);
}

.md-typeset .admonition:is(.warning, .caution),
.md-typeset details:is(.warning, .caution) {
  background-color: rgba(194, 65, 12, 0.08);
  border-color: var(--bf-border);
  border-left-color: #c2410c;
}

.md-typeset .admonition:is(.warning, .caution) > .admonition-title::before,
.md-typeset details:is(.warning, .caution) > summary::before {
  background-color: #c2410c;
}

.md-typeset .admonition:is(.danger, .failure, .bug),
.md-typeset details:is(.danger, .failure, .bug) {
  background-color: rgba(179, 38, 30, 0.08);
  border-color: var(--bf-border);
  border-left-color: #b3261e;
}

.md-typeset .admonition:is(.danger, .failure, .bug) > .admonition-title::before,
.md-typeset details:is(.danger, .failure, .bug) > summary::before {
  background-color: #b3261e;
}

.md-typeset .admonition:is(.success, .check),
.md-typeset details:is(.success, .check) {
  background-color: rgba(22, 101, 52, 0.08);
  border-color: var(--bf-border);
  border-left-color: #166534;
}

.md-typeset .admonition:is(.success, .check) > .admonition-title::before,
.md-typeset details:is(.success, .check) > summary::before {
  background-color: #166534;
}

/* ---------------------------------------------------------------- Tables */

.md-typeset table:not([class]) {
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius);
  box-shadow: none;
  display: table;
  font-size: 0.72rem;
  width: 100%;
}

.md-typeset table:not([class]) th {
  background-color: var(--bf-bg-soft);
  border-bottom: 2px solid var(--bf-brass-bright);
  color: var(--bf-fg);
  font-weight: 650;
}

/* A column is as wide as the token it holds: the theme breaks a code span anywhere it fits, which cuts
   "Domain" in two when the column is narrow. */
.md-typeset table:not([class]) code {
  word-break: normal;
}

.md-typeset table:not([class]) :is(th, td) {
  border-bottom: 1px solid var(--bf-border);
  padding: 0.55rem 0.8rem;
}

.md-typeset table:not([class]) tr:last-child td {
  border-bottom: 0;
}

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

/* ---------------------------------------------------------------- Buttons and footer */

.md-typeset .md-button {
  border-radius: var(--bf-radius-sm);
  border-width: 1px;
  font-size: 0.75rem;
  font-weight: 550;
  padding: 0.45rem 1rem;
}

.md-typeset .md-button--primary,
.md-typeset .md-button--primary:hover {
  background-color: var(--bf-brass);
  border-color: var(--bf-brass);
  color: var(--bf-on-brass);
}

.md-typeset .md-button--primary:hover {
  background-color: var(--bf-brass-strong);
  border-color: var(--bf-brass-strong);
}

.md-typeset .md-button:not(.md-button--primary) {
  border-color: var(--bf-border-strong);
  color: var(--bf-fg);
}

.md-typeset .md-button:not(.md-button--primary):hover {
  background-color: var(--bf-bg-soft);
  border-color: var(--bf-brass-bright);
  color: var(--bf-fg);
}

.md-footer {
  border-top: 1px solid var(--bf-border);
}

.md-footer__inner {
  display: flex;
  gap: 0.6rem;
  margin: 1rem auto;
  max-width: var(--bf-content-width);
  padding: 0;
}

.md-footer__link {
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius);
  flex: 1;
  margin: 0;
  opacity: 1;
  padding: 0.6rem 0.8rem;
  transition: border-color 120ms;
}

.md-footer__link:hover {
  border-color: var(--bf-brass-bright);
}

.md-footer__direction {
  color: var(--bf-fg-faint);
  font-size: 0.62rem;
}

.md-footer__title {
  font-size: 0.78rem;
  font-weight: 500;
}

.md-footer-meta {
  --md-footer-fg-color: var(--bf-slate-fg);
  --md-footer-fg-color--light: var(--bf-slate-muted);
  --md-footer-fg-color--lighter: var(--bf-slate-muted);

  background-color: var(--bf-slate);
  border-top: 2px solid var(--bf-brass-bright);
}

.md-footer-meta .md-footer-meta__inner {
  max-width: none;
}

.md-copyright,
.md-copyright__highlight,
.md-footer-meta a,
.md-social__link {
  color: var(--bf-slate-muted);
  font-size: 0.62rem;
}

.md-footer-meta a:hover,
.md-social__link:hover {
  color: var(--bf-brass-bright);
}

/* ---------------------------------------------------------------- The landing page */

.bf-hero {
  border-bottom: 1px solid var(--bf-border);
  margin-bottom: 2rem;
  padding: 0.5rem 0 2rem;
}

.md-typeset .bf-hero__eyebrow {
  color: var(--bf-brass);
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
}

.md-typeset .bf-hero h1 {
  font-size: 3rem;
  letter-spacing: -0.022em;
  line-height: 1.05;
  margin-bottom: 0.7rem;
}

.md-typeset .bf-hero__tagline {
  color: var(--bf-fg-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.4rem;
  max-width: 34rem;
}

.md-typeset .bf-hero .md-button + .md-button {
  margin-left: 0.4rem;
}

/* Cards, with the brass showing on the one the pointer is over. */
.md-typeset .grid.cards > :is(ul, ol) > li,
.md-typeset .grid > .card {
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius);
  box-shadow: none;
  padding: 0.9rem;
  transition: border-color 120ms, box-shadow 120ms;
}

.md-typeset .grid.cards > :is(ul, ol) > li:hover {
  border-color: var(--bf-brass-bright);
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.05);
}

.md-typeset .grid.cards > :is(ul, ol) > li > hr {
  margin: 0.6rem 0;
}

.md-typeset .grid.cards > :is(ul, ol) > li > :is(p, hr):first-child {
  margin-top: 0;
}

.md-typeset .grid.cards .twemoji,
.md-typeset .grid.cards .lg {
  color: var(--bf-brass-bright);
}

.md-typeset .grid.cards > :is(ul, ol) > li > p > strong {
  font-family: var(--bf-serif);
  font-size: 0.95rem;
  font-weight: 600;
}
