@font-face {
  font-family: "JBMono";
  src:
    url("fonts/JetBrainsMonoNerdFont.ttf") format("truetype"),
}
.jb-mono {
    font-family:"JBMono"; 
}

@font-face {
  font-family: "Atkinson";
  src:
    url("fonts/AtkinsonHyperlegibleNext.ttf") format("truetype"),
}
.atkinson {
    font-family:"Atkinson"; 
}

/*
 * Colors 
 */

:root {
    --rosewater   : #ffdbd2;
    --flamingo    : #ffc0c0;
    --pink        : #ffb8eb;
    --mauve       : #ca9eff;
    --red         : #f985a5;
    --maroon      : #f497a7;
    --peach       : #fcb385;
    --orange      : #fcb385;
    --yellow      : #f8d27b;
    --green       : #93f88c;
    --teal        : #59f8db;
    --sky         : #84eafa;
    --sapphire    : #56c6fb;
    --blue        : #75aaff;
    --dark-blue   : #436597;
    --bright-blue : #99c9fb;
    --lavender    : #99a4ff;
    --purple      : #99a4ff;

    --white       : #f8f8f8;
    --black       : #161616;
    --light-grey  : #d6d6d6;
    --lighter-grey: #f0f0f0;
    --dark-grey   : #404040;
    --darker-grey : #303030;

    --text        : var(--black);
    --subtext     : var(--dark-grey);
    --underlay    : var(--light-grey);
    --table-stripe: var(--lighter-grey);
    --background  : var(--white);

    --articlew: 50rem;
}

@media (prefers-color-scheme: light) {
    :root {
        --flamingo    : #ff7f85;
        --pink        : #e76ecb;
        --red         : #ca3f28;
        --peach       : #dd6e02;
        --orange      : #dd6e02;
        --yellow      : #d7a301;
        --green       : #38b934;
        --sky         : #037dad;
        --bright-blue : #2e9dff;
        --blue        : #073e9b;
        --purple      : #403060;
        --lavender    : #403060;
        --text        : var(--black);
        --subtext     : var(--dark-grey);
        --underlay    : var(--light-grey);
        --table-stripe: var(--lighter-grey);
        --background  : var(--white);
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --yellow      : #fde3ab;
        --text        : var(--white);
        --subtext     : var(--light-grey);
        --underlay    : var(--dark-grey);
        --table-stripe: var(--darker-grey);
        --background  : var(--black);
    }
}

/*
 * Settings
 * TODO: tab index
 */

:root {
    --c:     block;
    --cpp:   none;
    --scala: none;
    --rust:  none;
    --java:  none;
}

:root:has(.lselect input[type="radio"][value="cpp"]:checked) {
    --cpp:   block;
    --c:     none;
    --scala: none;
    --rust:  none;
    --java:  none;
}

:root:has(.lselect input[type="radio"][value="c"]:checked) {
    --cpp:   none;
    --c:     block;
    --scala: none;
    --rust:  none;
    --java:  none;
 }

:root:has(.lselect input[type="radio"][value="scala"]:checked) {
    --cpp:   none;
    --c:     none;
    --scala: none;
    --rust:  block;
    --java:  none;
}

:root:has(.lselect input[type="radio"][value="java"]:checked) {
    --cpp:   none;
    --c:     none;
    --scala: none;
    --rust:  none;
    --java:  block;
}

:root:has(.lselect input[type="radio"][value="rust"]:checked) {
    --cpp:   none;
    --c:     none;
    --scala: none;
    --rust:  block;
    --java:  none;
}

/*
 * LAYOUTING
 */

.none {
    display: none;
}

.flex-horizontal {
    height: 100%; 
    display: flex; 
    flex-direction: row; 
    flex-wrap: wrap; 
    margin: 0em 0em;
}

.flex-vertical {
    width: 100%; 
    display: flex; 
    flex-direction: column; 
    flex-wrap: nowrap; 
    margin: 0em 0em;
}

.flex-item {
    flex: 1 1 auto;
}

.centering-flex-item {
    flex: 1 1 auto;
    justify-content: center;
    align-items: center;
}

.centering-flex-item > * {
    margin: auto;
    width: fit-content;
    height: fit-content;
    display: block;
}


.flex-item-no-grow {
    flex: 0 1 auto;
}

.separator {
    background-color: var(--text);
    width: 100%; 
    height: 0.20rem; 
}

.icon-big {
    font-size: 4rem;
}

.icon {
    font-size: 2rem;
}

.icon-small {
    font-size: 1rem;
}

.title {
    font-size: 3.5rem;
    text-align: center;
}

.sub-title {
    font-size: 1.5rem;
    text-align: center;
}

.readable-text {
    max-width: min(90%, var(--articlew));
    margin: auto;
}

.page-break {
    break-after: page;
}

