/* SOJANG — preserve the visual difference between one and two Enters.
   One Enter = the author's regular paragraph gap (13px by default).
   Two Enters = a visible empty line at 80% of manuscript line height.
   Font/line-height adjustments are reflected in both reading and editing.
   The original manuscript HTML remains unchanged; blank blocks stay intact. */

/* Reader: show the margin indicated by --book-gap, with no additional user
   agent margin before the first line. Apply on both live and cloned leaves.
   Do not overwrite explicitly styled scene-break paragraphs. */
.reader-mode .reader-paper .reader-text p:not([style*="margin"]),
.reader-mode .reader-left-page .reader-text p:not([style*="margin"]){
  margin-block-start:0!important;
  margin-block-end:var(--book-gap,13px)!important;
}
.reader-mode .reader-paper .reader-text div.sojang-soft-break,
.reader-mode .reader-left-page .reader-text div.sojang-soft-break,
.reader-mode .reader-paper .reader-text p.sojang-soft-break,
.reader-mode .reader-left-page .reader-text p.sojang-soft-break,
.reader-mode .reader-paper .reader-text p:empty,
.reader-mode .reader-left-page .reader-text p:empty,
.reader-mode .reader-paper .reader-text p:has(> br:only-child),
.reader-mode .reader-left-page .reader-text p:has(> br:only-child){
  display:block!important;
  font-size:1px!important;
  /* Slightly softer than a full empty line, while clearly distinct from one Enter. */
  line-height:calc(var(--book-line,29px) * .80)!important;
  min-height:calc(var(--book-line,29px) * .80)!important;
  height:calc(var(--book-line,29px) * .80)!important;
  margin-block:0!important;
  padding:0!important;
}
.reader-mode .reader-paper .reader-text p.sojang-soft-break br,
.reader-mode .reader-left-page .reader-text p.sojang-soft-break br{
  line-height:calc(var(--book-line,29px) * .80)!important;
}

/* In the author editor, a truly empty block keeps a clear 80% line spacer.
   The caret remains visible and the paginator uses the same computed height. */
.editor-mode .editor-paper .paper-content > p:not([style*="margin"]),
.editor-mode .editor-paper .paper-content > div:not([style*="margin"]),
.editor-mode .sojang-next-editor-paper .paper-content > p:not([style*="margin"]),
.editor-mode .sojang-next-editor-paper .paper-content > div:not([style*="margin"]){
  margin-top:0!important;
  margin-bottom:var(--paragraph-gap,13px)!important;
}
.editor-mode .paper-content > :is(p,div):empty,
.editor-mode .paper-content > :is(p,div):has(> br:only-child){
  display:block!important;
  min-height:calc(var(--sojang-editor-line-height,29px) * .80)!important;
  line-height:calc(var(--sojang-editor-line-height,29px) * .80)!important;
  height:calc(var(--sojang-editor-line-height,29px) * .80)!important;
  margin-top:0!important;
  margin-bottom:0!important;
}
