// This file stylizes the API documentation (stuff generated by autodoc). It's
// deeply nested due to how autodoc structures the HTML without enough classes
// to select the relevant items.

// API docs!
dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple)
  // Tweak the spacing of all the things!
  dd
    margin-left: 2rem
    > :first-child
      margin-top: 0.125rem
    > :last-child
      margin-bottom: 0.75rem

  // This is used for the arguments
  .field-list
    margin-bottom: 0.75rem

    // "Headings" (like "Parameters" and "Return")
    > dt
      text-transform: uppercase
      font-size: var(--font-size--small)

    dd:empty
      margin-bottom: 0.5rem
    dd > ul
      margin-left: -1.2rem
      > li
        > p:nth-child(2)
          margin-top: 0
        // When the last-empty-paragraph follows a paragraph, it doesn't need
        // to augument the existing spacing.
        > p + p:last-child:empty
          margin-top: 0
          margin-bottom: 0

  // Colorize the elements
  > dt
    color: var(--color-api-overall)

.sig:not(.sig-inline)
  font-weight: bold

  font-size: var(--api-font-size)
  font-family: var(--font-stack--monospace)

  margin-left: -0.25rem
  margin-right: -0.25rem
  padding-top: 0.25rem
  padding-bottom: 0.25rem
  padding-right: 0.5rem

  // These are intentionally em, to properly match the font size.
  padding-left: 3em
  text-indent: -2.5em

  border-radius: 0.25rem

  background: var(--color-api-background)
  transition: background 100ms ease-out

  &:hover
    background: var(--color-api-background-hover)

  // adjust the size of the [source] link on the right.
  a.reference
    .viewcode-link
      font-weight: normal
      width: 4.25rem

em.property
  font-style: normal
  &:first-child
    color: var(--color-api-keyword)
.sig-name
  color: var(--color-api-name)
.sig-prename
  font-weight: normal
  color: var(--color-api-pre-name)
.sig-paren
  color: var(--color-api-paren)
.sig-param
  font-style: normal

div.versionadded,
div.versionchanged,
div.deprecated,
div.versionremoved
  border-left: 0.1875rem solid
  border-radius: 0.125rem

  padding-left: 0.75rem

  p
    margin-top: 0.125rem
    margin-bottom: 0.125rem

div.versionadded
  border-color: var(--color-api-added-border)
  .versionmodified
    color: var(--color-api-added)

div.versionchanged
  border-color: var(--color-api-changed-border)
  .versionmodified
    color: var(--color-api-changed)

div.deprecated
  border-color: var(--color-api-deprecated-border)
  .versionmodified
    color: var(--color-api-deprecated)

div.versionremoved
  border-color: var(--color-api-removed-border)
  .versionmodified
    color: var(--color-api-removed)

// Align the [docs] and [source] to the right.
.viewcode-link, .viewcode-back
  float: right
  text-align: right
