/* -*- web-mode-css-indent-offset: 4; -*- */

/*
 *
 * Copyright (c) kqr 2018
 * 
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 *
 */

:root {
    --serif: Whitman, 'Linux Libertine', serif;
    /* If you plan on using sans-serif type a lot, get something more specific here. */
    --sans: "CooperHewitt", Arial;
    --mono: 'Hack', monospace;

    /* a warm palette with 4 colours plus grayscales */
    --black: #000;
    --gray: #979795;
    --lightgray: #e0d7c9;
    --darkbrown: #6e4111;
    --brown: #9e7140;
    --lightbrown: #d7b28b;
    --cream: #fffcf9;
    --transparentcream: rgba(255, 252, 249, 0.9);

    /* sizes are computed as sqrt(sqrt(2))^n, with n = -4 .. 6 */
    --pixel: 0.0625rem;
    --r-4: 0.50;
    --r-3: 0.59;
    --r-2: 0.71;
    --r-1: 0.84;
    --r0: 1.00;
    --r1: 1.19;
    --r2: 1.41;
    --r3: 1.68;
    --r4: 2.00;
    --r5: 2.38;
    --r6: 2.83;
    --r10: 5.66;   /* not true, actually, but trust me it's better */
}

/* * Font definitions * */
@font-face {
    font-family: Whitman;
    src: url('/lib/font/Whitman-Roman.woff') format('woff');
    font-style: normal;
    font-weight: normal;
}
@font-face {
    font-family: Whitman;
    src: url('/lib/font/Whitman-Italic.woff') format('woff');
    font-style: italic;
    font-weight: normal;
}
@font-face {
    font-family: Whitman;
    src: url('/lib/font/Whitman-Bold.woff') format('woff');
    font-style: normal;
    font-weight: bold;
}
@font-face {
    font-family: CooperHewitt;
    src: url('/lib/font/CooperHewitt-Medium.woff') format('woff');
    font-style: normal;
    font-weight: normal;
}
@font-face {
    font-family: CooperHewitt;
    src: url('/lib/font/CooperHewitt-BookItalic.woff') format('woff');
    font-style: italic;
    font-weight: normal;
}
@font-face {
    font-family: CooperHewitt;
    src: url('/lib/font/CooperHewitt-Semibold.woff') format('woff');
    font-style: normal;
    font-weight: bold;
}
@font-face {
    font-family: Linux Libertine;
    src: url('/lib/font/LinLibertine_R.woff') format('woff');
    font-style: normal;
    font-weight: normal;
}
@font-face {
    font-family: Linux Libertine;
    src: url('/lib/font/LinLibertine_RI.woff') format('woff');
    font-style: italic;
    font-weight: normal;
}
@font-face {
    font-family: Linux Libertine;
    src: url('/lib/font/LinLibertine_RZ.woff') format('woff');
    font-style: normal;
    font-weight: bold;
}
@font-face {
    font-family: Hack;
    src: url('/lib/font/hack-regular.woff') format('woff');
    font-style: normal;
    font-weight: normal;
}
@font-face {
    font-family: Hack;
    src: url('/lib/font/hack-italic.woff') format('woff');
    font-style: italic;
    font-weight: normal;
}
@font-face {
    font-family: Hack;
    src: url('/lib/font/hack-bold.woff') format('woff');
    font-style: normal;
    font-weight: bold;
}


/* Baseline overlay to disable or enable at will */
body::after {
    display: none;
    content: "";
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1' height='29'><rect style='fill: rgb(196,196,196);' width='1' height='0.25px' x='0' y='28'/></svg>");
    position: absolute;
    top: 23px;
    left: 0px;
    z-index: 9998;
    pointer-events: none;
    opacity: 1;
    width: 1425px;
    height: 3693px;
    background-size: auto 1.414rem;
    background-position-y: 0.6rem;
}


/* * -------------------- SET UP -------------------- * */
* {
    box-sizing: border-box;
    overflow-wrap: break-word;
}

html {
    font-family: var(--serif);
    font-size: calc(12pt + 0.25vw);
    background-color: var(--cream);
    line-height: var(--r2);  /* No unit = scale font size by this amount */
}

