/**
 * DevMinds article components — the visual vocabulary for CKEditor article bodies.
 *
 * Source of truth: articles/ARTICLE_GUIDELINES.md (class list, markup, usage rules).
 * Loaded by header.php on every reading page (blog + guides) after guides-article.css.
 *
 * Theme: no palette of its own. Every color resolves from the reading-page tokens in
 * guides-article.css / devminds-theme.css, so the same HTML follows Dark and Light mode.
 * The only extra tokens are the two semantic hues (tip / warning), defined per theme;
 * the tip green is the success color the code-copy button already uses.
 *
 * Markup rules that keep these components CKEditor-safe:
 *  - classes are art-* only (allowed in public/ckeditor/config.js)
 *  - icons come from ::before in this file, never from empty <i>/<span> in the HTML
 *  - no inline styles, no scripts
 * Layout rule: anything that can contain inline markup (<strong>, <code>, <bdi>) is never a
 * flex/grid container. Icons are absolutely positioned in padding so text flows normally.
 * Units: html font-size is 62.5% (1rem = 10px), matching the rest of the site.
 */

/* ─── Tokens ─── */
html[data-theme] body.guides-reading-page {
  --art-accent: var(--guides-rail-accent, var(--pillar-accent));
  --art-accent-soft: var(--guides-rail-active-bg);
  --art-accent-border: var(--guides-rail-active-border);
  --art-on-accent: var(--gt-btn-fg);
  --art-surface: var(--guides-read-surface);
  --art-border: var(--guides-read-border);
  --art-text: var(--guides-read-text);
  --art-muted: var(--guides-read-muted);
  --art-heading: var(--gt-heading);
  --art-page: var(--guides-read-bg);
  --art-radius: 14px;
  --art-radius-lg: 18px;
  --art-gap: 2.8rem;
  --art-icon-font: "Font Awesome 6 Free";
}

html[data-theme="light"] body.guides-reading-page {
  --art-tip: #1a7f37;
  --art-warning: #9a6700;
}

html[data-theme="dark"] body.guides-reading-page {
  --art-tip: #3fb950;
  --art-warning: #d29922;
}

/* ─── Anchors & smooth in-page navigation ─── */
html:has(body.guides-reading-page) {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html:has(body.guides-reading-page) {
    scroll-behavior: auto;
  }
}

body.guides-reading-page .pillar-prose [id] {
  scroll-margin-top: 2.4rem;
}

/* A component never leaves a trailing paragraph margin inside its frame. */
body.guides-reading-page .pillar-prose [class^="art-"] > :last-child,
body.guides-reading-page .pillar-prose [class*=" art-"] > :last-child {
  margin-bottom: 0;
}

/* Font Awesome glyphs used by ::before icons */
body.guides-reading-page .pillar-prose .art-summary__title::before,
body.guides-reading-page .pillar-prose .art-toc__title::before,
body.guides-reading-page .pillar-prose .art-callout__title::before,
body.guides-reading-page .pillar-prose .art-list--questions > li::before,
body.guides-reading-page .pillar-prose .art-pitfalls__title::before,
body.guides-reading-page .pillar-prose .art-faq__item > h3::before,
body.guides-reading-page .pillar-prose .art-next__question::before {
  font-family: var(--art-icon-font);
  font-weight: 900;
  font-style: normal;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
}

/* ─── Inline elements ─── */
body.guides-reading-page .pillar-prose mark {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--art-accent-soft);
  color: inherit;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

