@code-background: #F5F7F9;
@pre-background: #4f566a;

@h1-font-size: 24px;
@h1-font-weight: 400;
@h1-border-style: solid;
@h1-border-width: 1px 0px 0px 0px;
@h1-border-color: #e3e8ee;

@h2-font-size: 20px;
@h2-font-weight: 400;

@h3-font-size: 16px;
@h3-font-weight: 400;

@img-border-style: solid;
@img-border-width: 1px;
@img-border-color:#e3e8ee;
@img-border-radius: 4px;
@img-padding: 1px;


@link: #5469d4;

// content is the parent element that contains the documentation
// content generated from the markdown file.
.content {
    font-size: 16px;
    line-height: 24px;
    margin-bottom: 48px;
    overflow: hidden;
    color: #3c4257;
    
    p, h1, h2, h3, ol, ul, img {
        margin-bottom: 24px;
    }

    h1 {
        border-style: @h1-border-style;
        border-width: @h1-border-width;
        border-color: @h1-border-color;

        font-family: Kanit;
        font-size: @h1-font-size;
        font-weight: @h1-font-weight;
        padding-top: 20px;
        margin-top: 40px;

        // font-size: 20px;
        color: #1f1a47;
    }

    h2 {
        font-family: Kanit;
        font-size: @h2-font-size;
        font-weight: @h2-font-weight;
        line-height: 1.5;
        margin: 32px 0px 24px 0px;

        // font-size: 18px;
        color: #1f1a47;
    }

    h3 {
        font-family: Kanit;
        font-size: @h3-font-size;
        font-weight: @h3-font-weight;
        line-height: 1.5;
        margin: 24px 0px;

        // font-size: 16px;
        color: #1f1a47;
        // font-weight: 500;
    }

    a, a:visited {
        color: @link;
        text-decoration: none;
        // outline: none;

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

    i, em {
        font-style: italic;
    }

    strong {
        font-weight: 700;
    }


    ul code,
    ol code,
    p code {
        background: @code-background;
        display: inline-block;
        font-family: @font-mono;

        font-size: 14px;
        border-radius: 4px;
        color: #3c4257;
        font-weight: 400;
        background: #f7fafc;
        border: 1px solid #e3e8ee;
        padding: 0px 3px;
        box-sizing: border-box;
        line-height: 18px;
    }

    &> ol > li > pre > code,
    &> ul > li > pre > code,
    &> pre > code,
    .highlight {
        background: @pre-background;
        color: #f5fbff;
        display: block;
        font-family: @font-mono;
        font-size: 13px;
        font-weight: 300;
        line-height: 19px;
        border-radius: 3px;
        border: none;
        margin-bottom: 24px;

        overflow: hidden;
        overflow-y: hidden;
        overflow-x: auto;

        pre, code {
            background: @pre-background;
        }
    }

    &> pre > code {
        padding: 12px;
    }

    &> ul > li > pre,
    &> ol > li > pre {
        &> code {
            padding: 12px;
        }
    }

    // chrome syntax highlighting.
    div.chroma {
        overflow: hidden;
        overflow-y: hidden;
        overflow-x: auto;
        padding: 12px 0px;

        .lntable {
            width: 100%;
        }

        td:last-of-type {
            width: 100%;
        }

        code {
            box-sizing: border-box;
            // padding-right: 12px;
            display: block;
        }

        .hl {
            display: block;
            color: rgb(164, 205, 254);
            background: #3c4157;
            // background: hsla(0,0%,100%,.1);
            // color: #85d99e;

            // box-shadow: inset 0 10px 10px -10px rgba(0,0,0,0.8);
            // padding-top: 5px;
            // margin-top: 5px;
        }

  

        // line numbers
        .lnt {
            box-sizing: border-box;
            color: #bec5ca;
            display: block;
            text-align: right;
            width: 60px;
            padding-right: 20px;
            // font-size: 90%;
            // font-weight: 500;
        }

        // .lntd:first {
        //     span {
        //         box-sizing: border-box;
        //         padding-right: 10px
        //     }
        // }
    }

    ul, ol {
        padding-left: 24px;
    }

    li {
        list-style-type: disc;
    }

    img {
        margin-bottom: 24px;
        box-sizing: border-box;
        border-width: @img-border-width;
        border-style: @img-border-style;
        border-color: @img-border-color;
        border-radius: @img-border-radius;
        padding: @img-padding;
        max-width: 100%;
    }
    
    &> .alert + table {
        padding-top: 12px;
    }
    &> table + p {
        padding-top: 12px;
    }

    &> table {
        // border: 1px solid #EFF0F2;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 24px;
        // border-radius: 3px;
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;

        thead th {
            font-weight: 400;
            font-size: 13px;
            color: #697386;
            text-transform: uppercase;
            text-align: left;
            padding: 0 0 8px 16px;
        }

        tbody {
            font-size: 14px;
            line-height: 20px;
            vertical-align: top;
            padding-top: 0;
            color: #3c4257;

            tr td {
                border-color: #e3e8ee;
                border-style: solid;
                padding: 16px;
                border-bottom-width: 1px;
            }

            tr:nth-child(odd) td {
                background: #f7fafc;
            }

            tr:first-child>td {
                border-top-width: 1px;
            }

            tr td:last-child {
                border-right-width: 1px;
            }

            tr td:first-child {
                border-left-width: 1px;
            }

            tr:first-child>td:first-child {
                border-top-left-radius: 4px;
            }

            tr:first-child>td:last-child {
                border-top-right-radius: 4px;
            }

            tr:last-child>td:last-child {
                border-bottom-right-radius: 4px;
            }

            tr:last-child>td:first-child {
                border-bottom-left-radius: 4px;
            }
        }
    }

    dt {
        font-weight: 600;
    }

    dd {
        margin-bottom: 24px;
    }
}

//
// blockquote
//

@blockquote-color: #74818d;
@blockquote-border-width: 0px 0px 0px 4px;
@blockquote-border-color: #E6ECF1;
@blockquote-margin: 0px 0px 24px;
@blockquote-padding: 0px 0px 0px 12px;

.content blockquote {
    color: @blockquote-color;
    margin: @blockquote-margin;
    padding: @blockquote-padding;
    border-color: @blockquote-border-color;
    border-width: @blockquote-border-width;
    border-style: solid;
}

//
// api and cli links
//

.content a[href^="/api/"],
.content a[href^="/cli/"] {
    position: relative;
    padding-right: 20px;
    display: inline-block;
}

.content a[href^="/api/"]:after {
    position: absolute;
    content: "";
    display: inline-block;
    margin-left: 4px;
    margin-right: -20px;
    width: 20px;
    height: 12px;
    background-image: url(/icons/api.svg);
    background-repeat: no-repeat;
    background-size: 16px auto;
    bottom: 5px;
}

.content a[href^="/cli/"]:after {
    position: absolute;
    content: "";
    display: inline-block;
    margin-left: 4px;
    margin-right: -20px;
    width: 20px;
    height: 12px;
    background-image: url(/icons/api.svg);
    background-repeat: no-repeat;
    background-size: 16px auto;
    bottom: 5px;
}

//
// unordered lists
//

.content ul {
    pre {
        &> code {
            padding: 12px;
        }
    }

    p ~ pre {
        margin-top: -15px; // hack
    }
}

//
// ordered list
//

.content ol {
    counter-reset: listitem;
    padding-left: 0px;

    li > :first-child {
        margin-top: 0px;
        margin-bottom: 0px;
    }

    li > * {
        margin-top: 10px;
    }

    li {
        position: relative;
        list-style: none;
        margin-left: 32px;
        margin-bottom: 10px;
    }

    li:before {
        counter-increment: listitem;
        content: counter(listitem);
        background: #e3e8ee;
        color: #697386;
        display: inline-block;
        font-size: 12px;
        font-weight: 500;
        line-height: 10px;
        text-align: center;
        height: 20px;
        width: 20px;
        line-height: 20px;
        border-radius: 10px;
        position: absolute;
        left: -30px;
        top: 2px;
    }
}

//
// prefix headers with step
//

.content.steps {
    counter-reset: step;
    h1:before {
        counter-increment: step;
        content: "Step " counters(step, "") ":";
        color: #8792a2;
        margin-right: 12px;
    }
}