html pre, html code, html kbd {
    font-family: var(--mono) !important;
    font-size: 0.71rem;
}

/* * DOCUMENT * */
* {
    box-sizing: border-box;
}

body {
    display: flex;
    flex-flow: column;
    margin-left: 1.19rem; /* (0.71rem + 8px = 1.16rem ~= 1.19rem?) */
    margin-right: 1.19rem;
    margin-top: 0;
    padding: 0px;
}

a {
    color: var(--brown);
    text-decoration: none;
    border-bottom: 0.0625rem dotted;
}
a:hover, a:focus {
    color: var(--lightbrown);
    text-decoration: none;
    border-bottom: 0.0625rem solid;
}
sup {
    vertical-align: top;
}

/* ** PAGE HEADER ** */
body > header {
    display: flex;
    flex-flow: row wrap;
    justify-content: space-between;
    align-items: baseline;

    position: fixed;
    top: 0px;
    left: 0.19rem;
    right: 0.19rem;
    z-index: 999;
    margin: 0;

    background-color: var(--transparentcream);
}
body > header > .title {
    flex-grow: 1;
    display: flex;
    align-items: baseline;
}
body > header h1, body > header h2 {
    font-weight: normal;
    margin-top: 0rem;
    margin-bottom: 0rem;
    margin-right: 0;
    line-height: 1.414rem;
}
body > header h1 a {
    font-size: 1.19rem;
    color: #000;
    border-bottom: 0;
    text-decoration: none;
}
body > header h1 a:hover,
body > header h1 a:focus {
    border-bottom: 0;
    text-decoration: none;
}
body > header h2::before {
    display: inline-block;
    font-family: var(--serif);
    content: "/";
    width: auto;
    margin-right: 0.50rem;
}
body > header h2 {
    font-family: var(--serif);
    font-size: 1.0rem;
    font-style: italic;
    color: var(--gray);
    display: none;
}

@media (min-width: 780px) {
    body > header h1 {
        margin-right: 1rem;        
    }
    body > header h2 {
        display: block;
    }
}



/* *** NAVIGATION *** */
nav {
    flex-grow: 1;
    display: flex;
    flex-flow: row nowrap;
    align-items: baseline;
    justify-content: flex-end;
    
}
nav h1 {
    font-size: 0.84em;
    color: var(--gray);
}
nav ul {
    list-style: none;
    padding-left: 0;
    text-align: center;
    margin-top: 0;
    margin-left: 0.5em;
    margin-bottom: 0;
}
nav li {
    display: inline-block;
}
nav li:first-child {
    display: none;
}
nav li a {
    font-family: var(--sans);
    line-height: 1.414rem;
    font-weight: normal;
    font-size: 0.71em;
    color: #000;
    display: block;
    padding-left: 8px;
    padding-right: 8px;
    padding-top: 8px;
    text-decoration: none;
    border: none;
}
nav li a:hover, nav li a:focus {
    color: #fffcf9;
    background-color: #000;
    text-decoration: none;
    border: none;
}

@media (min-width: 780px) {
    nav li:first-child {
        diplay: inline-block;
    }
    nav li a {
        padding-left: 16px;
        padding-right: 16px;
    }
}



