@charset "UTF-8";

:root {
    --background: #eee;
    --page: #fff; 
    --ink: #222;
    
    --halftone: #777;
    --halftone-weak: #bbb;
    
    --frame: #222;
    --shadow: #bbb;

    --accent-red: oklch(63.7% 0.237 25.331);
}

html {
    font-size: 16px;
    background: var(--background);
    text-rendering: optimizelegibility;
    font-variant-ligatures: common-ligatures;
}

body {
    margin-top: 2rem;
    margin-bottom: 2rem;
    padding: .5rem 3rem .25rem;
    border: 1px solid var(--frame);
    box-shadow: 2px 2px var(--shadow);
    
    max-width: 675px;
    margin-left: auto;
    margin-right: auto;
    
    font-family: "Ysabeau", serif;
    font-optical-sizing: auto;
    font-weight: 500;
    font-style: normal;
    line-height: 1.25rem;

    text-wrap: pretty;
    hanging-punctuation: first last;

    color: var(--ink);
    background: var(--page);
}

/* -----------------------------------------------------------------------------
 * Markdown Format Miscelany
 */

a {
    color: var(--ink);
}

a:hover {
    text-decoration-color: var(--accent-red);
}

code {
    font-size: 80%;
    font-family: "Ibm Plex Mono", monospace;
    font-weight: 400; 
    font-style: normal;
    color: var(--halftone);
}

blockquote {
    font-style: italic;
}

/* -----------------------------------------------------------------------------
 * Figures
 */

figcaption {
    position: relative;
    text-align: center;
    top: -0.7rem;
    font-style: italic;
}

/* -----------------------------------------------------------------------------
 * Tables
 */

table {
    width: 100%;
    text-align: left;

    font-size: 14px;
    font-family: "Ibm Plex Mono", monospace;
    font-weight: 400; 
    font-style: normal;
    
    border-collapse: collapse;
    border: 1px solid var(--halftone);
    border-top: 2px dotted var(--halftone-weak);
    border-left: 5px solid var(--halftone);
    box-shadow: 2px 2px var(--background);

    margin-bottom: 1rem;
}

th {
    overflow: hidden;
    padding: .2rem .4rem 0;

    border-bottom: 1px solid var(--ink);
    border-left: 1px solid var(--halftone);
}

td {
    overflow: hidden;
    height: 1.5rem;
    padding: .2rem .4rem 0;

    border-bottom: 1px solid var(--halftone);
    border-right: 1px solid var(--halftone);
}

/* -----------------------------------------------------------------------------
 * The Header
 */

header {
    display: block;
    height: 5rem;
}

header h1 {
    float: left;
    font-size: 2.8rem;
    font-weight: 600;
    font-style: italic;
    letter-spacing: -0.02em;
}

header a {
    text-decoration: none;
}

header a:hover {
    color: var(--accent-red);
}

nav a {
    height: 1.75rem;
    padding: .1rem .5rem 0;
        
    font-size: 14px;
    font-family: "Ibm Plex Mono", monospace;
    font-weight: 400; 
    font-style: normal;

    border: 1px solid var(--ink);
}

nav a:hover {
    color: var(--page);
    background: var(--accent-red);
    border: 1px solid var(--accent-red);
}

header ul {
    float: right;
    padding-left: 0;
}

header li {
    display: inline;
    list-style: none;
}

/* -----------------------------------------------------------------------------
 * Headings & Rules
 */
    
h1, h2, h3, h4, h5, h6 {
    display: inline-block;
    font-family: "Vollkorn", sans-serif;
    font-weight: 500;
    font-style: normal;
    margin-bottom: 0.5rem;
    letter-spacing: -0.015em,
}

hr {
    border-top: none;
    border-right: none;
    border-bottom: 1px solid var(--halftone);
}

/* -----------------------------------------------------------------------------
 * Lists
 */

li::marker {
    color: var(--accent-red);
}


