/* 字体定义 */

/* 黑体 */
@font-face {
	font-family: "Heiti";
	src: local("Times New Roman Bold"),
		local("TimesNewRomanPS-BoldMT");
	unicode-range: U+0020-002F, U+003A-0527;
}

@font-face {
	font-family: "Heiti";
	src: local("Arial Narrow"),
		local("ArialNarrow");
	unicode-range: U+002E, U+0030-0039;
}

@font-face {
	font-family: "Heiti";
	src: local("方正黑体简体"),
		local("FZHei-B01S"),
		local("FZFangZhenHeiTiJianTi");
	unicode-range: U+4E00-9FFF, U+3000-303F, U+FF00-FFEF;
}

/* 宋体 */
@font-face {
	font-family: "Songti";
	src: local("Times New Roman"),
		local("TimesNewRomanPSMT");
	unicode-range: U+0020-0527;
}

@font-face {
	font-family: "Songti";
	src: local("方正书宋简体"),
		local("FZShuSong-Z01S"),
		local("FZSSJW--GB1-0");
	unicode-range: U+4E00-9FFF, U+3000-303F,
				U+2014, U+2018-2019, U+00B7,
				U+201C-201D, U+FF00-FFEF, U+3100-312F;
}

/* 配置 */

:root {
	--sanhao: 21.4px;
	--sihao: 18.7px;
	--wuhao: 14px;
	--xiaowuhao: 12px;
	--liuhao: 10px;

	--songti: "Songti", serif;
	--heiti: "Heiti", sans-serif;

	--hangju: 1.66667;
}


span:lang(en) {
	font-family: "Times New Roman", serif;
}

/* ==================================================
3. 页面布局与基础样式
================================================== */

section.standard {
	max-width: 160mm;
	margin: auto;
	padding: 25mm;
	font-family: var(--songti);
	word-break: auto-phrase;
	line-break: strict;
}

p,
table {
	margin: 0;
}


/* ==================================================
4. 字体、字号与多语言
================================================== */

/* 黑体元素 */
h1, h2, h3, h4, h5, h6,
strong,
table > caption,
article.wubiaotitiao > p::before,
ol.zhu > li::before,
ol.shili > li::before {
	font-family: var(--heiti);
	font-weight: normal;
}

kbd {
	font-family: "Noto Sans Mono", monospace;
	font-size: 0.93em;
}

/* 表头 */
th {
	font-weight: normal;
}

/* 三号字 */
h2 {
	font-size: var(--sanhao);
	line-height: calc(var(--sanhao) * var(--hangju));
}

/* 五号字 */
h3, h4, h5, h6,
article,
table > caption {
	font-size: var(--wuhao);
	line-height: calc(var(--wuhao) * var(--hangju));
}

/* 小五号字 */
.shili, .zhu,
table {
	font-size: var(--xiaowuhao) !important;
	line-height: calc(var(--xiaowuhao) * var(--hangju));
}

/* 汉语拼音等拉丁转写文字 */
*:lang(zh-Latn) {
	font-family: "Inter", sans-serif;
	font-feature-settings: "cv10" 1, "cv11" 1, "ss03" 1;
	font-weight: 300;
	font-size: 0.91em;
}

*:lang(en), *:lang(nd-Latn) {
	font-family: "Times New Roman", serif;
}

/* ==================================================
5. 标题、段落与行内文字
================================================== */

h2 {
	margin-block-start: 15mm;
	margin-block-end: 12mm;
	text-align: center;
}

/* 标题间距 */
h3 {
	margin-block: 1lh;
}

h4, h5, h6,
.wubiaotitiao > p,
table > caption {
	margin-block: 0.5lh;
}

/* 段落 */
article > p {
	margin-inline: 0;
	text-indent: calc(var(--wuhao) * 2);
}

/* article 内带编号的首段，编号顶格 */
article.wubiaotitiao > p:first-child {
	text-indent: 0;
}

/* 只有一个无标题段落时，不显示编号 */
article.wubiaotitiao:only-of-type > p::before {
	content: none;
}

/* 下划线 */
u {
	text-decoration-thickness: from-font;
	text-underline-offset: 4px;
}

/* 强调点 */
em.zhuozhonghao {
	font-style: normal;
	text-emphasis: dot;
	text-emphasis-position: under;
}

/* 儿化音 */
span.erhua {
	font-size: 0.55em;
	baseline-shift: 0.24em;
}

/* 装饰性文字 */
.accent {
	position: absolute;
	bottom: 0;
	font-size: 2em;
	line-height: 0.5em;
	font-weight: 200;
}


/* ==================================================
6. 表格
================================================== */

