/*
 * 3.8.135-safe104 RC31 — Halo editor/front-end visual parity layer
 *
 * RC30 correctly stopped the theme from re-typesetting article HTML, but Halo Console's
 * editor itself applies presentation CSS that is not necessarily serialized into the saved HTML.
 * This layer reproduces the visible editor baseline seen in the current Billion content workflow:
 * narrow reading measure, centered first article heading, Chinese first-line paragraph indent,
 * editor-like text color/spacing, while still respecting explicit author alignment/styles.
 */

/* 01 | Reading measure — match the Console editor instead of stretching text across the shell. */
.inner-page .article-native-content {
  box-sizing: border-box;
  width: min(100%, 780px);
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
  color: #3f4650;
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", "Microsoft YaHei", serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.72;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

/* 02 | Headings — reproduce the editor hierarchy, without inheriting corporate page heading CSS. */
.inner-page .article-native-content h1,
.inner-page .article-native-content h2,
.inner-page .article-native-content h3,
.inner-page .article-native-content h4,
.inner-page .article-native-content h5,
.inner-page .article-native-content h6 {
  color: #3f4650;
  font-family: inherit;
  letter-spacing: 0;
}

.inner-page .article-native-content h1 {
  margin: 1.2em 0 .9em;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.45;
}
.inner-page .article-native-content h2 {
  margin: 1.35em 0 .7em;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.45;
}
.inner-page .article-native-content h3 {
  margin: 1.25em 0 .65em;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
}
.inner-page .article-native-content h4 {
  margin: 1.15em 0 .6em;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}
.inner-page .article-native-content h5,
.inner-page .article-native-content h6 {
  margin: 1.1em 0 .55em;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.55;
}

/* The first content H1 in the current Halo editor is visually centered.
   Explicit author alignment always overrides this fallback below. */
.inner-page .article-native-content > h1:first-of-type:not([style*="text-align"]):not([data-text-align]):not([data-align]) {
  margin-top: 0;
  text-align: center;
}

/* 03 | Paragraphs — editor-like Chinese article rhythm. */
.inner-page .article-native-content p {
  margin: 0 0 13px;
  color: inherit;
  font: inherit;
  line-height: 1.72;
  text-indent: 2em;
}

/* Do not indent semantic contexts that should stay flush. */
.inner-page .article-native-content :is(li, blockquote, figure, figcaption, td, th) p,
.inner-page .article-native-content p[style*="text-align: center"],
.inner-page .article-native-content p[style*="text-align:center"],
.inner-page .article-native-content p[style*="text-align: right"],
.inner-page .article-native-content p[style*="text-align:right"],
.inner-page .article-native-content p[style*="text-align: justify"],
.inner-page .article-native-content p[style*="text-align:justify"],
.inner-page .article-native-content p[data-text-align],
.inner-page .article-native-content p[data-align] {
  text-indent: 0;
}

.inner-page .article-native-content strong,
.inner-page .article-native-content b {
  color: #242a32;
  font-weight: 700;
}

/* 04 | Lists, quotes, rules and code — keep editor semantics predictable. */
.inner-page .article-native-content ul,
.inner-page .article-native-content ol {
  margin: 12px 0 16px;
  padding-left: 2em;
}
.inner-page .article-native-content li {
  margin: 5px 0;
  color: inherit;
  line-height: 1.7;
}
.inner-page .article-native-content blockquote {
  margin: 18px 0;
  padding: 8px 0 8px 18px;
  border-left: 4px solid #d8dee8;
  color: #626b78;
}
.inner-page .article-native-content hr {
  margin: 26px 0;
  border: 0;
  border-top: 1px solid #e1e5eb;
}

/* 05 | Images/media — preserve authored proportions; full-width editor images stay inside the 780px measure. */
.inner-page .article-native-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0;
}
.inner-page .article-native-content > img:not([style*="margin"]):not([align]),
.inner-page .article-native-content > figure:not([style*="margin"]) {
  display: block;
  margin: 14px auto 18px;
}
.inner-page .article-native-content figure {
  max-width: 100%;
}
.inner-page .article-native-content figcaption {
  margin-top: 7px;
  color: #7a828e;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

/* 06 | Explicit alignment support — covers common Halo/Tiptap HTML forms. */
.inner-page .article-native-content :is([data-text-align="center"],[data-align="center"],.text-center,.has-text-align-center) { text-align: center; }
.inner-page .article-native-content :is([data-text-align="right"],[data-align="right"],.text-right,.has-text-align-right) { text-align: right; }
.inner-page .article-native-content :is([data-text-align="left"],[data-align="left"],.text-left,.has-text-align-left) { text-align: left; }
.inner-page .article-native-content :is([data-text-align="justify"],[data-align="justify"],.text-justify,.has-text-align-justify) { text-align: justify; }

/* Block indentation support used by ProseMirror/Tiptap-style editors. */
.inner-page .article-native-content [data-indent="1"] { margin-left: 2em; }
.inner-page .article-native-content [data-indent="2"] { margin-left: 4em; }
.inner-page .article-native-content [data-indent="3"] { margin-left: 6em; }
.inner-page .article-native-content [data-indent="4"] { margin-left: 8em; }
.inner-page .article-native-content [data-indent="5"] { margin-left: 10em; }
.inner-page .article-native-content [data-indent="6"] { margin-left: 12em; }

/* 07 | Tables — retain authored dimensions on desktop; no theme-generated borders/colors. */
.inner-page .article-native-content table {
  width: auto;
  max-width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
  white-space: normal;
}
.inner-page .article-native-content th,
.inner-page .article-native-content td {
  white-space: normal;
}

/* 08 | Mobile — same visual logic, only make the reading measure fluid. */
@media (max-width: 768px) {
  .inner-page .article-native-content {
    width: 100%;
    max-width: 100%;
    font-size: 15.5px;
    line-height: 1.72;
  }
  .inner-page .article-native-content h1 { font-size: 20px; }
  .inner-page .article-native-content h2 { font-size: 18.5px; }
  .inner-page .article-native-content h3 { font-size: 17.5px; }
  .inner-page .article-native-content p { line-height: 1.72; }
  .inner-page .article-native-content [data-indent="4"],
  .inner-page .article-native-content [data-indent="5"],
  .inner-page .article-native-content [data-indent="6"] { margin-left: 4em; }
}
