body {
  -webkit-font-smoothings: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

code {
  padding: 2px 4px;
  font-size: 90%;
  background-color: #eeeeee;
  hyphens: none;
  /* reset changes from <p> */
  -webkit-hyphens: none;
  -ms-hyphens: none;
  word-wrap: break-word;
  /* border-radius: 4px; */
}

/* Reset these values when there's code inside a pre. Pre handles the styling then.*/
pre code {
  background-color: transparent;
  padding: 0;
}

pre {
  display: block;
  padding: 9.5px;
  margin: 0 0 10px;
  line-height: 1.4;
  word-wrap: break-word;
  border: 1px solid #ccc;
  box-shadow: 0 5px 5px -5px #777777;
  max-width: 100%;
  /* These two copied from chroma theme (syntax.css) */
  color: #f8f8f2;
  background-color: #272822;
}

pre,
code {
  font-family: monocode, monospace;
  -webkit-font-smoothings: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Lora', serif;
}

h1#title {
  /*Some UA stylesheets put h1 to 1.5em when in an article, so we reset it back for our title here.*/
  font-size: 2em;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
}

.content-container {
  padding-left: 1em;
  padding-right: 1em;
}

.content-container-narrow-pad {
  padding: 0.5em;
}

.v-center {
  align-items: center;
}

.look-sheet-bkg {
  background-color: white;
}

@media(min-width: 720px) {

  /* Make everything 10% smaller! */
  html {
    font-size: 14.4px;
  }

  .content-container {
    /* ACHTUNG:
    Images are scaled in the fitfigure shortcode with an assumption that the
    page is 652px wide. If you change this value, remeasure and change the value
    there too. */
    width: 45rem;
    padding-left: 2em;
    padding-right: 2em;
    margin: 0 auto;
  }

  .content-container-narrow-pad {
    padding-left: 0.5em;
    padding-right: 0.5em;
    width: 45rem;
    margin: 0 auto;
  }

  .bottom-links {
    border: 1px solid #ccc;
    border-bottom: 0px;
  }

  .look-sheet {
    border: 1px solid #ccc;
    box-shadow: 0 5px 5px -5px #777777;
    margin-top: 1em;
    margin-bottom: 1em;
    min-height: 0px;
    background-color: white;
  }

  .look-sheet-bkg {
    background-color: #fffdf7;
  }
}

figure.smaller {
  max-width: 67%;
}

.look-sheet-border {
  border: 1px solid #ccc;
  box-shadow: 0 5px 5px -5px #777777;
  margin-top: 1em;
  margin-bottom: 1em;
  min-height: 0px;
}

.article-pad-v {
  padding-top: 1em;
  padding-bottom: 1em;
}

blockquote {
  border-left: #777 0.25em solid;
  padding: 0 1.25em;
  margin: 2em 0 2em 1em;
}

body.sticky-nav .navbar {
  position: sticky;
  z-index: 1000; /* theoretically this should be applied automatically but it doesn't work on Safari in some circumstances */
  top: 0;
}

.nav-bkg {
  color: white;
  background: #000;
}

.nav-bkg-50 {
  color: white;
  background: #000;
}

.drop-shadow {
  box-shadow: 0 5px 5px -5px #777777;
}

.nav-bkg a {
  text-decoration: underline;
}

.pagewide-bar-padding {
  padding: 0.5em 1em;
}

nav a,
nav a:hover,
nav a:visited {
  color: white;
}

.post-date {
  color: #777;
}

.post-tags,
.post-tags a,
.post-tags a:hover,
.post-tags a:visited {
  color: #777;
}

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

.article-body h2,
.article-body h3 {
  margin-top: 2em;
  margin-bottom: 0.5em;
}

kbd {
  background-color: #333;
  color: #fff;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 95%;
  white-space: nowrap;
}

figure {
  margin: 2em auto;
  display: table;
  text-align: center;
}

.squash-bottom {
  margin-bottom: 0;
}

.squash-top {
  margin-top: 0;
}

.twoup.squash-bottom figure {
  margin-bottom: 0;
}

.twoup.squash-top figure {
  margin-top: 0;
}

.twoup {
  display: flex;
}

.twoup figure {
  max-width: 48%;
  display: inline-block;
}

.twoup figure:first-child {
  margin-left: 0;
}

.twoup figure:last-child {
  margin-right: 0;
}

figure:not(.no-border) video,
figure:not(.no-border) img,
figure:not(.no-border) object,
figure:not(.no-border).style-tables table {
  border: 1px solid #ccc;
  box-shadow: 0 5px 5px -5px #777777;
  max-width: 100%;
  background-color: white;
  max-height: 85vh;
}

