/* CSS3_ style sheet for the output of Docutils HTML writers.              */
/* Generic responsive design for all screen sizes.                         */
/*                                                                         */
/* :Author: Günter Milde                                                   */
/*                                                                         */
/* :Id: $Id$                                                               */
/* :Copyright: © 2021 Günter Milde.                                        */
/* :License: Released under the terms of the `2-Clause BSD license`_,      */
/*    in short:                                                            */
/*                                                                         */
/*    Copying and distribution of this file, with or without modification, */
/*    are permitted in any medium without royalty provided the copyright   */
/*    notice and this notice are preserved.                                */
/*                                                                         */
/*    This file is offered as-is, without any warranty.                    */
/*                                                                         */
/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause     */
/* .. _CSS3: http://www.w3.org/TR/CSS3                                     */


/* General Settings */
/* ================ */


* { box-sizing: border-box; }

body {
  background-color: #fafaf6;
  margin: auto;
  --field-indent: 6.6em; /* indent of fields in field lists */
  --sidebar-margin-right: 0; /* adapted in media queries below */
}
main {
  counter-reset: figure table;
}
body > * {
  background-color: white;
  line-height: 1.6;
  padding: 0.5rem calc(29% - 7.2rem); /* go from 5% to 15% (8.15em/54em) */
  margin: auto;
  max-width: 100rem;
}

/* Vertical Space (Parskip) */
p, ol, ul, dl, li,
div.line-block,
div.topic,
table {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}
h1, h2, h3, h4, h5, h6,
dl > dd {
  margin-bottom: 0.5em;
}
blockquote > table,
div.topic > table {
  margin-top: 0;
  margin-bottom: 0;
}

/* Indented Blocks */
blockquote, figure, div.topic {
  margin: 1em 2%;
  padding-left: 1em;
}
div.line-block div.line-block,
pre, dd, dl.option-list {
  margin-left: calc(2% + 1em);
}

/* Object styling */
/* ============== */

footer, header,
.sidebar, .marginal {
  font-size: small;
}

/* Frontmatter */
div.topic.dedication {
  padding: 0;
  margin: 1.4em 0;
  font-style: italic;
  font-size: large;
}
.dedication p.topic-title {
  display: none;
}

blockquote p.attribution,
div.topic p.attribution {
  text-align: right;
}

/* Table of Contents */
nav.contents,
div.topic.contents {
  padding: 0;
}
ul.auto-toc > li > p {
  padding-left: 1em;
  text-indent: -1em;
}
nav.contents ul,
div.topic.contents ul {
  padding-left: 1em;
}
main > div.topic.contents  ul:not(.auto-toc) {
  list-style-type: square;
}
main > div.topic.contents  ul ul:not(.auto-toc) {
  list-style-type: disc;
}
main > div.topic.contents  ul ul ul:not(.auto-toc) {
  list-style-type: '\2023\ ';
}
main > div.topic.contents  ul ul ul ul:not(.auto-toc) {
  list-style-type: '\2B29\ ';
}
main > div.topic.contents  ul ul ul ul ul:not(.auto-toc) {
  list-style-type: '\00B7\ ';
}
div.topic.contents ul > li::marker {
  color: grey;
}


/* Transitions */
hr {
  margin: 1em 10%;
}

/* Lists */

ul, ol {
  padding-left: 1.1em; /* indent by bullet width (Firefox, DejaVu fonts) */
}
dl.field-list > dd,
dl.docinfo > dd {
  margin-left: var(--field-indent); /* adapted in media queries or HTML */
}
dl.option-list > dd {
  margin-left: 20%;
}
/* run-in: start field-body on same line after long field names */
dl.field-list.run-in > dd p {
  display: block;
}
/* "description style" like in most dictionaries, encyclopedias etc. */
dl.description > dt {
  clear: left;
  float: left;
  margin: 0;
  padding: 0;
  padding-right: 0.5em;
  font-weight: bold;
}
dl.description > dd:after {
  display: block;
  content: "";
  clear: both;
}
/* start lists nested in description/field lists on new line */
dd > dl:first-child,
dd > ul:first-child,
dd > ol:first-child {
    clear: left;
}

/* Footnotes and Citations */
/* TODO: use <aside> */
dl.footnote {
  font-size: small;
  padding-left: 0.5em;
  border-left: solid;
  border-left-width: thin;
}
dt.label > span.fn-backref {
}

/* Images, Figures, and Tables */
img {
  display: block;
}
p > img, p > a > img,
figure > img, figure > a > img {
  display: inline;
}

figcaption,
table > caption {
  /*   font-size: small; */
  font-style: italic;
}
figcaption > .legend {
  font-size: small;
  font-style: initial;
}
figure.numbered > figcaption > p:before {
  counter-increment: figure;
  content: "Figure " counter(figure) ": ";
  font-weight: bold;
  font-style: initial;
}

table tr {
  text-align: left;
  vertical-align: baseline;
}
table.booktabs { /* "booktabs" style (no vertical lines) */
  border-top: 2px solid;
  border-bottom: 2px solid;
}
table.booktabs * {
  border: 0;
}
table.booktabs th {
  border-bottom: thin solid;
}
table.numbered > caption:before {
  counter-increment: table;
  content: "Table " counter(table) ": ";
  font-weight: bold;
  font-style: initial;
}

/* Admonitions and System Messages */
.admonition,
div.system-message {
  border: thin solid silver;
  margin: 1em 2%;
  padding: 0.5em 1em;
}
.caution p.admonition-title,
.attention p.admonition-title,
.danger p.admonition-title,
.warning p.admonition-title,
div.error {
  color: maroon;
}
div.system-message > p > span.literal {
  overflow-wrap: break-word;
}