/* ** ARTICLE LISTINGS ** */
article .content .article-entry {
    margin-top: 1.414rem;
    line-height: 1.414rem;
}
article .content .article-entry h2 {
    font-family: var(--serif);
    font-weight: normal;
    font-style: normal;
    font-size: 1.19rem;
    margin: 0;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    line-height: 1.414rem;
}
.article-entry h2 time {
    width: 5.64rem;
    flex-grow: 0;
    flex-shrink: 0;
    line-height: 1.414rem;
}
.article-entry h2 a {
    flex: 1;
    min-height: 0;
    border-bottom: 0;
    line-height: 1.414rem;
}
.article-entry h2 .tag-list.sidenote {
    margin-top: 0;
    margin-bottom: 0;
    padding-left: 0;
    line-height: 1.414rem;
}
.article-entry h2 .tag-list.sidenote li {
    list-style: none;
    display: inline;
    line-height: 1.414rem;
    margin-bottom: 0;
}
.article-entry h2 .tag-list.sidenote li a {
    color: var(--gray);
    margin-left: 0.7rem;
    border-bottom: 1px dotted;
    line-height: 1.414rem;
}
/* ** ARTICLE ** */
article {
    display: flex;
    flex-flow: column;
    max-width: 45.2rem;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    margin-top: 1.414rem;
    padding-bottom: 5.656rem;
}
/* *** HEADER *** */
article header {
    display: flex;
    flex-flow: row; 
    align-items: baseline;
    justify-content: space-between;
    text-align: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--gray);
}
article header h1 {
    width: 100%;
    font-size: 2.37rem;
    font-weight: bold;
    font-style: normal;
    line-height: 2.83rem;
    margin-top: 1.414rem;
    margin-bottom: 1.414rem;
}
article header .article-meta {
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 1.0rem;
    color: var(--gray);
    font-style: italic;
}
article header .article-meta address {
    margin-bottom: 1rem;
    display: inline;
}
article header .article-meta ul.tag-list {
    display: inline;
    list-style: none;
    padding-left: 0;
}
article header .article-meta ul.tag-list li {
    display: inline
}
article header .article-meta ul.tag-list li:after {
    content: ", ";
}
article header .article-meta ul.tag-list li:nth-last-child(2):after {
    content: " and ";
}
article header .article-meta ul.tag-list li:last-child:after {
    content: "";
}

/* *** TABLE OF CONTENTS *** */
article #table-of-contents {
    margin-bottom: 2.83rem;
}
.forceinline #table-of-contents h1,
#table-of-contents h1 {
    display: inline;
    font-size: 1rem;
    font-weight: bold;
    font-style: normal;
    display: block;
    margin: 0 1rem -1rem 0;
    float: left; 
}
#text-table-of-contents {
    display: inline;
}
#table-of-contents ul {
    list-style: none;
    padding-left: 0;
    margin-top: 0;
    margin-left: 0.5rem;
    margin-bottom: 0;
}
#table-of-contents ul + li {
    display: block;
}
#table-of-contents li {
    display: inline;
    margin-bottom: 0;
}
#table-of-contents li::before {
    content: " · ";
    display: inline;
}


