/* ---------------------------------------------------
   Various settings to display madoko elements correctly.
   For example, lines in tables or a table of contents.

   All rules use specific madoko classes and never just
   a generic element. This means one can safely include
   this CSS into any web page without affecting non-madoko
   content.
----------------------------------------------------*/

/* The table of  contents */
.madoko .toc>.tocblock .tocblock .tocblock {
  margin-left: 2.25em;
}

.madoko .toc>.tocblock .tocblock {
  margin-left: 1.5em;
}

.madoko .toc-contents>.tocblock>.tocitem {
  font-weight: bold;
}

.madoko .toc {
  margin-top: 1em;
}

/* Paragraphs */
.madoko p.para-continue {
  margin-bottom: 0pt;
}

.madoko .para-block+p {
  margin-top: 0pt;
}

.madoko ul.para-block, .madoko ol.para-block {
  margin-top: 0pt;
  margin-bottom: 0pt;
}

.madoko ul.para-end, .madoko ol.para-end {
  margin-bottom: 1em;
}

.madoko dl {
  margin-left: 0em;
}

.madoko blockquote {
  font-style: italic;
}

/* Local page links do not get an underline unless hovering */
.madoko a.localref {
  text-decoration: none;
}
.madoko a.localref:hover {
  text-decoration: underline;
}

/* Footnotes */
.madoko .footnotes {
  font-size: smaller;
  margin-top: 2em;
}

.madoko .footnotes hr {
  width: 50%;
  text-align: left;
}

.madoko .footnote { 
  margin-left: 1em;
}
.madoko .footnote-before {
  margin-left: -1em;
  width: 1em;
  display: inline-block;
}

/* Alignment */
.madoko .align-center, .madoko .align-center>p {
  text-align: center !important;
}

.madoko .align-center pre {
  text-align: left;
}

.madoko .align-center>* {
  margin-left: auto !important;
  margin-right: auto !important;
}

.madoko .align-left, .madoko .align-left>p {
  text-align: left !important;
}

.madoko .align-left>* {
  margin-left: 0pt !important;
  margin-right: auto !important;
}

.madoko .align-right, .madoko .align-right>p {
  text-align: right !important;
}

.madoko .align-right>* {
  margin-left: auto !important;
  margin-right: 0pt !important;
}

.madoko .align-center>table,
.madoko .align-left>table,
.madoko .align-right>table {
  text-align: left !important;
}


/* Equations, Figure's etc. */
.madoko .equation-before {
  float: right;
}

/* Bibliography */
.madoko .bibitem {
  font-size: smaller;
}

.madoko .bibsearch {
  font-size: x-small;
  text-decoration:none;
  color: black;
  font-family: "Segoe UI Symbol", Symbola, serif;
}

/* General */
.madoko .block, .madoko .figure, .madoko .bibitem, .madoko .equation, .madoko div.math {
  margin-top: 1ex;
  margin-bottom: 1ex;
}

.madoko .figure {
  padding: 0.5em;
  margin-left: 0pt;
  margin-right: 0pt;
}

.madoko .hidden {
  display: none;
}

.madoko .invisible {
  visibility: hidden;
}

.madoko.preview .invisible {
  visibility: visible;
  opacity: 0.5;
}

.madoko code.code, .madoko span.code {
  white-space: pre-wrap;
}

.madoko hr, hr.madoko {
  border: none;
  border-bottom: black solid 1px;
  margin-bottom: 0.5ex;
}

.madoko .framed>*:first-child {
  margin-top: 0pt;
}
.madoko .framed>*:last-child {
  margin-bottom: 0pt;
}

/* Lists */

.madoko ul.list-style-type-dash {
    list-style-type: none !important;
}

.madoko ul.list-style-type-dash > li:before {
    content: "\2013"; 
    position: absolute;
    margin-left: -1em; 
}

/* Tables */
.madoko table.madoko {
  border-collapse: collapse;
}
.madoko td, .madoko th {
  padding: 0ex 0.5ex;
  margin: 0pt;
  vertical-align: top;
}

.madoko .cell-border-left {
  border-left: 1px solid black;
}
.madoko .cell-border-right {
  border-right: 1px solid black;
}


