@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600&family=Source+Sans+Pro&display=swap');

body {
  --font-stack: "IBM Plex Serif", serif;
  --font-stack--secondary: "Source Sans Pro", sans-serif;
  --font-stack--monospace: Monaco, "SFMono-Regular", Menlo, Consolas,
    Liberation Mono, Lucida Console, monospace;
  /* --font-stack--headings is derived from --font-stack in stock Furo. */

  --font-size--normal: 100%;
  --font-size--small: 105%;
  --font-size--small--2: 95%;
  --font-size--small--3: 90%;
  --font-size--small--4: 85%;

  /* Admonitions */
  --admonition-font-size: .95rem;
  --admonition-title-font-size: .95rem;
}

body {
  --color-problematic: #b30000;
  --color-heading: #816E62; /* $mid-brown */

  /* Base Colors */
  --color-foreground-primary: #181e22;   /* $dark-charcoal */
  --color-foreground-secondary: #816E62; /* $mid-brown */
  --color-foreground-muted: #9F9793;     /* $grey-brown */
  --color-foreground-border: #8F9799;    /* $light-grey */

  --color-background-primary: #f0f0f0;   /* $white-ish */
  --color-background-secondary: #3D4F5B; /* $dark-blue */
  --color-background-tertiary: #816E62; /* $mid-brown */
  --color-background-hover: #efeff4ff;
  --color-background-border: #C6B2A7;    /* $light-brown */

  /* Brand colors */
  --color-brand-primary: #f0f0f0;   /* $white-ish */
  --color-brand-content: #816E62;  /* $mid-brown */

  --color-highlight-on-target: transparent;

  --color-inline-code-background: #ddd6d2;

  /* Sidebar (left) */
  --color-sidebar-link-text: #f0f0f0;           /* $white-ish */
  --color-sidebar-link-text--hover: #3D4F5B;     /* $dark-blue */
  --color-sidebar-link-text--top-level: #f0f0f0; /* $white-ish */
  --color-sidebar-item-background--hover: #f0f0f0; /* $white-ish (was a gradient) */

  /* Table of Contents (right) */
  --color-toc-item-text: #322620;          /* $dark-brown */
  --color-toc-item-text--active: #C6B2A7;  /* $light-brown */

  /* Links */
  --color-link: #3D4F5B;            /* $dark-blue */
  --color-link--hover: #677E8D;     /* $light-blue */
  --color-link-underline: #677E8D;  /* $light-blue */
  --color-link-underline--hover: #3D4F5B; /* $dark-blue */
  --color-link--visited: var(--color-link);
  --color-link-underline--visited: var(--color-link-underline);
  --color-link--visited--hover: var(--color-link--hover);
  --color-link-underline--visited--hover: var(--color-link-underline--hover);
}

body[data-theme="dark"] {
  --color-heading: #DDD6D2; /* $lighter-grey */
  --color-problematic: #ee5151;

  --color-foreground-primary: #f0f0f0;   /* $white-ish */
  --color-foreground-secondary: #DDD6D2; /* $lighter-grey */
  --color-foreground-muted: #81868d;
  --color-foreground-border: #666666;

  --color-background-primary: #322620;   /* $dark-brown */
  --color-background-secondary: #3D4F5B; /* $dark-blue */
  --color-background-tertiary: green;
  --color-background-hover: #1e2124ff;
  --color-background-border: #f0f0f0;   /* $white-ish */

  --color-highlight-on-target: transparent;

  --color-inline-code-background: #3a3535;

  /* Table of Contents (right) */
  --color-toc-background: var(--color-background-primary);
  --color-toc-title-text: var(--color-foreground-muted);
  --color-toc-item-text: #DDD6D2;         /* $lighter-grey */
  --color-toc-item-text--hover: var(--color-foreground-primary);
  --color-toc-item-text--active: #C6B2A7; /* $light-brown */

  /* Links. */
  --color-link: #8F9799;                 /* $light-grey */
  --color-link--hover: #DDD6D2;          /* $lighter-grey */
  --color-link-underline: #DDD6D2;       /* $lighter-grey */
  --color-link-underline--hover: #8F9799; /* $light-grey */
  --color-link--visited: var(--color-link);
  --color-link-underline--visited: var(--color-link-underline);
  --color-link--visited--hover: var(--color-link--hover);
  --color-link-underline--visited--hover: var(--color-link-underline--hover);
}