body.guides-reading-page .pillar-prose u {
  text-decoration-color: var(--art-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

body.guides-reading-page .pillar-prose kbd {
  display: inline-block;
  padding: 0.1em 0.5em;
  font-family: var(--guides-read-font-mono);
  font-size: 1.3rem;
  line-height: 1.5;
  color: var(--art-text);
  background: var(--art-surface);
  border: 1px solid var(--art-border);
  border-bottom-width: 2px;
  border-radius: 5px;
  direction: ltr;
  unicode-bidi: isolate;
}

/* ─── Code blocks ───
   public/js/guides-article.js wraps every .pillar-prose <pre> in the .guides-code frame.
   The <pre> inherits the 35px prose line box; its inline <code> asks for 1.6, but the
   block's strut keeps every line 35px tall (double-spaced code). Reset it on the block. */
body.guides-reading-page .pillar-prose pre {
  line-height: 1.6;
}

/* Each stored variant is readable without JS. The reader adds the tab list and hides
   inactive variants only after the complete group has been enhanced. */
body.guides-reading-page .pillar-prose .art-code-tabs {
  margin: var(--art-gap) 0;
  min-width: 0;
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius);
  background: var(--art-surface);
  overflow: hidden;
}
body.guides-reading-page .pillar-prose .art-code-tabs__variant {
  padding: 1.8rem;
  min-width: 0;
}
body.guides-reading-page .pillar-prose .art-code-tabs__variant + .art-code-tabs__variant {
  border-top: 1px solid var(--art-border);
}
body.guides-reading-page .pillar-prose .art-code-tabs__variant[hidden],
body.guides-reading-page .pillar-prose .art-code-tabs__label[hidden] {
  display: none !important;
}
body.guides-reading-page .pillar-prose .art-code-tabs__label,
body.guides-reading-page .pillar-prose .art-code-tabs__output-label {
  margin: 0.8rem 0;
  color: var(--art-heading);
  font-weight: 700;
}
body.guides-reading-page .pillar-prose .art-code-tabs__tablist {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 0.8rem;
  border-bottom: 1px solid var(--art-border);
  scrollbar-width: thin;
}
body.guides-reading-page .pillar-prose .art-code-tabs__tab {
  flex: 0 0 auto;
  min-width: 6.4rem;
  min-height: 4.4rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--art-muted);
  font: 700 1.4rem/1.3 var(--guides-read-font);
  cursor: pointer;
}
body.guides-reading-page .pillar-prose .art-code-tabs__tab small {
  display: block;
  font-size: 1.05rem;
  font-weight: 500;
  white-space: nowrap;
}
body.guides-reading-page .pillar-prose .art-code-tabs__tab[aria-selected="true"] {
  color: var(--art-accent);
  border-color: var(--art-accent-border);
  background: var(--art-accent-soft);
}
body.guides-reading-page .pillar-prose .art-code-tabs__tab:focus-visible {
  outline: 3px solid var(--art-accent);
  outline-offset: 2px;
}
body.guides-reading-page .pillar-prose .art-code-tabs__variant:focus-visible {
  outline: 3px solid var(--art-accent);
  outline-offset: -3px;
}
body.guides-reading-page .pillar-prose .art-code-tabs .guides-code {
  margin: 0.8rem 0 1.6rem;
}
body.guides-reading-page .pillar-prose .art-code-tabs .art-code-tabs__output-label + .guides-code {
  margin-bottom: 0;
}

/* Keep the editor font and C# palette with the tab component. This stylesheet is
   loaded after the general article theme and also covers a stale theme asset. */
