/* ===================================================================
   aiKit Chinese Copywriting CSS – Heti-inspired typography for Porto
   =================================================================== */

:root {
  --aikit-cjk-text: #1a1a1a;
  --aikit-cjk-muted: #555;
  --aikit-cjk-heading: #111;
  --aikit-cjk-accent: #007cba;
  --aikit-cjk-block-bg: #f7f8fa;
  --aikit-cjk-code-bg: #f0f1f3;
  --aikit-cjk-border: #e5e7eb;
  --aikit-cjk-radius: 6px;
  --aikit-cjk-line-height: 1.88;
  --aikit-cjk-heading-line-height: 1.35;
  --aikit-cjk-paragraph-gap: 1.35em;
  --aikit-cjk-strong-weight: 700;
}

/* ===== I. Base Body ===== */

body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures contextual;
}

/* ===== II. Article Content Container ===== */
/*   matches Porto single post + Gutenberg blocks */

.entry-content,
.post-content,
.page-content,
.single-content,
.wp-block-post-content,
article.post .post-content,
article.hentry .entry-content {
  color: var(--aikit-cjk-text);
  font-variant-numeric: tabular-nums;
  line-height: var(--aikit-cjk-line-height);
  overflow-wrap: anywhere;
  word-break: normal;
  font-size: 1.05rem;
}

/* ===== III. Paragraph Rhythm ===== */

.entry-content p,
.post-content p,
.page-content p,
.single-content p,
.wp-block-post-content p,
article.post .post-content p,
article.hentry .entry-content p {
  margin-block: 0 var(--aikit-cjk-paragraph-gap);
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Text indent for consecutive paragraphs (optional, Heti-style) */
.entry-content p + p,
.post-content p + p,
.single-content p + p {
  text-indent: 2em;
}

/* No indent after headings/media */
.entry-content h1 + p,
.entry-content h2 + p,
.entry-content h3 + p,
.entry-content h4 + p,
.entry-content img + p,
.entry-content figure + p,
.entry-content blockquote + p,
.entry-content ul + p,
.entry-content ol + p,
.entry-content pre + p,
.entry-content table + p,
.post-content h1 + p,
.post-content h2 + p,
.post-content h3 + p,
.post-content h4 + p,
.post-content img + p,
.post-content figure + p,
.post-content blockquote + p,
.post-content ul + p,
.post-content ol + p,
.post-content pre + p,
.post-content table + p,
.single-content h1 + p,
.single-content h2 + p,
.single-content h3 + p,
.single-content h4 + p,
.single-content img + p,
.single-content figure + p,
.single-content blockquote + p,
.single-content ul + p,
.single-content ol + p,
.single-content pre + p,
.single-content table + p {
  text-indent: 0;
}

/* ===== IV. Headings ===== */

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.page-content h1,
.page-content h2,
.page-content h3,
.single-content h1,
.single-content h2,
.single-content h3,
.single-content h4,
.wp-block-post-content h1,
.wp-block-post-content h2,
.wp-block-post-content h3,
.wp-block-post-content h4 {
  color: var(--aikit-cjk-heading);
  line-height: var(--aikit-cjk-heading-line-height);
  text-wrap: balance;
  margin-block: 1.8em 0.6em;
  letter-spacing: 0.02em;
}

.entry-content h2,
.post-content h2,
.single-content h2,
.wp-block-post-content h2 {
  font-size: 1.55rem;
  padding-bottom: 0.35em;
  border-bottom: 2px solid var(--aikit-cjk-border);
}

.entry-content h3,
.post-content h3,
.single-content h3,
.wp-block-post-content h3 {
  font-size: 1.25rem;
}

/* ===== V. Blockquote ===== */

.entry-content blockquote,
.post-content blockquote,
.page-content blockquote,
.single-content blockquote,
.wp-block-post-content blockquote,
article.post .post-content blockquote {
  margin: 1.5em 0;
  padding: 1em 1.2em;
  border-left: 3px solid var(--aikit-cjk-accent);
  background: var(--aikit-cjk-block-bg);
  border-radius: 0 var(--aikit-cjk-radius) var(--aikit-cjk-radius) 0;
  color: var(--aikit-cjk-muted);
  font-size: 0.96em;
}

.entry-content blockquote p,
.post-content blockquote p,
.single-content blockquote p {
  margin-block: 0.25em;
  text-indent: 0;
}

/* ===== VI. Code & Pre ===== */

.entry-content code,
.post-content code,
.page-content code,
.single-content code,
.wp-block-post-content code {
  -webkit-font-smoothing: auto;
  word-break: normal;
  background: var(--aikit-cjk-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  color: #d63384;
}

.entry-content pre,
.post-content pre,
.page-content pre,
.single-content pre,
.wp-block-post-content pre {
  -webkit-font-smoothing: auto;
  word-break: normal;
  background: var(--aikit-cjk-block-bg);
  padding: 1em 1.2em;
  border-radius: var(--aikit-cjk-radius);
  overflow-x: auto;
  border: 1px solid var(--aikit-cjk-border);
  line-height: 1.65;
  margin: 1.5em 0;
}

.entry-content pre code,
.post-content pre code,
.single-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.92em;
}

/* ===== VII. Lists ===== */

.entry-content ul,
.entry-content ol,
.post-content ul,
.post-content ol,
.single-content ul,
.single-content ol,
.wp-block-post-content ul,
.wp-block-post-content ol {
  margin: 0.8em 0 1.2em 0;
  padding-inline-start: 1.6em;
}

.entry-content li,
.post-content li,
.single-content li,
.wp-block-post-content li {
  margin-bottom: 0.35em;
  line-height: 1.75;
}

/* ===== VIII. Tables ===== */

.entry-content table,
.post-content table,
.single-content table,
.wp-block-post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95em;
}

