body {
    text-indent: 0;
    text-align: justify;
    margin: 0;
    $body.margin
}

head, script {
    display: none;
}

/* EPUB container of each individual HTML file */
DocFragment {
    page-break-before: always;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0.7em;
    margin-bottom: 0.5em;
    font-weight: bold;
    text-indent: 0;
    hyphens: none;
    page-break-inside: avoid;
    page-break-after: avoid;
}

h1, h2 {
    $title.all
}

h3, h4, h5, h6, .title3, .title4, .title5, .subtitle { 
    $subtitle.all
}

h1 { font-size: 150%; }
h2 { font-size: 140%; }
h3 { font-size: 130%; }
h4 { font-size: 120%; }
h5 { font-size: 110%; }

/* Block elements */
p {
    $def.all
}

blockquote {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    margin-left: 2em;
    margin-right: 1em;
    $cite.all
}
blockquote:dir(rtl) {
    margin-left: 1em;
    margin-right: 2em;
}
hr {
    border: 1px solid #808080;
    margin: 0.5em auto;
}
center {
    text-align: center;
}

/* Lists */
ul {
    list-style-type: disc;
    margin-left: 1em;
}

ul[type=disc], li[type=disc] {
  list-style-type: disc;
}
ul[type=circle], li[type=circle] {
  list-style-type: circle;
}
ul[type=square], li[type=square] {
  list-style-type: square;
}

ol {
    list-style-type: decimal;
    margin-left: 1em;
}
ul:dir(rtl), ol:dir(rtl) {
    margin-left: 0;
    margin-right: 1em;
}
ol[type=1], li[type=1] {
  list-style-type: decimal;
}
ol[type=a], li[type=a] {
  list-style-type: lower-alpha;
}
ol[type=A], li[type=A] {
  list-style-type: upper-alpha;
}
ol[type=i], li[type=i] {
  list-style-type: lower-roman;
}
ol[type=I], li[type=I] {
  list-style-type: upper-roman;
}

ul ul, ol ul {
   list-style-type: circle;
}

ol ol ul, ol ul ul, ul ol ul, ul ul ul {
   list-style-type: square;
}

li {
    display: list-item;
    text-indent: 0;
}

/* Definitions */
dl {
    margin-left: 0;
}
dt {
    margin-left: 0;
    margin-top: 0.3em;
    font-weight: bold;
}
dd {
    margin-left: 1.3em;
}
dd:dir(rtl) {
    margin-left: 0;
    margin-right: 1.3em;
}

/* Tables */
table {
    font-size: 80%;
    margin: 3px 0;
}
table table { /* stop imbricated tables from getting smaller */
    font-size: 100%;
}
td, th {
    text-indent: 0;
    padding: 3px;
}
th {
    font-weight: bold;
    text-align: center;
    background-color: #DDD;
}
table caption {
    text-indent: 0;
    padding: 4px;
    background-color: #EEE;
}

/* Monospace block elements */
/* (note that xmp should ignore html, which won't be done, but pre is a better
 * approximation than no pre */
pre, xmp {
    white-space: pre; /* has to be set in fb2def.h to work */
    font-family: "Noto Mono", "FreeMono", "Courier New", "Andale Mono", "Droid Sans Mono", "Menlo", "Liberation Mono", "DeJaVu Sans Mono", monospace;
    text-align: left;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    /* background-color: #BFBFBF; */
}

/* Inline elements (all unknown elements default now to display: inline) */
code, kbd, samp, tt     { font-family: "Noto Mono", "FreeMono", "Courier New", "Andale Mono", "Droid Sans Mono", "Menlo", "Liberation Mono", "DeJaVu Sans Mono", monospace; }
sup                     { font-size: 70%; vertical-align: super; }
sub                     { font-size: 70%; vertical-align: sub; }
small                   { font-size: 80%; }
big                     { font-size: 130%; }
b, strong               { font-weight: bold; }
i, em, dfn, var, cite   { font-style: italic; }
u, ins                  { text-decoration: underline; }
del, s, strike          { text-decoration: line-through; }
a                       { text-decoration: underline; $link.all }