@font-face {
  font-family: "DevMinds Tabs Code";
  src: url("../assets/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
body.guides-reading-page .pillar-prose .art-code-tabs .guides-code pre code {
  font-family: "DevMinds Tabs Code", "Cascadia Code", Consolas, ui-monospace, monospace !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  font-variant-ligatures: none;
}
html[data-theme="dark"] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp {
  --art-cs-base: #d4d4d4;
  --art-cs-keyword: #569cd6;
  --art-cs-type: #4ec9b0;
  --art-cs-function: #dcdcaa;
  --art-cs-string: #ce9178;
  --art-cs-number: #b5cea8;
  --art-cs-comment: #6a9955;
}
html[data-theme="light"] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp {
  --art-cs-base: #1f1f1f;
  --art-cs-keyword: #0000ff;
  --art-cs-type: #267f99;
  --art-cs-function: #795e26;
  --art-cs-string: #a31515;
  --art-cs-number: #098658;
  --art-cs-comment: #008000;
}
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp {
  color: var(--art-cs-base) !important;
}
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp .token.keyword {
  color: var(--art-cs-keyword);
}
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp .token.class-name,
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp .token.builtin {
  color: var(--art-cs-type);
}
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp .token.function {
  color: var(--art-cs-function);
}
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp .token.string,
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp .token.interpolation-string {
  color: var(--art-cs-string);
}
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp .token.number,
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp .token.boolean {
  color: var(--art-cs-number);
}
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp .token.comment {
  color: var(--art-cs-comment);
}
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp .token.operator,
html[data-theme] body.guides-reading-page .pillar-prose .art-code-tabs code.language-csharp .token.punctuation {
  color: var(--art-cs-base);
}
@media (max-width: 575.98px) {
  body.guides-reading-page .pillar-prose .art-code-tabs__variant { padding: 1.2rem; }
}

/* ─── Key statement ─── */
body.guides-reading-page .pillar-prose p.art-keyline {
  position: relative;
  margin: 2.4rem 0;
  padding-inline-start: 1.8rem;
  font-size: 1.8rem !important;
  font-weight: 700;
  line-height: 3.2rem;
  color: var(--art-heading);
}

body.guides-reading-page .pillar-prose p.art-keyline::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 4px;
  border-radius: 4px;
  background: var(--art-accent);
}

/* ─── Summary ("what you'll learn") ─── */
body.guides-reading-page .pillar-prose .art-summary {
  margin: 0 0 var(--art-gap);
  padding: 2.4rem 2.8rem;
  border: 1px solid var(--art-accent-border);
  border-radius: var(--art-radius-lg);
  background:
    linear-gradient(135deg, var(--art-accent-soft) 0%, transparent 65%),
    var(--art-surface);
}

body.guides-reading-page .pillar-prose p.art-summary__title {
  position: relative;
  margin: 0 0 1.4rem;
  padding-inline-start: 4.8rem;
  font-size: 1.9rem !important;
  font-weight: 700;
  line-height: 3.6rem;
  color: var(--art-heading);
}

body.guides-reading-page .pillar-prose .art-summary__title::before {
  content: "\f19d"; /* graduation-cap */
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  font-size: 1.6rem;
  color: var(--art-accent);
  background: var(--art-accent-soft);
  border-radius: 10px;
}

body.guides-reading-page .pillar-prose .art-summary p {
  margin-bottom: 1rem;
  line-height: 3.2rem;
}

body.guides-reading-page .pillar-prose .art-summary ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 2.4rem;
  margin: 1.6rem 0 0;
  padding: 1.6rem 0 0;
  list-style: none;
  border-top: 1px dashed var(--art-accent-border);
}

body.guides-reading-page .pillar-prose .art-summary li {
  position: relative;
  margin: 0;
  padding-inline-start: 2.4rem;
  font-size: 1.5rem;
  line-height: 2.6rem;
}

body.guides-reading-page .pillar-prose .art-summary li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0.2rem;
  top: 0.8rem;
  width: 0.9rem;
  height: 0.5rem;
  /* Physical sides on purpose: a check mark does not mirror in RTL. */
  border-left: 2px solid var(--art-accent);
  border-bottom: 2px solid var(--art-accent);
  transform: rotate(-45deg);
}

/* ─── Table of contents ─── */
body.guides-reading-page .pillar-prose .art-toc {
  margin: 0 0 3.6rem;
  padding: 2rem 2.2rem 1.8rem;
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius-lg);
  background: var(--art-surface);
}

body.guides-reading-page .pillar-prose p.art-toc__title {
  position: relative;
  margin: 0 0 1.2rem;
  padding: 0 0 1.2rem;
  padding-inline-start: 2.6rem;
  font-size: 1.6rem !important;
  font-weight: 700;
  line-height: 2.6rem;
  color: var(--art-heading);
  border-bottom: 1px solid var(--art-border);
}

body.guides-reading-page .pillar-prose .art-toc__title::before {
  content: "\f03a"; /* list */
  position: absolute;
  inset-inline-start: 0;
  top: 0.55rem;
  font-size: 1.5rem;
  color: var(--art-accent);
}

body.guides-reading-page .pillar-prose ol.art-toc__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.2rem 1.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: art-toc;
}

body.guides-reading-page .pillar-prose .art-toc__list > li {
  margin: 0;
  line-height: 1.6;
  counter-increment: art-toc;
}

/* The link holds plain text only, so a flex row is safe here. */
html[data-theme] body.guides-reading-page .pillar-prose .art-toc__list a {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  min-height: 4.4rem;
  padding: 0.7rem 0.9rem;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--art-text) !important;
  text-decoration: none !important;
  border-radius: 10px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

body.guides-reading-page .pillar-prose .art-toc__list a::before {
  content: counter(art-toc, persian);
  display: grid;
  place-items: center;
  flex: none;
  width: 2.8rem;
  height: 2.8rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--art-accent);
  background: var(--art-accent-soft);
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

html[data-theme] body.guides-reading-page .pillar-prose .art-toc__list a:hover,
html[data-theme] body.guides-reading-page .pillar-prose .art-toc__list a:focus-visible {
  color: var(--art-accent) !important;
  background: var(--art-accent-soft);
}

