@font-face {
  font-family: "Luciole";
  src: url("fonts/Luciole-Math/Luciole-Regular.woff2") format("woff2");
  font-weight: normal;
  font-display: swap;
}
@font-face {
  font-family: "Luciole";
  src: url("fonts/Luciole-Math/Luciole-Italic.woff2");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Luciole";
  src: url("fonts/Luciole-Math/Luciole-Bold.woff2");
  font-weight: bold;
  font-display: swap;
}
@font-face {
  font-family: "Luciole";
  src: url("fonts/Luciole-Math/Luciole-BoldItalic.woff2");
  font-weight: bold;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Luciole Math";
  src: url("fonts/Luciole-Math/Luciole-Math.otf") format("opentype");
  font-display: swap;
}

:root {
    --bg: white;
    --bg-lum: 0.95;
    --bg-chroma: 0.05;
    --header-font: 'Luciole',sans-serif;
    --text-font: 'Luciole', sans-serif;
    --text-color: black;
    --text-decoration-color: #555;
    --rule-color: white;
    --border-color: black;
    --border-radius: 0.2em;
    --more-border-radius: calc(2 * var(--border-radius));
    --muted-color: #333;
    color-scheme: light dark;

    --start-bg: oklch(var(--bg-lum) var(--bg-chroma) 210);
    --end-bg: oklch(var(--bg-lum) var(--bg-chroma) 0);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: hsl(203.8, 72.2%, 8%);
        --bg-lum: 0.32;
        --bg-chroma: 0.09;
        --text-color: white;
        --text-decoration-color: #aaa;
        --rule-color: black;
        --border-color: white;
        --muted-color: #ddd;
    }
}

* {
    box-sizing: border-box;
    word-break: break-word;
}

html {
    font-size: 4vmin;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text-color);
    font-family: var(--text-font);
    padding: 0;
}

math {
    font-family: 'Luciole Math', var(--text-font);
}

h1,h2,h3,h4,h5,h6 {
    font-family: var(--header-font);
    margin: 0 0 1rem 0;
}

h2 {
    margin: 0;
    font-size: 1.1em;
}

hr {
    width: 5em;
    border: 1px solid var(--rule-color);
}

aside {
    display: none;
}

a {
    color: var(--text-color);
    text-decoration-color: var(--text-decoration-color);
}

header {
    padding: 1rem;
    & #uni svg {
        width: 100%;
    }
}

@media screen and (orientation: landscape) {
    body {
        display: grid;
        grid-template:
            "main header" / 1fr 15svw;
        
        & > header {
            grid-area: header;
            padding: 1svw;
            display: flex;
            flex-direction: column;
            gap: 1em;
        }
    }
    
}

* {
    line-height: 1.5em;
}

main {
    overflow: hidden scroll;
    height: 100vh;
    scroll-snap-type: y mandatory;
            border-left: min(1em, 1svw) solid;
            border-image: 
                linear-gradient(
                    in oklch longer hue to bottom,
                    var(--start-bg),
                    var(--end-bg)
                )
                1 100%
            ;

    & > section {
        container-type: inline-size;
        width: 100%;
        height: 100vh;
        display: grid;
        position: relative;
        align-items: center;
        justify-items: center;
        text-align: center;
        padding: 0;
        scroll-snap-align: center;
        grid-auto-rows: max-content;
        align-content: center;
        overflow-y: hidden;
        --background-color: color-mix(in oklch longer hue,  var(--start-bg), var(--end-bg) calc(100% * var(--slide-number)));      
        background-color: var(--background-color);
        padding: 1svw;

        & mjx-container * {
            line-height: revert;
        }

        &:focus {
            outline: none;
        }

        & > :is(h1, h2) {
            align-self: start;
            padding: 0 1em;
            line-height: 1.2em;
        }

        &:not(#start):has(> h1:first-child) {
            display: flex;
            flex-direction: column;
            & > h1:first-child {
                flex-grow: 1;
                align-self: center;
            }
            
            &::after {
                content: ' ';
                flex-grow: 1;
            }
        }
        
        
        & h2 {
            margin: 1rem 0 0 0;
        }

        & math[display="block"] {
            margin: 2em 0;
        }

        & > details {

            & summary {
                position: absolute;
                left: 0;
                width: 100%;
                text-align: start;
                color: transparent;
                margin-top: -2lh;
                
                &::marker {
                    color: var(--text-color);
                }
            }
        }


        & pre {
            padding: 0.5rem;
            max-width: 100%;
            text-align: start;
            overflow: auto;
            max-height: 8rem;
            font-size: 0.8em;
            background: color-mix(in oklab, var(--background-color), var(--bg) 50%);
        }

        & :is(ul,ol) {
            width: 100%;
            padding-left: 2em;

            &.markers {
                list-style-position: inside;

                & li {
                    list-style-type: var(--marker);

                    &::marker {
                        font-size: 1.5em;
                    }
                }
            }

            & li {
                text-align: left;
            }

            &:has(li > img.bullet) {
                list-style: none;
                padding-left: 0;
                
                
                & li {
                    position: relative;
                    padding-left: 6em;
                    min-height: 2em;
                    
                    & img.bullet {
                        height: 3em;
                        width: calc(16 / 9 * 3em);
                        position: absolute;
                        left: 0;
                        top: -0.5em;
                    }
                }
            }


            & > li ~ li {
                margin-top: 0.5lh;
            }
        }

        & p:has(img, svg, video, iframe) {
            max-width: 90%;
            max-height: 60vh;
            display: grid;
            align-items: center;
            justify-items: center;
            margin: 1rem 0;
            
            grid-template: 1fr / auto;
        }
        & :is(img, svg, video, iframe):not(.inline, .bullet) {
            max-width: 100%;
            max-height: 60vh;
            border-radius: var(--border-radius) var(--more-border-radius) var(--border-radius) var(--more-border-radius);
        }

        & .inline {
            height: 2ex;
        }
        
        & :is(figure, p, blockquote) {
            margin: 0;
        }
        
        & figure {
            width: 100%;
        }

        & p:not(:has(numbas-exam)) {
            text-wrap: balance;
            word-break: keep-all;
        }
        & :is(figure, p, blockquote) + :is(figure, p, blockquote) {
            margin-top: 1lh;
        }

        & .full-height {
            max-height: 90vh;
        }

        & blockquote {
            line-height: 1.8em;
        }
        & iframe {
          width: 80%;
          height: 60vh;
        }

        & dl {
            text-align: left;

            & dt {
                font-weight: bold;
            }
            & dd ~ dt {
                margin-top: 1lh;
            }
        }

        & table {
            border-collapse: collapse;

            & :is(td,th):not(:first-child) {
                border-left: thin solid;
            }

            & thead tr:last-child th {
                border-bottom: thin solid;
            }

            & :is(td,th) {
                vertical-align: top;
            }

            & ul {
                margin: 0;
            }
        }
    }

    & #start {
        --slide-number: 0;

        & > * {
            margin: 1rem 0;
        }
        & img {
            border-radius: 0;
            border: none;
        }
        
        & #logo {
            width: 50%;
        }

        & .event {
            font-style: italic;
        }
    }
}

