/* typohan.css | MIT License | github.com/iceway/typohan.css */
/* 字体选择, 参考：https://segmentfault.com/a/1190000006110417
   英文 无衬线：
	macos: "Helvetica Neue", Helvetica
	windows: Tahoma, Arial
	linux: "Liberation Sans"
   中文 无衬线：
	macos: "Hiragino Sans GB"
	windows: "Microsoft YaHei"
	linux: "WenQuanYi Micro Hei"
   英文 衬线:
	macos: Baskerville
	windows: Georgia
	linux: "Liberation Sans"
   中文 衬线:
	macos: "Kaiti SC", STkaiti
	windows: KaiTi
	linux: "AR PL UKai CN"
   等宽:
	macos: Consolas
	windows: Consolas
	linux: Inconsolata
  中文字体中宋体可能更像英文意义上的衬线体，这里用楷体只是觉得显示效果更好。
*/
/* 三大操作系统默认字体 */
/* 需要自己安装的字体
   - Noto Sans和Source Han Sans是同一个字体，由谷歌和Adobe合作推出的，
     谷歌自己命名为Noto，而Adobe命名为Source Han，也就是思源（黑体，宋体）
*/
/*$font-sans-en-pre = */
/*$font-serif-cn-pre = */
* {
  margin: 0;
  padding: 0;
}
/* 定义全局颜色和字体；防止浏览器默认的字符缩放 */
html {
  color: #5c5c5c;
  background-color: #f8f8f8;
  font: 17.6px/1.3em "Helvetica Neue", Helvetica, Tahoma, Arial, "Liberation Sans", "Noto Sans CJK SC", "Source Han Sans CN", "Source Han Sans SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  -moz-font-size-adjust: 100%;
  -webkit-font-size-adjust: 100%;
  font-size-adjust: 100%;
}
@media print {
  html {
    background-color: #fff;
  }
}
body {
  margin: 2em auto 4em auto;
  max-width: 1024px;
}
/* 标题 */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: #333;
  line-height: 1.35em;
  margin: 1.5em 0 0.5em 0;
  font-weight: bold;
}
h1 {
  font-size: 2em;
/* 页面中h1可以认为是文章的顶层章节标题，所以在其位置之前强制翻页。
     这里的效果在打印文档，或者打印成pdf时可以看到，在h1之前会翻页。
   */
  page-break-before: always;
}
h2 {
  font-size: 1.8em;
}
h3 {
  font-size: 1.6em;
}
h4 {
  font-size: 1.4em;
}
h5 {
  font-size: 1.2em;
}
h6 {
  font-size: 1em;
}
/* 段落 */
p {
  margin: 1em 0;
/* 中文段落第一行应该缩进2个字的宽度，但是现在大多的网站都没有这个缩进。
     而且考虑到可能用户全英文的页面，这里取消段落第一行的缩进。
  */
/*text-indent: 2em*/
  line-height: 1.6em;
}
p.poem-like {
  text-indent: 0;
  margin-left: 2em;
}
/* 列表 */
ul,
ol {
  padding-left: 2em;
  margin-bottom: 2em;
}
ul li,
ol li {
  margin: 0.5em 0;
}
ul p,
ol p {
  text-indent: 0;
}
ul blockquote,
ol blockquote {
  margin-left: 0;
  margin-right: 0;
}
ul.none-list,
ol.none-list {
  list-style: none;
}
/* HTML5标签默认显示为块 */
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
  display: block;
}
/* 多媒体标签和img类似，显示为行内块 */
audio,
canvas,
progress,
video {
  display: inline-block;
}
img {
  max-width: 100%;
  display: block;
  margin: 1em 0 2em 0;
}
/* 表单元素默认不会继承父级元素font，单独设置font */
button,
input,
select,
textarea {
  font: normal 1em/1.5em "Helvetica Neue", Helvetica, Tahoma, Arial, "Liberation Sans", "Noto Sans CJK SC", "Source Han Sans CN", "Source Han Sans SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
}
/* 取消表格中单元格之间的间隔边距，并让相邻边重合 */
table {
  width: 100%;
  border-collapse: collapse;
  page-break-inside: avoid;
  font: normal 0.9em/1em "Helvetica Neue", Helvetica, Tahoma, Arial, "Liberation Sans", "Noto Sans CJK SC", "Source Han Sans CN", "Source Han Sans SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
}
table tr,
table th,
table td,
table caption {
  border: 1px solid #adadad;
  padding: 0.5em 1em;
  text-align: left;
}
table th,
table caption {
  font-weight: bold;
}
table caption {
  text-align: center;
}
/* 块及段落引用 */
blockquote {
  font: normal 1em/1.5 "EB Garamond", Baskerville, Georgia, "Liberation Serif", "Kaiti SC", STkaiti, KaiTi, "AR PL UKai CN", serif;
  color: #6c6c6c;
  background: #f0f0f0;
  border-left: 3px solid #dcdcdc;
  position: relative;
  margin: 1em 0;
  padding: 0 1em;
}
/* 不推荐在中文环境使用<i>标签强调某些内容，中文没有斜体字，而英文手写本来就是斜体字。 */
i {
  font-style: italic;
}
strong,
b {
  font-weight: bold;
  color: inherit;
}
/* 属性添加鼠标问号 */
abbr {
  cursor: help;
  border-bottom: 1px dotted;
}
/* 删除样式 */
del {
  text-decoration: line-through;
}
/* 上下标 */
sub,
sup {
  font-size: x-small;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
sub {
  bottom: -0.25em;
}
sup {
  top: -0.5em;
}
small {
  font-size: smaller;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
/* 链接颜色 */
a {
  color: inherit;
  background-color: transparent;
  text-decoration: none;
  border-bottom: 1px solid #cecece;
}
a:hover {
  border-bottom-color: #5c5c5c;
}
/* 地址，变量等使用等宽字体 */
address,
caption,
cite,
dfn,
var {
  font: normal "Source Code Pro", Consolas, Inconsolata, monospace;
}
/* 代码片段, 代码高亮样式根据高亮使用的解析器决定，一般是highligh.js或者prism.js */
pre {
  font-size: 0.8em;
  background: #f0f0f0;
  margin: 1em 0;
  padding: 1em;
  display: block;
  overflow-x: auto;
  word-wrap: normal;
  white-space: pre;
}
pre > code {
  font-family: "Source Code Pro", Consolas, Inconsolata, monospace;
  background: none;
  margin: 0;
  padding: 0;
}
:not(pre) > code {
  font-family: "Source Code Pro", Consolas, Inconsolata, monospace;
  font-size: 0.8em;
  background: #f0f0f0;
  margin: 0 0.2em;
  padding: 0.1em;
}
hr {
  border: none;
  border-bottom: 1px solid #8d8d8d;
  margin-bottom: 1em;
  height: 10px;
}
/* 引用符号 */
q {
  quotes: "\201c" "\201d" "\2018" "\2019" "\201c" "\201d" "\2018" "\2019" "\201c" "\201d" "\2018" "\2019";
}
q:lang(zh) {
  quotes: "\300c" "\300d" "\300e" "\300f" "\300c" "\300d" "\300e" "\300f" "\300c" "\300d" "\300e" "\300f";
}
q:before {
  content: open-quote;
}
q:after {
  content: close-quote;
}
/* 键盘按键 */
kbd {
  background-color: #f0f0f0;
  border-style: solid;
  border-width: 1px 2px 2px 1px;
  padding: 0 1px;
}
/* ===特定类样式=== */
/* 传统中文样式：段落首行缩进，强调使用字体底部加着重号的方式等。 */
.cn-style p {
  text-indent: 2em;
}
.cn-style p.poem-like {
  text-indent: 0;
  margin-left: 2em;
}
.cn-style em {
  -moz-text-emphasis: filled circle;
  -webkit-text-emphasis: filled circle;
  text-emphasis: filled circle;
  -moz-text-emphasis-position: under;
  -webkit-text-emphasis-position: under;
  text-emphasis-position: under;
  font-style: inherit;
  border-bottom-style: dotted;
  border-bottom-width: calc(0px);
  padding-bottom: calc(0px);
}
/* 标题前面自动加章节号 */
.counter body {
  counter-reset: h1counter;
}
.counter h1 {
  counter-reset: h2counter;
  counter-increment: h1counter;
}
.counter h1:before {
  content: counter(h1counter) ".\0000a0\0000a0";
}
.counter h2 {
  counter-reset: h3counter;
  counter-increment: h2counter;
}
.counter h2:before {
  content: counter(h1counter) "." counter(h2counter) ".\0000a0\0000a0";
}
.counter h3 {
  counter-reset: h4counter;
  counter-increment: h3counter;
}
.counter h3:before {
  content: counter(h1counter) "." counter(h2counter) "." counter(h3counter) ".\0000a0\0000a0";
}
.counter h4 {
  counter-reset: h5counter;
  counter-increment: h4counter;
}
.counter h4:before {
  content: counter(h1counter) "." counter(h2counter) "." counter(h3counter) "." counter(h4counter) ".\0000a0\0000a0";
}
.counter h5 {
  counter-reset: h6counter;
  counter-increment: h5counter;
}
.counter h5:before {
  content: counter(h1counter) "." counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) ".\0000a0\0000a0";
}
.counter h6 {
  counter-increment: h6counter;
}
.counter h6:before {
  content: counter(h1counter) "." counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) "." counter(h6counter) ".\0000a0\0000a0";
}
/* 独立封面，<header>标签中的特定类段落。*/
header p.title {
  font-size: 200%;
  text-align: center;
}
header p.subtitle {
  font-size: 130%;
  text-align: center;
}
header p.author {
  text-align: center;
}
header p.date {
  text-align: center;
}
@media print {
  header.cover {
    padding-top: 15em;
  }
}
