@mixin sidenote() {
    font-family: $font-text-secondary;
    clear: both;
    float: right;
    min-width: 5em;
    padding: $line-height-default / 2;
    text-indent: 0;
    font-size: $font-size-default * $font-size-smaller;
    line-height: $line-height-default * $font-size-smaller;
    font-style: inherit;
    position: relative;
    max-width: 40%;
    margin: 0 0 ($line-height-default / 2) ($line-height-default / 2);
    background-color: white;
    // Don't text-indent paragraphs that follow sidenotes that follow a heading.
    // We allow for up to three sidenotes between the heading and paragraph.
    h1 + & + p,
    h2 + & + p,
    h3 + & + p,
    h4 + & + p,
    h5 + & + p,
    h6 + & + p,
    h1 + & + & + p,
    h2 + & + & + p,
    h3 + & + & + p,
    h4 + & + & + p,
    h5 + & + & + p,
    h6 + & + & + p,
    h1 + & + & + & + p,
    h2 + & + & + & + p,
    h3 + & + & + & + p,
    h4 + & + & + & + p,
    h5 + & + & + & + p,
    h6 + & + & + & + p {
        text-indent: 0;
    }
    // Unless we're spacing paras, add an indent
    // on paras that follow sidenotes that follow paras.
    p + & + p {
        text-indent: $paragraph-indent;
    }
    @if $spaced-paras {
        p + & + p {
            text-indent: 0;
        }
    }

    h1, h2, h3, h4, h5, h6 {

        &:first-child {
            margin-top: 0;
        }
    }

    p, ul, ol, dl {

        &:last-child {
            margin-bottom: 0;
        }
    }
}
