/* ---------- Sigrix Learn: the shared sheet ----------
 *
 * Four pages link this sheet: a Learn article (`learn_article.html`), a blog post (`blog_post.html`), and the two
 * editors whose live previews draw a body (`moderator_learn_form.html`, `moderator_blog_form.html`). It holds three
 * things:
 *
 *   1. Learn's category tokens (`--cat-<id>`), which the article page's category dots read (a blog post's are in
 *      its own template), and the theme a body image answers in;
 *   2. the article body, `.art-body`: the Markdown a moderator writes, as the two article pages draw it and as both
 *      previews do, so a preview reads as the page will;
 *   3. the digest's newsletter status line (`.news-form-status`), at the end, which the article pages draw.
 *
 * /learn and /blog link none of it: their tokens and every rule they read are `css/sx-learn.css`.
 *
 * The article page's own layout (the hero, the facts column, the end of the article, Keep reading and the digest)
 * is `css/sx-article.css`, which only the two article templates link.
 *
 * The body is Sigrix_new/learn/Learn - Article v2.html's reading column (its `.la-article` rules, design repo commit
 * b0a4e3c), drawn over the classes the renderer writes (`src/markdown_it`): no section numbers (the renderer's
 * `§ NN` ornament, `.hnum`, is not shown), no per-article accent, neutral list markers, the callouts as flat cards
 * with their label, the quote between two hairlines, the tables as hairline rows, the breakdown's cards flat with
 * their numbers on a hairline. Tokens only: light is the cascade's base and every token flips for dark, so no rule
 * here names a theme but the token blocks. What the port kept against the prototype is the 2026-11-16 entry in
 * docs/reference/design_sync_log.md. */

.sx {
  --cat-foundations: #2A33C4;
  --cat-tutorials:   #0F766E;
  --cat-patterns:    #6D28D9;
  --cat-seller:      #B91C5C;
  --cat-buyer:       #1F9D55;
  --cat-case:        #B7791F;

  /* The theme a body image's own `prefers-color-scheme` answers (`.art-body img` below). */
  --art-img-scheme: light;
}
[data-theme="dark"] .sx {
  --cat-foundations: #6B78FF;
  --cat-tutorials:   #7CE3D4;
  --cat-patterns:    #B48CFF;
  --cat-seller:      #F47B7B;
  --cat-buyer:       #6EE7A1;
  --cat-case:        #F5B454;

  --art-img-scheme: dark;
}

/* ─────────── The article body ─────────── */
/* One reading column at 20px rhythm. The first block sits level with the facts column beside it, whatever it is,
   and the rhythm is the top margin alone: a block's own bottom margin (the browser's 1em under a <pre>, or the blog
   editor's preview sheet's under a paragraph) does not add to it. */
.sx .art-body > * + * { margin-top: 20px; }
.sx .art-body > :first-child { margin-top: 0; }
.sx .art-body > * { margin-bottom: 0; }
.sx .art-body h2 {
  margin-top: 56px;
  font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25;
  /* The jump row under the hero names each h2; the bar is 61px. */
  scroll-margin-top: 96px;
  text-wrap: balance;
}
/* The v2 page draws no section numbers. The ornament stays out of the heading's id and of the jump row's label. */
.art-body h2 .hnum { display: none; }
.sx .art-body h3 {
  font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35;
  scroll-margin-top: 96px;
}
.sx .art-body p,
.sx .art-body li { font-size: 16.5px; line-height: 1.7; color: var(--sx-text-2); text-wrap: pretty; }
.sx .art-body b,
.sx .art-body strong { font-weight: 600; color: var(--sx-text); }
.sx .art-body em { color: var(--sx-text); }
/* `:::lead`: the renderer's `p.lead`, the prototype's `.la-lede`. */
.sx .art-body p.lead { font-size: 19px; line-height: 1.6; color: var(--sx-text); }

/* A link in the body is underlined in the text's own ink, as on Mission v2: the shell's `:where(.sx) a` reset
   strips a bare link to its words. Every link the renderer writes carries no class; the heading anchor does. */
