/**
 * Article body typography — Quill output + semantic HTML
 * Scoped to .article-content only
 */

.article-page .article-content {
  --ac-text: var(--text-primary, #1a1d26);
  --ac-muted: var(--text-secondary, #4b5563);
  --ac-border: var(--border-color, #e5e7eb);
  --ac-accent: var(--primary, #0053db);
  --ac-code-bg: #0f172a;
  --ac-quote-bg: color-mix(in srgb, var(--primary, #0053db) 8%, transparent);

  font-size: 1.125rem;
  line-height: 1.85;
  color: var(--ac-muted);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

.article-page .article-content > *:first-child {
  margin-top: 0;
}

.article-page .article-content > *:last-child {
  margin-bottom: 0;
}

/* Paragraphs */
.article-page .article-content p {
  margin: 0 0 1.25rem;
  line-height: 1.85;
}

.article-page .article-content p:empty {
  display: none;
}

/* Headings */
.article-page .article-content h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--ac-text);
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.02em;
}

.article-page .article-content h2 {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ac-text);
  margin: 2.25rem 0 0.85rem;
  letter-spacing: -0.02em;
}

.article-page .article-content h3 {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ac-text);
  margin: 2rem 0 0.75rem;
}

.article-page .article-content h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ac-text);
  margin: 1.75rem 0 0.65rem;
}

/* Lists — RTL */
.article-page .article-content ul,
.article-page .article-content ol {
  margin: 0 0 1.25rem;
  padding-right: 1.75rem;
  padding-left: 0;
}

.article-page .article-content ul {
  list-style-type: disc;
}

.article-page .article-content ol {
  list-style-type: decimal;
}

.article-page .article-content li {
  margin-bottom: 0.45rem;
  line-height: 1.75;
}

.article-page .article-content li > ul,
.article-page .article-content li > ol {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

/* Blockquote */
.article-page .article-content blockquote {
  margin: 1.75rem 0;
  padding: 1.1rem 1.35rem;
  border-inline-end: 4px solid var(--ac-accent);
  border-radius: 12px 0 0 12px;
  background: var(--ac-quote-bg);
  color: var(--ac-text);
  font-size: 1.05rem;
  line-height: 1.75;
}

.article-page .article-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Links */
.article-page .article-content a {
  color: var(--ac-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease, opacity 0.2s;
}

.article-page .article-content a:hover {
  opacity: 0.85;
}

/* Images */
.article-page .article-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.75rem auto;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.1);
}

.article-page .article-content p img,
.article-page .article-content figure img {
  margin: 1.25rem auto;
}

.article-page .article-content figure {
  margin: 1.75rem 0;
  text-align: center;
}

.article-page .article-content figcaption {
  font-size: 0.9rem;
  color: var(--ac-muted);
  margin-top: 0.5rem;
}

/* Video / embed */
.article-page .article-content video,
.article-page .article-content iframe {
  display: block;
  max-width: 100%;
  margin: 1.75rem auto;
  border-radius: 12px;
  border: none;
}

.article-page .article-content .ql-video {
  display: block;
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 1.75rem 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
}

.article-page .article-content .ql-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}

/* Tables */
.article-page .article-content .table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 1.75rem 0;
  -webkit-overflow-scrolling: touch;
}

.article-page .article-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 0;
}

.article-page .article-content th,
.article-page .article-content td {
  border: 1px solid var(--ac-border);
  padding: 0.65rem 0.85rem;
  text-align: start;
  vertical-align: top;
}

.article-page .article-content th {
  background: color-mix(in srgb, var(--ac-accent) 10%, transparent);
  color: var(--ac-text);
  font-weight: 700;
}

.article-page .article-content tr:nth-child(even) td {
  background: color-mix(in srgb, var(--ac-border) 25%, transparent);
}

/* Code */
.article-page .article-content code {
  font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.9em;
  background: color-mix(in srgb, var(--ac-border) 40%, transparent);
  padding: 0.15em 0.4em;
  border-radius: 6px;
  color: var(--ac-text);
}

.article-page .article-content pre {
  margin: 1.75rem 0;
  padding: 1.1rem 1.25rem;
  background: var(--ac-code-bg);
  color: #e2e8f0;
  border-radius: 14px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}

.article-page .article-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Quill alignment */
.article-page .article-content .ql-align-center {
  text-align: center;
}

.article-page .article-content .ql-align-justify {
  text-align: justify;
}

.article-page .article-content .ql-align-right {
  text-align: right;
}

.article-page .article-content .ql-align-left {
  text-align: left;
}

/* Quill indent (RTL: padding on end) */
.article-page .article-content .ql-indent-1 { padding-inline-end: 3em; }
.article-page .article-content .ql-indent-2 { padding-inline-end: 6em; }
.article-page .article-content .ql-indent-3 { padding-inline-end: 9em; }
.article-page .article-content .ql-indent-4 { padding-inline-end: 12em; }
.article-page .article-content .ql-indent-5 { padding-inline-end: 15em; }
.article-page .article-content .ql-indent-6 { padding-inline-end: 18em; }
.article-page .article-content .ql-indent-7 { padding-inline-end: 21em; }
.article-page .article-content .ql-indent-8 { padding-inline-end: 24em; }

/* Quill font sizes */
.article-page .article-content .ql-size-small {
  font-size: 0.85em;
}

.article-page .article-content .ql-size-large {
  font-size: 1.25em;
}

.article-page .article-content .ql-size-huge {
  font-size: 1.5em;
}

.article-page .article-content .ql-font-serif {
  font-family: Georgia, 'Times New Roman', serif;
}

.article-page .article-content .ql-font-monospace {
  font-family: ui-monospace, Consolas, monospace;
}

.article-page .article-content .ql-syntax {
  background: var(--ac-code-bg);
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 12px;
  overflow-x: auto;
}

/* Prevent floats / overlap from legacy markup */
.article-page .article-content img,
.article-page .article-content video,
.article-page .article-content iframe {
  max-width: 100%;
}

/* Dark theme */
[data-theme='dark'] .article-page .article-content {
  --ac-code-bg: #0b1220;
  --ac-quote-bg: color-mix(in srgb, var(--primary, #3b82f6) 15%, transparent);
}

[data-theme='dark'] .article-page .article-content code {
  background: rgba(255, 255, 255, 0.08);
}

/* TOC stays outside article-content */
.article-page .article-toc {
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .article-page .article-content {
    font-size: 1.05rem;
  }
  .article-page .article-content .ql-indent-1,
  .article-page .article-content .ql-indent-2,
  .article-page .article-content .ql-indent-3 {
    padding-inline-end: 1.5em;
  }
}