.madoko thead>tr:first-child>.cell-line,
.madoko tbody:first-child>tr:first-child>.cell-line {
  border-top: 1px solid black;
  border-bottom: none;
}

.madoko .cell-line, .madoko .cell-double-line {
  border-bottom: 1px solid black;
  border-top: none;
}

.madoko .cell-double-line {
  border-top: 1px solid black;
  padding-top: 1.5px !important;
}


/* Math Pre */
.madoko .input-mathpre .MathJax_Display {
  text-align: left !important;
}

.madoko div.input-mathpre {
  text-align: left;
  margin-top: 1.5ex;
  margin-bottom: 1ex;
}

.madoko .math-rendering {
  text-align: left;
  white-space: pre;
  color: gray;
}

.madoko .mathdisplay {
  text-align: center;
}


/*---------------------------------------------------------------------------
  Default style for syntax highlighting
---------------------------------------------------------------------------*/

.madoko .pretty table {
  border-collapse: collapse;
}
.madoko .pretty td {
  padding: 0em;
}
.madoko .pretty td.empty {
  min-width: 1.5ex;
}
.madoko .pretty td.expander {
  width: 100em;
}

/* ---------------------------------------------------
   Styling for full documents
----------------------------------------------------*/
body.madoko, .madoko .serif {
  font-family: Cambria,"Times New Roman","Liberation Serif","Times",serif;
}
.madoko .sans-serif {
  font-family: "Calibri", "Optima", sans-serif;
}
.madoko .symbol {
  font-family: "Segoe UI Symbol", Symbola, serif;
}


body.madoko {  
  -webkit-text-size-adjust: 100%;       /* so math displays well on mobile devices */
  text-rendering: optimizeLegibility;
}

body.madoko {
  max-width: 88ex; /* about 88 characters */
  margin: 1em auto;
  padding: 0em 2em;  
}

body.preview.madoko {
  padding: 0em 1em;
}

.madoko p {
  text-align: justify;
}

/* style headings nicer, especially h5 and h6 */
.madoko h1, .madoko h2, .madoko h3, .madoko h4 { 
  margin-top: 1.22em; 
  margin-bottom: 1ex;
}
.madoko h1+p, .madoko h2+p, .madoko h3+p, .madoko h4+p, .madoko h5+p  { 
  margin-top: 1ex;    
}
.madoko h5, .madoko h6 { 
  margin-top: 1ex;
  font-size: 1em;
}
.madoko h5 { 
  margin-bottom: 0.5ex;
}
.madoko h5 + p {
  margin-top: 0.5ex;
}
.madoko h6 { 
  margin-bottom: 0pt;
}
.madoko h6 + p {
  margin-top: 0pt;
}


/* Fix monospace display (see http://code.stephenmorley.org/html-and-css/fixing-browsers-broken-monospace-font-handling/) */
.madoko pre, .madoko code, .madoko kbd, .madoko samp, .madoko tt, 
.madoko .monospace, .madoko .token-indent, .madoko .reveal pre, .madoko .reveal code, .madoko .email {
  font-family: Consolas,"Andale Mono WT","Andale Mono",Lucida Console,Monaco,monospace,monospace;
  font-size: 0.85em;
}
.madoko pre code, .madoko .token-indent {
  font-size: 0.95em;
}

.madoko pre code {
  font-family: inherit !important;
}

/* Code prettify */
.madoko ol.linenums li {
  background-color: white;
  list-style-type: decimal;
}

/* Merging */
.madoko .remote {
  background-color: #F0FFF0;
}
.madoko .remote + * {
  margin-top: 0pt;
}

/* ---------------------------------------------------
   Print settings
----------------------------------------------------*/

@media print {
  body.madoko {
    font-size: 10pt;
  }
  @page {
    margin: 1in 1.5in;
  }
}

/* ---------------------------------------------------
   Mobile device settings
----------------------------------------------------*/

@media only screen and (max-device-width:1024px) {
  body.madoko {
    padding: 0em 0.5em;    
  }
  .madoko li {
    text-align: left;
  }
}
