.page-title {
    margin-bottom: 30px;
}

// Applies to all block types, and specific news styles nest inside
.block {
    margin-bottom: 10px;

    @media screen and (min-width: $screen-md-min) {
        margin-bottom: 20px;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        align-items: stretch;
    }

    &.richtextblock {
        background-color: #fff;

        @media screen and (min-width: $screen-md-min) {
            :target {
                margin-top: -40px !important;
                padding-top: 40px !important;
            }
        }

        table {
            border-collapse: collapse;

            td {
                padding: 10px 11px;

                p {
                    margin: 0;
                }
            }
        }
    }

    &.richtextblock, .teaser .caption {
        padding: 20px;
        line-height: 1.6;

        .layout__block--100 & {
            @media screen and (min-width: $screen-md-min) {
                padding: 20px 10%;
            }
        }

        &.full-width {
            padding-left: 20px;
            padding-right: 20px;
        }

        pre {
            display: block;
            overflow: auto;
            padding: 5px 10px;
            word-wrap: normal;
            background-color: #f8f8f8;
            margin: 10px 0;
            white-space: pre;
            border: none;

            @media screen and (min-width: $screen-md-min) {
                width: 766px;
            }

            @media screen and (min-width: $screen-lg-min) {
                width: 925px;
            }

            @media screen and (min-width: $screen-xl-min) {
                width: 1372px;
            }
        }

        code {
            border: 1px solid #e0e0e0;
        }

        h1, h2, h3, h4, h5, h6 {
            margin-top: 20px;
            color: #000;

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

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

        p {
            margin-bottom: 1em;

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

        ul, ol {
            margin: 0.3em 0;
            overflow: hidden;

            li {
                margin: 0.4em 0;

                &:last-child {
                    margin-bottom: 1em;
                }
            }
        }

        blockquote {
            padding: 0;
            margin: 0 0 1em 20px;
            border: none;

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

            @media screen and (min-width: $screen-sm-min) {
                margin-left: 50px;
            }
        }

        hr {
            margin-top: 2em;
            margin-bottom: 2em;
        }

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

            dt {
                margin-top: 1em;

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

            dd {
                margin: 0.3em 0 0.3em 20px;
                padding-left: 10px;
                border-left: 3px solid #e0e0e0;
            }
        }

        cite {
            display: block;
            font-style: normal;
            margin-top: -0.5em;
            margin-bottom: 0.5em;
            color: #808080;
            line-height: 1.5;
            font-size: 0.9rem;
        }

        a[name] {
            pointer-events: none;
            color: #000;
            text-decoration: none;
        }
    }

    &.teaserblock {
        padding: 0;
    }

    .teaser .caption {
        h1, h2, h3, h4, h5, h6 {
            color: #000;
        }

        @media screen and (min-width: $screen-md-min) {
            padding: 20px;
        }
    }

    &.homepage-summary-block {
        background: #fff;
        padding: 20px;
        position: relative;
        z-index: 0;

        h3 {
            margin: 0;
        }

        .homepage-summary-row {
            width: 100%;
            max-width: 600px;
            margin: auto;
        }

        .homepage-summary-count {
            clear: both;
            text-align: center;
            padding: 1em 0;

            svg {
                fill: #fff;
                margin-right: 1em;
            }
        }

        .facet {
            width: 50%;
            float: left;
            padding: 0 30px;
            border-bottom: none;
        }
    }
}

a.url {
    word-break: break-all;
}

// All figures get this class
.richtextblock.img, figure {
    display: block;
    width: 100%;
    margin: 0 0 1em;
    line-height: 0;

    @media screen and (min-width: $screen-sm-min) {
        &.fig-width-25 { width: 25%; }
        &.fig-width-50 { width: 50%; }
        &.fig-width-75 { width: 75%; }
        &.fig-width-100 { width: 100%; }
    }

    &.fig-align-center {
        margin-left: auto;
        margin-right: auto;
    }

    &.fig-align-right {
        float: right;
        margin-left: 20px;
    }

    &.fig-align-left {
        float: left;
        margin-right: 20px;
    }

    figcaption {
        font-size: 0.9rem;
        color: #808080;
        line-height: 1.5;
    }
}

// Right aligned figures
img.fig-align-right {
    display: block;
    width: 100%;
    margin-bottom: 1em;

    @media screen and (min-width: $screen-md-min) {
        float: right;
        margin-left: 10px;
        width: auto;

        &.fig-width-25 { width: 25%; }
        &.fig-width-50 { width: 50%; }
        &.fig-width-75 { width: 75%; }
    }
}

// Left aligned figures
img.fig-align-left {
    display: block;
    width: 100%;
    margin-bottom: 1em;

    @media screen and (min-width: $screen-md-min) {
        float: left;
        margin-right: 10px;
        margin-bottom: 10px;
        width: 50%;

        &.fig-width-25 { width: 25%; }
        &.fig-width-50 { width: 50%; }
        &.fig-width-75 { width: 75%; }
    }
}

// Left aligned figures
img.fig-align-center {
    display: block;
    width: 100%;
    margin: 0 auto 1em;

    @media screen and (min-width: $screen-md-min) {
        width: auto;
        margin: 0 auto 1em;

        &.fig-width-25 { width: 25%; }
        &.fig-width-50 { width: 50%; }
        &.fig-width-75 { width: 75%; }
        &.fig-width-100 { width: 100%; }
    }
}

// Teaser block styes
.img-link {
    display: block;

    &:hover {
        text-decoration: none;
    }
}

.teaser {
    position: relative;
    padding: 0;
    border-radius: 0;
    border: 4px solid #fff;

    // Only react to hover if there's an href
    .img-link &:hover {
        border-color: #0a253d;
    }

    &.thumbnail {
        margin-bottom: 0;
    }

    .caption {
        @media screen and (min-width: $screen-sm-min) {
            float: right;
            width: 33.33%;
            padding: 0 20px !important;
            line-height: 1.6;
        }
    }

    figure {
        margin-bottom: 0;

        @media screen and (min-width: $screen-sm-min) {
            float: left;
            width: 66.66%;
        }
    }

    figcaption {
        display: none;
    }

    p {
        margin: 0;
        font-weight: normal;
    }
}

.teaser-font-13 p {
    font-size: 0.9rem;
}

.teaser-font-12 p {
    font-size: 0.85rem;
}

.teaser-font-11 p {
    font-size: 0.8rem;
}

// Used for paragraphs of text used outside of Page @types.
.block-text {
    p {
        margin: 1rem 0;
        line-height: 1.6;

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

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