/* standard OTP style sheet */
/* We use three responsive breakpoints:
 * 768px - mobile
 * 992px - small screen
 * 1200px - medium screen
 * default - large screen
*/
body {
    background: #fefefe;
    color: #1a1a1a;
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    border: 0;
    max-height: 100%;
    line-height: 1.2em;
    font-size: 16px;
}

h1, h2, h3, h4, h5, h6{
    line-height: 1.2em;
}

.header       { background: #222; color: #fefefe }
.top          { background: #efe }
.otp          { background: #efe }
.erlang       { background: #ffe }
.otp2         { background: #efe }
.app          { background: #ffe }

a:link         { color: #1862ab; text-decoration: none }
a:active       { color: #1c7cd6; text-decoration: none }
a:visited      { color: #1b6ec2; text-decoration: none }

#container {
    display: grid;
    grid-template-columns: 1fr 5fr;
    grid-template-areas: "leftnav content";
}

#leftnav {
    grid-area: leftnav;
}

.leftnav-tube {
    top: 0;
    margin-left: 15px;
    position: sticky;
    height: 100vh;
    max-width: 250px;
    overflow: auto;
    border-right: 1px solid #ccc;
}

#content {
    grid-area: content;
    max-width: 52em;
    margin-left: 30px;
}

@media screen and (max-width: 1200px) {
    #content {
        margin-left: 0px;
    }
}

@media screen and (max-width: 992px) {
    #content {
        max-width: 35em;
    }
}

.topbar {
    grid-area: topbar;
    display: none;
}

@media screen and (max-width: 768px) {

    #container {
        grid-template-columns: 100%;
        grid-template-areas:
            "topbar"
            "leftnav"
            "content";
    }

    /* styling for the top bar */
    .topbar {
        display: flex;
        position: relative;
        top: 0px;
        padding: 0.5em;
        width: 100%;
        box-sizing: border-box;
        border-bottom: 1px solid #ccc;
        box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.05),
                    inset 0 -1px 0 rgba(0,0,0,0.15);
        text-align: center;
    }
    .topbar button {
        padding: 1 6 1 6;
        margin: 0;
        height: auto;
        display: inline-block;
        border-radius: .25rem;
        border: 1px solid transparent;
        background: transparent;
    }
    .topbar-expand:not(.show) > button {
        /* When we add the "show" class we rotate the button 180deg */
        transform: rotate(180deg);
    }
    .topbar-expand > button {
        transition: transform 0.35s ease;
    }
    .topbar-expand.show-permanent > button {
        display: none;
    }
    .topbar-title {
        text-align: center;
        flex-grow: 2;
    }
    .topbar-title > h1 {
        font-size: 1.17em;
        margin: 0px;
    }

    /* Break words on mobile */
    #content {
        overflow-wrap: break-word;
        word-wrap: break-word;
        margin-left: 0px;
        max-width: 100%;
    }
    p {
        max-width: 100%;
    }
    /* The h1 is part of the topbar on mobile */
    #content h1 {
        display: none;
    }

    /* Styling of the navbar when shown/hidden */
    #leftnav {
        overflow: hidden;
    }
    #leftnav:not(.show) {
        max-height: 0px;
        border-bottom: 0px;
        transition: max-height 0.35s ease;
    }
    #leftnav.show {
        max-height: 60vh;
        border-bottom: 1px solid #ccc;
        box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.05),
                    inset 0 -1px 0 rgba(0,0,0,0.15);
        transition: max-height 0.35s ease;
    }
    
    .leftnav-tube {
        max-height: 60vh;
        max-width: 100%;
        position: unset;
        border-right: 0px;
        margin-right: 0px;
        margin-left: 0px;
        padding: 0px 15px 0px 15px;
    }
    #leftnav.show-permanent {
        max-height: none;
    }
    .show-permanent > .leftnav-tube {
        overflow: initial;
        max-height: none;
        height: inherit;
    }
    .hide-mobile {
        opacity: 0;
    }

}

@media (prefers-reduced-motion: reduce){
    #leftnav.collapsing{
        transition: none;
    }
    .topbar-expand > button {
        transition: none;
    }
}

.frontpage {
    padding-top: 50px; /* Magins for inner DIV inside each DIV (to provide padding) */
}

.mobile-only {
    display: none;
}

@media screen and (max-width: 768px) {
    .mobile-only {
        display: revert;
    }
}

.innertube, .exports-tube {
    margin-left: 15px;
    margin-right: 15px;
}

@media screen and (max-width: 1200px) {
    .innertube, .exports-tube {
        margin-left: 0px;
        margin-right: 15px;
    }
}

@media screen and (max-width: 768px) {
    .innertube, .exports-tube {
        margin-left: 15px;
        margin-right: 15px;
    }
}

.footer {
    margin: 15px; /* Magins for inner DIV inside each DIV (to provide padding) */
    text-align: center;
}

.bold_code   { font-family: mono, Courier, monospace; font-weight: bold }

.title-link {
    display: flex;
}

.cref-head, .func-head, .data-type-name {
    margin: 0 0 0 -4em;
    padding-bottom: 0.2em;
    padding-top: 0.2em;
}

.cref-head h4, .func-head h4, .data-type-name h4 {
    margin: 0;
}

.cref-head:hover, .func-head:hover, .data-type-name:hover {
    background-color: #f5f5f5;
}

/* This small trick is in order to make all but the first line of the function
 * head indented by 7em. So that it looks like this:
 * int enif_alloc_binary(
 *              size_t size,
 *              ErlNifBinary* bin)
 */