hr {
  padding: 0;
  border: none;
  border-top: 1px solid #AAA;
  margin: 2.5em 3em;
}

body {
  background-color: #fffdf7;
}

figcaption {
  margin-top: 0.75em;
  font-style: italic;
  text-align: center;
  font-size: 0.75em;
  color: #5e5e5e;
}

/*
The figure is handling the margin here, its last child doesn't need to.
This is a side-effect of using display: table on figure. This is gross and
will have side-effects if you have multiple nested elements under the figcaption I think.
*/
figure figcaption :last-child {
  margin-bottom: 0;
}

.footnotes {
  margin-top: 4em;
  font-size: 85%;
}

.footnotes hr {
  margin-bottom: 1em;
}

.footnotes li {
  margin: 0 0 12px;
}

twitter-widget {
  /*
  Have to use important here because the twitter oembed puts the styles in the
  style attribute.
  */
  margin: 2em auto !important;
}

.list-unstyled {
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.flex-row {
  display: flex;
  justify-content: space-between;
}

.flex-row.flex-center {
  justify-content: center;
}

a.no-underline:hover {
  text-decoration: none;
}

a.no-underline:hover .re-underline {
  text-decoration: underline;
}

a.btn-dashed {
  border: dashed 1px #777;
  border-radius: 4px;
  padding: 0.5em;
}

a.btn-dashed:hover {
  box-shadow: 0 5px 5px -5px #777777;
  border: solid 1px #777;
  text-decoration: none;
  background-color: #77777722;
  transition: all 0.1s;
}

.vertical-margins {
  margin-top: 1em;
  margin-bottom: 1em;
}

.list-of-titles .post-title {
  color: black;
  font-size: 1.5em;
}

.list-of-titles li a {
  text-decoration: none;
  display: block;
  padding: 1em;
  border-bottom: 1px solid #ccc;
  /* hacks so that the text doesn't move unintentionally */
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
}

.list-of-titles li a:hover {
  background-color: white;
  border-left: 1px solid #ccc;
  border-right: 1px solid #ccc;
  box-shadow: 0 5px 5px -5px #777777;
}

.list-of-titles li a:hover .post-title {
  text-decoration: underline;
}

.list-of-titles li:first-child a {
  border-top: 1px solid #ccc;
}

.list-of-titles .post-meta {
  font-size: 0.875em;
  color: #777;
}

ul.right-links {
  display: none;
  float: right;
}

ul.right-links li {
  display: inline-block;
  margin-right: 1em;
}

@media(min-width: 440px) {
  ul.right-links {
    display: block;
  }
}

.embed.rich,
img {
  max-width: 100%;
}

p {
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}

.look-sheet-bkg.draft,
.list-of-titles li.draft a:hover {
  background: repeating-linear-gradient(135deg, white, white 10px, #ffd4a3 12px, #ffd4a3 12px);
}

.list-of-titles li.draft {
  background: repeating-linear-gradient(135deg, #fffdf7, #fffdf7 10px, #ffd4a3 12px, #ffd4a3 12px);
}

.post-meta.draft {
  font-weight: bold;
}

.text-1p5 {
  font-size: 1.5em;
}

.text-0p75 {
  font-size: 0.75em;
}

aside.article-aside {
  background-color: #fffdf7;
  padding: 0 1em;
  margin-top: 3em;
}

aside.article-aside>p:first-child {
  margin-top: 1rem;
}

aside.content-warning {
  font-style: italic;
  margin-bottom: 2rem;
  color: #777;
  border-top: solid 1px #777;
  border-bottom: solid 1px #777;
  padding-left: 1em;
  padding-right: 1em;
  padding-top: 0.25em;
  padding-bottom: 0.25em;
  display: inline-block;
}

aside.content-warning>p:last-child {
  margin-bottom: 0;
}

/*
TODO: understand CSS so I don't need to do this insane thing. The idea here is
that if an `aside` appears immediately after a heading, it should have close
spacing, but if it appears after other content it should have sufficient spacing
to make it look like a new section. I think we should theoretically be able to
do that with margins, but I don't understand how they work enough yet.
*/
h2+aside.article-aside,
h3+aside.article-aside,
h4+aside.article-aside,
h5+aside.article-aside {
  margin-top: 0.5em;
}

/* If we've nested this inside something, we probably don't want to have the huge margin */
h2:first-child,
h3:first-child,
h4:first-child,
h5:first-child,
h6:first-child {
  margin-top: 0.5em;
}

.expander {
  background-color: #fffdf7;
  padding: 0 1em;
  position: relative;
  /* anchor for the buttons */
}

.expander h2:first-child {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.expander .button {
  display: inline-block;
  font-weight: 400;
  text-align: center;
  vertical-align: middle;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  background-color: transparent;
  line-height: 1.5;
  border-radius: .25rem;
  font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
  padding: .25rem .75rem;
  font-size: .875rem;

  color: white;
  box-shadow: 0 5px 5px -5px #777777;
  background: #00223E;
  /* fallback for old browsers */
  background: -webkit-linear-gradient(135deg, #00223E 85%, #FFA17F 85%);
  /* Chrome 10-25, Safari 5.1-6 */
  background: linear-gradient(135deg, #00223E 85%, #FFA17F 85%);
  /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}

.expander .button {
  position: absolute;
  top: 0;
  right: 0;
  margin-right: 1em;
  margin-top: 1em;
}

.hidden {
  display: none;
}

.expander input.show:checked~.inner {
  display: block;
}

.expander input.hide:checked~.inner {
  display: none;
}

.expander input.show:checked~.button-show {
  display: none;
}

.expander input.hide:checked~.button-hide {
  display: none;
}

/*
This cursed incantation works around a display bug in Firefox, where writing
an emoji with default Emoji Presentation (e.g. 🐻) followed by a non-default
emoji character (e.g. ↩) results in the latter being rendered with emoji
presentation as well.

This is only a problem on the newer Goldmark renderer, which I'm not using yet.
*/
a.footnote-backref::before {
  content: ' ';
}


/* all this stuff is for header links */

.header-link {
  text-decoration: none;
  position: absolute;
  right: 0;
  top: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, white 20%);
  color: grey;
  fill: grey;
}

aside .header-link {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, #fffdf7 20%);
}

.header-link:hover {
  text-decoration: none;
}

/* Keep the selectors here in sync with site.js  */
h2,
h3,
h4 {
  position: relative;
}

h2:not(:hover) .header-link,
h3:not(:hover) .header-link,
h4:not(:hover) .header-link {
  display: none;
}

.header-link svg {
  height: 0.65em;
  margin-bottom: 0.225em;
  /* make these links easier to tap */
  margin-left: 0.6em;
  margin-right: 0.6em;
}

/* end header links */

/* this goes on the parent */
#content {
  position: relative;
}

.floating-footnotes {
  width: 25em;
  margin-top: 0;
  position: absolute;
  top: 0;
  /* The entire main article content, + the margins */
  left: calc(100% + 2em);
}

.floating-footnotes hr {
  display: none;
}

.floating-footnotes li[role=doc-endnote] p:last-child {
  margin-bottom: 0;
}

a.timestamp {
  border: solid 1px #007bff;
  background: rgb(0, 123, 255);
  background: linear-gradient(145deg, rgba(0, 123, 255, 1) 60%, rgba(0, 86, 179, 1) 100%);
  color: white;
  border-radius: 4px;
  padding: 2px;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

figure audio {
  /*
  Ok, you can't use 100% for this -- both Chrome and Firefox do _weird things_ if you try that.
  So we hardcode a pixel value manually based on the page width.
  */
  width: 580px;
  max-width: 100%;
}

article table {
  margin: 2.5em auto;
}

article table td:not(:first-child),
article table th:not(:first-child) {
  padding-left: 2em;
}

article table thead tr {
  border-bottom: 1px solid #00223E;
}

article table {
  border-bottom: 1px solid #00223E;
}

article table thead th {
  padding-bottom: 0.5em;
  font-family: 'Lora', serif;
}

article table tbody tr:first-child td {
  padding-top: 0.75em;
}

article table tbody tr:last-child td {
  padding-bottom: 0.75em;
}

article table td,
article table th {
  padding-left: 0.5em;
  padding-right: 0.5em;
  padding-top: 0.25em;
  padding-bottom: 0.25em;
  vertical-align: top;
}

.sidepull-side {
  margin-bottom: 4em;
}

@media(min-width: 1170px) {
  .sidepull-container {
    position: relative;
  }

  .sidepull-container .sidepull-side {
    /*
      fallback will be absolute positioning if browser doesn't know about sticky
      the `top` will result in maybe a little too much padding but it'll work still
    */
    position: absolute;
    position: sticky;
    width: 16em;
    top: 3em;
    margin-left: -18em /* width + a margin */;
    float: left;
  }

  .sidepull-not-when-sidebar-shown {
    display: none;
  }
}
