{{range fonts}}
{{range .}}
@font-face {
font-family: iBooks_{{.$parent.$key}};
src: local('{{.}}');
font-weight: {{.$key}};
}
{{end range .}}
{{end range fonts}}

body {
text-align: {{.justification}};

-webkit-locale: '{{.language}}';
-webkit-hyphens: {{.hyphens}};
-webkit-hyphenate-character: '-';
-webkit-hyphenate-limit-before: 3;
-webkit-hyphenate-limit-after: 3;
-webkit-hyphenate-limit-lines: 2;
text-rendering: {{.textRendering}};

{{if isJapanese}}
/* Turn on break-word by default for Japanese */
word-wrap: break-word;
-webkit-line-box-contain: block inline replaced;
line-break: strict;
-webkit-line-break: strict;
{{end isJapanese}}

{{if isChinese}}
font-family: {{.defaultChineseFont}};
{{end isChinese}}
}

a { text-decoration: none; }
pre { white-space: pre-wrap; }
table,ol,il { text-align: -webkit-auto; }
h1,h2,h3,h4,h5,h6 {
{{if isJapanese}}
/* don't set text-align */
{{else}}
text-align: -webkit-auto;
{{end isJapanese}}
text-rendering: optimizelegibility;
}

{{if style}}
{{if fontFamily}}
body {
{{if useLineHeight}}
line-height: {{.style.lineHeight}};
{{end useLineHeight}}
font-family: 'iBooks_{{.fontFamily}}'{{range fontFallbacks}}, '{{.}}'{{end}} !important;
}
math {
font-family: STIXGeneral, Symbol, 'iBooks_{{.fontFamily}}'{{range fontFallbacks}}, '{{.}}'{{end}} !important;
}
{{end fontFamily}}
{{end style}}

/* forced font overrides */
{{if fontFamily}}
p[__ibooks_font_override], span[__ibooks_font_override], div[__ibooks_font_override]
{
font-family: 'iBooks_{{.fontFamily}}'{{range fontFallbacks}}, '{{.}}'{{end}} !important;
}
/* forced justification */
p[__ibooks_align_override], span[__ibooks_align_override], div[__ibooks_align_override]
{
text-align: {{.justification}} !important;
}
{{end fontFamily}}