/* Literal and Code */
/* basic highlighting: for a complete scheme, see */
/* http://docutils.sourceforge.net/sandbox/stylesheets/ */
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}

/* Hyperlink References */
a {
  text-decoration: none;
  /* text-decoration-skip-ink: auto; !!nonstandard, default in modern browsers */
}
/* Wrap links at any place, if this is the only way to prevent overflow */
a:link{
  overflow-wrap: break-word;
}
.contents a, a.toc-backref, a.citation-reference {
  overflow-wrap: inherit;
}
/* Undecorated Links */
/* a.footnote-reference, a.fn-backref, .fn-backref a, */
/* a.citation-reference, */
.citation a.fn-backref,
.contents a, a.toc-backref {
  color: inherit;
}
a:link:hover {
  text-decoration: underline;}
/* highlight the active ToC entry */
.topic.contents :target {
  background-color: #d2e6ec;
}

/* Block Alignment */
/* Let content flow to the side of aligned images and figures */

/* no floats around this elements */
dl.footnote, dl.citation, /* errors with internal floats */
footer, header, hr,
h1, h2, h3 {
  clear: both;
}

img.align-left,
video.align-left,
figure.align-left,
table.align-left {
  margin-left: 0;
  padding-left: 0;
  margin-right: 0.5em;
  clear: left;
  float: left;
}
img.align-right,
video.align-right,
figure.align-right,
table.align-right {
  margin-left: 0.5em;
  margin-right: 0;
  clear: right;
  float: right;
}

/* Margin Elements */
/* see below for screen size dependent rules */
.sidebar,
.marginal,
.admonition.marginal {
  max-width: 40%;
  border: none;
  background-color: #efefea;
  margin: 0.5em var(--sidebar-margin-right) 0.5em 1em;
  padding: 0.5em;
  clear: right;
  float: right;
}
.sidebar {
  width: 40%;
}

/* Adaptive page layout */
/* ==================== */

@media (max-width: 30em) {
  /* Smaller margins and no floating elements for small screens */
  /* (main text less than 40 characters/line) */
  body > * {
    padding: 0.5rem 5%;
    line-height: 1.4
  }
  .sidebar,
  .marginal,
  .admonition.marginal {
    width: auto;
    max-width: 100%;
    float: none;
  }
  dl.option-list,
  pre {
    margin-left: 0;
  }
  body {
    --field-indent: 4em;
  }
  dl.field-list.narrow, dl.docinfo, dl.option-list {
    --field-indent: 2.4em;
  }
  pre, pre * {
  font-size: 0.9em;
  /* overflow: auto; */
  }
}

@media (min-width: 54em) {
  /* Move ToC to the left */
  /* Main text width before: 70% ≙ 35em ≙ 75…95 chrs (Dejavu/Times) */
  /*                  after:      ≳ 30em ≙ 54…70 chrs (Dejavu/Times) */
  body.with-toc {
    padding-left: 8%;
  }
  body.with-toc > * {
    margin-left: 0;
    padding-left: 22rem; /* fallback for webkit */
    padding-left: min(22%, 22rem);
    padding-right: 7%;
  }
  main > div.topic.contents { /* exclude local ToCs */
    position: fixed;
    top: 0;
    left: 0;
    width: min(25%, 25em);
    height: 100vh;
    margin: 0;
    background-color: #fafaf6;
    padding: 1em 2% 0 2%;
    overflow: auto;
  }
  main > div.topic.contents > * {
    padding-left: 0;
  }
}

@media (min-width: 70em) {
  body {
    --field-indent: 9em;
  }
}

@media (min-width: 77em) {
  /* Move marginalia to 6rem from right border       */
  /* .sidebar,                                       */
  /* .marginal,                                      */
  /* .admonition.marginal {                          */
  /*   margin-right: calc(6rem - 15%);               */
  /* }                                               */
  /* BUG: margin is calculated for break point width */
  /* workaround: variable + many breakpoints         */
  body > * {
    padding-left: 18%;
    padding-right: 28%; /* fallback for webkit */
    padding-right: min(28%, 28rem);
    --sidebar-margin-right: -20rem;
  }
  /* limit main text to ~ 50em ≙ 85…100 characters DejaVu rsp. …120 Times */
  body.with-toc > * {
    padding-left: min(22%, 22rem);
    padding-right: calc(78% - 50rem); /* fallback for webkit */
    padding-right: min(78% - 50rem, 28rem);
    --sidebar-margin-right: 0;
  }
}

@media (min-width: 85em) {
  body.with-toc > * {
    --sidebar-margin-right: -9rem;
  }
}

@media (min-width: 90em) {
  /* move marginalia into the margin */
  body > * {
    padding-left: min(22%, 22rem);
    --sidebar-margin-right: -23rem;
  }
  body.with-toc > * {
    --sidebar-margin-right: -14rem;
  }
}

@media (min-width: 99em) {
  /* move marginalia out of main text area */
  body.with-toc > * {
    --sidebar-margin-right: -20rem;
  }
  body > *, body.with-toc > * { /* for webkit */
    padding-left: 22rem;
    padding-right: 28rem;
  }
  .admonition.marginal,
  .marginal {
    width: 40%; /* make marginal figures, ... "full width" */
  }
}

@media (min-width: 104em) {
  body.with-toc > * {
    --sidebar-margin-right: -23rem;
  }
}