/* *** CONTENTS *** */
article .content {
    width: 100%;
}
/* **** BLOCK ELEMENTS **** */
article .content h1 {
    font-family: var(--sans);
    font-size: 1.414rem;
    line-height: 1.414rem;
    margin-bottom: 1.414rem;
    margin-top: 2.82rem;
    font-weight: bold;
    text-align: left;
}
article .content h1 code {
    font-size: 1.414rem;
}
article .content h2 {
    font-family: var(--sans);
    font-size: 0.89rem;
    margin-bottom: 0.5rem;
    margin-top: 2rem;
    font-weight: bold;
}
p {
    margin-bottom: 0;
    margin-top: 0;
    line-height: 1.414rem;
}
p + p {
    text-indent: 1.414rem;
}
caption,
.figure,
.org-src-name {
    margin-top: 0;
    margin-bottom: 0;
    font-family: var(--sans);
    font-size: 0.71rem;
    line-height: 1.414rem;
    font-style: italic;
    text-align: center;
}
.org-src-container .org-src-name {
    display: none;
}
caption + p,
.figure + p,
blockquote + p {
    margin-top: 1.414rem;
}
article .content .figure p {
    text-indent: 0;
}
article .content img {
    max-width: 100%;
}
article .content .org-svg {
    width: 100%;
}
article .content ul,
article .content ol,
article .content dl {
    margin-top: 1.414rem; /* multiple of line-height */
}
article .content dl {
    clear: right; /* XXX: Temporary until I can figure out with sidenotes */
}
article .content li,
article .content dd {
    margin-bottom: 1.414rem; /* multiple of line-height */
}
article .content dl {
    width: 100%;
    padding-left: 7rem;
    position: relative;
}
article .content dl dl {
    /*    margin-left: 1.41rem;*/
}
article .content dt {
    clear: left;
    float: left;
    font-family: var(--sans);
    font-variant: small-caps;
    /*    margin-left: 2rem;*/
    font-size: 0.83rem;
    line-height: 1.414rem;
    font-weight: normal;
    display: block;
    width: 6rem;
    position: absolute;
    left: 0;
    margin-left: 0;
}
article .content dd::before {
    content: " ";
    margin-right: 1rem;
    float: left;
    display: none;
}
article .content dd {
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    display: block;
}
blockquote {
    font-size: 1rem;
    border-left: 4px solid var(--lightbrown);
    padding-left: 2rem;
    margin-right: 0;
    margin-left: 0.5rem;
    margin-top: 1.414rem;
    margin-bottom: 0;
    font-style: italic;
}
article .content table {
    width: 100%;
    margin-top: 1.414rem;
    margin-bottom: 1.414rem;
    margin-left: auto;
    margin-right: auto;
}
article .content table .org-right {
    text-align: right;
}
label.input,
label.output {
    display: block;
    font-family: var(--mono);
    font-size: 0.8rem;
    margin-top: 1.414rem;
    font-family: var(--sans);
    font-size: 0.71rem;
    font-weight: bold;
    font-style: normal;
    margin-right: 0.71rem;
    display: inline-block;
}
.org-src-name {
    font-weight: normal;
}
label.input {
    color: var(--brown);
    line-height: 1.414rem;
}
label.output {
    color: var(--gray);
    line-height: 1.414rem;
}
label.input + .org-src-container,
label.output + .example,
.org-src-name + .org-src-container,
.org-src-name + .example {
    margin-top: 0;
}
.org-src-container + label.output {
    margin-top: 0;
}
.org-src-container,
.example {
    font-size: 0.71rem;
    /* overflow-x: scroll; */
    /*    border: 1px solid #c0c7b9; */
    /*    background-color: #fff7e9; */
    border-left: 0.2rem solid var(--lightgray);
    /* border-right: 4px solid var(--lightgray);*/
    margin-top: 0.71rem;
    margin-bottom: 1.414rem;
    /*border: 1px solid var(--lightgray);*/
    border-radius: 0.5rem;
    padding: 0.8rem;
    margin-left: -1rem;
    line-height: 0.84rem; /* fuck baseline rhythm */
}
article .content .org-src-container.full-width,
article .content .fullwidth .org-src-container {
    /* We're not going to be able to make it wider than this... */
    overflow-x: scroll;
}
article .content .org-src-container pre {
    margin: 0;
}
article .content hr {
    margin-top: 2.82rem;
    margin-bottom: 2.38rem;
    color: var(--gray);
    border: none; 
}
article .content hr::before {
    font-size: 1.41rem;
    text-align: center;
    content: "* * *";
    margin-left: auto;
    margin-right: auto;
    display:block;
    letter-spacing: 1.19rem;
}
/* **** INLINE ELEMENTS **** */
article .content abbr {
    font-variant: small-caps;
}
article .content sup a {
    border-bottom: 0;
}
article .content img.inline-image {
    display: inline;
    width: auto;
}
article .content code {
    color: var(--darkbrown);
}
article .content .katex {
    font-size: 0.95em; /* Breaks god damn modular sizing scheme but it's
                          because fonts be fonts. */
    /* actually that stuff also needs to be in em rather than rem, so it renders
       well also in the sidenotes... */
}

/* **** SIDENOTES **** */
article .content .sidenote {
    display: none;
}

/* *** FOOTER *** */
article .content footer {
    clear: both;
    font-size: 0.84em; /* em because it's a scaling factor, not absolute size */
    line-height: 1.414rem;
    border-top: 1px solid var(--gray);
    margin-top: 1.414rem;
}
article .content .footer h1 {
    font-size: 1em; /* em because it's a scaling factor, not absolute size */
    font-weight: bold;
    font-style: normal;
}
article .content footer .footdef {
    display: block;
    margin-bottom: 1.414rem;
}
article .content footer a.footnum {
    float: left;
}

.shoutout {
    margin-top: 2.8rem;
    text-align: center;
    width: 16rem;
    margin-left: auto;
    margin-right: auto;
}

.shoutout .redacted {
    display: inline-block;
    width: 4rem;
    background-color: #000;
    color: #000;
}


