*:not(:defined) {
    all: unset;
}

script, style {
    display: none;
}

:root {
    font-family: Arial, sans-serif;
}

summary {
    cursor: pointer;
}

ol > li > ol {
    list-style-type: lower-alpha;
}

summary > :is(h2,h3,h4,h5,h6) {
    display: inline-block;
}

main > div {
    margin-top: 1rem;
    margin-bottom: 1rem;

    text-align: justify;
}

div > ul, div > ol {
    margin-top: 0;
}

img {
    break-inside: avoid;
}
table { 
    margin-left: auto;
    margin-right: auto;
}

table, th, td {
    border: 1px solid grey;
    border-collapse: collapse;
}
  
tbody th {
    text-align: left;
}

th,td {
    padding: 5px;
}
@media print {
    @page {
        size  : A4;
        margin: 15px 0; /* top/bottom page margins */
    }
}

.hidden {
    display: none;
}

body.overview {
    
    overflow-y: hidden;

    margin-left: 0;
    margin-right: 0;
    margin-top: 0;

    main {

        margin: 0;

        border-left: none;
        border-right: none;

        columns: auto 210mm;

        overflow-x: auto;

        /* TODO: scale */
        --scale: calc( (var(--screen_width)/818) / var(--overview) );
        height: calc( 100vh / var(--scale) );
        width: calc( 100vw / var(--scale) );

        transform: scale( var(--scale) );
        transform-origin: top left;
    }

    & .menu_area {
        display: none;
    }
}

main {
    display   : block;
    box-sizing: border-box;
    width     :  210mm; /* A4 width */
    /*padding   : 0 12px; left-right page margins */
    border-left : 12px solid transparent;
    border-right: 12px solid transparent;

    overflow-x: hidden;
    
    font-size: 14px; /* 16px is the default */
    line-height: 18px;
    /*
    margin-left : auto;
    margin-right: auto;
    */
}

/* scale down */
@media screen and (max-width: 210mm) {
    main {
        transform-origin: top left;
        scale: min(1, calc( var(--screen_width)/818 ) );
    }
}
/* scale up */
@media screen and (min-width: 210mm) and (display-mode: fullscreen) {
    main {
        transform-origin: top left;
        scale: max(1, calc( var(--screen_width)/818 ) );
    }
}
/* center */
@media screen and (min-width: 210mm) and (not (display-mode: fullscreen)) {
    main {
        margin-left: auto;
        margin-right: auto;
    }
}

.center {
    margin-left: auto;
    margin-right: auto;
}

div.center {
    width: fit-content;
}

.flex-2 {
    gap: 1px;
    display: grid;
    grid: auto / 1fr 1fr;

    & img {
        width: 100%;
    }
}

.flex-3 {
    gap: 1px;
    display: grid;
    grid: auto / 1fr 1fr 1fr;

    & img {
        width: 100%;
    }
}


.flex-4 {
    gap: 1px;
    display: grid;
    grid: auto / 1fr 1fr 1fr 1fr;

    & img {
        width: 100%;
    }
}

.dark  {
    color-scheme: dark;
}
.light {
    color-scheme: light;
}

@media print {
    .onscreen {
        display: none;
    }
}

