/* ==========================================================================
   Structures - Cards
   ========================================================================== */

/* General
   ========================================================================== */
.sg-card {
    position: relative;

    margin: 0 0 15px;

    background: $white;
    border: 1px solid $grey;

    border-radius: 4px;

    & + & {
        margin-top: 30px;
    }
}

.sg-card__anchor {
    position: relative;

    padding: 30px 0 10px;
}

/* Title
   ========================================================================== */
.sg-card__heading {
    padding: 10px 15px;
    margin: 0;

    border-radius: 4px 4px 0 0;
    border-bottom: 1px solid $grey;

    color: $black;
    font-family: $primary-font;
    font-size: 21px;

    &:target:before {
        content: ' ';

        display: block;
        height: 100px;
        margin: -100px 0 0;
    }
}


/* Body
   ========================================================================== */
.sg-card__body {

    @media (min-width: $screen-sm-min) {
        display: flex;
        width: 100%;
    }

    &--full-width {
        display: block;

        .sg-card__example,
        .sg-card__description {
            width: 100%;
        }
    }
}

.sg-card__example {
    flex: 1 1 auto;
    padding: 15px;
    //max-width: 1190px;

    small {
        display: block;
        margin: 0 0 5px;

        font-size: 12px;
        color: $black;
    }

    > p:first-child {
        margin-top: 0;
    }

    @media (min-width: $screen-sm-min) {
        width: 60%;
    }

    // override the bootstrap container width as this conflicts with the IotaCSS container class
    .container {
        width: auto;
    }
}

.sg-card__description {
    flex: 1 1 auto;

    font-size: 14px;
    line-height: 1.4;

    p {
        margin: 1em 0;

        + strong {
            display: block;
            margin-top: 2em;
        }
    }

    ul {
        padding: 0;
        margin: 0 10px;

        list-style: none;

        li {
            position: relative;

            padding: 0 0 15px 15px;
            margin: 0;

            line-height: 1.6;

            &:before {
                content: '-';

                position: absolute;
                left: 0;
            }
        }
    }

    blockquote {
        padding-left: 16px;
        margin: 16px 0 16px 2px;

        border-left: 3px solid $grey;
    }

    @media (min-width: $screen-sm-min) {
        width: 40%;
    }
}

.sg-card__description__inner {
    padding: 15px;

    > p:first-child + .sg-title {
        margin-top: 0;
    }

    pre {
        background: none;

        code {
            display: block;
        }
    }
}

/* Toggle
   ========================================================================== */
.sg-card__footer {
    background: lighten($grey--light, 2.5);

    border-radius: 0 0 4px 4px;
}

.sg-card__footer__toggle {
    line-height: 1;
}

.sg-card__footer__toggle__button {
    position: relative;

    display: inline-block;
    width: 100%;
    padding: 8px 20px;
    margin: 0;

    background: none;

    border: none;
    border-top: 1px solid $grey;
    border-bottom: 1px solid $grey;
    border-radius: 0;
    outline: none;

    color: $grey--dark;
    font-size: 14px;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;

    appearance: none;
    cursor: pointer;
    user-select: none;
    vertical-align: middle;
    white-space: nowrap;

    transition: color .3s ease;

    &:hover {
        color: $black;
    }

    .hide-code {
        display: none;
    }

    &.active {

        .hide-code {
            display: block;
        }

        .show-code {
            display: none;
        }
    }
}

.sg-card__footer__toggle__content {
    position: relative;

    display: block;
    overflow: hidden;
}

/* Markup
   ========================================================================== */
.sg-card__footer__toggle__content__code-snippet {
    position: relative;
}
