/*

   VERTICAL SPACING

   Everything should be multiple of body line-height expressed in
   terms of rem.

   1.4 = 1.4, 2.8, 4.2, 5.6
 */

@media all {
    html { font-size: 22px; }
    .content, header, footer {
	font-family: "triplicate t3p";
	width: 62ch;
    }
    code, pre { font-family: "triplicate t3c"; }
}
@media all and (max-width: 912px) {
    html { font-size: 21px; }
    .content, header, footer {
	font-family: "triplicate t3p";
        width: 62ch;
    }
    code, pre { font-family: "triplicate t3c"; }
}
@media all and (max-width: 870px) {
    html { font-size: 20px; }
    .content, header, footer {
	font-family: "triplicate t3p";
	width: 62ch;
    }
    code, pre { font-family: "triplicate t3c"; }
}
@media all and (max-width: 812px) {
    html { font-size: 18px; }
    .content, header, footer {
	font-family: "triplicate t4p";
	width: 62ch;
    }
    code, pre { font-family: "triplicate t4c"; }
}
@media all and (max-width: 730px) {
    html { font-size: 18px; }
    .content, header, footer {
	font-family: "triplicate t4p";
	width: 58ch;
    }
    code, pre { font-family: "triplicate t4c"; }
}
@media all and (max-width: 660px) {
    html { font-size: 18px; }
    .content, header, footer {
	font-family: "triplicate t4p";
	width: 48ch;
    }
    code, pre { font-family: "triplicate t4c"; }
}
@media all and (max-width: 600px) {
    html { font-size: 18px; }
    .content, header, footer {
	font-family: "triplicate t4p";
	width: 44ch;
    }
    code, pre { font-family: "triplicate t4c"; }
}
@media all and (max-width: 560px) {
    html { font-size: 16px; }
    .content, header, footer {
	font-family: "triplicate t4p";
	width: 42ch;
    }
    code, pre { font-family: "triplicate t4c"; }
}
@media all and (max-width: 410px) {
    html { font-size: 16px; }
    .content, header, footer {
	font-family: "triplicate t4p";
	width: 38ch;
    }
    code, pre { font-family: "triplicate t4c"; }
    /* Fit more chars in a small screen. */
    code.block,figure.code pre { letter-spacing: -0.05em; }
}
@media all and (max-width: 370px) {
    html { font-size: 14px; }
    .content, header, footer {
	font-family: "triplicate t4p";
	width: 34ch;
    }
    code, pre { font-family: "triplicate t4c"; }
    code.block,figure.code pre { letter-spacing: -0.05em; }
}

* {
    /* Strip default margins and padding. */
   margin: 0;
   padding: 0;
   /* Tell mobile browsers not to auto resize my fonts. I can make my
   own responsive design, thank you very much. */
   -moz-text-size-adjust: none;
   -ms-text-size-adjust: none;
   -webkit-text-size-adjust: none;

   }

/* Center the content. */
.content,
header,
footer {
    margin: 0 auto;
}

.content {
    margin-bottom: 1.4rem;
    margin-top: 1.4rem;
}


/*

BODY

*/

body {
    /* Enable kerning. */
    font-feature-settings: "kern" on;
    -webkit-font-feature-settings: "kern" on;
    text-rendering: optimizeLegibility;
}

body,
br {
    line-height: 1.4em;
}

p + p {
    margin-top: 1.4rem;
}

/*

HEADERS

*/
header a,
h1 a,
h2 a,
h3 a {
    text-decoration: none;
}

header {
    font-family: "triplicate c4p";
}

h1 {
    font-family: "triplicate c4p";
    font-size: 1.20rem;
    margin-bottom: 2.0rem;
    margin-top: 2.2rem;
}

h2 {
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
    margin-top: 1.6rem;
}

h3 {
    font-size: 1rem;
    margin-bottom: 0.6rem;
    margin-top: 0.8rem;
}

/*

CODE

Code blocks have their on vertical tempo inside of the box.

*/

code {
    background-color: #f2f2f2;
}