body.guides-reading-page .pillar-prose .art-toc__list a:hover::before,
body.guides-reading-page .pillar-prose .art-toc__list a:focus-visible::before {
  color: var(--art-on-accent);
  background: var(--art-accent);
}

body.guides-reading-page .pillar-prose .art-toc__list a:focus-visible {
  outline: 2px solid var(--art-accent);
  outline-offset: 1px;
}

/* ─── Callouts: info (default) · tip · warning · example · definition ─── */
body.guides-reading-page .pillar-prose .art-callout {
  --art-c: var(--art-accent);
  margin: var(--art-gap) 0;
  padding: 1.8rem 2.2rem;
  border: 1px solid color-mix(in srgb, var(--art-c) 28%, transparent);
  border-inline-start: 4px solid var(--art-c);
  border-radius: var(--art-radius);
  background: color-mix(in srgb, var(--art-c) 7%, transparent);
}

body.guides-reading-page .pillar-prose .art-callout--tip { --art-c: var(--art-tip); }
body.guides-reading-page .pillar-prose .art-callout--warning { --art-c: var(--art-warning); }

body.guides-reading-page .pillar-prose .art-callout--example {
  border-color: var(--art-border);
  border-inline-start-color: var(--art-accent);
  background: var(--art-surface);
}

body.guides-reading-page .pillar-prose p.art-callout__title {
  position: relative;
  margin: 0 0 0.6rem;
  padding-inline-start: 2.7rem;
  font-size: 1.6rem !important;
  font-weight: 700;
  line-height: 2.8rem;
  color: var(--art-c);
}

body.guides-reading-page .pillar-prose .art-callout--example p.art-callout__title {
  color: var(--art-heading);
}

body.guides-reading-page .pillar-prose .art-callout__title::before {
  content: "\f05a"; /* circle-info */
  position: absolute;
  inset-inline-start: 0;
  top: 0.6rem;
  font-size: 1.6rem;
  color: var(--art-c);
}

body.guides-reading-page .pillar-prose .art-callout--tip .art-callout__title::before { content: "\f0eb"; } /* lightbulb */
body.guides-reading-page .pillar-prose .art-callout--warning .art-callout__title::before { content: "\f071"; } /* triangle-exclamation */
body.guides-reading-page .pillar-prose .art-callout--definition .art-callout__title::before { content: "\f518"; } /* book-open */
body.guides-reading-page .pillar-prose .art-callout--example .art-callout__title::before { content: "\f0c3"; color: var(--art-accent); } /* flask */

body.guides-reading-page .pillar-prose .art-callout p {
  margin-bottom: 1rem;
  line-height: 3.2rem;
}

body.guides-reading-page .pillar-prose .art-callout--definition p:not(.art-callout__title) {
  font-size: 1.7rem !important;
  font-weight: 500;
  line-height: 3.4rem;
  color: var(--art-heading);
}

body.guides-reading-page .pillar-prose .art-callout ul,
body.guides-reading-page .pillar-prose .art-callout ol,
body.guides-reading-page .pillar-prose .art-callout ul.art-list--questions {
  margin-bottom: 1.4rem;
}

/* ─── Lists ─── */
body.guides-reading-page .pillar-prose ul.art-list--questions {
  display: grid;
  gap: 0.8rem;
  margin: 0 0 var(--guides-read-para-gap);
  padding: 0;
  list-style: none;
}

body.guides-reading-page .pillar-prose .art-list--questions > li {
  position: relative;
  margin: 0;
  padding-inline-start: 2.7rem;
  line-height: 2.8rem;
}

body.guides-reading-page .pillar-prose .art-list--questions > li::before {
  content: "\f059"; /* circle-question */
  position: absolute;
  inset-inline-start: 0;
  top: 0.65rem;
  font-size: 1.5rem;
  color: var(--art-accent);
}

/* Skill chips (each chip holds a short phrase) */
body.guides-reading-page .pillar-prose ul.art-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 0 0 var(--guides-read-para-gap);
  padding: 0;
  list-style: none;
}

body.guides-reading-page .pillar-prose .art-tags > li {
  display: block;
  max-width: 100%;
  margin: 0;
  padding: 0.5rem 1.3rem;
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 2.2rem;
  color: var(--art-text);
  background: var(--art-surface);
  border: 1px solid var(--art-border);
  border-radius: 999px;
}

