
html {
    --c-bg-backdrop:        #0d1015;
    --c-bg-behind:          #1f232a;
    --c-bg-front:           #272c35;
    --c-bg-highlight:       #383f4c;
    --c-bg-figure-backdrop: #383f4c;
    --c-text:               #d0d0d0;
    --c-text-inverted:      #101010;
    --c-text-muted:         #a0a0a0;
    --c-text-highlight:     #ffffff;
    --c-fg-highlight:       #e0e0e0;
    --c-fg-primary:         #fc00b9;
    --c-bg-primary:         #fc0daf;
    --c-fg-secondary:       #ff9449;
    --c-bg-secondary:       #ff9449;

    --shadow-opacity: 0.8;

    --default-border: 0.5px dotted rgba(255, 255, 255, 0.3);
}

/*
@font-face {
    font-family: "Manuskript Gothisch";
    src: url("/fonts/manuskript_gothisch/Manuskript%20Gothisch%20UNZ1A.ttf");
}
*/

@font-face {
    font-family: "Nyght Serif";
    src: url("/fonts/nyght-serif-main/fonts/WEB/NyghtSerif-Light.woff2");
    font-weight: 100;
}

@font-face {
    font-family: "Nyght Serif";
    src: url("/fonts/nyght-serif-main/fonts/WEB/NyghtSerif-LightItalic.woff2");
    font-weight: 100;
    font-style: italic;  
}

@font-face {
    font-family: "Nyght Serif";
    src: url("/fonts/nyght-serif-main/fonts/WEB/NyghtSerif-Regular.woff2");
    font-weight: 400;
}

@font-face {
    font-family: "Nyght Serif";
    src: url("/fonts/nyght-serif-main/fonts/WEB/NyghtSerif-RegularItalic.woff2");
    font-weight: 400;
    font-style: italic;  
}

@font-face {
    font-family: "Nyght Serif";
    src: url("/fonts/nyght-serif-main/fonts/WEB/NyghtSerif-Medium.woff2");
    font-weight: 500;
}

@font-face {
    font-family: "Nyght Serif";
    src: url("/fonts/nyght-serif-main/fonts/WEB/NyghtSerif-MediumItalic.woff2");
    font-weight: 500;
    font-style: italic;  
}

@font-face {
    font-family: "Nyght Serif";
    src: url("/fonts/nyght-serif-main/fonts/WEB/NyghtSerif-Bold.woff2");
    font-weight: 700;
}

@font-face {
    font-family: "Nyght Serif";
    src: url("/fonts/nyght-serif-main/fonts/WEB/NyghtSerif-BoldItalic.woff2");
    font-weight: 700;
    font-style: italic;  
}

@font-face {
    font-family: "Nyght Serif";
    src: url("/fonts/nyght-serif-main/fonts/WEB/NyghtSerif-Dark.woff2");
    font-weight: 900;
}

@font-face {
    font-family: "Nyght Serif";
    src: url("/fonts/nyght-serif-main/fonts/WEB/NyghtSerif-DarkItalic.woff2");
    font-weight: 900;
    font-style: italic;  
}

@font-face {
    font-family: "Roboto Slab";
    src: url("/fonts/roboto_slab/RobotoSlab-VariableFont_wght.ttf") format("truetype-variations");
    font-weight: 100 200 300 400 500 600 700 800 900;
}

/*
@font-face {
    font-family: "Bodoni Moda";
    src: url("/fonts/bodoni_moda/static/BodoniModa_9pt/BodoniModa_9pt-MediumItalic.ttf");
    font-style: italic;  
}

@font-face {
    font-family: "Bodoni Moda";
    src: url("/fonts/bodoni_moda/static/BodoniModa_18pt/BodoniModa_18pt-Medium.ttf");
}
*/

@font-face {
    font-family: "Fira Code";
    src: url("/fonts/fira_code/FiraCode-VariableFont_wght.ttf") format("truetype-variations");
    font-weight: 300 400 500 600 700;
}