@media screen {
    .onprint {
        display: none;
    }
}
@media screen {

    :root {
        scroll-padding-top: 2.5em;
    }

    body {
        margin-top: 2.5em;
    }

    .menu_area {
        position: fixed;
        top : 0;

        font-family: Arial, sans-serif;

        background-color: light-dark(rgb(204, 204, 204), rgb(51, 51, 51));

        --menu_width: calc( 210mm );
        left: max(0px, calc( ( 100dvw - var(--menu_width) ) / 2 ) );
        width: var(--menu_width);

        border-radius: 5px;

        padding-left: 12px;
        z-index: 1;

        font-weight: bold;

        & > :is(.menu_page,.menu_pages) {


            white-space  : nowrap;
            /*
            // try popover ?
            overflow-x: clip;
            text-overflow: ellipsis;
            white-space  : nowrap;
            overflow-y: visible;
            */

            a, a:visited {
                text-decoration: none;
                color: light-dark(black, white);
            }

            & > span {
                position: relative;
            }

            & > span:not(:hover) > .menu {
                display: none;
            }
            & > span > .menu {
                position: absolute;
                z-index: 1;
                bottom: 0;
                transform: translate(0, 100%);
                left: 0;
                background-color: light-dark(white, black);
                border: 1px solid gray;
                border-top: none;
                & > a {
                    display: block;
                    white-space: nowrap;
                    padding: 5px 10px;
                    &:hover {
                        background-color: light-dark(#DDD, #222);
                    }
                }
            }

            /* body.hide_h1 & > span:first-child { */
            &.menu_pages > span:nth-child(2),
            &.menu_page  > span:first-child {
                display: none;
            }

            & > span:not(:first-child) {

                &::before {
                    content: " > ";
                }
        
                &:hover::before {
                    content: " v "
                }
            }
        }
    }
}

@media print {
    .menu_area {
        display: none;
    }
}


/* compteurs */
body {
    counter-reset: h1 h2 h3;
    counter-set: h1 var(--header_start_id);
}

h1::before {
    counter-set: h2 h3;
    counter-increment: h1;
    content: counter(h1, upper-roman) ". ";
}
h2::before {
    counter-set: h3;
    counter-increment: h2;
    content: counter(h1, upper-roman) "." counter(h2) ". ";
}
h3::before {
    counter-increment: h3;
    content: counter(h1, upper-roman) "." counter(h2) "." counter(h3, lower-alpha) ". ";
}

h1, h2, h3, h4, h5, h6 {
    cursor: pointer;

    &:hover::after {
        content: "🔗";
        opacity: 0.5;
    }
}
:root {

    color: light-dark(black, white);

    @media screen {
        &.light-mode {
            color-scheme: light;
        }
        &.dark-mode {
            color-scheme: dark;
        }
    }

    @media print {
        & {
            color-scheme: light;
            print-color-adjust: exact;
        }
    }
}

.color-scheme-gui-btn {
    position: fixed;
    top: 0px;
    right: 0px;
    cursor: pointer;
    font-size: 20px;
 
    :root.light-mode & {
        &::before {
            content: "🌘"; /*var(--color-scheme-gui-btn-icon);*/
        }
    }
    :root.dark-mode & {
        &::before {
            content: "🌖"; /*var(--color-scheme-gui-btn-icon);*/
        }
    }

    @media print {
        & {
            display: none;
        }
    }
}

.code-lang_switch {
    position: fixed;
    top: 0;
    left: 0;
    font-size: 20px;
    cursor: pointer;

    body[code-lang="html"] &::after {
        content: "HTML";
        font-weight: bold;
        color: light-dark( #FFC300 , gold);
    }
    body[code-lang="js"] &::after {
        content: "JS";
        font-weight: bold;
        color: light-dark( #FFC300 , gold);
    }
    body[code-lang="bry"] &::after {
        content: "🐍"
    }
}

.lastmodified {
    font-size: small;
    font-style: italic;
}

todo {
    display: block;

    background-color: yellow;
    color: black;
    padding: 2px;
    border-radius: 4px;

    &::before {
        content: "[TODO] "
    }
}

p {
    text-align: justify;
}

img {
    max-width: 100%;

    &[src$=".svg"] {

        display: block;
        margin-left: auto;
        margin-right: auto;

        width:60%;
        background-color:white;
        border-radius:5px;
        padding:5px
    }
}

.terminal {
    border: 1px solid gray; border-radius: 5px; padding: 5px;
    & > pre {
        margin: 0;
    }
}

a[disabled] {
    color: gray;
    opacity: 0.5;
    font-style: italic;
    pointer-events: none;
}

/*# sourceMappingURL=index.css.map*/