code.block {
    border-bottom: 0.06rem dashed;
    border-top: 0.06rem dashed;
    display: block;
    /* font-family needs to be controlled by media queries for responsive web */
    /* font-family: "triplicate t4c"; */
    font-size: 0.75rem;
    line-height: 1.4em;
    margin: 1.4rem 0;
    overflow: scroll;
    padding: 1em 0;
    white-space: pre;
}

div.code {
    margin-top: 1.4rem;
}

/* TODO Is this still used? */
div.code span.title {
    display: block;
    font-size: 0.9rem;
    font-weight: bold;
    text-align: center;
}

div.code code.block {
    margin-top: 0;
}

/*
 * New figure-based code block.
 */
figure.codeblock-lineno div,
figure.codeblock div,
figure.codeblock pre,
figure.cmd pre
{
    background-color: #f2f2f2;	/* TODO: get rid of this? */
    border-bottom: 0.06rem dashed;
    border-top: 0.06rem dashed;
    overflow-x: auto;
    width: 100%;
}

figure.cmd pre
{
    overflow-x: unset;
    overflow-y: auto;
    white-space: pre-wrap;
}

figure.codeblock figure,
figure.codeblock-lineno figure,
figure.codeblock div,
figure.codeblock-lineno div
{
    margin: 0;
}

figure.cmd pre,
figure.codeblock pre,
figure.codeblock-lineno pre
{
    /*
     * We use the same font for all code figures, thus there is no
     * need to set this based on media type.
     */
    font-family: "triplicate t4c";
    font-size: 0.75rem;
    line-height: 1.4em;
    min-width: 100%;
}

figure.codeblock-lineno pre
{
   display: table;
   table-layout: fixed;
}

figure.codeblock.short div,
figure.codeblock-lineno.short div,
figure.cmd.short pre
{
    height: calc(28 * 1em);
}

figure.codeblock-lineno pre::before
{
    counter-reset: linenum;
}

figure.codeblock-lineno pre span.tr
{
    counter-increment: linenum;
}

figure.codeblock pre span.tr,
figure.codeblock-lineno pre span.tr
{
    display: table-row;
}

figure.codeblock pre span.tr:nth-child(even),
figure.codeblock-lineno pre span.tr:nth-child(even)
{
    background-color: #e8e8e8;
}

figure.codeblock pre span.tr:nth-child(odd),
figure.codeblock-lineno pre span.tr:nth-child(odd)
{
    background-color: #f2f2f2;
}

figure.codeblock pre span.tr:hover,
figure.codeblock-lineno pre span.tr:hover
{
    background-color: #cce6ff;
}

figure.cmd pre span code,
figure.codeblock pre span code,
figure.codeblock-lineno pre span code
{
    background-color: inherit;
    /*
     * We use the same font for all code figures, thus there is no
     * need to set this based on media type.
     */
    font-family: "triplicate t4c";
}

figure.codeblock pre span.th,
figure.codeblock-lineno pre span.th
{
    display: table-cell;
    user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
}

figure.codeblock-lineno pre span.th::before
{
    content: counter(linenum);
    display: block;
    text-align: right;
}

figure.codeblock pre span.th,
figure.codeblock-lineno pre span.th
{
    padding-right: 2ch;
    width: 4ch;
}

figure.codeblock pre code,
figure.codeblock-lineno pre code
{
    display: table-cell;
}

/*

IMAGES

*/
img {
    display: block;
    margin: 1.4rem auto;
    max-width: 100%;
}

figure object {
    width: 100%;
}

/*

LISTS

*/
ul {
    padding-left: 2ch;
}

dl,
ol,
ul {
    margin: 1.4rem 0;
}

dd + dt,
ol + ol,
ul li + li,
ol li + li {
    margin-top: 1.4rem;
}


dl dt {
    font-weight: bold;
    font-style: italic;
}

ol li {
    list-style-type: decimal;
    list-style-position: outside;
    margin-left: 2.5ch;
}

/* Pad it left 10 characters to account for post ID. */
ol.linklist li {
    list-style-type: none;
    margin-left: unset;
    padding-left: 10ch;
}

ol.linklist span.listnum {
    clear: both;
    display: inline;
    float: left;
}

ol.linklist a {
    text-decoration: none;
}

