/*
 * Cascading stylesheet for GNU Emacs org mode
 * Nicolas P. Rougier - September 2020
 * Original styles released under a Creative Commons CC-BY 4.0 licence
 * Color scheme and additional theme styling adapted from Earl Grey
 * by halt.wtf (https://earl-grey.halt.wtf/)
 * Licensed under the Parity License (https://paritylicense.com/)
 *
 * IBM Plex fonts © 2017 IBM Corp.
 * Licensed under the SIL Open Font License 1.1
 */

@charset "utf-8";
@import url('fonts/ibm-plex-sans-all.css');
@import url('fonts/ibm-plex-mono-all.css');

/* Base styles */
body {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 14px;
    font-weight: 300;
    color:  #605A52; /* foreground */
    line-height: 1.4em;
    counter-reset: section;
    counter-reset: toc-section;
    counter-increment: toc-section;
    margin: 0;
    padding: 0;
    background-color: #FCFBF9; /* background */
}

/* Navigation styling */
header {
    width: 100%;
    background-color: #FCFBF9; /* background */
    border-bottom: 1px solid #E4DAE0;
    margin-bottom: 2em;
}

nav {
    max-width: 720px;
    margin: 0 auto;
    padding: 1em 0;
    display: flex;
    gap: 2em;
}

nav a {
    text-decoration: none;
    color: #556995; /* color4 */
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9em;
    transition: color 0.2s ease;
}

nav a:hover {
    color: rgba(85, 105, 149, 0.75);
}

/* Content and main layout */
#content, #postamble {
    margin: 0 auto;
    max-width: 720px;
    margin-top: 2.5%;
    margin-bottom: 2.5%;
}

a, a:visited {
    text-decoration: none;
    color: #556995; /* color4 */
}

a:hover, a:visited:hover {
    color: #556995; /* color4 */
}


.org-bold {
    font-weight: 400;
}

i, i a {
    color: #BEBBB6; /* color8 */
    font-style: italic;
}

.org-italic, .org-org-meta-line {
    color: #556995; /* color4 */
    font-style: italic;
}

.org-face-salient {
    font-weight: 400;
}

/* Blinking cursor when strike-through */
.custom { animation: blinker 1s linear infinite; }
@keyframes blinker { 50% { opacity: 0; } }

/* Side notes */
div.side-note::before {
    content: "Note";
    color: #605A52; /* foreground */
    font-weight: 400;
}

div.side-note {
    color: rgba(96, 90, 82, 0.5); /* foreground */
    float: left;
    font-size: .85em;
    line-height: 1.25em;
    margin-left: -24em;
    width: 20em;
}

/* Table of contents */
#table-of-contents {
    padding-top: 0em;
    margin-top: 0em;
    text-transform: uppercase;
}

#table-of-contents ul {
    padding: 0;
    font-weight: 400;
    list-style: none;
    counter-reset: list 0;
}

#table-of-contents ul ul {
    padding-left: 0em;
    font-weight: 300;
    font-size: 90%;
    line-height: 1.5em;
    margin-top: 0em;
    margin-bottom: 1em;
    padding-left: 2em;
}

#table-of-contents h2:before {
    content: "";
    counter-reset: section;
}

#table-of-contents ul li {
    vertical-align: top;
    display: inline-block;
    width: 32%;
}

#table-of-contents ul li:before {
    display: inline-block;
    counter-increment: list;
    content: counters(list, ".") "〉";
    width: 2.0em;
    margin-left: -2.0em;
    text-align: right;
    text-transform: uppercase;
    color: #556995; /* color4 */
}

#table-of-contents ul li ul,
#table-of-contents ul li ul li {
    display: static;
    width: 100%;
    padding-left: 0;
    line-height: 1.35em;
}

#table-of-contents ul li ul li:before {
    content: ""
}

#table-of-contents h2 {
    font-size: 1em;
    font-weight: 400;
    padding-top: 5em;
}

#table-of-contents h2:before {
    content: "⌘";
}

/* Text elements */
blockquote {
    color: #999999;
    padding-top: 0;
    margin-left: 1em;
    padding-left: 1em;
    border-left: 3px solid #E4DAE0; /* selection_background */
}

blockquote.tip {
  color: #747B4D; /* color2 */
  background-color: #E1E1D7; /* color10 */
  border-left: 5px solid #747B4D; /* color2 */
}

blockquote.warning {
  color: #8F5652; /* color1 */
  background-color: #E6DAD8; /* color9 */
  border-left: 5px solid #8F5652; /* color1 */
  padding: 0.5rem 1rem;
  margin-left: 0;
  border-radius: 4px;
}

ul.org-ul {
    padding-left: 0
}

ul.org-ul li  {
    list-style-type: none;
    margin-bottom: .5em;
}

