@font-face { 
    src:
        local('Source Code Pro'), 
        url('../_assets/SourceCodePro-Regular.ttf') format('truetype');
    font-family: 'Source Code Pro';
}

:root 
{
    --fs-default: 1.15rem;

    --openSideNavBtn-size: 3rem;
    --openSideNavBtn-margin: 2rem;
    --openSideNavBtn-fs: 3rem;

    --background-color: rgb(26, 28, 32);
    --text-color: rgb(236, 239, 242);
    --delimiter-color: rgb(46, 48, 57);
    --internalLink-color: rgb(152 158 255);;
    --time-color: rgb(140, 144, 161);
    --quote-color: rgb(175 178 191);

    --border-radius: 8px;
}

@media (min-width: 850px) {
    :root {
        --fs-default: 1.25rem;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: sans-serif;
    word-break: break-word;
}

code {
    font-family: "Source Code Pro", monospace;
    color: rgb(255, 132, 132);
}

.code-block {
    font-size: 1rem;
    line-height: 1.4;
    display: block; 
    background-color: #272727;
    border-radius: var(--border-radius);
    border: 1px solid #454545;
    padding: 1em;
    width: 100%;
    /* word-break: break-word; */
}

time {
    font-family: serif;
    color: rgb(177, 182, 201);
}

main {    
    margin: .75em;
    /* This margin is to let the text at the bottom of the page not be covered by #open-side-nav-btn */
    margin-bottom: calc(var(--openSideNavBtn-size) + 2*var(--openSideNavBtn-margin));
    font-size: var(--fs-default);

    max-width: 72ch;
    flex-grow: 2;
}

@media (min-width: 850px) {
    main {
        margin-top: 1em;
        margin-inline: 1em;
        /* font-size: 1.25rem; */
    }
}

a {
    /* overflow-wrap: break-word; */
}

a,
.internal-link {
    color: var(--internalLink-color);
}
.my-external-link {
    color: #86bbff;
}
.foreign-link {
    color: orange;
}

a,
.internal-link:hover {
    color: rgb(172 160 255);
}
.my-external-link:hover {
    color: #81aeff;
}
.foreign-link:hover {
    color: #e9bc00;
}

a, button {
    cursor: pointer;
}

q {
    color: var(--quote-color);
}

/* p, ul, ol {
    max-width: 80ch;
} */

p {
    line-height: 1.6;
    margin-block: .5rem;
}

ul, ol {
    list-style-position: inside;
    line-height: 1.5;
}

li > ul {
    margin-bottom: .5em;
    margin-left: 1em;
}

hr {
    border: 1px solid var(--delimiter-color);
}

iframe {
    border: none;
}

img {
    max-width: 100%;
}

#side-nav {
    position: fixed;
    bottom: 0;
    right: 0;
    height: 100vh;
    min-width: 30vw;
    /* I specify the font-size in the parent because of the padding in em */
    font-size: var(--openSideNavBtn-fs);
    padding: 1em;
    box-shadow: -1px 0px 7px rgb(133, 133, 133);
    background-color: rgb(26, 28, 32);
    
    /* When nav is open on mobile */
    flex-direction: column;
    justify-content: end;
}

/* E.g. while the nav is open, it isn't allowed to see an image fullscreen. */
/* body:has(#side-nav.flex) main > * {
    pointer-events: none;
} */

#side-nav menu {
    font-size: inherit;
    line-height: 1.2;
    list-style: none;
    white-space: nowrap;
    /* text-align: right; */
}

#side-nav > button {
    /* only for desktop */
    display: none;
    margin-top: 5vh;
    background: unset;
    border: unset;
    font-size: 2rem;
    color: rgb(164, 164, 164);
    margin-left: auto;
    border-radius: var(--border-radius);
} 

#minify-nav-btn {
    padding-right: .5em;
}
#expand-nav-btn {
    padding-left: .5em;
}

#side-nav > button:hover {
    background-color: rgb(73 73 73 / 36%);
}

#open-side-nav-btn {
    background-color: var(--background-color);
    position: fixed;
    border-radius: var(--border-radius);
    bottom: var(--openSideNavBtn-margin);
    right: var(--openSideNavBtn-margin);

    padding: .85rem .65rem;

    border: 1px solid var(--internalLink-color);
}

#open-side-nav-btn:hover {
    border-color: #999;
    box-shadow: 0 2px 4px rgba(46, 48, 57, 0.08);
}

#open-side-nav-btn:active {
    box-shadow: 0 1px 2px rgba(46, 48, 57, 0.1);
    transform: translateY(1px);
}

#open-side-nav-btn span[role=img] {
    display: flex;
    flex-direction: column;
    gap: .65rem;
}

#open-side-nav-btn span[role=img] span {
    width: 2.5rem;
    height: 4px;
    border-radius: var(--border-radius);
    background-color: var(--internalLink-color);
}

/* 
  Desktop version */

@media (min-width: 1050px) {    
    body {
        display: flex;
        align-items: start;
        justify-content: center;
    }

    #side-nav {
        display: block;
        position: sticky;
        top: 0;
        min-width: unset;
        border-left: 1px solid var(--delimiter-color);
        box-shadow: unset;
        background-color: unset;
    }

    #side-nav > button.display-block {
        display: block;
    }

    #side-nav:has(.minified-list) {
        border-left: unset;
        padding-inline: 0;
    }
    .minified-list li a {
        visibility: hidden;
        font-size: 0;
    }

    #open-side-nav-btn {
        display: none;
    }
}  

/*
 * States */

.flex {
    display: flex;
}

.display-block {
    display: block;
}

.display-none {
    display: none;
}

.display-opaque {
    opacity: .5;
}
.display-opaque a,
.display-opaque button {
    pointer-events: none;
}

/* .hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
} */

/* body:has(.fullscreen) * {
    pointer-events: none;
} */