/* ─── Badge line (short caption under a heading) ─── */
body.guides-reading-page .pillar-prose p.art-badge {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: -0.2rem 0 2.2rem;
  padding: 0.3rem 1.2rem;
  font-size: 1.35rem !important;
  font-weight: 600;
  line-height: 2.2rem;
  color: var(--art-accent);
  background: var(--art-accent-soft);
  border: 1px solid var(--art-accent-border);
  border-radius: 999px;
}

/* ─── Side-by-side comparison ─── */
body.guides-reading-page .pillar-prose .art-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.6rem;
  margin: var(--art-gap) 0;
}

body.guides-reading-page .pillar-prose .art-compare__item {
  min-width: 0;
  padding: 2rem 2.2rem;
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius);
  background: var(--art-surface);
}

body.guides-reading-page .pillar-prose .art-compare__item--accent {
  border-color: var(--art-accent-border);
  background:
    linear-gradient(160deg, var(--art-accent-soft) 0%, transparent 70%),
    var(--art-surface);
}

body.guides-reading-page .pillar-prose p.art-compare__label {
  margin: 0 0 0.8rem;
  font-size: 1.7rem !important;
  font-weight: 700;
  line-height: 2.8rem;
  color: var(--art-heading);
}

body.guides-reading-page .pillar-prose .art-compare__item--accent p.art-compare__label {
  color: var(--art-accent);
}

body.guides-reading-page .pillar-prose .art-compare__item p {
  line-height: 3rem;
}

/* ─── Numbered subsections (h3 badges) ─── */
body.guides-reading-page .pillar-prose .art-numbered {
  margin-bottom: var(--guides-read-para-gap);
  counter-reset: art-num;
}

body.guides-reading-page .pillar-prose .art-numbered > h3 {
  position: relative;
  padding-inline-start: 5rem;
  counter-increment: art-num;
}

body.guides-reading-page .pillar-prose .art-numbered > h3::before {
  content: counter(art-num, persian);
  position: absolute;
  inset-inline-start: 0;
  top: calc((1.3em - 3.6rem) / 2);
  display: grid;
  place-items: center;
  min-width: 3.6rem;
  height: 3.6rem;
  padding: 0 0.6rem;
  font-family: var(--guides-read-font);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--art-accent);
  background: var(--art-accent-soft);
  border: 1px solid var(--art-accent-border);
  border-radius: 10px;
}

/* ─── Roadmap timeline ─── */
body.guides-reading-page .pillar-prose ol.art-timeline {
  margin: 0 0 var(--art-gap);
  padding: 0;
  list-style: none;
  counter-reset: art-step;
}

body.guides-reading-page .pillar-prose .art-timeline > li {
  position: relative;
  margin: 0;
  padding-inline-start: 5.6rem;
  padding-bottom: 2rem;
  counter-increment: art-step;
}

body.guides-reading-page .pillar-prose .art-timeline > li::before {
  content: counter(art-step, persian);
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 3.8rem;
  height: 3.8rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--art-accent);
  background: var(--art-page);
  border: 2px solid var(--art-accent);
  border-radius: 50%;
}

body.guides-reading-page .pillar-prose .art-timeline > li::after {
  content: "";
  position: absolute;
  inset-inline-start: calc(1.9rem - 1px);
  top: 3.8rem;
  bottom: 0;
  width: 2px;
  background: linear-gradient(var(--art-accent-border), var(--art-border));
}

body.guides-reading-page .pillar-prose .art-timeline > li:last-child {
  padding-bottom: 0;
}

body.guides-reading-page .pillar-prose .art-timeline > li:last-child::after {
  display: none;
}

body.guides-reading-page .pillar-prose p.art-timeline__title {
  margin: 0;
  padding-top: 0.3rem;
  font-size: 1.7rem !important;
  font-weight: 700;
  line-height: 3.2rem;
  color: var(--art-heading);
}

body.guides-reading-page .pillar-prose p.art-timeline__desc {
  margin: 0;
  font-size: 1.5rem !important;
  line-height: 2.8rem;
  color: var(--art-muted);
}

/* ─── Table ─── */
body.guides-reading-page .pillar-prose .art-table {
  margin: var(--art-gap) 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius);
  background: var(--art-surface);
}