@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) {
    --color-heading: #DDD6D2; /* $lighter-grey */
    --color-problematic: #ee5151;

    --color-foreground-primary: #f0f0f0;   /* $white-ish */
    --color-foreground-secondary: #DDD6D2; /* $lighter-grey */
    --color-foreground-muted: #81868d;
    --color-foreground-border: #666666;

    --color-background-primary: #322620;   /* $dark-brown */
    --color-background-secondary: #3D4F5B; /* $dark-blue */
    --color-background-tertiary: green;
    --color-background-hover: #1e2124ff;
    --color-background-border: #f0f0f0;   /* $white-ish */

    --color-highlight-on-target: transparent;

    --color-inline-code-background: #3a3535;

    /* Table of Contents (right) */
    --color-toc-background: var(--color-background-primary);
    --color-toc-title-text: var(--color-foreground-muted);
    --color-toc-item-text: #DDD6D2;         /* $lighter-grey */
    --color-toc-item-text--hover: var(--color-foreground-primary);
    --color-toc-item-text--active: #C6B2A7; /* $light-brown */

    /* Links. */
    --color-link: #8F9799;                 /* $light-grey */
    --color-link--hover: #DDD6D2;          /* $lighter-grey */
    --color-link-underline: #DDD6D2;       /* $lighter-grey */
    --color-link-underline--hover: #8F9799; /* $light-grey */
    --color-link--visited: var(--color-link);
    --color-link-underline--visited: var(--color-link-underline);
    --color-link--visited--hover: var(--color-link--hover);
    --color-link-underline--visited--hover: var(--color-link-underline--hover);
  }
}

/* Default-admonition colour for "abstract".
   Stock Furo uses #651fff; vurt uses #3D4F5B ($dark-blue). */
body {
  --color-admonition-title: #3D4F5B;
  --color-admonition-title-background: rgba(61, 79, 91, .1);
  --icon-admonition-default: var(--icon-abstract);
}

body { font-size: var(--font-size--normal); }

aside { font-family: var(--font-stack--secondary); }

/* --------- headings --------- */

h1, h2, h3, h4, h5, h6 {
  color: var(--color-heading);
  border: none; /* stock Furo sets border-radius: 0.5rem */
}

h1 { font-size: 1.8em; }
h2 { font-size: 1.3em; font-weight: 700; }
h3 { font-size: 1.15em; }
h4 { font-size: 1.05em; }
h5 { font-size: .95em; }
h6 { font-size: .9em; }

/* --------- left and right TOCs --------- */

/* Stock Furo sets `border-right: 1px solid var(--color-sidebar-background-border)`
   on .sidebar-drawer; vurt removes it. */
.sidebar-drawer { border-right: none; min-width: 14rem; width: calc(50% - 26rem); }

.sidebar-container, .toc-drawer { width: 14rem; }

.sidebar-tree .caption, .sidebar-tree :not(.caption) > .caption-text { font-style: italic; }

.sidebar-tree .toctree-l1 > .reference { color: var(--color-sidebar-link-text--top-level); }
.sidebar-tree .toctree-l1 > .reference:hover { color: var(--color-sidebar-item-background); }
.sidebar-tree .reference:hover { color: var(--color-sidebar-link-text--hover); }
.sidebar-tree label:hover { background: var(--color-brand-content); }

.sidebar-tree li.current-page > .reference:hover ~ label .icon { color: var(--color-brand-content); }

.toctree-checkbox ~ label .icon svg { transform: rotate(0deg); }
.toctree-checkbox:checked ~ label .icon svg { transform: rotate(90deg); }

li:not(:first-child) > .toctree-group {border-top: 1px solid white;}

/* --------- asides --------- */

article .sidebar { font-family: var(--font-stack--secondary); font-size: 95%; }

/* --------- widths at different breakpoints --------- */

.main { background-color: var(--color-background-secondary); }

.content {
  background-color: var(--color-background-primary);
  padding: 0 1rem;
  width: 36rem;
}

@media (min-width: 38rem) {
  article .sidebar {
    float: right;
    clear: right;
    width: 50%;
    margin-left: 1rem;
    margin-right: 0;
  }
}

@media (min-width: 52rem) {
  article img.floated {
    width: 50%;
    float: right;
    margin-bottom: 1rem;
    margin-left: 1rem;
  }
}

/* On wide screens, h2 drops into the left aside. */
@media (min-width: 66rem) {
  h2 {
    position: absolute;
    left: 0;
    text-align: right;
    width: 13rem; /* $aside-width */
    margin: -2rem 2rem 0 1rem;
    padding-top: 2rem;
    padding-left: 0;
    padding-right: 0;
  }
  h2 > .headerlink {
    position: absolute;
    top: 0;
    right: 0;
  }
  h2 + p {
    margin-top: 3rem;
  }
}

/* On wide screens, the content gets left padding to make room for the
   left aside (where h2 and article .sidebar live). */
@media (min-width: 66rem) {
  .content {
    padding-left: 15rem; /* $content-padding--for-aside */
    position: relative;
  }
  .content .wider {
    width: 50em;
    max-width: 50em;
    margin-left: 0;
    margin-right: 0;
    left: -14em;
    position: relative;
  }
}

@media (min-width: 66rem) {
  article .sidebar {
    position: absolute;
    left: 0;
    text-align: right;
    width: 13rem; /* $aside-width */
    background-color: transparent;
    border: none;
    padding: 0;
  }
  article .sidebar > * {
    padding-left: 0;
    padding-right: 0;
  }
  article .sidebar > :first-child {
    margin-top: 0;
  }
}