.entry-content thead,
.post-content thead,
.single-content thead {
  background: var(--aikit-cjk-block-bg);
}

.entry-content th,
.post-content th,
.single-content th,
.wp-block-post-content th {
  font-weight: var(--aikit-cjk-strong-weight);
  padding: 0.6em 0.8em;
  border: 1px solid var(--aikit-cjk-border);
  text-align: left;
}

.entry-content td,
.post-content td,
.single-content td,
.wp-block-post-content td {
  padding: 0.5em 0.8em;
  border: 1px solid var(--aikit-cjk-border);
}

/* ===== IX. Links ===== */

.entry-content a,
.post-content a,
.page-content a,
.single-content a,
.wp-block-post-content a {
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

/* ===== X. Strong & Emphasis ===== */

.entry-content strong,
.post-content strong,
.single-content strong,
.wp-block-post-content strong {
  font-weight: var(--aikit-cjk-strong-weight);
}

/* ===== XI. Images ===== */

.entry-content img,
.post-content img,
.single-content img,
.wp-block-post-content img,
.entry-content figure img,
.post-content figure img {
  border-radius: var(--aikit-cjk-radius);
  max-width: 100%;
  height: auto;
}

.entry-content figure,
.post-content figure,
.single-content figure,
.wp-block-post-content figure {
  margin: 1.5em 0;
}

.entry-content figcaption,
.post-content figcaption,
.single-content figcaption {
  text-align: center;
  font-size: 0.88em;
  color: var(--aikit-cjk-muted);
  margin-top: 0.5em;
}

/* ===== XII. Horizontal Rule ===== */

.entry-content hr,
.post-content hr,
.single-content hr,
.wp-block-post-content hr {
  border: 0;
  height: 1px;
  background: var(--aikit-cjk-border);
  margin: 2em 0;
}

/* ===== XIII. Responsive Tuning ===== */

@media (max-width: 768px) {
  .entry-content,
  .post-content,
  .single-content,
  .wp-block-post-content,
  article.post .post-content,
  article.hentry .entry-content {
    font-size: 1rem;
    line-height: 1.78;
  }

  .entry-content p + p,
  .post-content p + p,
  .single-content p + p {
    text-indent: 1.5em;
  }

  .entry-content p,
  .post-content p,
  .single-content p,
  .wp-block-post-content p {
    text-align: start; /* disable justify on mobile */
  }
}
