:root {
    color-scheme: light;

    --background: #fff;
    --background-2: #ededed;
    --text: #000;
    --text-light: #444;
    --text-lighter: #666;

    --primary: #1c71d8;
    --complementary: #ea9e41;

    --url-color: rgb(33, 144, 255);

    --font-size: 16px;
    --line-height: 1.35;


    /* syntax highligthing theme: */
    --sh-blue: #1186D9;/* Names */
    --sh-green: #2bc915;/* Keyword */
    --sh-orange: #D4480F;/* Namespace, Regex */
    --sh-red:#DC322F;/* Error */
    --sh-brown: #B58900;/* Type */
    --sh-purple: #D33682; /* preprocessors */
    --sh-teal: #0e9388; /* constants, strings, numbers */

    --sh-bg: #f9feff;
    --sh-bg-hll: #bedbe2;
    --sh-fg: #2e2e2e;
    --sh-fg-faint: #838383; /* comments */
    --sh-hilite-bg: #ffffc0;
    --sh-hilite-fg: #000;
}
:root.theme-dark {
    color-scheme: dark;
    --background: #000;
    --background-2: #333;
    --text: #eee;
    --text-light: #c5c5c5;
    --text-lighter: #8c8c8c;

    --sh-bg: #041b20;
    --sh-bg-hll: #073642;
    --sh-fg: #bbd9dc;
    --sh-fg-faint: #7B9DA7; /* comments */

}

@media (prefers-color-scheme: dark) {
    /* backup non-js theme switching */
    :root:not(.theme-light, .theme-dark) {
        color-scheme: dark;
        --background: #000;
        --background-2: #333;
        --text: #eee;
        --text-light: #c5c5c5;
        --text-lighter: #8c8c8c;

        --sh-bg: #041b20;
        --sh-bg-hll: #073642;
        --sh-fg: #bbd9dc;
        --sh-fg-faint: #7B9DA7; /* comments */
    }

    /* invert svgs as a simple hack */
    svg.latex {
        filter: invert(1);
    }
}

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

html {
    font-family: "Atkinson Hyperlegible Next", sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    font-variation-settings: "wdth" 100;
    font-size: var(--font-size);
    background-color: var(--background);
    color: var(--text);
    line-height: var(--line-height);
}

body {
    display: flex;
    flex-direction: column;
}


code, pre, .monospace {
    font-family: 'Inconsolata', monospace;
    font-variation-settings: "wdth" 100;
    font-optical-sizing: auto;
    font-style: normal;
    white-space: pre-wrap;
}
pre {
    padding: 16px;
}
p code {
    padding: 2px 6px;
    border-radius: 6px;
    color: var(--text-light);
    background-color: var(--background-2);
}

h1, h2, h3 {
    font-weight: 200;
}

h4, h5, h6 {
    font-weight: 600;
}

main {
    max-width: 720px;
    width: 90%;
    margin: auto;
}
header, footer {
    max-width: 1080px;
    width: 90%;
    margin: auto;
}

header {
    margin: 32px auto;
    font-weight: 800;
    letter-spacing: -1px;
    font-size: 2rem;
    display: flex;
}
header .header-subtitle {
    font-weight: 200;
    letter-spacing: 1px;
}
header a svg {
    vertical-align: -.15em;
}
header a:hover {
    color: var(--text);
    text-decoration: none;
}
header .header-aside {
    flex-grow: 1;
    text-align: right;
}

main {
    flex-grow: 1;
}
.meta-info {
  width: auto;
}
table.meta-info tr {
  background: transparent !important;
}
table.meta-info td {
  padding: 6px;
}
.meta-name {
  font-weight: bold;
}

img {
    max-height: 100%;
    max-width: 100%;
}

a[href] {
    text-decoration: none;
    color: var(--url-color);
    transition: .1s;
}

a:hover, a:active, a:focus {
    text-decoration: underline;
}

footer {
    padding: 32px 0;
    display: flex;
    justify-content: space-between;
    color: var(--text-lighter);
    letter-spacing: -.4px;
}

p {
    text-align: justify;
}

ul, ol {
    line-height: 1.5;
}

figure {
    margin: 32px;
}
/* figures get a border */
figure img {
    border: 65px solid var(--text);
    box-sizing: border-box;
}
figure figcaption::before {
    content: 'Figure: ';
    font-weight: bold;
}

figure figcaption {
    font-style: italic;
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow: auto;
}

th, td {
    text-align: left;
    padding: 12px 16px;
}

th {
    font-weight: 500;
    text-transform: uppercase;
    font-weight: bold;
    border-bottom: 2px solid var(--primary);
}

td {
    color: var(--text-light);
}

tbody tr:nth-child(2n+1) {
    background-color: var(--background-2);
    color: var(--text);
}

hr {
border: none;
  height: 1px;
  background-color: #ddd;
  margin: 2rem auto;
  width: 80%;
}

hr:nth-child(2n) {
  transform: rotate(-.4deg);
}
hr:nth-child(2n+1) {
  transform: rotate(.7deg);
}

hr:nth-child(5n+3) {
  transform: rotate(.1deg);
}

.latex-error {
    font-family: 'inconsolata', monospace;
    white-space: pre-wrap;
}
blockquote {
  border-left: 2px solid var(--primary);
  margin-left: 0;
  padding: .25em 0 .25em 1em;
}
blockquote p {
  margin: 0;
}
.latex-figure {
    text-align: center;
}

.summary {
    margin: 16px 0;
}
.summary-heading {
    font-weight: bold;
    margin-bottom: 8px;
    position: relative;
}
.summary-date {
    font-weight: bold;
}
.summary.search-highlight > a {
    color: var(--complementary);
}
.summary.search-highlight .summary-heading::before {
    content: ">>>";
    position: absolute;
    text-align: right;
    right: calc(100% + 8px);
}

