/*
 * PixHome ArticleEditor HTML renderer v1.
 * Load AFTER the website's legacy styles and opt in on the BODY wrapper:
 *   <div class="article-content pixhome-article-v1">articleText</div>
 * Use the same class and stylesheet for the editor's HTML preview.
 * Does not set the page width or override authored inline styles.
 */
.pixhome-article-v1 {
  --article-body-line-height: 1.65;
  --article-h1-before: 32px;
  --article-h1-after: 12px;
  --article-h2-before: 24px;
  --article-h2-after: 8px;
  --article-h3-before: 18px;
  --article-h3-after: 6px;
  --article-special-spacing: 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: var(--article-body-line-height);
  letter-spacing: normal;
  color: #202532;
  overflow-wrap: break-word;
}

/* The live site's universal selector sets a font on EVERY element.
 * Restore inheritance, including nested bold text inside a chosen font.
 * Authored inline font-family/letter-spacing/color remain higher priority.
 * Do not reset math internals or code fonts here.
 */
.pixhome-article-v1 :where(p, h1, h2, h3, ul, ol, li, blockquote, span, strong, b, em, i, u, s, a):not(:where(.katex *)) {
  font-family: inherit;
}

.pixhome-article-v1,
.pixhome-article-v1 * {
  box-sizing: border-box;
}

.pixhome-article-v1 > p {
  min-height: 32px;
  margin: 0;
  padding: 3px 0;
}

/* Preserve intentionally entered blank blocks; do not delete them in CSS. */
.pixhome-article-v1 > p:empty {
  min-height: 25px;
  padding-block: 1px;
  line-height: 1.45;
}

.pixhome-article-v1 > p:empty::after {
  content: "\200b";
}

.pixhome-article-v1 h1,
.pixhome-article-v1 h2,
.pixhome-article-v1 h3 {
  margin: 0;
  font-weight: 700;
  border: 0;
}

.pixhome-article-v1 h1 {
  padding: var(--article-h1-before) 0 var(--article-h1-after);
  font-size: 32px;
  line-height: 1.3;
  letter-spacing: -.025em;
}

.pixhome-article-v1 h2 {
  padding: var(--article-h2-before) 0 var(--article-h2-after);
  font-size: 25px;
  line-height: 1.35;
  letter-spacing: -.02em;
}

.pixhome-article-v1 h3 {
  padding: var(--article-h3-before) 0 var(--article-h3-after);
  font-size: 20px;
  line-height: 1.4;
  letter-spacing: -.015em;
}

/* Disable the legacy Markdown theme's automatically generated rules. */
.pixhome-article-v1 h1::after,
.pixhome-article-v1 h2::after {
  content: none;
  display: none;
  border: 0;
}

.pixhome-article-v1 :where(ul, ol) {
  margin: 0;
  padding: 0 0 0 24px;
}

.pixhome-article-v1 li {
  padding-block: 3px;
}

.pixhome-article-v1 li > p,
.pixhome-article-v1 blockquote p {
  margin: 0;
}

.pixhome-article-v1 img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

/* No width:100% on single images: retain exported width="716", etc. */
.pixhome-article-v1 img[data-text-alignment="left"] {
  margin-left: 0;
  margin-right: auto;
}

.pixhome-article-v1 img[data-text-alignment="center"] {
  margin-left: auto;
  margin-right: auto;
}

.pixhome-article-v1 img[data-text-alignment="right"] {
  margin-left: auto;
  margin-right: 0;
}

.pixhome-article-v1 figure {
  margin: var(--article-special-spacing) 0;
}

.pixhome-article-v1 .article-image-columns {
  display: grid;
  width: 100%;
  max-width: 100%;
  align-items: start;
  gap: 12px;
  margin: var(--article-special-spacing) 0;
}

.pixhome-article-v1 .article-image-columns[data-image-columns="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pixhome-article-v1 .article-image-columns[data-image-columns="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pixhome-article-v1 .article-image-column-cell {
  min-width: 0;
}

.pixhome-article-v1 .article-image-column-cell img {
  width: 100%;
}

.pixhome-article-v1 blockquote {
  margin: var(--article-special-spacing) 0;
  padding: 3px 0 3px 15px;
  color: #5b6578;
  background: transparent;
  border: 0;
  border-left: 3px solid #aeb7e9;
}

/* Block highlighting only. Inline highlights must not become padded cards. */
.pixhome-article-v1 > [data-background-color="yellow"] {
  margin: var(--article-special-spacing) 0;
  min-height: auto;
  padding: 14px 16px;
  border-radius: 8px;
  color: #604c04;
  background: #fbf3db;
  box-shadow: inset 3px 0 #dfab01;
}

.pixhome-article-v1 pre {
  overflow-x: auto;
  margin: var(--article-special-spacing) 0;
  padding: 16px 18px;
  color: #344054;
  background: #eef1f5;
  border: 1px solid #d7dce4;
  border-radius: 9px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: var(--article-body-line-height);
  white-space: pre;
  overflow-wrap: normal;
}

.pixhome-article-v1 pre code {
  display: block;
  margin: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

.pixhome-article-v1 pre code * {
  font-family: inherit;
}