ul.org-ul li p {
    display: inline-block;
    margin-top: 0em;
    margin-bottom: 0em;
}

ul.org-ul li::before {
    display: inline-block;
    content: "— ";
    color: #BEBBB6; /* color8 */
    width: 1em;
    margin-left: -1em;
}

ol.org-ol {
    padding-left: 0;
    margin-left: 2em;
    list-style: none;
    counter-reset: li;
}

.org-ol li  {
    counter-increment: li;
    margin-bottom: .25em;
}

.org-ol li::before {
    content: counter(li) ". ";
    color: #BEBBB6; /* color8 */
    display: inline-block;
    width: 2em;
    margin-left: -2em;
}

/* Headings */
h1.title {
    font-size: 1.5em;
    margin-top: 4em;
    margin-bottom: 0em;
    font-weight: 400;
    text-align: left;
    color: #605A52; /* foreground */
}

span.subtitle {
    font-family: "IBM Plex Mono";
    text-transform: lowercase;
    display: inline-block;
    margin-top: .25em;
    font-size: 74.5%;
    font-weight: 300;
    color: #999999;
}

h3 { padding-top: .5em; }

h2, h3, h4 {
    color: #605A52; /* foreground */
    font-size: 1em;
    font-weight: 400;
    text-transform: uppercase;
}

h2 { padding-top: 5em; }
h3 { padding-top: 3em; }

body {
  counter-reset: section;
}

h2 {
  counter-reset: subsection;
}

h2::before {
    color: #E4DAE0; /* selection_background */
    float: left;
    text-align: right;
    font-weight: 300;
    width: 7.5em;
    margin-left: -8.0em;
    counter-increment: section;
    content: "Chapter " counter(section) " ";
}

h3::before {
    color: #E4DAE0; /* selection_background */
    float: left;
    text-align: right;
    font-weight: 300;
    width: 2.5em;
    margin-left: -3.0em;
    counter-increment: subsection;
    content: counter(section) "." counter(subsection) " ";
}

/* Code blocks */
code {
    background-color: #F7F3EE; /* color0 */
    font-family: "IBM Plex Mono", sans-serif;
    font-weight: 400;
    color: #00008b;
}

pre::before {
    color: #E4DAE0; /* selection_background */
    float: left;
    text-align: right;
    font-weight: 300;
    width: 3.0em;
    margin-left: -4.25em;
    font-variant: small-caps;
    content: "";
}

pre.src-emacs-lisp::before { content: "elisp"; }
pre.src-lisp::before { content: "lisp"; }
pre.src-org::before { content: "org"; }

pre {
    color: #00008b;
    background-color: #FCFBF9; /* background */
    overflow: auto;
    margin: 0em;
    padding: 0.25em;
    padding-left: 0.5em;
    line-height: 1.35em;
    font-family: "IBM Plex Mono", sans-serif;
    font-weight: 300;
    border-left: 2px dotted #00008b;
}

pre.src {
    position: relative;
    overflow: visible;
}

/* Code folding */
details {
    color: #556995; /* color4 */
    background: #FCFBF9; /* background */
    border: 1px solid #556995; /* color4 */
    border-radius: 3px;
    padding:  0.25em;
    margin-bottom: 1.0em;
}

details pre {
    border: 0;
}

details pre.src-lisp::before { content: ""; }

summary {
    outline: 0;
    color: #556995; /* color4 */
}

summary::after {
    font-size: 0.85em;
    color: rgba(85, 105, 149, 0.25);
    display: inline-block;
    float: right;
    content: "Click to fold/unfold";
    padding-right:  0.5em;
}

/* Tables */
table { min-width: 100%; }

table, tbody, td, tr, th, colgroup, thead {
    border: 0;
}

table {
    margin-top: 1em;
}

thead {
    border-bottom: 1px dashed black;
}

th {
    text-align: left;
    font-weight: 400;
    padding: 0;
    margin-bottom: 0.25em;
    padding-bottom: 0.25em;
}

td { padding: 0; }

tr:nth-child(even) {background: #F7F3EE; /* color0 */ }
tr:nth-child(odd) {background: #FCFBF9; /* background */ }

/* Description list */
dd {
    margin-top: 0.25em;
    margin-bottom: 0.50em;
}

/* Back links in header */
div.back a {
    float: right;
    font-weight: 300;
    color: #E4DAE0; /* selection_background */
    font-variant: small-caps;
    margin-top: -2.5em;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Footer */
#postamble {
    padding-top: 1.5em;
    border-top: 1px solid #E4DAE0; /* selection_background */
    margin-top: 3em;
}

#postamble p, #postamble a {
    color: #999999;
    line-height: 1.25em;
    margin: 0;
    text-align: right;
}