html, body {
    border: 0;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

body {
    position: relative; /* important for sizing of background image ::before pseudo-element */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    font-family: "Roboto Slab";
    font-weight: 350;
    color: var(--c-text);
}

body::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    z-index: -1000;
    width: 100%;
    height: 100%;
    /* linear-gradient(hsl(0 0% 100% / 0%), hsl(240 20% 12% / 100%)),  */
    background:
        linear-gradient(to bottom, hsl(0 0% 8% / 80%), hsl(0 0% 3% / 95%)),
        linear-gradient(hsl(220 15% 18%), hsl(220 15% 18%)),
        center 20% / cover space no-repeat fixed url("/images/fabrizio-conti-TUmjK7ZJgbI-unsplash.jpg"),
        var(--c-bg-backdrop);
    background-blend-mode: luminosity, color, normal;
}

::selection {
    background-color: var(--c-bg-secondary);
    color: var(--c-text-inverted);
}

strong {
    font-family: "Nyght Serif";
    font-style: italic;
}

a:hover, a:visited, a:active, a:link {
    color: var(--c-fg-secondary);
    text-decoration: none;
}

a:hover {
    background: var(--c-bg-primary);
    color: var(--c-text);
}

nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    background-color: var(--c-bg-front);
    box-shadow: 0 0 3px 2px hsl(0 0% 10% / var(--shadow-opacity));
    padding: 0 10px 0 10px;
    justify-content: space-between;
}

nav > div {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
    border-top: var(--default-border);
    margin-top: -1px;
}

nav a:link, nav a:active, nav a:visited, nav a:hover {
    flex-grow: 1;
    text-align: center;
    color: inherit;
    padding: 10px 10px 10px 10px;
}

nav a:hover {
    background: var(--c-bg-primary);
}

.breadcrumbs {
    max-width: 40em;
    text-align: center;
    align-self: center;
    margin: 0;
    padding: 0;
}

.breadcrumbs li {
    list-style: none;
    display: inline;
}

.breadcrumbs li + li::before {
    content: "/";
    margin: 0 5px 0 5px;
}

main::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(10px);
    z-index: -1;
}

main {
    position: relative;
    align-self: center;
    margin-top: -100px;
    padding: 100px;
    max-width: min(100%, 60em);
    box-sizing: border-box;
    box-shadow: 0 0 3px 2px hsl(0 0% 10% / calc(0.6 * var(--shadow-opacity)));
    text-align: justify;
    background-color: hsl(260 5% 20% / 40%);
    hyphens: auto;
}

main > .intro {
    margin-top: 40px;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 50px;
    margin-bottom: 8px;
    font-family: "Nyght Serif";
    text-align: left;
    font-weight: 700;
}

h1 {
    font-style: italic;  
}

h2 {
    font-size: 30px;
    font-weight: 400;
}

h3 {
    font-size: 20px;
    font-weight: 700;
}

/* Prevent long literals from breaking the page layout's width */ 
span.pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    overflow-wrap: anywhere;
}

body > header {
    z-index: 1;
    margin-top: 100px;
    margin-bottom: 200px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

body > header > h1 {
    text-align: center;
    background-image: linear-gradient(to right, var(--c-fg-primary), var(--c-fg-secondary)); 
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, var(--shadow-opacity)));
    font-size: clamp(20px, 60px, min(10vw, 10vh));
    /* Padding to avoid the first character getting cut off in firefox */
    padding-left: 40px;
    padding-right: 40px;
}

/* https://css-tricks.com/linearly-scale-font-size-with-css-clamp-based-on-the-viewport/ */
/*
body > header > h1::first-line {
  --min-fs: 3;
  --max-fs: 10;
  --min-vw: 20;
  --max-vw: 40;

  --min-fs-rem: var(--min-fs) * 1rem;
  --max-fs-rem: var(--max-fs) * 1rem;
  --min-vw-rem: var(--min-vw) * 1rem;

  --slope: (var(--max-fs) - var(--min-fs)) * (100vw - var(--min-vw-rem)) / (var(--max-vw) - var(--min-vw));

  font-size: clamp(var(--min-fs-rem), var(--min-fs-rem) + var(--slope), var(--max-fs-rem));
}
*/

