p.caption {
  color: #777;
  margin-top: 10px;
}
p code {
  white-space: inherit;
}
pre {
  word-break: normal;
  word-wrap: normal;
}
pre code {
  white-space: inherit;
}

/*
  Example
*/
div.ex {
  background-color: #e8f4f9;
  padding: 1px 50px 30px 50px;
}

/*
  Summary boxes
*/
div.summary {
  background-color: #e7f1f1;
  padding: 1px 50px 30px 50px;
}


/*
  Sidenotes, margin notes, figures, captions
*/
.sidenote { float: right;
             clear: right;
             margin-right: -15%;
             width: 40%;
             margin-top: 0;
             margin-bottom: 1rem;
             font-size: 1.1rem;
             line-height: 1.3;
             vertical-align: baseline;
             position: relative; }

.sidenote-number { font-family: et-book-roman-old-style;
                                           position: relative;
                                           vertical-align: baseline; }

.sidenote-number { font-size: 1rem;
                         top: -0.5rem;
                         left: 0.1rem; }


.sidenote code { font-size: 1rem; }

label.sidenote-number { display: inline; }

/* footnote counter to restart numbering for each chapter and subchapter
  thanks @romles https://stackoverflow.com/questions/50616517/restart-endnote-numbering-after-each-gitbook-style-web-chapter-in-r-bookdown
  thanks @ilyankou for update from footnote-ref to footnoteRef for bookdown 0.9, and .level1 to .page-inner for 0.15 */

  /* don't show the wrong footnote calls */
  .footnote-ref sup,
  .footnoteRef sup {
    display: none;
  }

  /* use a counter for footnote calls */
  .page-inner {
    counter-reset: fn-call;
  }

  .footnote-ref,
  .footnoteRef {
    counter-increment: fn-call;
  }

  /* generate new footnote calls */
  .footnote-ref::after,
  .footnoteRef::after {
    content: counter(fn-call);
    position: relative;
    top: -.5em;
    font-size: 85%;
    line-height: 0;
    vertical-align: baseline;
  }

  /* use a counter for footnotes numbering */
  .footnotes ol {
    list-style: none;
    counter-reset: fn-number;
  }

  .footnotes li {
    counter-increment: fn-number;
  }

  .footnotes p::before {
    content: counter(fn-number) '. ';
  }