body.guides-reading-page .pillar-prose .art-table table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 1.5rem;
  line-height: 2.6rem;
}

body.guides-reading-page .pillar-prose .art-table th,
body.guides-reading-page .pillar-prose .art-table td {
  padding: 1.3rem 1.8rem;
  text-align: start;
  vertical-align: top;
  border: 0;
  border-top: 1px solid var(--art-border);
  color: var(--art-text);
  background: transparent;
}

body.guides-reading-page .pillar-prose .art-table thead th {
  border-top: 0;
  font-weight: 700;
  color: var(--art-heading);
  background: var(--art-accent-soft);
}

body.guides-reading-page .pillar-prose .art-table tbody td:first-child {
  white-space: nowrap;
  font-weight: 600;
  color: var(--art-accent);
}

body.guides-reading-page .pillar-prose .art-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--art-border) 35%, transparent);
}

/* ─── Pitfalls (common mistakes) ─── */
body.guides-reading-page .pillar-prose ul.art-pitfalls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem;
  margin: var(--art-gap) 0;
  padding: 0;
  list-style: none;
}

body.guides-reading-page .pillar-prose .art-pitfalls > li {
  min-width: 0;
  margin: 0;
  padding: 1.8rem 2rem;
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius);
  background: var(--art-surface);
}

body.guides-reading-page .pillar-prose p.art-pitfalls__title {
  position: relative;
  margin: 0 0 0.6rem;
  padding-inline-start: 3.6rem;
  font-size: 1.6rem !important;
  font-weight: 700;
  line-height: 2.6rem;
  color: var(--art-heading);
}

body.guides-reading-page .pillar-prose .art-pitfalls__title::before {
  content: "\f00d"; /* xmark */
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.2rem;
  color: var(--art-warning);
  background: color-mix(in srgb, var(--art-warning) 14%, transparent);
  border-radius: 50%;
}

body.guides-reading-page .pillar-prose .art-pitfalls p:not(.art-pitfalls__title) {
  font-size: 1.5rem !important;
  line-height: 2.8rem;
  color: var(--art-muted);
}

/* ─── Steps (how-to) ─── */
body.guides-reading-page .pillar-prose ol.art-steps {
  display: grid;
  gap: 1rem;
  margin: var(--art-gap) 0;
  padding: 0;
  list-style: none;
  counter-reset: art-howto;
}

body.guides-reading-page .pillar-prose .art-steps > li {
  position: relative;
  margin: 0;
  padding: 1.3rem 1.6rem;
  padding-inline-start: 6rem;
  line-height: 3rem;
  border: 1px solid var(--art-border);
  border-radius: 12px;
  background: var(--art-surface);
  counter-increment: art-howto;
}

body.guides-reading-page .pillar-prose .art-steps > li::before {
  content: counter(art-howto, persian);
  position: absolute;
  inset-inline-start: 1.6rem;
  top: 1.3rem;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--art-on-accent);
  background: var(--art-accent);
  border-radius: 50%;
}

/* ─── FAQ ─── */
body.guides-reading-page .pillar-prose .art-faq {
  display: grid;
  gap: 1.2rem;
  margin: 2rem 0 var(--art-gap);
}

body.guides-reading-page .pillar-prose .art-faq__item {
  min-width: 0;
  padding: 1.8rem 2.2rem;
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius);
  background: var(--art-surface);
}

body.guides-reading-page .pillar-prose .art-faq__item > h3 {
  position: relative;
  margin: 0 0 0.8rem;
  padding-inline-start: 2.8rem;
  font-size: 1.8rem;
  line-height: 3rem;
}

body.guides-reading-page .pillar-prose .art-faq__item > h3::before {
  content: "\f059"; /* circle-question */
  position: absolute;
  inset-inline-start: 0;
  top: 0.7rem;
  font-size: 1.6rem;
  color: var(--art-accent);
}

body.guides-reading-page .pillar-prose .art-faq__item p {
  line-height: 3.1rem;
}

/* ─── Closing / next step ─── */
body.guides-reading-page .pillar-prose .art-next {
  margin: 4rem 0 1rem;
  padding: 2.8rem 3rem;
  border: 1px solid var(--art-accent-border);
  border-radius: var(--art-radius-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, var(--art-accent-soft) 0%, transparent 60%),
    var(--art-surface);
}

body.guides-reading-page .pillar-prose .art-next > h2 {
  margin-top: 0;
  padding-bottom: 0;
}