.cref-head .title-name {
    padding-left: 7em;
    text-indent: -7em;
}

.title-since {
    margin-left: auto;
}

@media screen and (max-width: 768px) {
    .cref-head, .func-head, .data-type-name {
        margin-left: 0em;
        padding-bottom: 0em;
        padding-top: 0em;
    }
    .title-link {
        flex-direction: column;
    }
    .title-anchors {
        display: none;
    }
    .title-since {
        margin-left: 1em;
    }
}

.code        {
    font-family: mono, Courier, monospace;
    font-weight: normal;
    background-color: #f3f3f3;
}

.note, .change, .warning, .do, .dont {
    border: 1px solid #495057;
    margin: 1em 0;
}
.note .label {
    background-color: #2b8a3e;
    color: #fefefe;
    font-weight: bold;
    padding: 0.5em 1em;
}
.note .content {
    background: #f8f9fa;
    line-height: 120%;
    font-size: 0.9em;
    padding: 0.5em 1em;
}
.change .label {
    background-color: steelblue;
    color: #fefefe;
    font-weight: bold;
    padding: 0.5em 1em;
}
.change .content {
    background: #f8f9fa;
    line-height: 120%;
    font-size: 0.9em;
    padding: 0.5em 1em;
}
.warning .label {
    background: #c92a2a;
    color: #fefefe;
    font-weight: bold;
    padding: 0.5em 1em;
}
.warning .content {
    background-color: #f8f9fa;
    line-height: 120%;
    font-size: 0.9em;
    padding: 0.5em 1em;
}
.do .label {
    background-color: #2b8a3e;
    color: #fefefe;
    font-weight: bold;
    padding: 0.5em 1em;
}
.do .content {
    background: #f8f9fa;
    line-height: 120%;
    font-size: 0.9em;
    padding: 0.5em 1em;
}
.dont .label {
    background: #c92a2a;
    color: #fefefe;
    font-weight: bold;
    padding: 0.5em 1em;
}
.dont .content {
    background-color: #f8f9fa;
    line-height: 120%;
    font-size: 0.9em;
    padding: 0.5em 1em;
}

.quote {
    font-style: italic
}

.example {
    background-color:#f1f3f5;
    border: 1px solid #dee2e6;
    padding: 0.5em 1em;
    margin: 1em 0;
    font-size: 0.7em;
    overflow-x: auto;
    max-width: min(100%, 48em);
}
.extrafrontpageinfo {
    color: #C00;
    font-weight: bold;
    font-size: 1.2em;
}

pre {
    font-family: mono, Courier, monospace;
    font-weight: normal;
    margin: 0;
}


.data-types-body, .REFBODY {
    margin-left: 2em;
}
.REFTYPES    { margin-left: 1.5em }
.exports-body {
    margin-left: 3em;
}

@media screen and (max-width: 768px) {
    .data-types-body, .REFBODY{
        margin-left: 1em;
    }
    .REFTYPES    { margin-left: 0.75em }
    .exports-body {
        margin-left: 1em;
    }
}

footer       { }

.erlang-logo-wrapper{
    text-align: center;
    margin-top: 1em;
    margin-bottom: 1em;
}

.main-title{
    text-align: center;
}

.main-description{
    text-align: center;
    margin: 2em 0;
    font-size: 1.5em;
    line-height: 1.5em;
}

.doc-table-wrapper, .doc-image-wrapper{
    width: 100%;
    overflow-x: scroll;
}

.doc-image-wrapper{
    text-align: center;
}

.doc-svg, doc-image {
    width: 100%;
}

.doc-table, .doc-image{
    min-width: 50%;
    margin: 0 auto;
    font-size: 0.7em;
}

.doc-table-caption, .doc-image-caption{
    margin-top: 1em;
    font-style: italic;
    text-align: center;
}

table {
    border-collapse: collapse;
    min-width: 50%;
    margin: 1em;
}

table, th, td {
    border: 1px solid #666;
}

th, td {
    padding: 0.5em;
    text-align: left;
}

tr:hover {
    background-color: #f5f5f5;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

th {
    background-color: #777;
    color: #fefefe;
}

.section-title, .section-subtitle, .section-version{
    text-align: center;
    margin: 0;
}

.section-title{
    font-weight: bold;
}

.section-version{
    font-size: small;
}

.expand-collapse-items{
    font-size: small;
}

.title_link {
    color: #1a1a1a !important;
    outline: none;
}

.ghlink-before {
    visibility: hidden;
}

.pencil-before:before {
    transform: rotateZ(90deg);
    display: inline-block;
    content: "\270E";
    color: #1a1a1a !important;
    font-size: 1.5em;
    font-family: mono;
}

.paperclip-before:before {
    display: inline-block;
    content: "\1F517";
    padding-left: 1em;
    padding-right: .3em;
}

.ghlink-after {
    visibility: hidden;
}

.pencil-after:after {
    display: inline-block;
    transform: rotate(90deg);
    content: "\270E";
    color: #1a1a1a !important;
    font-size: 1.5em;
    font-family: mono;
}

.paperclip-after:after {
    display: inline-block;
    content: "\1F517";
    padding-right: .3em;
    padding-left: .7em;
}

hr{
    border: 0;
    border-top: 1px solid #aaa;
}

.section-links, .panel-sections, .expand-collapse-items{
    padding: 0 1em;
}

.section-links, .panel-sections{
    margin-top: 0;
}

a > .code {
    color: #1862ab;
}

.func-types-title{
    font-size: 1em;
}

.since{
    color: gray;
    font-weight: normal;
    font-size: small;
}
