/*
 * main.css
 * Copyright (C) 2020 Benoit Rapidel
 *
 * Distributed under terms of the MIT license.
 */

@import url("fonts.css");
@import url("footer.css");
@import url("titleblock-manual.css");

:root {
    --base-width: 70rem;
    --min-base-width: 30rem;
    --body-margin-lr: auto;
    --page-margin-lr: 0.5rem;
    --page-margin-tb: 0.5rem;
}

body {
    padding: 0;
    margin: 0;
}


/* Navigation section */

#TOC {
    padding: .25rem var(--page-margin-lr);
    background: var(--titleblock-color-bg);
    color: var(--titleblock-color-main);
    margin: var(--page-margin-tb) auto;
    padding: 0;
    text-align: center;
    display: grid;
    width: var(--base-width);
    border: 1px solid var(--titleblock-color-border);
    border-radius: 5px;
    grid-template-areas:
    'side toc';
    grid-template-columns: 5rem auto;
    grid-gap: 0px;
    overflow: hidden;
    justify-content: stretch;
    align-content: stretch;
}

#TOC li, nav a {
    color: var(--text-color);
    text-decoration: none;
}
#TOC a:hover {
    color: var(--text-color-hover);
    text-decoration: underline;
}

#TOC ul {
    margin: 0;
    padding: 0;
    list-style-position: inside;
    list-style-type: none;
}
#TOC > ul {
    font-size: 14pt;
    column-count: 2;
    column-gap: 4rem;
    margin: 2rem;
}
#TOC > ul > li ul {
    font-size: 12pt;
    padding-left: 1rem;
    margin-bottom: .5rem
}
#TOC ul li a {
    display: flex;
    flex-direction: row;
    justify-content: start;
    flex-grow: 2;
    order: 2;
}
#TOC li .toc-section-number {
    margin-right: .3em;
}
#TOC li a::before {
    margin-left: .3em;
    background-image: radial-gradient(circle, currentcolor 0.5px, transparent 1px);
    background-position: bottom;
    background-size: 1ex 4.5px;
    background-repeat: space no-repeat;
    content: "";
    height: 1em;
    order: 3;
    flex-grow: 2;
}
#TOC li a:hover .toc-section-number {
    text-decoration: none;
}
#TOC li .toc-section-number {
    color: #101010;
    flex-shrink: 2;
}

body > section, body > nav {
    max-width: var(--base-width);
    padding: .25rem var(--page-margin-lr);
    color: var(--text-color);
    margin: 1rem var(--body-margin-lr);
}

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


/* Headers */

h1, h2, h3, h4, h5, h6 {
    color: #0d0d0d;
}

h2, h3, h4, h5, h6 {
    margin-bottom: .75rem;
}

h1 {
    padding-bottom: 1rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid #0d0d0d;
}

h2 {
    padding-bottom: .5rem;
}

.header-section-number {
    color: #303030;
    margin-right: .25rem;
}

@media screen and (max-width: 1250px) {
   :root {
       --base-width: calc(98vw - 1rem);
   }
}

@media screen and (max-width: 800px) {
    #TOC > ul {
        column-count: 1;
    }
}

@media screen and (max-width: 680px) {
    #TOC {
        grid-template-areas:
        'side'
        'toc';
        grid-template-columns: auto;
        grid-template-rows: 5rem auto;
    }
    
}

@media screen and (max-width: 520px) {
    #TOC {
        width: calc(var(--base-width) - var(--page-margin-lr) * 2);
    }
    section > :is(h1):not(.component-family) {
        position: sticky;
    }
    section > :is(h1, h2):not(.component-family) {
        padding: .5rem;
        height: 2rem;
        background: #fff;
        top: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        z-index: 30;
        font-size: 1.5rem;
        margin-left: 0;
        margin-right: 0;
    }
    section > h2, section > h3 {
        top: 3rem;
        z-index: 29;
    }
    body > section {
        padding-left: 0;
        padding-right: 0;
    }
    section > :is(h4, h5, h6):not(.component-family) {
        padding-left: var(--page-margin-lr);
        padding-right: var(--page-margin-lr);
    }
}

@media screen and (max-width: 417px) {
    :root {
        --page-margin-lr: 0.25rem;
    }
}

@media screen and (max-height: 506px) {
    :root {
        --page-margin-tb: 0.25rem;
    }
    section > h2, section > h3 {
        top: 0;
    }
}