body.guides-reading-page .pillar-prose p.art-next__question {
  position: relative;
  margin: 0.4rem 0 1.4rem;
  padding: 1.2rem 1.6rem;
  padding-inline-start: 6rem;
  font-size: 1.8rem !important;
  font-weight: 700;
  line-height: 3rem;
  color: var(--art-heading);
  background: var(--art-accent-soft);
  border-radius: 12px;
}

body.guides-reading-page .pillar-prose .art-next__question::before {
  content: "\f060"; /* arrow-left: forward in RTL */
  position: absolute;
  inset-inline-start: 1.6rem;
  top: 50%;
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  font-size: 1.4rem;
  color: var(--art-on-accent);
  background: var(--art-accent);
  border-radius: 50%;
  transform: translateY(-50%);
}

body.guides-reading-page .pillar-prose .art-next p {
  line-height: 3.2rem;
}

/* ═══ Image & text composition ═══
 * Guidelines: ARTICLE_GUIDELINES.md §7 "Image & Text Composition System".
 *
 * .art-figure            framed image (+ optional <figcaption>); full width on its own
 * .art-media             image beside text: .art-media--img-{4|5|6|7} = image share of 12
 *                        columns; image on the RIGHT by default, .art-media--img-left flips it.
 *                        Placement uses explicit grid columns + grid-row:1 so it does not depend
 *                        on source order or on how row-reverse behaves in RTL. Below 768px the
 *                        grid becomes one column and the SOURCE ORDER is the reading order.
 * .art-gallery           2/3/4 related figures in a grid (.art-gallery--2|--3|--4)
 * img.art-img--dark/light    theme pair: only the image matching html[data-theme] is shown
 * img.art-img--wide/narrow   art direction: wide diagram ≥768px, re-drawn tall one <768px
 * Hidden variants are display:none, so with loading="lazy" the browser never fetches them.
 */
body.guides-reading-page .pillar-prose .art-figure {
  margin: var(--art-gap) 0;
  padding: 1.6rem;
  background: var(--art-surface);
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius-lg);
}

body.guides-reading-page .pillar-prose .art-figure img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 0;
}

body.guides-reading-page .pillar-prose .art-figure figcaption {
  margin: 1.2rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px dashed var(--art-border);
  color: var(--art-muted);
  font-size: 1.4rem;
  line-height: 2.4rem;
  text-align: center;
}

html:not([data-theme="light"]) body.guides-reading-page .pillar-prose img.art-img--light,
html[data-theme="light"] body.guides-reading-page .pillar-prose img.art-img--dark {
  display: none;
}

@media (min-width: 768px) {
  body.guides-reading-page .pillar-prose img.art-img--narrow {
    display: none;
  }
}

@media (max-width: 767.98px) {
  body.guides-reading-page .pillar-prose img.art-img--wide {
    display: none;
  }
}

/* Image beside text */
body.guides-reading-page .pillar-prose .art-media {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  column-gap: 3.2rem;
  row-gap: 2rem;
  align-items: center;
  margin: var(--art-gap) 0;
}

body.guides-reading-page .pillar-prose .art-media--top {
  align-items: start;
}

body.guides-reading-page .pillar-prose .art-media > .art-figure {
  grid-row: 1;
  grid-column: 1;
  margin: 0;
}

body.guides-reading-page .pillar-prose .art-media > .art-media__body {
  grid-row: 1;
  grid-column: 2;
  min-width: 0;
}

body.guides-reading-page .pillar-prose .art-media--img-left > .art-figure {
  grid-column: 2;
}

body.guides-reading-page .pillar-prose .art-media--img-left > .art-media__body {
  grid-column: 1;
}

/* Column ratios (image : text). In RTL, grid column 1 is the right-hand one. */
body.guides-reading-page .pillar-prose .art-media--img-4 { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
body.guides-reading-page .pillar-prose .art-media--img-5 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
body.guides-reading-page .pillar-prose .art-media--img-6 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
body.guides-reading-page .pillar-prose .art-media--img-7 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
body.guides-reading-page .pillar-prose .art-media--img-4.art-media--img-left { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); }
body.guides-reading-page .pillar-prose .art-media--img-5.art-media--img-left { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
body.guides-reading-page .pillar-prose .art-media--img-7.art-media--img-left { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }

body.guides-reading-page .pillar-prose .art-media__body > :first-child {
  margin-top: 0;
}

/* Gallery */
body.guides-reading-page .pillar-prose .art-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.6rem;
  margin: var(--art-gap) 0;
}

