/*
 * H3 section
 */

.h3-section > .body {
  & > pre {
    margin: 0;
    padding: 16px;
  }

  @media (max-width: 768px) {
    overflow-x: auto;
  }

  & {
    background: white;
    box-shadow: $shadow3;
  }

  /* Collapse/flush */
  @media (max-width: 480px) {
    margin: 0 -16px;
    box-shadow: $shadow2;
  }

  /* Border radius */
  @media (min-width: 481px) {
    & {
      border-radius: 2px;
    }

    & > :first-child {
      border-top-left-radius: 3px;
      border-top-right-radius: 3px;
    }

    & > :last-child {
      border-bottom-left-radius: 3px;
      border-bottom-right-radius: 3px;
    }
  }
}

/*
 * Heading
 */

.h3-section > h3 {
  & {
    margin-top: 8px;
    margin-bottom: 16px;
    white-space: nowrap;
    overflow: hidden;
  }

  // Mobile: the padding below h3-section is enough
  @media (max-width: 768px) {
    margin-top: 0;
  }

  // Horizontal line
  &::after {
    margin-left: 24px;
    content: '';
    display: inline-block;
    vertical-align: middle;
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, rgba($base-a, 0.2), transparent 80%);
  }
}

/*
 * Children
 */

.h3-section > .body {
  /* Lists */
  & > ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
  }

  & > ul > li {
    padding: 8px;
    padding-left: 32px + 4px;
    position: relative;
  }

  & > ul > li > p {
    margin: 0;
    padding: 0;
  }

  & > ul > li::before {
    content: '';
    position: absolute;
    display: inline-block;
    width: 4px;
    height: 4px;
    background: $gray-text;
    border-radius: 50%;
    left: 16px;
    top: 16px + 2px;
  }

  & > ul > li + li {
    border-top: solid 1px $line-color;
  }

  /* Paragraphs */
  & > p {
    padding: 16px;
    margin: 0;
  }

  /* Headings in between bodies */
  & > h4 {
    @include font-size(-1);
    margin: 0;
    padding: 4px 16px;
    font-weight: normal;
    background: $gray-bg;
    color: $gray-text;

    & + * {
      border-top: solid 1px $line-color;
    }
  }

  /* Description paragraphs */
  & > pre ~ p,
  & > ul ~ p,
  & > iframe ~ p,
  & > table ~ p {
    background: $gray-bg;
    color: $gray-text;

    /* Links */
    & a,
    & a:visited {
      color: $base-text;
      text-decoration: none;
      border-bottom: solid 1px $line-color;
    }

    & a:hover {
      color: $base-b;
    }
  }

  // Line divisions
  & > *:not(:first-child) {
    border-top: solid 1px $line-color;
  }

  // Collapse paragraphs together
  & > p + p,
  & > p + p:not(:first-child) {
    margin-top: -1.5em;
    border-top: 0;
  }
}

/*
 * Variant: Prime
 */

.h3-section.-prime > .body {
  @media (min-width: 481px) {
    border-radius: 2px;
    box-shadow: $shadow6;
  }
}

/*
 * Variant: Also see :\
 */

ul.-also-see.-also-see.-also-see {
  display: flex;
  flex-wrap: wrap;
  background: $gray-bg;

  & > li {
    flex: 1 0 20%;
    padding: 24px;
    border-top: solid 1px $dark-line-color;

    & + li {
      border-left: solid 1px $dark-line-color;
    }
  }

  &,
  & > li {
    list-style-type: none;
  }

  & > li::before {
    display: none;
  }

  & > li > a {
    @include font-size(1);
    display: block;
  }

  & > li > em {
    @include font-size(-1);
    display: block;
  }
}
