/* Copyright (c) 2017 Anish Athalye */
@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro");
@import url("https://fonts.googleapis.com/css?family=Source+Code+Pro");

/* Basic styling */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  text-rendering: geometricPrecision;
}

html {
  font-family: "Source Sans Pro", sans-serif;
  font-size: 14pt;
  line-height: 1.5;
}

body {
  margin: 0;
  color: #000;
  background-color: #fff;
  overflow-y: scroll;
}

h1, h2, h3, h4, h5, h6 {
  margin-bottom: 1rem;
  font-weight: bold;
  line-height: 1.25;
  font-size: 1rem;
}

h1 {
  margin-top: 1.25rem;
  font-size: 1.5rem;
}

h2 {
  margin-top: 1.25rem;
  font-size: 1.1rem;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

strong {
  font-weight: bold;
}

em {
  font-style: italic;
}

ul {
  list-style-position: inside;
  padding-left: 1rem;
}

ol {
  margin-left: 1rem;
}

li > ul {
  padding-left: 2rem;
}

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

ul, ol {
  margin-bottom: 1rem;
}

ul ul, ol ul, ul ol, ol ol {
  margin-bottom: inherit;
}

ul li:before {
  content: "\2013  "; /* note: extra space needed because first is consumed by css parser */
  position: absolute;
  margin-left: -1rem;
}

ul.double-spaced li {
  margin-top: 1rem;
}

pre, code {
  font-family: "Source Code Pro", "Menlo", "DejaVu Sans Mono", "Lucida Console", monospace;
}

code {
  background-color: rgba(27,31,35,.05);
  border-radius: 3px;
  padding: 0 0.2rem;
  font-size: 12pt;
}

pre {
  color: #000;
  margin: 1rem;
  padding: 0.5rem 0.7rem;
  border: 1px dashed #444;
  font-size: 11pt;
  overflow-x: auto;
}

pre code {
  color: inherit;
  background: none;
  font-size: 100%;
  padding: 0;
}

a {
  color: #54008c;
  text-decoration: underline;
}

a:hover {
  color: #fff;
  background-color: #54008c;
}

img, video {
  display: block;
  margin-left: auto;
  margin-right: auto;
  border-radius: 5px;
  max-width: 100%;
  max-height: 80vh;
}

video {
  margin-bottom: 1rem;
}

summary {
  outline: none;
  user-select: none;
}

hr {
  position: relative;
  margin: 1.5rem 0;
  border: 0;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #fff;
}

blockquote {
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background-color: rgba(36, 0, 140, 0.05);
  border-left: 3px solid #24008c;
}

blockquote p:last-child {
  margin-bottom: 0;
}

blockquote.epigraph {
  background: none;
  border: none;
  padding: 0;
  margin: 1.5rem 0 1.5rem 1rem;
}

blockquote.epigraph p {
  font-style: italic;
  margin-bottom: 0.5rem;
}

blockquote.epigraph footer {
  font-size: 0.9rem;
  text-align: right;
}

@media (min-width: 64rem) {
  #content {
    position: relative;
  }

  .sidenote-column {
    position: absolute;
    top: 0;
    left: calc(100% + 1.5rem);
    width: 14rem;
  }

  /* Hide inline sidenotes on desktop, show margin ones */
  .sidenote-inline {
    display: none;
  }

  .sidenote-margin {
    position: absolute;
    width: 100%;
    padding: 0.2rem 0.5rem 0.5rem 0.5rem;
    margin: 0;
    font-size: 0.8rem;
    color: #000;
    background: none;
    border: none;
    border-left: 2px solid #54008c;
  }

  .sidenote-ref {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.5rem 0;
    width: 100%;
    background-color: #e8e8e8;
    font-size: 0.7rem;
    line-height: 1.4;
    padding: 0.15rem 0.5rem;
    box-sizing: border-box;
  }

  .sidenote-arrows {
    color: #54008c;
    letter-spacing: 0.1em;
  }

  .sidenote-label {
    color: #666;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
  }

  .sidenote-num {
    color: #54008c;
    font-size: 0.65rem;
    font-weight: bold;
    margin-right: 0.15rem;
    margin-bottom: 0.1rem;
    display: block;
  }

  .sidenote-back {
    color: #54008c;
    text-decoration: none;
    font-size: 0.9em;
  }

  .sidenote-back:hover {
    text-decoration: underline;
  }
}

@media (max-width: 63.99rem) {
  /* Hide margin sidenotes and column on mobile, show inline ones */
  .sidenote-column {
    display: none;
  }

  .sidenote-inline {
    display: block;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    background-color: #faf8fc;
    border-left: 3px solid #54008c;
  }

  .sidenote-ref {
    display: none;
  }
}

/* Classes */

.title {
  font-size: 2rem;
}

.subtitle {
  margin-top: -1rem;
  font-size: 1.25rem;
}

.small {
  font-size: 0.75rem;
}

.small p {
  margin-bottom: 0;
}

.center {
  text-align: center;
}

.padded {
  padding: 10rem 0;
}