/* ** PAGE FOOTER ** */
body > footer {
    display: flex;
    flex-flow: column;
    max-width: 45.2rem;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 5.656rem;
    text-align: center;
}

body > footer p {
    margin: 0;
}

/* * MEDIA QUERIES * */
@media (min-width: 780px){
    article header h1,
    article .content {
        width: 64%; /* no longer 32rem and 19rem, depending on container size */
        margin-left: 1%;
    }
    article .content img {
        clear: none;
    }
    article .content .fullwidth {
        width: 154%;
        clear: both;
    }
    article .content .org-src-container.full-width {
        width: 154%;
        clear: both;
    }
    article .content .sidenote,
    article .content .aside,
    #table-of-contents,
    article .content .sidenote code {
        font-size: 0.84em; /* em b/c it's a scaling factor, not absolute size */
        color: var(--gray);
        line-height: 1.42rem;
        text-indent: 0;
    }
    article .content .sidenote code {
        font-size: 0.75em;  /* for some god damned weird reason */
    }
    article .content .sidenote,
    article .content .aside,
    #table-of-contents {
        display: block;
        float: right;
        clear: right;
        position: relative;
        margin-right: -54%; /* no longer 21.8rem */
        margin-bottom: 1.41rem;
        width: 44%;
        top: 0.1rem;
    }
    #table-of-contents h1 {
        color: #000;
        font-size: 0.89rem;
        margin: 0 1rem 0 0;
    }
    #table-of-contents li {
        display: block;
        clear: left;
    }
    .forceinline #table-of-contents {
        font-size: 1rem;
        float: none;
        clear: none;
        position: static;
        margin-right: 0; /* 21.8rem */
        text-indent: 0;
        color: #000;
        margin-bottom: 2.83rem;
        line-height: 1.41rem;
        width: auto;
    }
    .forceinline #table-of-contents li {
        display: inline;
        clear: none;
    }

    article .content footer {
        display: none;
    }
}

/* * LEGACY CSS * */
article .legacy h1 {
    margin-top: 56px;
    margin-bottom: 40px;
}
article .legacy p.image-text {
    font-style: italic;
    text-align: center;
    margin-bottom: 32px;
}
article .legacy img.center-img + p.image-text {
    margin-top: -28px;
}
article .legacy footer {
    display: block;
    text-align: left;
    border-top: 0;
    width: 100%;
    padding-top: 0;
}
article .legacy footer ol {
    list-style: none;
    padding-left: 0;
}
article .legacy kbd {
    font-family: var(--mono), monospace !important;
    font-size: 0.71em;
    background-color: #fffcf9;
    padding: 4px;
    color: var(--darkbrown);
    box-shadow: -1px -2px 0px 0px rgba(48,25,0,0.25) inset;
    font-weight: bold;
    min-width: 1.5em;
    padding-left: 6px;
    padding-right: 6px;
    border: 1px solid rgba(48,25,0,0.25);
}
article .legacy kbd+kbd {
    margin-left: 6px;
}
article .legacy li > ul, li > ol {
    margin-bottom: 32px;
}
article .legacy img {
    padding: 4px;
    margin: 8px;
    max-width: 100%;
}
article .legacy .center-img {
    display: block;
    margin: 32px auto 32px auto;
    clear: both;
}
article .legacy code {
    font-family: var(--mono), monospace !important;
    color: var(--darkbrown);
    font-size: 0.7rem;
    background-color: #fffcf8;
    border-radius: 2px;
}
article .legacy pre {
    font-family: var(--mono), monospace !important;
    margin-top: 16px;
    margin-bottom: 16px;
    background: #000000;
    color: #fffcf9;
}
article .legacy pre code {
    color: #fffcf9;
    white-space: pre;
    word-wrap: normal;
    background: none;
    border: 0;
    font-size: 0.7rem;
}
article .legacy ul,ol {
    margin-top: 16px;
    margin-bottom: 16px;
}
article .legacy abbr {
    font-variant: small-caps;
    font-size: 85%;
    font-weight: 600;
}
article .legacy span.old {
    color: var(--gray);
}

/* * Natural-language HTML list (for e.g. tags) *

 */
