/***********************************************************
************************** Website *************************
***********************************************************/

/**************
********* Colours
**************/

:root {
    /** Base colors */
    --clr-font-a0: #1f1e1c;
    --clr-font-a10: #7f7e7c;

    /** Theme primary colors */
    --clr-primary-a0: #c90022;
    --clr-primary-a10: #c4282c;
    --clr-primary-a20: #be3b36;
    --clr-primary-a30: #b74940;
    --clr-primary-a40: #b0544a;
    --clr-primary-a50: #a95e55;

    /** Theme surface colors */
    --clr-surface-a0: #f5f5f5;
    --clr-surface-a10: #e7e7e7;
    --clr-surface-a20: #dadada;
    --clr-surface-a30: #cccccc;
    --clr-surface-a40: #bfbfbf;
    --clr-surface-a50: #b2b2b2;

    --navbar-height: 60px;
}

:root[data-theme="dark"] {
    /** Base colors */
    --clr-font-a0: #f5f5f5;
    --clr-font-a10: #c5c5c5;

    /** Theme primary colors */
    --clr-primary-a0: #82c1ff;
    --clr-primary-a10: #92c8ff;
    --clr-primary-a20: #a1ceff;
    --clr-primary-a30: #b0d5ff;
    --clr-primary-a40: #bedcff;
    --clr-primary-a50: #cbe3ff;

    /** Theme surface colors */
    --clr-surface-a0: #1f1e1c;
    --clr-surface-a10: #343331;
    --clr-surface-a20: #4a4947;
    --clr-surface-a30: #61605f;
    --clr-surface-a40: #797977;
    --clr-surface-a50: #939291;
}

/**************
********* Elements
**************/

html {
    height: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 4em;
}

body {
    height: calc(100% - var(--navbar-height));
    margin: 0;
    padding: 0;
    padding-top: var(--navbar-height);
    font-family: sans-serif;
    line-height: 1.6;
    background-color: var(--clr-surface-a0);
    color: var(--clr-font-a0);
    display: flex;
    flex-direction: column;
}

.content {
    padding-left: 1rem;
    padding-right: 1rem;
    flex-grow: 1;
    width: 100%;
    box-sizing: border-box;
}

/* This wraps your whole page content */
/* Mobile */

article>*,
.home>* {
    width: 100%;
    box-sizing: border-box;
}

/* Desktop */
@media (min-width: 801px) {
    .content {
        display: flex;
        flex-flow: column;
        box-sizing: border-box;
    }

    article>* {
        width: 60%;
    }

    article,
    .home {
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    article {
        max-width: 75rem;
    }

    .home {
        max-width: 50rem;
    }
}

.responsive-svg {
    padding: 0.25rem 0.5rem;
    fill: var(--clr-font-a0);
}

/***********************************************************
********************** Navigation Bar **********************
***********************************************************/

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    background-color: var(--clr-surface-a30);
}

.push {
    margin-left: auto;
}

.navbar a {
    padding: 0.25rem 0.5rem;
    font-weight: bold;
    text-decoration: none;
    font-size: x-large;
}

.navbar a:hover {
    background-color: var(--clr-surface-a0);
    color: var(--clr-font-a0);
}

.navbar #theme-switch {
    /* padding: 0.25rem 0.5rem; */
    background-color: var(--clr-surface-a30);
    border-style: none;
    stroke: var(--clr-font-a0);
}

.navbar #theme-switch:hover {
    background-color: var(--clr-surface-a0);
}

@media (min-width: 801px) {
    .navbar a {
        padding: 0.5rem 1rem;
    }

    .navbar #theme-switch {
        padding: 0.5rem 1rem;
    }
}

button:hover {
    cursor: pointer;
}


/***********************************************************
************************** Footer **************************
***********************************************************/

footer {
    width: 100%;
    flex-shrink: 0;
    background-color: var(--clr-surface-a30);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: end;
}

footer div,
footer a {
    font-weight: bold;
    text-decoration: none;
    font-size: medium;
    display: inline;
    vertical-align: middle;
    display: flex;
    align-items: center;
    height: 100%;
    aspect-ratio: 1 / 1;
}

footer a:hover {
    background-color: var(--clr-surface-a0);
    color: var(--clr-font-a0);
}

footer svg {
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 801px) {
    footer {
        height: var(--navbar-height);
    }
}

/***********************************************************
********************** Post Summaries **********************
***********************************************************/

.post-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}