pre, xmp { $pre.all; }
code, kbd, samp, tt { $pre.font-face; }

/* Ruby support */
ruby {
    /* These will have no effect when ruby is reset to display: inline */
    text-align: center;
    text-indent: 0;
}
rb, rubyBox[T=rb] {
    line-height: 1;
}
rt, rubyBox[T=rt] {
    line-height: 1.2;
    font-size: 50%;
    font-variant-east-asian: ruby;
    -cr-hint: text-selection-skip;
}

/* No support for the "quotes:" property, these will use default quote chars */
q::before               { content: open-quote; }
q::after                { content: close-quote; }

code {
   $code.all
}

nobr {
    display: inline;
    hyphens: none;
    white-space: nowrap;
}

/* Element added for each empty line when rendering plain txt files */
empty-line {
    height: 1em;
}

/* Attributes that make some elements float or clear */
br[clear=all i], br[clear=both i]   { clear: both; }
br[clear=left i]     { clear: left; }
br[clear=right i]    { clear: right; }
img[align=left i]    { float: left; }
img[align=right i]   { float: right; }
table[align=left i]  { float: left; }
table[align=right i] { float: right; }

/* Footnotes attributes */
/* EPUB attributes: */
*[type~="note"], *[type~="footnote"], *[type~="rearnote"],
*[role~="doc-note"], *[role~="doc-footnote"], *[role~="doc-rearnote"],
/* Classic footnotes class names: */
.footnote, .note, .note1, .note2, .note3,
.ntb, .ntb-txt, .ntb-txt-j {
    -cr-hint: footnote-inpage;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

*[type~="noteref"] {
    vertical-align: super;
    font-size: 80%;
}

/* EPUB3 epub:type="pagebreak" may sometimes have the page number
 * as content: hide it. (Usually, its content is empty and the
 * page number is in a title= attribute.) */
span[type=pagebreak] { display: none; }

/* Old element or className based selectors involving display: that
 * we need to support for older gDOMVersionRequested
 * DO NOT MODIFY BELOW to not break past highlights */

/* Images are now inline by default, and no more block with exceptions.
 * Note that when 'block', lvrend.cpp displays the title="" content
 * under the image */
img {
    -cr-ignore-if-dom-version-greater-or-equal: 20180528;
    text-align: center;
    text-indent: 0;
    display: block;
}
sup img { -cr-ignore-if-dom-version-greater-or-equal: 20180528; display: inline; }
sub img { -cr-ignore-if-dom-version-greater-or-equal: 20180528; display: inline; }
a img   { -cr-ignore-if-dom-version-greater-or-equal: 20180528; display: inline; }
p img   { -cr-ignore-if-dom-version-greater-or-equal: 20180528; display: inline; }
p image { -cr-ignore-if-dom-version-greater-or-equal: 20180528; display: inline; } /* non html */

/* With dom_version < 20180528, unknown elements defaulted to 'display: inherit'
 * These ones here were explicitely set to inline (and some others not
 * specified here were also set to inline in fb2def.h */
b, strong, i, em, dfn, var, q, u, del, s, strike, small, big, sub, sup, acronym, tt, samp, kbd, code {
    -cr-ignore-if-dom-version-greater-or-equal: 20180528;
    display: inline;
}

form {
    -cr-ignore-if-dom-version-greater-or-equal: 20180528;
    display: none;
}

.title, .title1, .title2, .title3, .title4, .title5, .subtitle {
    -cr-ignore-if-dom-version-greater-or-equal: 20180528;
    display: block;
}
.fb2_info { -cr-ignore-if-dom-version-greater-or-equal: 20180528; display: block; }
.code     { -cr-ignore-if-dom-version-greater-or-equal: 20180528; display: block; }