/* -----------------------------------------------------------------------------
 * Code blocks
 */

pre.z-code {
    page-break-inside: avoid;
    background-color: transparent;
}

pre.z-code code {
    border-collapse: collapse;
    border: 1px solid var(--halftone);
    box-shadow: 2px 2px var(--background);

    font-weight: 500;
    font-size: 12px;
    line-height: 1.5;

    padding: 1rem;
    display: block;

    overflow: scroll;
}

pre.z-code table {
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

pre.z-code tbody {
    border: none;
    font-size: 12px;
}

pre.z-code td {
    border: none;
}

/* -----------------------------------------------------------------------------
 * Footnotes
 */

sup {
    vertical-align: baseline;
    position: relative;
    top: -0.4rem;
    font-weight: 600;
}

.footnote-reference a {
    text-decoration: none;
    color: var(--accent-red);
}

.footnotes {
    padding: 1.5rem;
    padding-left: 2.5rem;
    padding-right: 2.5rem;

    margin-top: 1rem;
    margin-bottom: 1rem;
    
    border-collapse: collapse;
    border: 1px solid var(--halftone);
    box-shadow: 2px 2px var(--background);

    font-size: 12px;
    font-family: "Ibm Plex Mono", monospace;
    font-weight: 400; 
    font-style: normal;
    line-height: 1.2;
}

.footnotes:before {
    content: "MARGINALIA";
    font-weight: 600;
    letter-spacing: 0.05em;
}

.footnotes-list {
    padding: 0;
    text-align: left;

    border-top: solid 1px;
}

.footnotes a {
    color: var(--accent-red);
    text-decoration: none;
}

/* -----------------------------------------------------------------------------
 * The Footer
 */

.copyright {
    text-align: center;
    
    font-size: 10px;
    font-family: "Ibm Plex Mono", monospace;
    font-weight: 400; 
    font-style: normal;
    line-height: 1.1;

    color: var(--halftone-weak);
}

/* -----------------------------------------------------------------------------
 * Error Box
 */

.error {
    width: 200px;
    height: 100px;

    display: grid;
    align-items: center;
    margin: auto;
    text-align: center;
    
    font-size: 16px;
    font-family: "Ibm Plex Mono", monospace;
    font-weight: 400; 
    font-style: normal;

    color: rgb(252, 252, 252);
    border: 1px solid rgb(252, 252, 252);
}

.error-container {
    width: 220px;
    height: 120px;

    display: grid;
    align-items: center;

    margin: auto;
    margin-top: 3rem;
    margin-bottom: 3rem;
    
    border: 1px solid var(--frame);
    background: var(--accent-red);
    box-shadow: 2px 2px var(--background);
}

/* -----------------------------------------------------------------------------
 * Media Display Customizations
 */

/* In print media and small devices, use the full screen instead of a inset page element. */
@media print, (width <= 800px) {
    html {
        background: var(--page);
    }
    
    body {
        padding: .5rem 1rem .25rem;
        margin-top: 0;
        margin-bottom: 0;
        border: none !important;
        box-shadow: none;
        height: 100%;    
    }
}

@media (width <= 525px) {
    header h1 {
        float: none;
    }
    
    header ul {
        float: none;
    }

    header {
        margin-bottom: 2rem;
    }
} 

/* Hide the nav buttons for print media. */
@media print {
    nav {
        display: none;
    }
}

/* Hide the footnotes box for print media. */
@media print {
    .footnotes {
        border: none;
        box-shadow: none;
        padding: 0;
    }
}

/* -----------------------------------------------------------------------------
 * Dark Theme
 */

@media (prefers-color-scheme: dark) {
    
    :root {
        --background: var(--page);
        --page: #000;
        --ink: #ddd;
        
        --halftone: #bbb;
        --halftone-weak: #777;
        
        --frame: var(--page);
        --shadow: var(--page);
    }
}
