<script>
    import Header from "$lib/viewport/header.svelte";
    import Footer from "$lib/viewport/footer.svelte";

	let { children } = $props();
</script>

<div class="waters"></div>
<div class="all-content-container">
    <Header />

    {@render children()}

    <Footer />
</div>

<style>
    /* #region New Fonts */
    /* Bai Jamjuree. wght: 200-700 */

    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/extralight.ttf");
        font-weight: 200;
    }
    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/extralight-italic.ttf");
        font-weight: 200;
        font-style: italic;
    }
    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/light.ttf");
        font-weight: 300;
    }
    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/light-italic.ttf");
        font-weight: 300;
        font-style: italic;
    }
    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/regular.ttf");
        font-weight: 400;
    }
    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/italic.ttf");
        font-weight: 400;
        font-style: italic;
    }
    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/medium.ttf");
        font-weight: 500;
    }
    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/medium-italic.ttf");
        font-weight: 500;
        font-style: italic;
    }
    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/semibold.ttf");
        font-weight: 600;
    }
    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/semibold-italic.ttf");
        font-weight: 600;
        font-style: italic;
    }
    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/bold.ttf");
        font-weight: bold;
    }
    @font-face {
        font-family: "Bai Jamjuree";
        src: url("/fonts/bai-jamjuree/bold-italic.ttf");
        font-weight: bold;
        font-style: italic;
    }

    /* Kode Mono. wght: 400-700 */
    @font-face {
        font-family: "Kode Mono";
        src: url("/fonts/kode-mono/variable-wght.ttf");
        font-weight: 400 700;
        font-style: normal;
    }
    /* #endregion */

    :global {
        :root {
            /* colours */
            --color-text: #d0d0d0;
            --color-text-secondary: #b0b0b0;
            --color-text-img: invert(98%) sepia(1%) saturate(4643%) hue-rotate(297deg) brightness(115%) contrast(76%);
            --color-text-dark: #1e1e1e;
            --color-highlight: #51B86B;
            --color-highlight-dark: color-mix(in srgb, var(--color-highlight) 60%, black);
            --color-highlight-alt: #d03b4a;
            --color-header: color-mix(in srgb, var(--color-highlight) 80%, black);
            --color-header-highlight: color-mix(in srgb, #6d1e26 80%, transparent);

            --color-background: #111111;
            --color-background-highlight: color-mix(in srgb, var(--color-highlight) 10%, transparent);
            --color-background-highlight-hover: color-mix(in srgb, var(--color-highlight) 60%, transparent);
            --color-background-highlight-hover-dark: color-mix(in srgb, var(--color-highlight-dark) 60%, transparent);
            
            --color-waters: #242424;

            --color-link-unvisited: #c2e8ff;
            --color-link-visited: #ffd7f0;
            --color-link-hovered: #ffdad5;

            /* blurs */
            --blur-radius-background: 6px;

            /* borders */
            --border-dash-sizing: 2px;
            
            /* durations */
            --duration-animation: 0.1s;
            --duration-blur: 0.2s;

            /* fonts */
            --font-line-height: 1.6rem;

            --font-sans-serif: 'Bai Jamjuree', sans-serif;
            --font-size-sans-serif: 1.1rem;

            --font-mono: 'Kode Mono', monospace;
            --font-size-mono: 0.9em;

            --font-size-h1: 2.0rem;
            --font-size-h2: 1.5rem;
            --font-size-h3: 1.3rem;
            --font-size-h4: 1.2rem;

            --margin-header-top: 16px;
            --margin-header-bottom: 8px;

            /* sizing */
            --media-width: 80%;

            /* page sizing */
            --page-width: 900px;
            --screen-width-mobile: 800px;

            --margin-content-side: 24px;

            /* misc */
            --notch-size: 32px;
            --notch-size-small: 16px;
        }

        html {
            scroll-behavior: smooth;
            position: relative;
            min-height: 100%;
        }

        body {
            font-family: var(--font-sans-serif);
            font-size: 1.2rem;
            color: var(--color-text); /* text colour */
            
            margin: 0;
            background-color: var(--color-background);
        }

        .all-content-container {
            display: flex;
            flex-direction: column;
            height: 100vh;
            /* max-width: 100%; */
        }

        .waters {
            position: fixed;
            z-index: -99;
            top: 0;
            left: 0;
            height: 100%;
            width: 100%;
            background-color: var(--color-waters);
            mask-image: url('/bremen-waters-white.svg');
            mask-position: center;
            background-position: center;
            background-attachment: fixed;
        }

        p, span, li, pre, a {
            color: var(--color-text);
            font-size: var(--font-size-sans-serif);
            line-height: var(--font-line-height);
            margin: 12px 0;
            font-weight: 400;
        }

        button {
            background-color: transparent;
            border: none;
            padding: 0;
        }

        /* #region Headers */
        /* All headers */
        h1, h2, h3, h4, h5, h6 {
            font-weight: 700;
            font-family: var(--font-mono);
            color: var(--color-highlight);
            margin-top: var(--margin-header-top);
            margin-bottom: var(--margin-header-bottom);
            width: fit-content;
        }

        h2 + h3, h3 + h4, h4 + h5, h5 + h6 {
            /* Remove top margin when a header immediately preceds another header */
            margin-top: 0;
        }

        /* Individual header settings */
        h1 {
            font-size: var(--font-size-h1);
            line-height: var(--font-size-h1);
        }

        h2 {
            font-size: var(--font-size-h2);
            line-height: var(--font-size-h2);
        }
        h2::before {
            content: '> ';
            margin-right: 12px;
        }

        h3 {
            font-size: var(--font-size-h3);
            line-height: var(--font-size-h3);
        }
        h3::before {
            content: '>> ';
            margin-right: 4px;
        }

        h4, h5, h6 {
            font-size: var(--font-size-h4);
            line-height: var(--font-size-h4);
        }
        h4::before {
            letter-spacing: -0.26rem;
            content: '>>> ';
            margin-right: 14px;
        }
        /* #endregion */

        hr {
            width: 100%;
            height: 1px;
            border: none;
            border-top: var(--border-dash-size) dashed var(--color-highlight);
            margin: 8px 0;
        }

        code, .code-block {
            font-family: var(--font-mono);
            font-size: var(--font-size-mono);
            line-height: var(--font-line-height);
            font-weight: 500;
            background-color: var(--color-background-highlight);
            /* color: var(--color-background); */
            border-radius: 8px;
            padding-left: 6px;
            padding-right: 6px;
        }

        img, video {
            width: var(--media-width);
            margin-left: auto;
            margin-right: auto;
            display: flex;
            max-height: 400px;
            object-fit: contain;
        }

        .horizontally-centre-aligned {
            width: var(--media-width);
            display: flex;
            justify-content: center;
            align-items: center;
            margin-left: auto;
            margin-right: auto;
        }

        .inline-img-left {
            float: left;
            max-width: 24%;
            margin: 0 24px 24px 0;
        }

        .inline-img-right {
            float: right;
            max-width: 24%;
            margin: 0 0 24px 24px;
        }

        a:link {
            color: var(--color-link-unvisited);
            text-decoration-style: dashed;
        }
        /* visited link */
        a:visited {
            color: var(--color-link-visited);
        }
        /* mouse over link */
        a:hover {
            color: var(--color-link-hovered);
            text-decoration-thickness: 1px;
        }

        .notched {
            clip-path: polygon(
                0% var(--notch-size), 
                var(--notch-size) 0%, 
                calc(100% - var(--notch-size)) 0%, 
                100% var(--notch-size), 
                100% calc(100% - var(--notch-size)), 
                calc(100% - var(--notch-size)) 100%, 
                var(--notch-size) 100%, 
                0% calc(100% - var(--notch-size))
            );
        }

        .notched-small {
            clip-path: polygon(
                0% var(--notch-size-small), 
                var(--notch-size-small) 0%, 
                calc(100% - var(--notch-size-small)) 0%, 
                100% var(--notch-size-small), 
                100% calc(100% - var(--notch-size-small)), 
                calc(100% - var(--notch-size-small)) 100%, 
                var(--notch-size-small) 100%, 
                0% calc(100% - var(--notch-size-small))
            );
        }

        .pixelated-img {
            image-rendering: pixelated;
        }

        .small-supertext {
            font-size: 0.7rem;
            line-height: 0.7rem;
            vertical-align: super;
        }
        
        /* #region Lists (ul and LinkList) */
        .list, ul {
            padding: 0;
            display: table;
        }

        .list a, li {
            width: 100%;
            list-style-type: none;
            display: table-row;
        }
        .list a::before, li::before {
            content: "–";
            font-family: var(--font-mono);
            font-weight: bold;
            color: var(--color-highlight);
            display: table-cell;
            padding-left: 12px;
            padding-right: 8px;
        }
        .list a:hover::before {
            content: ">";
        }
        .list a:link, .list a:visited, li {
            color: var(--color-text);
            text-decoration: none;
        }
        .list a:hover {
            color: var(--color-highlight);
        }

        .list img {
            filter: var(--color-text-img);
            margin-top: 4px;
            margin-bottom: -4px;
            width: fit-content !important;
            margin-left: 0;
            margin-right: 0;
            display: inline;
        }
        /* #endregion */

        .date-marker {
            font-size: 1rem;
            font-weight: 700;
            line-height: 1rem;
            width: fit-content;
            margin: 0;
            padding: 0;
            
            color: var(--color-text-dark);
            background-color: var(--color-highlight);
            font-family: var(--font-sans-serif);
            padding: 4px;
        }

        @media screen and (max-width: 800px) {
            /* h1 {
                font-size: 2.3rem;
                line-height: 2.4rem;
            }

            h2 {
                font-size: 1.8rem;
                line-height: 1.8rem;
            }

            h3 {
                font-size: 1.6rem;
                line-height: 1.6rem;
            }

            h4, h5, h6 {
                font-size: 1.4rem;
                line-height: 1.4rem;
            } */

            /* p, span, li, pre, a {
            } */
        }
    }
</style>