@media (min-width: 94rem) {
  html { font-size: 110%; }
}

@media (max-width: 80rem) {
  .main { background-color: var(--color-background-primary); }
  .toc-content-icon { display: flex; }
  .toc-drawer {
    border-left: 1px solid var(--color-background-muted);
    height: 100vh;
    position: fixed;
    right: -14rem;
    top: 0;
  }
  .toc-tree {
    border-left: none;
    font-size: var(--toc-font-size--mobile);
  }
  .sidebar-drawer { width: calc(50% - 19rem); }
}

@media (max-width: 66rem) {
  .nav-overlay-icon { display: flex; }
  .sidebar-drawer {
    height: 100vh;
    left: -14rem;
    position: fixed;
    top: 0;
    width: 14rem;
  }
  .toc-header-icon { display: flex; }
  .theme-toggle-content, .toc-content-icon { display: none; }
  .theme-toggle-header { display: block; }
  .mobile-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    position: sticky;
    top: 0;
  }
  .mobile-header .header-left, .mobile-header .header-right {
    display: flex;
    height: var(--header-height);
    padding: 0 var(--header-padding);
  }
  .mobile-header .header-left label, .mobile-header .header-right label {
    height: 100%;
    width: 100%;
  }
  :target { scroll-margin-top: calc(.5rem + var(--header-height)); }
  section > span:target { scroll-margin-top: calc(.8rem + var(--header-height)); }
  .back-to-top { top: calc(var(--header-height) + .5rem); }
  .page {
    flex-direction: column;
    justify-content: center;
  }
  .content {
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 38rem) {
  .content {
    overflow-x: auto;
    width: 100%;
  }
}

@media (max-width: 36rem) {
  .content { padding: 0 1rem; }
  article div.sidebar {
    float: none;
    margin: 1rem 0;
    width: 100%;
  }
  .bottom-of-page {
    flex-direction: column-reverse;
    gap: .25rem;
    text-align: center;
  }
}

/* --------- misc --------- */

.back-to-top {
  box-shadow: 0 .2rem .5rem rgba(0, 0, 0, .05), 0 0 1px 0 hsla(220, 9%, 46%, .502);
}

.code-block-caption { border-color: var(--color-background-border); }

article figure, article img { margin-top: 1rem; margin-bottom: 1rem; }

article img.sidebar { margin-top: 0; margin-bottom: 0; }

article figcaption .headerlink { position: absolute; top: 0; right: 0; }

article .caption-text { font-style: italic; color: var(--color-foreground-secondary); }

article .align-left { margin-left: 1rem; margin-right: 1rem; }
article .align-right { margin-left: 1rem; margin-right: 1rem; }
article .align-default { text-align: right; }
article .align-center { text-align: center; }

.field-list dd ul, .field-list dd > p:first-child,
.option-list dd ul, .option-list dd > p:first-child,
dl.footnote dd ul, dl.footnote dd > p:first-child,
dl.glossary dd ul, dl.glossary dd > p:first-child,
dl.simple dd ul, dl.simple dd > p:first-child,
dl:not([class]) dd ul, dl:not([class]) dd > p:first-child {
  margin-top: .125rem;
}

blockquote { background: transparent; font-weight: 300; font-size: 95%; }

blockquote.epigraph, blockquote.pull-quote { padding: 1em 0 1em 3em; font-weight: 600; }

blockquote.epigraph p.attribution, blockquote.pull-quote p.attribution {
  padding-left: 3em;
  font-style: normal;
  font-weight: 300;
}

.sd-card-header, .sd-card-footer a { color: var(--color-brand-primary); }

.related-pages a svg.furo-related-icon,
.related-pages a svg.furo-related-icon > use {
  color: var(--color-foreground-border);
  flex-shrink: 0;
  height: .75rem;
  margin: 0 .5rem;
  width: .75rem;
}

/* --------- tables --------- */

table.docutils { font-family: var(--font-stack--secondary); }

/* --------- links --------- */

.content a { font-weight: 700; }

.headerlink {
  color: var(--color-heading);
  text-decoration: none; /* applies to :hover as well (see note) */
}

/* Stock Furo comments out the `.headerlink { visibility: visible }` rule
   inside :target; vurt re-enables it. */
:target > h1:first-of-type .headerlink,
:target > h2:first-of-type .headerlink,
:target > h3:first-of-type .headerlink,
:target > h4:first-of-type .headerlink,
:target > h5:first-of-type .headerlink,
:target > h6:first-of-type .headerlink,
span:target ~ h1:first-of-type .headerlink,
span:target ~ h2:first-of-type .headerlink,
span:target ~ h3:first-of-type .headerlink,
span:target ~ h4:first-of-type .headerlink,
span:target ~ h5:first-of-type .headerlink,
span:target ~ h6:first-of-type .headerlink {
  visibility: visible;
}
