/* A wrapper for styling the markup generated by MarkupRenderer. */

sdoc-autogen {
  /*
    TODO: 'display: contents;'
    Turn this back on when the bug is fixed:
    Selenium cannot detect text inside a container
    with the 'display: contents;' directive
  */
  /* display: contents; */

  /* hyphens: auto; */

  --autogen-v-rhythm: calc(var(--base-rhythm, 8px) * 2);
}

sdoc-autogen a,
sdoc-autogen a:link,
sdoc-autogen a:visited {
  text-decoration: underline;
}

/* Table */

sdoc-autogen table {
  border-collapse: collapse;
  margin: var(--base-padding) 0;
  font-size: 1rem;

  /*** add scroll for wide tables */
  /* issue#1370 https://css-tricks.com/preventing-a-grid-blowout/ */
  /* border: 1px solid #ccc; */
  border: none;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

sdoc-autogen table caption {
  font-weight: bold;
  padding-bottom: 1rem;
}

sdoc-autogen table th {
  background-color: var(--color-bg-main);
}

sdoc-autogen table th,
sdoc-autogen table td {
  padding: var(--base-rhythm) calc(var(--base-rhythm) * 1.5);
  vertical-align: top;
  text-align: left;
  border: 1px solid #ccc;

  /* issue#1370 https://css-tricks.com/preventing-a-grid-blowout/ */
  /*** add scroll for wide tables (unset) */
  white-space: initial;
}

/* Typography */

sdoc-autogen p {
  margin: var(--autogen-v-rhythm) 0;
}

/* blockquote */

sdoc-autogen blockquote {
  color: #666;
  padding: .25em 0 0.25em 1rem;
  border-left: 4px solid #ccc;
  margin: var(--autogen-v-rhythm) 0;
}

/* pre.code */

sdoc-autogen pre.code {
  font-family: var(--code-font-family);

  font-size: var(--code-font-size);
  line-height: 2;
  margin:   var(--code-font-size) 0;
  padding:  calc(var(--code-font-size)*1)
            calc(var(--code-font-size)*1)
            calc(var(--code-font-size)*1)
            calc(var(--code-font-size)*2);

  overflow: auto;
  background-color: var(--color-bg-main);
  border: 1px solid var(--color-border);
}

/*  We have to override this for the print version because the printer
    interprets scroll-bars differently in different environments,
    which breaks HTML2PDF.
    Also, we need to show the whole code in its entirety.
 */
[html2pdf] sdoc-autogen pre.code {
  overflow: unset;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* ``some text`` is generated into: <tt class="docutils literal"> by docutils. */
sdoc-autogen tt.literal {
  position: relative;
  padding: 0 4px;
  font-style: normal;
  font-family: var(--code-font-family);
  font-size: var(--code-font-size);
  background-color: var(--color-bg-main);
  border: 1px solid var(--color-border);
  border-radius: 4px;

  overflow-wrap: break-word;
  word-wrap: break-word;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ul */

sdoc-autogen ul,
sdoc-autogen ol {
  padding-left: 1.6em;
  margin: var(--autogen-v-rhythm) 0;
}

/* list in table */
sdoc-autogen td ul,
sdoc-autogen dt ol {
  margin: 0;
  padding-left: 1em;
}

/* object */

sdoc-autogen img,
sdoc-autogen object {
  width: 100%;
  padding: 1em;
  background: var(--color-bg-contrast);
}

/*
  **************************
  automatically added by RST
  **************************
*/

div.document {
  /* alarm style for detecting unwrapped blocks */
  border: 1px dashed red;
}

sdoc-autogen div.document {
  display: contents;
  border: none;
}

/* block margins */

sdoc-autogen .document > *:first-child, /* RST */
sdoc-autogen > *:first-child {
  margin-top: 0 !important;
}

sdoc-autogen .document > *:last-child, /* RST */
sdoc-autogen > *:last-child {
  margin-bottom: 0 !important;
}

/* admonition by RST */
/* "attention", "caution", "danger", "error", "hint", "important", "note", "tip", "warning" */

sdoc-autogen .admonition {
  display: block;
  overflow: hidden;
  padding: 0 var(--autogen-v-rhythm);
  border: var(--requirement-border-width, 1px) solid;
  border-radius: var(--requirement-border-radius);
  margin: var(--autogen-v-rhythm) 0;
  color: var(--color-fg-main);
}

sdoc-autogen .admonition .admonition-title {
  margin: 0;
  padding-top: calc(0.5 * var(--base-rhythm));
  padding-bottom: calc(0.5 * var(--base-rhythm));
  color: currentColor;
  font-weight: 600;
  position: relative;
}

sdoc-autogen .admonition .admonition-title::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: calc(-1 * var(--autogen-v-rhythm));
  right: calc(-1 * var(--autogen-v-rhythm));
  /* background:repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, .25),
    rgba(255, 255, 255, .25) 10px,
    rgba(255, 255, 255, .0) 10px,
    rgba(255, 255, 255, .0) 20px
  ); */
  background-color: currentColor;
  opacity: 0.1;
}

sdoc-autogen .admonition > *:not(.admonition-title) {
  color: var(--color-fg-main);
}

sdoc-autogen .admonition.attention {
  color: Crimson;
}

sdoc-autogen .admonition.caution {
  color: Crimson;
}

sdoc-autogen .admonition.important {
  color: OrangeRed;
}

sdoc-autogen .admonition.danger {
  color: red;
}

sdoc-autogen .admonition.error {
  color: Red;
}

sdoc-autogen .admonition.warning {
  color: DarkOrange;
}

sdoc-autogen .admonition.warning .admonition-title::before {
  /* content: '⚠️'; */
  margin-right: var(--base-rhythm);
}

sdoc-autogen .admonition.note {
  /* color: CornflowerBlue; */
  color: SteelBlue;
}

sdoc-autogen .admonition.hint {
  color: DarkSlateBlue;
}

sdoc-autogen .admonition.tip {
  color: MediumSlateBlue;
}