ol.linklist div {
    margin-top: 0.7rem;
}

ol.linklist + ol {
    margin-top: 2.8rem;
}


/*

REFLIST

*/
table.references {
    margin: 0;
}

table.references tr td:first-child {
    vertical-align: top;
}

table.references td + td {
    padding-left: 2ch;
}

table.references tr + tr td {
    padding-top: 1.4rem;
}

ul.reflist,
ul.reflist p {
    margin: 0;
}

ul.reflist p.info span +  span:before {
    content: "—";
}

ul.reflist {
    padding-left: 0;
}

ul.reflist li {
    list-style-type: none;
}

li span.title {
    font-weight: bold;
}

li span.title:after {
    content: ": ";
}

/*

DUNNO LIST, because I dunno what to call it yet.

*/
ul.dunno h3 {
    margin-bottom: 0;
    margin-top: 1.4rem;
}

ul.dunno p {
    margin: 0 0;
}

ul.dunno p.summary {
    margin-top: 0.7rem;
}

ul.dunno li span.location:after {
    content: ",";
}

ul.dunno li span.vs:before {
    content: "[";
}

ul.dunno li span.vs:after {
    content: "]";
}

/* Tight list: no margin between list items. */
ul.tight li {
    margin-top: 0;
}


/*

LINKS

*/
a {
    color: inherit;
    text-decoration-color: #e02020;
    -moz-text-decoration-color: #e02020;
    -webkit-text-decoration-color: #e02020;
}

a:hover {
    color: #e00000;
}

a.ref {
    text-decoration: none;
}

a.ref:before {
    content: "«";
}

a.ref:after {
    content: "»";
}


/*

QUOTES

Yes, this breaks veritcal tempo by using a line-height not a multiple
of the root line-heigh but I don't give a shit. This is a single
column layout.

*/
blockquote {
    background: #e6e6ff;
    font-family: "triplicate t4p";
    font-size: 0.9rem;
    padding: 1ch 1ch;
    line-height: 1.4em;
    margin: 1.4rem auto;
    width: 90%;
}

blockquote cite {
    display: block;
    font-size: 0.75rem;
    margin-top: 1em;
}

body {
    background: #fdfdfd;
}

/*

TABLES

 */
table {
    border-collapse: collapse;
    display: block;
    font-size: 0.9rem;
    margin: 1.4rem auto;
    overflow-x: auto;
    text-align: left;
    width: 90%;
}

tr {
    width: 30ch;
}

table thead {
    border-bottom: 2px solid #000000;
}

table tr.superheader {
    text-align: center;
}

/* Put padding between columns except for leftmost. */
td + td, th + th, th + td {
    padding-left: 1ch;
}


/*

ASIDE

*/
span.aside {
    color: #888888;
    float: none;
    position: static;
    text-align: left;
}

aside:before,
span.aside:before {
    content: "‹";
}

aside:after,
span.aside:after {
    content: "›";
}


/*

FIGURES

*/
figure {
    margin: 1.4rem 0;
}

figure code.block {
    margin-bottom: 0.5rem;
}

figcaption {
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
}

figcaption span.title:after {
    content: ": ";
}

figure a {
    text-decoration: none;
}


/*

NOTES

This is a block element inline with normal flow of content. Meant for
special notices which draw attention but clearly separate from the
main content. E.g. an update to a piece of writing or a nota bene.

*/
div.note {
    border-bottom: 1px solid #ccc;
    border-top: 1px solid #ccc;
    margin: 1.3rem auto;
    padding: 0.5rem 0;
    text-align: justify;
    width: 80%;
}

div.note-title {
    font-weight: bolder;
    font-size: 0.95rem;
    line-height: 1.4em;
    text-align: center;
}

div.note p {
    font-size: 0.8rem;
    line-height: 1.4em;
}

/*

MISC

*/
h1,
p.date {
    text-align: center;
}

span.attn:before {
    content: "/";
    color: #e00000;
}

ol.footnotes li a + a:before,
ol.footnotes li p a:before {
    content: "⏎";
}

/*

HIGHLIGHTS

*/
.hll { background-color: #f7bdbd; }