.pagination-links {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.pagination-links > a {
    background-color: var(--c-bg-front);
    box-shadow: 0 0 3px 1px rgba(0, 0, 0, calc(0.25*var(--shadow-opacity)));
    padding: 10px 20px 10px 20px;
}

.pagination-links > a:hover {
    background: var(--c-bg-primary);
}

.arrow-right {
  display: inline-block;
  width: 0; 
  height: 0; 
  border-top: .3rem solid transparent;
  border-bottom: .3rem solid transparent;
  border-left: .3rem solid ;
  margin-bottom: .05rem;
  margin-left: 5px;
}

.card {
    background-color: var(--c-bg-front);
    box-shadow: 0 0 3px 1px rgba(0, 0, 0, calc(0.25*var(--shadow-opacity)));
    padding: 30px 20px 30px 20px;
    margin-top: 50px;
    margin-bottom: 30px;
}

.card > .links {
    margin-left: -20px;
    margin-bottom: -30px;
    border-top: var(--default-border);
    margin-top: 20px;
    width: calc(100% + 40px);
    display: flex;
    flex-direction: row;
    justify-content: space-around;
}

.card > .links > a {
    padding: 10px 10px 10px 10px;
    flex-grow: 1;
    text-align: center;
}

main > .links {
    margin: 20px 0px 40px 0px;
    border: var(--default-border);
    border-left: none;
    border-right: none;
    width: calc(100%);
    max-width: calc(100%);
    display: flex;
    flex-flow: row wrap;
    justify-content: space-around;
}

main > .links > a {
    padding: 10px 10px 10px 10px;
    flex-grow: 1;
    text-align: center;
}

/* un-mess-up rst2html output */
.card > .summary > .document, .card > .summary > .document > p {
    display: inline;
}

.card > h1,
.card > h2,
.card > h3,
.card > h4,
.card > h5,
.card > h6 {
    margin-top: 0px;
}

tt {
    font-family: "Fira Code";
    font-weight: bold;
    font-size: 14px;
}

cite {
    font-family: "Fira Code";
    font-weight: bold;
    font-size: 14px;
    font-style: normal;
}

figure {
    margin-top: 2em;
    margin-bottom: 2em;
    margin-left: auto;
    margin-right: auto;
    background-color: var(--c-bg-figure-backdrop);
    box-shadow: 0 0 3px 2px rgba(0, 0, 0, calc(0.6*var(--shadow-opacity)));
    display: flex;
    flex-direction: column;
}

.subfigure {
    margin-top: 2em;
    margin-bottom: 2em;
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-items: stretch; 
    align-items: stretch;
    column-gap: 40px;
    row-gap: 40px;
}

.subfigure > figure {
    margin-top: 0;
    margin-bottom: 0;
}

figure.side-by-side {
    min-width: 15em;
    margin: 0 0 0 0;
    padding: 0 40px 0 0;
}

figure img, figure video {
    display: block;
    margin: 0 auto 0 auto;
    width: 100%;
}

figcaption {
    background-color: var(--c-bg-highlight);
    line-height: 16pt;
    padding: 1em;
    flex-grow: 1;
}


figure.header {
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
}

img {
    max-width: 100%;
    margin: 40px auto 40px auto;
    display: block;
    filter: brightness(70%);
    transition: filter 100ms;
}

img:hover {
    filter: none;
}

/*****************************************************/
/* Code block formatting / syntax highlighting rules */
/*****************************************************/

.code {
    font-family: "Fira Code";
    font-size: 13px;
    text-align: left; /* Override default content "justify" alignment */
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    display: grid;
    align-items: start;
    grid-template-columns: min-content 1fr;
}

.code > .line {
    padding-left: calc(2em + 5px);
    text-indent: -2em;
    padding-top: 2px;
    min-width: 15em;
}

/* Make individual syntax tokens wrap anywhere */
.code > .line > span {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* We render line numbers in CSS! */
.code > .lineno {
    counter-increment: lineno;
    word-break: keep-all;
    margin: 0;
    padding-left: 15px;
    padding-right: 5px;
    overflow: clip;
    position: relative;
    text-align: right;
    color: var(--c-text-muted);
    border-right: 1px solid var(--c-fg-highlight);
    align-self: stretch;
}

/* We also handle line continuation markers in CSS. */
.code > .lineno::after {
    position: absolute;
    right: 5px;
    content: "\a↳\a↳\a↳\a↳\a↳\a↳\a↳\a↳\a↳\a↳\a↳\a↳\a↳\a↳\a↳\a↳\a↳\a↳";
    white-space: pre;
    color: var(--c-text-muted);
}

/* Insert the actual line number */
.code > .lineno::before {
    content: counter(lineno);
}

.code::before {
    counter-reset: lineno;
}

/* Token styling rules for syntax highlighting */
.code .hll {}
.code .c   { color: var(--c-text); font-weight: 400 } /* Comment */
.code .n   { color: var(--c-text); font-weight: 400 } /* Name */
.code .o   { color: var(--c-text); font-weight: 400 } /* Operator */
.code .cm  { color: var(--c-text); font-weight: 400 } /* Comment.Multiline */
.code .cp  { color: var(--c-text); font-weight: 400 } /* Comment.Preproc */
.code .c1  { color: var(--c-text); font-weight: 400 } /* Comment.Single */
.code .cs  { color: var(--c-text); font-weight: 400 } /* Comment.Special */
.code .nd  { color: var(--c-text); font-weight: 400 } /* Name.Decorator */
.code .nn  { color: var(--c-text); font-weight: 400 } /* Name.Namespace */
.code .vc  { color: var(--c-text); font-weight: 400 } /* Name.Variable.Class */
.code .vg  { color: var(--c-text); font-weight: 400 } /* Name.Variable.Global */
.code .vi  { color: var(--c-text); font-weight: 400 } /* Name.Variable.Instance */
.code .err { color: var(--c-text-highlight); font-weight: 500 } /* Error */
.code .k   { color: var(--c-text-highlight); font-weight: 500 } /* Keyword */
.code .l   { color: var(--c-text-highlight); font-weight: 500 } /* Literal */
.code .kc  { color: var(--c-text-highlight); font-weight: 500 } /* Keyword.Constant */
.code .kd  { color: var(--c-text-highlight); font-weight: 500 } /* Keyword.Declaration */
.code .kn  { color: var(--c-text-highlight); font-weight: 500 } /* Keyword.Namespace */
.code .kp  { color: var(--c-text-highlight); font-weight: 500 } /* Keyword.Pseudo */
.code .kr  { color: var(--c-text-highlight); font-weight: 500 } /* Keyword.Reserved */
.code .kt  { color: var(--c-text-highlight); font-weight: 500 } /* Keyword.Type */
.code .na  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Attribute */
.code .nb  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Builtin */
.code .nc  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Class */
.code .no  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Constant */
.code .ni  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Entity */
.code .ne  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Exception */
.code .nf  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Function */
.code .nl  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Label */
.code .nx  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Other */
.code .py  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Property */
.code .nt  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Tag */
.code .nv  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Variable */
.code .ow  { color: var(--c-text-highlight); font-weight: 500 } /* Operator.Word */
.code .bp  { color: var(--c-text-highlight); font-weight: 500 } /* Name.Builtin.Pseudo */
.code .ld  { color: var(--c-text); font-weight: 600 } /* Literal.Date */
.code .m   { color: var(--c-text); font-weight: 600 } /* Literal.Number */
.code .s   { color: var(--c-text); font-weight: 600 } /* Literal.String */
.code .mb  { color: var(--c-text); font-weight: 600 } /* Literal.Number.Bin */
.code .mf  { color: var(--c-text); font-weight: 600 } /* Literal.Number.Float */
.code .mh  { color: var(--c-text); font-weight: 600 } /* Literal.Number.Hex */
.code .mi  { color: var(--c-text); font-weight: 600 } /* Literal.Number.Integer */
.code .mo  { color: var(--c-text); font-weight: 600 } /* Literal.Number.Oct */
.code .sb  { color: var(--c-text); font-weight: 600 } /* Literal.String.Backtick */
.code .sc  { color: var(--c-text); font-weight: 600 } /* Literal.String.Char */
.code .sd  { color: var(--c-text); font-weight: 600 } /* Literal.String.Doc */
.code .s2  { color: var(--c-text); font-weight: 600 } /* Literal.String.Double */
.code .se  { color: var(--c-text); font-weight: 600 } /* Literal.String.Escape */
.code .sh  { color: var(--c-text); font-weight: 600 } /* Literal.String.Heredoc */
.code .si  { color: var(--c-text); font-weight: 600 } /* Literal.String.Interpol */
.code .sx  { color: var(--c-text); font-weight: 600 } /* Literal.String.Other */
.code .sr  { color: var(--c-text); font-weight: 600 } /* Literal.String.Regex */
.code .s1  { color: var(--c-text); font-weight: 600 } /* Literal.String.Single */
.code .ss  { color: var(--c-text); font-weight: 600 } /* Literal.String.Symbol */
.code .il  { color: var(--c-text); font-weight: 600 } /* Literal.Number.Integer.Long */

footer {
    margin-top: 30px;
    align-self: center;
    margin-bottom: 10px;
    text-align: center;
    padding: 5px 25px 5px 25px;
}

@media (max-width: 40em) {
    nav > div {
        flex-grow: 1;
    }

    main {
        padding-left: 20px;
        padding-right: 20px;
    }
}

.search {
    align-self: center;
    max-width: calc(100vw - 20px);
    flex-grow: 1;
    margin-left: 10px;
    margin-right: 10px;
}

.pagefind-ui__form {
    max-width: 100%;
}

.search input {
    height: 1.5lh;
    max-width: 100%;
}

#search, .pagefind-ui, #search form, #search input {
    width: 100%;
}

.search button {
    display: none;
}

.pagefind-ui__drawer {
    position: fixed;
    margin-top: 10px;
    background: var(--c-bg-highlight);
    max-width: min(100%, min(100vw, 40em));
    max-height: 100%;
    overflow-x: clip;
    overflow-y: scroll;
    text-overflow: clip;
    z-index: 100;
}

.pagefind-ui__message {
    font-family: "Nyght Serif";
    font-weight: 700;
    font-size: 16pt;
}

.pagefind-ui__results-area {
    padding: 10px;
}

.pagefind-ui__results-area img {
    max-width: min(50vw, 200px);
}

.pagefind-ui__results-area a {
    max-width: min(50vw, 200px);
    color: var(--c-fg-secondary) !important;
    text-decoration: none;
    padding: 10px 10px 10px 0 !important;
    font-family: "Nyght Serif";
    font-weight: 700;
    font-size: 12pt;
}

.pagefind-ui__results-area figure, .pagefind-ui__results-area div.subfigure, .pagefind-ui__results-area img {
    display: none;
}

@media print, (prefers-color-scheme: light) {
    html {
        --c-bg-backdrop:        hsl(220, 10%, 90%);
        --c-bg-behind:          hsl(220, 10%, 95%);
        --c-bg-front:           hsl(220, 10%, 96%);
        --c-bg-highlight:       #ffffff;
        --c-bg-figure-backdrop: #b5bcc8;
        --c-text:               hsl(220, 20%, 30%);
        --c-text-inverted:      hsl(220, 20%, 100%);
        --c-text-muted:         #5d5980;
        --c-text-highlight:     #000000;
        --c-fg-highlight:       #3c4b62;
        --c-fg-primary:         hsl(25, 100%, 64%);
        --c-bg-primary:         hsl(25, 100%, 64%);
        --c-fg-secondary:       hsl(319, 98%, 52%);
        --c-bg-secondary:       hsl(319, 98%, 52%);

        --shadow-opacity: 0.2;

        --default-border: 0.5px dotted hsla(220, 10%, 30%, 50%);
    }

    body::before {
        background:
            linear-gradient(to bottom, hsl(0 0% 100% / 70%), hsl(0 0% 90% / 80%)),
            linear-gradient(hsl(260 10% 10%), hsl(260 10% 10%)),
            center 20% / cover space no-repeat fixed url("/images/fabrizio-conti-TUmjK7ZJgbI-unsplash.jpg"),
            var(--c-bg-backdrop);
    }

    main::before {
        backdrop-filter: brightness(106%) blur(10px);
    }

    main {
        background-color: hsl(260 5% 90% / 40%);
    }

    body > header > h1 {
        filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.4));
    }

    a:hover, nav a:hover {
        color: var(--c-text-inverted);
    }

    img {
        filter: none;
    }
    
    .card {
        box-shadow: 0 0 3px 1px rgba(0, 0, 0, calc(0.5*var(--shadow-opacity)));
    }
}

@media print, (max-width: 60em) {
    main::before {
        backdrop-filter: none;
    }
    
    main {
        background-color: hsl(230 10% 15%);
    }
}

@media print, (max-width: 60em) and (prefers-color-scheme: light) {
    main {
        background-color: hsl(260 5% 90%);
    }
}