.sx .art-body a:not([class]) {
  color: var(--sx-text);
  text-decoration: underline; text-decoration-color: var(--sx-line-2); text-underline-offset: 3px;
}
.sx .art-body a:not([class]):hover { text-decoration-color: currentColor; }
/* External links (rendered with target="_blank") get a small ↗ affordance. */
.art-body a[target="_blank"]::after {
  content: "\2197";
  margin-left: 2px;
  font-size: 0.82em;
  vertical-align: text-top;
  line-height: 1;
}

/* On-hover "#" deep-link affordance after a section heading (#3311), appended by learn_article.js. */
.art-body .art-anchor {
  margin-left: 0.5em;
  font-family: var(--sx-font-mono); font-weight: 600; font-size: 0.62em;
  color: var(--sx-text-2); text-decoration: none;
  opacity: 0; transition: opacity 120ms ease;
}
.art-body h2:hover .art-anchor,
.art-body h3:hover .art-anchor,
.art-body .art-anchor:focus-visible { opacity: 0.55; }
.art-body .art-anchor:hover { opacity: 1; }

.sx .art-body ul,
.sx .art-body ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
/* The rule above is (0,2,1) and the rhythm's `> * + *` (0,2,0), so it took every list's top margin to 0 and a list
   sat flush under the paragraph or heading before it. A list in the body's flow takes the rhythm back at the same
   weight, later; a nested list and one in a callout keep no margin. */
.sx .art-body > * + ul,
.sx .art-body > * + ol { margin-top: 20px; }
.art-body li::marker { color: var(--sx-text-2); }
.art-body ol li::marker { font-family: var(--sx-font-mono); font-size: 14px; }

/* A quote sits between two hairlines, as Mission v2's: no card, no accent bar. */
.art-body blockquote {
  margin: 0;
  padding: 26px 0;
  border-top: 1px solid var(--sx-line);
  border-bottom: 1px solid var(--sx-line);
  font-family: var(--sx-font-display); font-size: 21px; font-weight: 500;
  letter-spacing: -0.015em; line-height: 1.5; color: var(--sx-text);
}
.sx .art-body blockquote p { font-size: inherit; line-height: inherit; color: inherit; }
.art-body blockquote .attrib {
  display: block; margin-top: 14px;
  font-family: var(--sx-font-body); font-size: 13px; font-weight: 400; letter-spacing: 0;
  color: var(--sx-text-2);
}
/* Thematic break (--- / *** / ___): a quiet full-width divider. */
.sx .art-body hr { border: 0; height: 1px; margin: 40px 0; background: var(--sx-line); }

/* A fenced code block. */
.art-code {
  font-family: var(--sx-font-mono);
  font-size: 13px;
  line-height: 1.65;
  padding: 18px 22px;
  background: var(--sx-bg-2);
  border-radius: var(--sx-r-md);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  color: var(--sx-text-2);
  white-space: pre;
  overflow-x: auto;
  position: relative;
}
.art-code .filename {
  position: absolute; top: 10px; right: 16px;
  font-size: 10px; color: var(--sx-text-3); letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* Inline code; :not(pre) leaves a fenced block's own <code> alone. */
.art-body :not(pre) > code {
  font-family: var(--sx-font-mono);
  font-size: 0.86em;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--sx-bg-2);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  color: var(--sx-text);
}

/* A pipe table (`table.md-table`) and `:::compare` are hairline rows with no card, as the prototype's pricing-mix
   table is. A row's header is the renderer's `<th>` in `:::compare`; a pipe table's cells are all data. */