table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
	margin-block: 0 1.5em;
	counter-increment: biao;
}

table,
thead,
tfoot,
tfoot > tr {
	border: 1px solid #000;
}

th, td {
	border: 0.75px solid #000;
	padding: 0.3em 0.6em;
}

/* 居中表格 */
table.h-centre {
	text-align: center;
}

table > caption::before {
	content: "表" counter(biao);
	margin-inline-end: 1em;
}


/* ==================================================
7. 示例
================================================== */

/* 示例容器 */
.shili > div {
	gap: 0 1em;
}

.shili div[class*="col-"] {
	display: grid;
	text-indent: calc(var(--wuhao) * 2);
}

.shili div.col-2 {
	grid-template-columns: repeat(2, 1fr);
}

div.shili > strong,
.shili > div.em {
	margin-left: calc(var(--wuhao) * 2);
}

.shili > div.em {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
}

div.shili > div > span {
	display: inline-block;
}

/* 示例有序列表 */
ol.shili {
	margin-block: 0;
	padding-inline-start: 0;
	counter-set: shili;
}

ol.shili > li {
	counter-increment: zhu;
	text-indent: calc(var(--wuhao) * 2);
}

ol.shili > li::marker {
	content: none;
}

ol.shili > li::before {
	content: "示例" counter(zhu) "：";
}

ol.shili > li:only-child::before {
	content: "示例：";
}

/* ==================================================
8. 注释
================================================== */

/* 注释有序列表 */
ol.zhu {
	padding-inline-start: 0;
	margin-block: 0;
	counter-set: zhu;
}

ol.zhu > li {
	display: flex;
	counter-increment: zhu;
	margin-inline-start: calc(var(--wuhao) * 2);
}

ol.zhu > li::marker {
	content: none;
}

ol.zhu > li::before {
	content: "注" counter(zhu) "：";
	flex-shrink: 0;
}

ol.zhu > li:only-child::before {
	content: "注：";
}


/* ==================================================
9. 列表与破折号条目
================================================== */
/*
列项符号从两大格处开始。
正文从四大格处开始。
后续行与正文首行对齐。
*/
article > ul,
article > ol {
	padding-inline-start: calc(var(--wuhao) * 4);
	margin-block: 0;
}

/* 保留原有的破折号列表布局 */
article > ul.pozhehao {
	list-style: none;
	padding-inline-start: calc(var(--wuhao) * 2);
}

article > ul.pozhehao > li {
	display: flex;
}

article > ul.pozhehao > li::before {
	content: "——";
	flex-shrink: 0;
	width: calc(var(--wuhao) * 2);
}



/* ==================================================
10. 章节与条目计数器
================================================== */

/* 初始化正文计数器 */
section#zhengwen {
	counter-set: zhang tu biao;
}

/* 章节 */
article.zhang {
	counter-increment: zhang;
	counter-set: tiao1;
}

/* 第一层条目 */
article.tiao1 {
	counter-increment: tiao1;
	counter-set: tiao2;
}

/* 第二层条目 */
article.tiao2 {
	counter-increment: tiao2;
	counter-set: tiao3;
}

/* 第三层条目 */
article.tiao3 {
	counter-increment: tiao3;
	counter-set: tiao4;
}

/* 第四层条目 */
article.tiao4 {
	counter-increment: tiao4;
	counter-set: tiao5;
}

/* 第五层条目 */
article.tiao5 {
	counter-increment: tiao5;
}

/* 第五层段落条目 */
p.tiao5 {
	counter-increment: tiao5;
}


/* ==================================================
11. 章节与条目编号显示
================================================== */

/* 章 */
.zhang > h3::before {
	content: counter(zhang);
	margin-inline-end: 1em;
}

/* 第一层 */
.tiao1 > h4::before,
.tiao1.wubiaotitiao > p:first-child::before {
	content: counter(zhang) "." counter(tiao1);
	margin-inline-end: 1em;
}

/* 第二层 */
.tiao2 > h5::before,
.tiao2.wubiaotitiao > p:first-child::before {
	content: counter(zhang) "." counter(tiao1) "." counter(tiao2);
	margin-inline-end: 1em;
}

/* 第三层 */
.tiao3 > h6::before,
.tiao3.wubiaotitiao > p:first-child::before {
	content: counter(zhang) "." counter(tiao1) "." counter(tiao2) "." counter(tiao3);
	margin-inline-end: 1em;
}

/* 第四层 */
.tiao4 > div.h7::before,
.tiao4.wubiaotitiao > p:first-child::before {
	content: counter(zhang) "." counter(tiao1) "." counter(tiao2) "." counter(tiao3) "." counter(tiao4);
	margin-inline-end: 1em;
}