.light {}
.dark {}
@media (prefers-color-scheme: light) {
    .dark {
        display: none;
    }
}
@media (prefers-color-scheme: dark) {
    .light {
        display: none;
    }
}


.lselect {
    margin-top: 1rem;
    border: 0.1rem solid var(--text);
    
    p {
        margin: 0.5rem;
    }   

    label {
        color: var(--color);
    }
    label:hover, label:focus {
        cursor: pointer;
        font-weight: bold;
        background: var(--color);
        color: var(--background);
    }
}

code-block, blockquote {
    .Comment    {color: var(--subtext)}
    .Constant   {color: var(--peach)}
    .Identifier {color: var(--flamingo)}
    .Keyword    {color: var(--purple)}
    .Number     {color: var(--yellow)}
    .Operator   {color: var(--sky)}
    .PreProc    {color: var(--pink)}
    .Repeat     {color: var(--red)}
    .String     {color: var(--green)}
    .Structure  {color: var(--bright-blue)}
    .Type       {color: var(--blue)}
    .StorageClass{color: var(--yellow)}
    .Statement  {color: var(--purple)}
    
    break-inside: avoid;
}

blockquote { 
    background-color: var(--table-stripe);
    border-radius: 1rem;
    padding: 1rem;
    margin: 0.5rem;
}

code-block {
    display: var(--display);
    pre {
        margin: 1rem;
        margin-top: 0.5rem;
    }

    > p {
        margin: 0;
        border: 0.1rem solid var(--text);
        p {
            margin: 0.5rem;
            text-align: center;
            background-color: var(--underlay);
            border-radius: 1rem; 
        }
    }
}

code-table {
    break-inside: avoid;
    display: var(--display);
}

body {
    background-color: var(--background);
    color: var(--text);
}

code {
    border-radius: 0.25rem;
    background: var(--underlay);
    padding: 0 0.5rem;
}

a {
    text-decoration: none;
    font-style: italic;
}

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

a:link {
    color: var(--blue);       
}

a:visited {
    color: var(--lavender);       
}

h1, h2, h3, h4, h5, h6, p, body, article, section, pre {
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6, p {
    margin-top: 1.5em;
}

h1, h2, h3, h4, h5, h6 {
    font-family: sans-serif;
}

hgroup * {
    margin-top: 0.5em;
    font-family: sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    a {
    color: var(--text);
    font-style: normal;
    }
    a:link {
        color: var(--text);       
    }

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

article {
    font-family: serif;
}

article hgroup {
    margin-top:    6rem;
    margin-bottom: 6rem;
}

article > * {
    --w: min(90%, var(--articlew));
    max-width: var(--articlew);
    width: var(--w);
    margin: 0.8rem calc(calc(100vw - var(--w)) / 2);
}

figure-list > * {
    --w: min(90%, var(--articlew));
    max-width: var(--articlew);
    width: var(--w);
    margin: 0.8rem calc(calc(100vw - var(--w)) / 2);
}

article > *:focus {
    box-shadow: 
    inset 0  0.5rem 0 -0.25rem var(--text),
    inset 0 -0.5rem 0 -0.25rem var(--text);
}

article > * *:focus {
    box-shadow: 0 0 0 0.25rem var(--text);
}

article > ul, article > ol {
    padding-right: 5%;
    padding-left: 2em;
}

article h1 {
    font-size: 2.5rem;
}
article h2 {
    font-size: 2.0rem;
}
article h3 {
    font-size: 1.5rem;
}
article h4 {
    font-size: 1.4rem;
}
article h5 {
    font-size: 1.3rem;
}

article .separator {
    margin: 2rem 0;
}

article blockquote {
    font-family: monospace;
}

article img {
    max-width: var(--articlew);
    max-height: 30rem;
}

article figure {
    text-align: center;
    align-items: center;
}

mark {
    background-color: var(--yellow);
    color: var(--black);
}

section {
    break-inside: avoid;
}

table { 
    width: 100%;
    margin-bottom: 1rem;
    table-layout: fixed;
    font-size: 0.85rem;
}

table, th, td {
    border: 1px solid var(--text);
    border-collapse: collapse;
    padding: 0.5rem;
}
td {
    font-family: "JBMono";
    text-align: right;
}
tr:nth-child(odd) {
    background-color: var(--table-stripe);
}
td:nth-child(1) {
    text-align: center;
}

caption {
  caption-side: bottom;
  text-align: center;
  padding-top: 0.5rem;
  font-style: italic;
}

math[display="block"] {
    margin: 1rem;
}


.print-only {
    display: none;
}

@media print {
    :root {
        --white: #ffffff;
        --black: #000000;
        --c:     block;
        --cpp:   block;
        --scala: block;
        --rust:  block;
        --java:  block;
    }

    .lselect {
        display: none;
    }

    .print-only {
        display: block;
    }
    .page-break { break-after: page; }
}

@page {
    margin: 2cm 0.5cm 1cm 0.5cm;
}