body.guides-reading-page .pillar-prose .art-gallery--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.guides-reading-page .pillar-prose .art-gallery--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

body.guides-reading-page .pillar-prose .art-gallery > .art-figure {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 0;
  padding: 1.4rem 1.4rem 1.2rem;
}

body.guides-reading-page .pillar-prose .art-gallery figcaption {
  margin-top: 1rem;
  padding-top: 0.9rem;
  font-size: 1.35rem;
  line-height: 2.2rem;
}

/* Tablet: soften the extreme ratios so neither column gets too narrow. */
@media (min-width: 768px) and (max-width: 1023.98px) {
  body.guides-reading-page .pillar-prose .art-media {
    column-gap: 2.4rem;
  }

  body.guides-reading-page .pillar-prose .art-media--img-4 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  body.guides-reading-page .pillar-prose .art-media--img-4.art-media--img-left { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  body.guides-reading-page .pillar-prose .art-media--img-7,
  body.guides-reading-page .pillar-prose .art-media--img-7.art-media--img-left { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

  body.guides-reading-page .pillar-prose .art-gallery--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ─── Small screens ─── */
@media (max-width: 767.98px) {
  body.guides-reading-page {
    --art-gap: 2.2rem;
  }

  /* Image + text stack in source order; compact images do not stretch to the full width. */
  body.guides-reading-page .pillar-prose .art-media,
  body.guides-reading-page .pillar-prose .art-media[class*="art-media--img-"] {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 1.8rem;
  }

  body.guides-reading-page .pillar-prose .art-media > .art-figure,
  body.guides-reading-page .pillar-prose .art-media > .art-media__body {
    grid-row: auto;
    grid-column: 1;
  }

  body.guides-reading-page .pillar-prose .art-media--img-4 > .art-figure,
  body.guides-reading-page .pillar-prose .art-media--img-5 > .art-figure {
    justify-self: center;
    width: 100%;
    max-width: 40rem;
  }

  body.guides-reading-page .pillar-prose .art-figure {
    padding: 1.2rem;
  }

  body.guides-reading-page .pillar-prose .art-gallery,
  body.guides-reading-page .pillar-prose .art-gallery--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
  }

  body.guides-reading-page .pillar-prose .art-gallery--2 {
    grid-template-columns: minmax(0, 1fr);
  }

  body.guides-reading-page .pillar-prose .art-gallery > .art-figure {
    padding: 1rem 1rem 0.9rem;
  }

  body.guides-reading-page .pillar-prose .art-summary,
  body.guides-reading-page .pillar-prose .art-next {
    padding: 2rem 1.8rem;
  }

  body.guides-reading-page .pillar-prose .art-summary ul,
  body.guides-reading-page .pillar-prose ol.art-toc__list,
  body.guides-reading-page .pillar-prose .art-compare,
  body.guides-reading-page .pillar-prose ul.art-pitfalls {
    grid-template-columns: minmax(0, 1fr);
  }

  body.guides-reading-page .pillar-prose .art-toc {
    padding: 1.8rem 1.4rem 1.4rem;
  }

  body.guides-reading-page .pillar-prose .art-callout,
  body.guides-reading-page .pillar-prose .art-faq__item,
  body.guides-reading-page .pillar-prose .art-compare__item,
  body.guides-reading-page .pillar-prose .art-pitfalls > li {
    padding: 1.6rem;
  }

  body.guides-reading-page .pillar-prose p.art-keyline {
    font-size: 1.65rem !important;
  }

  body.guides-reading-page .pillar-prose .art-timeline > li {
    padding-inline-start: 5rem;
  }

  body.guides-reading-page .pillar-prose .art-table th,
  body.guides-reading-page .pillar-prose .art-table td {
    padding: 1.1rem 1.3rem;
  }

  body.guides-reading-page .pillar-prose .art-steps > li {
    padding: 1.2rem 1.3rem;
    padding-inline-start: 5.4rem;
  }

  body.guides-reading-page .pillar-prose .art-steps > li::before {
    inset-inline-start: 1.3rem;
    top: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] body.guides-reading-page .pillar-prose .art-toc__list a,
  body.guides-reading-page .pillar-prose .art-toc__list a::before {
    transition: none;
  }
}