.art-body .md-table,
.art-compare table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.5; }
.art-body .md-table :is(th, td),
.art-compare :is(th, td) {
  padding: 12px 14px 12px 0;
  text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--sx-line);
}
.art-body .md-table thead th,
.art-compare thead th {
  padding-top: 0;
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--sx-text-2);
  border-bottom-color: var(--sx-line-2);
}
.art-body .md-table td,
.art-compare td { color: var(--sx-text-2); }
.art-compare tbody th { width: 150px; font-weight: 600; color: var(--sx-text); }
.art-body .md-table td :is(b, strong),
.art-compare td :is(b, strong) { font-weight: 600; color: var(--sx-text); }
/* The prototype's table scrolls sideways in its own box on a narrow screen. */
.art-compare { overflow-x: auto; }
.art-compare table { min-width: 560px; }
/* A compare column's swatch is a dot in its heading's ink: its colour rides an inline style the CSP refuses. */
.art-compare .col-h { display: inline-flex; align-items: center; gap: 8px; }
.art-compare .col-h .swatch { flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* `:::breakdown`: flat cards, the kicker in text-2, the numbers on a hairline, not a dashed rule. Two or three
   stanzas share the row equally (the prototype draws three). */
.art-breakdown { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; }
.art-breakdown-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px;
  border-radius: var(--sx-r-lg);
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}
.art-breakdown-card .type {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--sx-text-2);
}
.art-breakdown-card .h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.art-breakdown-card .name { font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em; line-height: 1.35; color: var(--sx-text); }
/* `.price` is the head bundle's bold price too (base.css); the card sets its own weight. */
.art-breakdown-card .price { flex: none; font-family: var(--sx-font-mono); font-size: 14px; font-weight: 500; color: var(--sx-text); }
.art-breakdown-card .desc { font-size: 13px; line-height: 1.55; color: var(--sx-text-2); }
.art-breakdown-card .metrics {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px;
  margin-top: auto; padding-top: 12px;
  border-top: 1px solid var(--sx-line);
  font-size: 11.5px; line-height: 1.4; color: var(--sx-text-2);
}
.art-breakdown-card .metrics b {
  display: block; margin-bottom: 2px;
  font-family: var(--sx-font-mono); font-size: 14px; font-weight: 500; color: var(--sx-text);
}

/* `:::callout`: a flat rail card with its label, no tint or icon. */
.art-callout {
  padding: 18px 22px;
  border-radius: var(--sx-r-lg);
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}
.art-callout .icon { display: none; }
.art-callout .body { font-size: 15px; line-height: 1.6; color: var(--sx-text); }
.art-callout .body :is(b, strong) { font-weight: 600; }
.art-callout .label {
  display: block; margin-bottom: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; line-height: 1.5; text-transform: uppercase;
  color: var(--sx-text-2);
}

/* An inline body image (#2849): the column's width, its height capped, cornered as the cards are. A Learn
   diagram is an SVG drawn through <img>, which brings its own grounds (theme-tokens-and-contrast.md). */
.art-body img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 480px;
  margin: 0 auto;
  border-radius: var(--sx-r-lg);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  /* An SVG drawn through <img> answers `prefers-color-scheme` from the image's own `color-scheme`, and from the
     operating system when that is `normal`, as the light page's is: so the page's theme is written here, and a
     diagram with a dark branch (building-blocks.svg) draws the branch the page is in. */
  color-scheme: var(--art-img-scheme);
}

@media (max-width: 960px) {
  .art-breakdown { grid-auto-flow: row; }
}
@media (max-width: 760px) {
  /* A pipe table is its own scroll box on a phone, as sx-richtext.css boxes one: a table's cells cannot shrink
     below their words, and the article's comparison ran 56px past a 320px screen (spill_sweep.py, 2026-11-06). */
  .art-body .md-table { display: block; max-width: 100%; overflow-x: auto; }
}
@media (max-width: 720px) {
  .art-body blockquote { font-size: 19px; }
}

/* ─────────── The digest's status line ─────────── */
/* The newsletter signup's status line, under the digest's form on a Learn article and a blog post (#2811).
   Its words take the status inks, not the fills (on the light ground `--sx-danger` reads 4.45:1 and `--sx-ok` 3.35:1, both under AA for 13px words). */
.news-form-status {
  grid-column: 1 / -1;
  margin: 4px 2px 0;
  min-height: 1.1em;
  font-size: 13px;
  line-height: 1.4;
  color: var(--sx-text-2);
}
.news-form-status:empty { margin: 0; min-height: 0; }
.news-form-status.is-error { color: var(--sx-danger-text); }
.news-form-status.is-success { color: var(--sx-ok-text); }