.theme-toggle {
    box-shadow: 0 4px 5px 0 rgba(0,0,0,0.14),0 1px 10px 0 rgba(0,0,0,0.12),0 2px 4px -1px rgba(0,0,0,0.3);
    border-radius: 50%;
    font-size: 1.4em;
    width: 2em;
    height: 2em;
    position: fixed;
    right: 16px;
    bottom: 16px;
    background: var(--text);
    color: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover {
    color: var(--url-color);
}
html:not(.theme-light, .theme-dark) .theme-toggle{
    display: none;
}

/* mobile styles */

@media (max-width: 660px) {
    :root {
        --font-size: 15px;
    }

    header, main, footer {
        width: calc(100% - 24px);
    }

    header {
        font-size: 1.8rem;
        line-height: 1.5;
        flex-direction: column;
        margin-bottom: 0;
    }

    header .header-aside {
        font-size: .8em;
    }
    .summary.search-highlight .summary-heading::before {
        content: none;
    }
}
/* very small phones get even smaller text */
@media (max-width: 330px) {
    :root {
        --font-size: 13px;
    }

    header, main, footer {
        width: calc(100% - 8px);
    }
}

/* fonts */
@font-face {
    font-family: "Atkinson Hyperlegible Next";
    src: url('/static/fonts/Atkinson_Hyperlegible_Next/AtkinsonHyperlegibleNext-VariableFont_wght.ttf');
    font-display: optional;
}
@font-face {
    font-family: "Atkinson Hyperlegible Next";
    font-style: italic;
    src: url('/static/fonts/Atkinson_Hyperlegible_Next/AtkinsonHyperlegibleNext-Italic-VariableFont_wght.ttf');
    font-display: optional;
}
@font-face {
    font-family: "Inconsolata";
    src: url('/static/fonts/Inconsolata/Inconsolata-VariableFont_wdth\,wght.ttf');
    font-display: optional;
}


/* plain fg */
.codehilite, .codehilite .esc, .codehilite .g, .codehilite .l, .codehilite .n, .codehilite .x, .codehilite .p, .codehilite .ge, .codehilite .ges, .codehilite .gh, .codehilite .go, .codehilite .gs, .codehilite .gu, .codehilite .ld, .codehilite .na, .codehilite .nx, .codehilite .py, .codehilite .pm, .codehilite .w {
    color: var(--sh-fg);
}
/* literals and stuff */
.codehilite .kc, .codehilite .kd, .codehilite .m, .codehilite .s, .codehilite .mb, .codehilite .mf, .codehilite .mh, .codehilite .mi, .codehilite .mo, .codehilite .sa, .codehilite .sb, .codehilite .sc, .codehilite .dl, .codehilite .s2, .codehilite .se, .codehilite .sh, .codehilite .si, .codehilite .sx, .codehilite .s1, .codehilite .ss, .codehilite .il {
    color: var(--sh-teal);
}
/* names and stuff */
.codehilite .gp, .codehilite .gt, .codehilite .nb, .codehilite .nc, .codehilite .no, .codehilite .nd, .codehilite .ni, .codehilite .ne, .codehilite .nf, .codehilite .nl, .codehilite .nn, .codehilite .nt, .codehilite .nv, .codehilite .bp, .codehilite .fm, .codehilite .vc, .codehilite .vg, .codehilite .vi, .codehilite .vm {
    color: var(--sh-blue);
}
/* operator */
.codehilite .o {
    color: var(--sh-fg-faint);
}
/*comments and stuff */
.codehilite .c, .codehilite .ch, .codehilite .cm, .codehilite .cpf, .codehilite .c1, .codehilite .cs, .codehilite .sd {
    color: var(--sh-fg-faint);
    font-style: italic;
}
/* regex, namespace */
.codehilite .kn, .codehilite .sr {
    color: var(--sh-orange);
}
/* preprocessor */
.codehilite .cp {
    color: var(--sh-purple);
}
/* errors, deleted */
.codehilite .gd, .codehilite .gr {
    color: var(--sh-red);
}
/* Keywords */
.codehilite .k, .codehilite .gi, .codehilite .kp, .codehilite .kr, .codehilite .ow {
    color: var(--sh-green);
}
/* Types */
.codehilite .kt {
    color: var(--sh-brown);
}

td.linenos .normal { color: var(--sh-fg-faint); background-color: var(--sh-bg-hll); padding-left: 5px; padding-right: 5px; }
span.linenos { color: var(--sh-fg-faint); background-color: var(--sh-bg-hll); padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: var(--sh-hilite-fg); background-color: var(--sh-hilite-bg); padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: var(--sh-hilite-fg); background-color: var(--sh-hilite-bg); padding-left: 5px; padding-right: 5px; }
.codehilite .hll { background-color: var(--sh-bg-hll) }
.codehilite {
  position: relative;
  background: var(--sh-bg);
  color: var(--sh-fg);
  overflow: scroll;
  border-radius: 3px;
  box-shadow: 0 4px 5px 0 rgba(0,0,0,0.14),0 1px 10px 0 rgba(0,0,0,0.12),0 2px 4px -1px rgba(0,0,0,0.3);
}
.codehilite pre {margin: 0;}

/* code copy button: */

.copy-to-clipboard-action {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--text-lighter);
  transition-property: color, background;
  transition-duration: .2s, 1s;
  transition-delay: 0s, .5s;
  
  width: 1.8em;
  height: 1.8em;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.copy-to-clipboard-action:hover {
  color: var(--url-color);
}
.copy-to-clipboard-action:active {
  background: var(--background-2);
  transition-duration: .2s, .1s;
  transition-delay: 0s, 0s;
}