.bordered {
  border: 1px solid #ccc;
}

.accent {
  color: #8c0038;
}

.youtube-wrapper {
  position: relative;
  height: 0;
  margin-bottom: 1rem;
  background: black;
}

.youtube-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.construction {
  display: block;
  padding: .5em 1em;
  background: rgba(0, 0, 0, 0.1);
  border-left: 2px solid #54008c;
}

/* Elements */

#content {
  max-width: 35rem;
  margin: auto;
  margin-bottom: 2rem;
  padding: 1rem 1rem 0 1rem;
}

.demo {
  margin-top: 2em;
  margin-bottom: 2em;
}

#nav-bg {
  margin: 0;
  padding: 0.25rem 1rem;
  font-family: "Source Code Pro", "Menlo", "DejaVu Sans Mono", "Lucida Console", monospace;
  background: #24008c;
  color: #fff;
}

#top-nav {
  max-width: 40rem;
  margin: auto;
  text-align: center;
}

#top-nav a {
  color: #fff;
  text-decoration: none;
}

#top-nav a:hover {
  color: #000;
  background-color: #fff;
}

a#logo {
  color: #f2deff;
}

a:hover#logo {
  color: #000;
}

#menu-icon {
  display: none;
}

.trigger {
  display: none;
}

input[type=checkbox]:checked ~ .trigger {
  display:block;
  margin: auto;
}

.menu-label {
  font-family: "Source Code Pro", "Menlo", "DejaVu Sans Mono", "Lucida Console", monospace;
}

input[type=checkbox] ~ .menu-label:after {
  content: "(+)";
}

input[type=checkbox]:checked ~ .menu-label:after {
  content: "(-)";
}

.nav-link {
  display: block;
}

.trigger-child {
  display: inline-block;
  text-align: initial;
}

.nav-link:before {
  content: "- ";
}

/* in terms of our fixed-width layout; if smaller than this, we want to
 * collapse the menu */
@media (min-width: 40rem) {
  .menu-label {
    display: none;
  }

  .trigger {
    display: inline;
    padding-top: inherit;
  }

  .trigger-child {
    display: inline;
    text-align: initial;
  }

  input[type=checkbox]:checked ~ .trigger {
    display: inline;
  }

  .nav-link {
    display: initial;
  }

  .nav-link:before {
    content: "| ";
  }
}

@media (prefers-color-scheme: dark) {

  body {
    background-color: #303030;
    color: #ddd
  }

  a {
    color: #66D9EF;
    text-decoration: none;
  }

  a:hover {
    color: #000;
    background-color: #66D9EF;
    text-decoration: none;
  }

  h1, h2, h3, h4, h5, h6 {
    color: #eee;
  }

  #nav-bg, a#logo, #top-nav a {
    background-color: #A6E22E;
    color: #202020;
  }

  a:hover > code  {
    background-color: #66D9EF;
  }

  .accent {
    color: #F92672;
  }

  .construction {
    background: rgba(0, 0, 0, 0.5);
    border-left: 2px solid #A6E22E;
  }

  blockquote {
    background-color: rgba(166, 226, 46, 0.06);
    border-left-color: #A6E22E;
  }

  .sidenote-margin {
    color: #bbb;
    border-left-color: #A6E22E;
  }

  .sidenote-inline {
    border-left-color: #A6E22E;
  }

  .sidenote-ref {
    background-color: #404040;
  }

  .sidenote-arrows {
    color: #A6E22E;
  }

  .sidenote-label {
    color: #aaa;
  }

  .sidenote-num {
    color: #A6E22E;
  }

  .sidenote-back {
    color: #A6E22E;
  }
}

@media (prefers-color-scheme: dark) and (min-width: 64rem) {
  .sidenote-margin {
    background: none;
    color: #ddd;
  }
}

@media (prefers-color-scheme: dark) and (max-width: 63.99rem) {
  .sidenote-inline {
    background-color: rgba(166, 226, 46, 0.06);
  }
}

@media print {
  #nav-bg, #logo, #top-nav { display: none; }
  h1.title ~ p.center.padded.bordered { display: none; }
  .youtube-wrapper { display: none; }
  .sidenote-column { display: none; }
  .sidenote-ref { display: none; }
  .sidenote-inline {
    display: block;
    background: none;
    border-left: 2px solid #999;
    padding: 0 0 0 0.75rem;
    margin: 1rem 0;
  }
  html { font-size: 1em; font-family: sans-serif; }
  body { background: none; }
  #content { max-width: none; }
  h1.title { text-align: center; }
  h1, h2, h3, h4, h5, h6 { break-after: avoid-page; page-break-after: avoid; }
  #content hr:last-of-type { display: none; }
  #content pre { break-inside: avoid-page; page-break-inside: avoid; white-space: pre-wrap; }
  #content div.small:last-of-type { display: none; }
  a[href^="https://"]::after, a[href^="http://"]::after {
    content: "("attr(href)")"; font-family: monospace; margin: 0 .25em;
  }
}
