/* ===== 思源笔记 custom.css · 英文统一 Times New Roman ===== */

/* 0. 全局先锁死英文，再写中文 */
.protyle-wysiwyg,
.protyle-wysiwyg [data-node-id] {
    /* Times 放最前，保证英文最先命中 */
    font-family: "Times New Roman", "方正仿宋_GBK", "FZFangSong-Z02", "Noto Serif CJK SC", serif !important;
    font-size: 16pt !important;
    line-height: 1.6;
    /* 关闭中文字体对 ASCII 的覆盖 */
    font-variant-east-asian: normal;
}

/* 1. 一级标题 */
.protyle-wysiwyg [data-subtype="h1"],
.b3-typography h1 {
    font-family: "Times New Roman", "方正黑体_GBK", "FZZhengHei-B01", "Noto Sans CJK SC", serif !important;
    font-size: 16pt !important;
    font-weight: normal !important;
}

/* 2. 二级标题 */
.protyle-wysiwyg [data-subtype="h2"],
.b3-typography h2 {
    font-family: "Times New Roman", "方正楷体_GBK", "FZKai-Z03", "Noto Serif CJK SC", serif !important;
    font-size: 16pt !important;
    font-weight: bold !important;
}

/* 3. 三级标题 */
.protyle-wysiwyg [data-subtype="h3"],
.b3-typography h3 {
    font-family: "Times New Roman", "方正仿宋_GBK", "FZFangSong-Z02", "Noto Serif CJK SC", serif !important;
    font-size: 16pt !important;
    font-weight: bold !important;
}

/* 4. 四级及以上 */
.protyle-wysiwyg [data-subtype="h4"],
.protyle-wysiwyg [data-subtype="h5"],
.protyle-wysiwyg [data-subtype="h6"],
.b3-typography h4,
.b3-typography h5,
.b3-typography h6 {
    font-family: "Times New Roman", "方正仿宋_GBK", "FZFangSong-Z02", "Noto Serif CJK SC", serif !important;
    font-size: 16pt !important;
    font-weight: normal !important;
}

/* 5. 保险：强制所有 ASCII 码点用 Times 渲染 */
@font-face {
    font-family: "Times Override";
    src: local("Times New Roman");
    unicode-range: U+0000-007F;          /* 基本拉丁 */
}
.protyle-wysiwyg,
.b3-typography {
    font-family: "Times Override", "Times New Roman", serif;
}
/* ===== 追加：文档标题 & 正文首行缩进 ===== */

/* 1. 文档标题（富文本顶部那个 NodeTitle） */
.protyle-title__input,
.b3-typography h1[data-type="NodeTitle"] {
    /* Times 放最前，保证英文最先命中；中文随后 */
    font-family: "Times New Roman",
                 "方正小标宋_GBK", "FZXiaoBiaoSong-B05",
                 "Noto Serif CJK SC", "Source Han Serif SC", serif !important;
    font-size: 22pt !important;     /* 二号字 */
    font-weight: normal !important; /* 不加粗 */
    text-align: center;             /* 可选：居中 */
}
 /* 1. 非列表内的段落才缩进 */
.protyle-wysiwyg [data-type="NodeParagraph"]:not([data-type="NodeListItem"] [data-type="NodeParagraph"]) {
    text-indent: 2em;
    margin-block: 0 0.5em;
}
/* ===== 增量：1-6 级标题首行缩进 2 字符 ===== */
.protyle-wysiwyg [data-type="NodeHeading"],
.b3-typography h1,
.b3-typography h2,
.b3-typography h3,
.b3-typography h4,
.b3-typography h5,
.b3-typography h6 {
    text-indent: 3em;        /* 首行缩进两个汉字宽 */
    margin-block: 0em 0.5em; /* 段间距可自行调 */
}


 /* 2. 列表项本身清零（保险） */
.protyle-wysiwyg [data-type="NodeListItem"] {
    text-indent: 0 !important;
}

/* ===== 终极行内版：编号与文字绝对同一行 ===== */

/* 1. 计数器作用域 */
.protyle-wysiwyg { counter-reset: h1-counter; }
.protyle-wysiwyg [data-subtype="h1"] { counter-reset: h2-counter; }
.protyle-wysiwyg [data-subtype="h2"] { counter-reset: h3-counter; }

/* ===== 修改说明（本次改动的全部内容） =====
   - 调整了每级标题的 padding-left（按级别分别设定），减小你标红处的横向拥挤；
   - 令 ::before 采用垂直居中的定位（top:50% + transform），修正编号偏上的问题；
   - 调整了每级 ::before 的 width 以配合 padding-left；
   其余文件内容与之前完全一致。
*/

/* 为标题本身创建定位上下文，并为编号留出横向空间；同时覆盖先前的 text-indent（避免双重缩进） */
.protyle-wysiwyg [data-subtype="h1"] {
    position: relative;    /* 建立定位上下文，供 ::before 绝对定位 */
    padding-left: 2.0em;   /* 修改：为 h1 留出稍小的空间（比上次更紧凑） */
    text-indent: 0;        /* 覆盖上面通用的 text-indent，避免叠加缩进导致换行 */
}
.protyle-wysiwyg [data-subtype="h2"] {
    position: relative;
    padding-left: 3.0em;   /* 保持二级较宽的占位（通常二级编号是带括号的，宽度略大） */
    text-indent: 0;
}
.protyle-wysiwyg [data-subtype="h3"] {
    position: relative;
    padding-left: 2.0em;   /* 修改：为 h3 留出中等空间 */
    text-indent: 0;
}

/* ::before 改为绝对定位并垂直居中，固定在标题左侧的留白区，不会推动正文换行 */
.protyle-wysiwyg [data-subtype="h1"]::before {
    counter-increment: h1-counter;
    content: counter(h1-counter, cjk-ideographic) "、";
    position: absolute;
    left: 0;
    top: 50%;                    /* 修改：垂直居中基线 */
    transform: translateY(-50%); /* 新增：将编号视觉居中 */
    display: inline-block;
    width: 1.8em;                /* 修改：配合 h1 的 padding-left 缩小宽度 */
    text-align: right;
    white-space: nowrap;
}
.protyle-wysiwyg [data-subtype="h2"]::before {
    counter-increment: h2-counter;
    content: "（" counter(h2-counter, cjk-ideographic) "）";
    position: absolute;
    left: 0;
    top: 50%;                    /* 垂直居中 */
    transform: translateY(-50%);
    display: inline-block;
    width: 2.6em;                /* 保持二级较宽的编号区 */
    text-align: right;
    white-space: nowrap;
}
.protyle-wysiwyg [data-subtype="h3"]::before {
    counter-increment: h3-counter;
    content: counter(h3-counter) "．";  /* 全角点 */
    position: absolute;
    left: 0;
    top: 50%;                    /* 垂直居中 */
    transform: translateY(-50%);
    display: inline-block;
    width: 2.0em;                /* 适配 h3 的 padding-left */
    text-align: right;
    white-space: nowrap;
}