dl.grid {
    display: grid;
    
    & dt {
        grid-row: 1;
        justify-self: center;
        align-self: end;
    }
    & dd {
        grid-row: 2;
    }
}


footer {
    position: absolute;
    bottom: 0;
    font-size: min(1svw,0.6em);
    text-align: center;
    right: 0;
    background: var(--bg);
    padding: 0.5em;
}

header {
    font-size: 0.5rem;

    & hr {
        flex-grow: 1;
    }

    & a {
        text-decoration: none;
    }
}

footer #url {
    color: var(--muted-color);
    text-decoration: none;
}

@media print {
    main {
        & > section {
            page-break-before: always;
        }
    }
}

@media (orientation: portrait), print {
    header {
        margin-bottom: 10vh;
        justify-content: center;
        
        & svg {
            width: 50vw;
            max-height: 30vh;
        }
        & #qrcode {
            display: none;
        }
        
        display: flex;
        flex-direction: column;
    }
    
    main {
        overflow: initial;
        height: auto;

        & > section {
            height: auto;
            scroll-snap-align: none;
            padding: 5em 1em;

            & + section {
                border-top: 0.5vh dashed white;
            }

            & details > summary {
                display: none;
            }

        }
        
        & dl.grid {
            grid-auto-flow: row;
            gap: 1em;

            & dt {
                grid-row: initial;
                grid-column: 1;
                justify-self: end;
                align-self: center;
                margin: 0;
            }
            & dd {
                grid-row: initial;
                grid-column: 2;
                margin: 0;
                & :is(img, svg, video) {
                    max-width: 30vw;
                }
            }
        }        
    }
    
    footer {
        position: initial;
        padding: 1em;
        margin-top: 10vh;
    }
}

@media print {
    main {
        & section {
            height: 100vh;
        }
        & section + section {
            padding: 0;
        }
    }
}

numbas-exam {
    display: block;
    max-height: calc(100svh - 5rem);
    width: calc(100cqw - var(--spacing));
    overflow: auto;
    border-radius: var(--more-border-radius);

    font-size: 18px;
    text-align: start;

    --base-text-size: 18px;
    --text-size: 1;
    --line-height: 1.5em;

    --border-width: thin;

    --main-font: sans-serif;

    --readable-width: 80ch;

    --content-max-width: calc(1.3 * var(--readable-width));

    --spacing-scale: 1;
    --spacing: calc(1 * var(--base-text-size) * var(--spacing-scale));
    --half-space: calc(0.5 * var(--spacing));
    --third-space: calc(1 / 3 * var(--spacing));
    --two-thirds-space: calc(2 / 3 * var(--spacing));
    --double-space: calc(2 * var(--spacing));
    --quad-space: calc(4 * var(--spacing));

    --font-weight: 400;
    --font-weight-bold: calc(700 / 400 * var(--font-weight));

    --main-font: sans-serif;

    --text-pad: calc(0.1 * var(--spacing));
    --double-text-pad: calc(2 * var(--text-pad));
    --quad-text-pad: calc(4 * var(--text-pad));

    --transition-duration: 0.5s;
    --half-transition: calc(0.5 * var(--transition-duration));
    --double-transition: calc(2 * var(--transition-duration));
    --quad-transition: calc(4 * var(--transition-duration));

    --button-radius: 0.2em;

}
exam-container {
    border-radius: 1em;
}
@font-face{
  font-family:'FontAwesome';
  src:url('numbas-runtime/iconfont/fontawesome.eot?v=3.0.1');
  src:url('numbas-runtime/iconfont/fontawesome.eot?#iefix&v=3.0.1') format('embedded-opentype'),
  url('numbas-runtime/iconfont/fontawesome.woff?v=3.0.1') format('woff'),
  url('numbas-runtime/iconfont/fontawesome.ttf?v=3.0.1') format('truetype');
  font-weight:normal;
  font-style:normal
}