.post-row {
    display: grid;
    grid-template-columns: 120px 1fr max-content;
    gap: 1rem;
    align-items: start;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.post-date {
    font-family: 'Berkeley Mono', Courier, monospace;
    font-size: 1.1rem;
}

@media (min-width: 801px) {
    .post-date {
        font-size: 1.2rem;
    }
}

/**************
********* Post Title
**************/

.post-title a {
    color: var(--clr-font-a0);
    font-size: 1.1rem;
    text-decoration: dashed underline;
}

.post-title a:hover {
    color: var(--clr-primary-a0);
}

@media (min-width: 801px) {
    .post-title a {
        font-size: 1.2rem;
    }
}

/**************
********* Post Tags
**************/

.post-tags {
    display: none;
}

@media (min-width: 801px) {
    .post-tags {
        display: inline
    }

    .post-tags a {
        font-size: 0.9em;
        text-decoration: dotted underline;
        color: var(--clr-font-a0-subtle)
    }

    .post-tags a:hover {
        color: var(--clr-font-a0)
    }
}

/***********************************************************
************************** Headers *************************
***********************************************************/

/* Hide anchor by default */
.heading-link {
    opacity: 0;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

/* Show anchor when hovering the header */
h2:hover .heading-link,
h3:hover .heading-link,
h4:hover .heading-link,
h5:hover .heading-link,
h6:hover .heading-link {
    opacity: 1;
}

/***********************************************************
************************** Tables **************************
***********************************************************/

table {
    border-collapse: collapse;
    /* Ensures borders don't double up */
    margin-bottom: 1rem;
}

th,
td {
    border: 0.15em solid var(--clr-font-a0);
    /* Adds the actual outline */
    padding: 0.5rem;
    text-align: left;
}

td {
    background-color: var(--clr-surface-a10);
}

th {
    background-color: var(--clr-surface-a30);
}


/***********************************************************
************************ Code Blocks ***********************
***********************************************************/

p.filename {
    font-family: "Berkeley Mono", monospace;
    color: var(--clr-font-a0-subtle);
    margin: 0;
}

pre {
    padding: 1rem;
    background-color: var(--clr-surface-a10);
}

code {
    font-family: "Berkeley Mono", monospace;
}

pre,
code {
    white-space: pre-wrap;
    /* allow wrapping */
    word-break: break-word;
    /* break long words */
    overflow-wrap: anywhere;
    /* fallback for older browsers */
    tab-size: 4;
    /* preserve tab width */
    -moz-tab-size: 4;
    /* Firefox support */
}

pre code span {
    white-space: pre-wrap;
}



p>code,
li>code,
dd>code,
td>code {
    background-color: var(--clr-surface-a20);
    word-wrap: break-word;
    box-decoration-break: clone;
    padding-left: .1rem;
    padding-right: .1rem;
    border-radius: .2rem;
}


/***********************************************************
************************ Blockquote ************************
***********************************************************/

blockquote {
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: 0;
    margin-right: 0;
    padding: 1rem;
    border-left: 0.2em solid var(--clr-primary-a0);
    background-color: var(--clr-surface-a10);
}


/***********************************************************
******************* Other Posts in Series ******************
***********************************************************/

#other-posts-in-series {
    padding: 1em;
    margin-top: 1em;
    margin-bottom: 1em;
    background-color: var(--clr-surface-a10);
}

/***********************************************************
*************************** Links **************************
***********************************************************/

a {
    color: var(--clr-font-a0-subtle);
}

a:hover {
    color: var(--clr-primary-a0);
}

/***********************************************************
******************* Floating Side Content ******************
***********************************************************/

/* Table of contents default */
#contents {
    padding: 1em;
    margin-top: 1em;
    margin-bottom: 1em;
    background-color: var(--clr-surface-a10);
}

/***********************************************************
************************* Sidenotes ************************
***********************************************************/

/* Global counter */
body {
    counter-reset: sidenote-counter;
}

/* Inline sidenote number */
.sidenote-number {
    counter-increment: sidenote-counter;
    cursor: pointer;
}

.sidenote-number:hover {
    color: var(--clr-primary-a0);
}

.sidenote-number::after,
.sidenote::before {
    content: counter(sidenote-counter);
    font-size: 0.8em;
    vertical-align: super;
    margin-left: 0.15em;
    font-style: normal;
}

/* Hidden checkbox */
.sidenote-toggle {
    display: none;
}

/* Desktop: classic Tufte float */
.sidenote {
    float: right;
    clear: right;
    margin-right: -60%;
    width: 50%;
    margin-top: 0;
    margin-bottom: 0;
    vertical-align: baseline;
    /* position: relative; */
    top: 0rem;
    font-style: italic;
    font-size: small;
    color: var(--clr-font-a10);
}

.sidenote>span:first-child {
    display: inline
}

.sidenote>span {
    display: inline-block;
    margin-top: 0.5cap;
}

/* ---------- Mobile Behavior ---------- */
@media (max-width: 800px) {

    /* Stop floating on mobile */
    .sidenote {
        display: none;
        /* hidden by default */
    }

    /* When checkbox is checked → reveal sidenote */
    .sidenote-toggle:checked+.sidenote {
        float: none;
        width: fit-content;
        max-width: 100%;
        margin-top: 1em;
        margin-bottom: 1em;
        padding-top: 0.1em;
        padding-bottom: 0.1em;
        display: block;
    }
}

/***********************************************************
************************* Comments *************************
***********************************************************/

.comments {
    width: 100%;
    padding-bottom: 2rem;
}