/*
 * prose.css
 * The Prose term — a block of authored long-form content, styled by element.
 *
 *   <div class="prose">
 *     <p>…</p>
 *     <ul><li>…</li></ul>
 *     <p>… <code>inline</code> …</p>
 *   </div>
 *
 * ── Why this exists at all ────────────────────────────────────────────
 *
 * The package styles no bare `p` — it is not classless, and a global element
 * rule would fight a host app. That is stated in typography.css and frame.css
 * and it stays true: this is scoped. A `p` is only touched inside a box that
 * opted in by name, which is the same bargain `.prose` makes everywhere it
 * exists.
 *
 * What it buys is the class of markup nothing else here can express: authored
 * copy, where the author writes paragraphs and lists rather than composing
 * terms. The guide had 286 `<p>` carrying a class each, because there was no
 * way to say "this region is prose" once.
 *
 * ── The thin rule ─────────────────────────────────────────────────────
 *
 * Prose sets ONLY what the package has no term for: measure, the muted ink
 * of body copy, and list indentation. It does not set a face, a size, a
 * weight or a color that a term already owns — so `.prose h2` is not here,
 * because Heading owns h1–h6 and two owners for one property is the bug
 * Invariant 4 names. A heading inside a Prose is the package's heading rung,
 * unchanged.
 *
 * That rule is what makes over-reach harmless. A `.prose` on a Pane reaches
 * every descendant `p` including one inside a Card, an Alert or a Field —
 * and since all this contributes is measure and ink, the ones that already
 * carry their own color keep it, and the ones that do not were body copy
 * anyway. Anything that must not inherit the measure states its own.
 *
 * ── Spacing is NOT here ───────────────────────────────────────────────
 *
 * The vertical rhythm half of what other prose plugins do belongs to the
 * parent: `class="prose stack"` if the blocks need a gap. The parent owns
 * the space between children — the package's own doctrine, and the reason
 * this file is a third the size it would otherwise be. Margins here would
 * add to a Stack's gap and, being element rules, would be unreachable by
 * --density.
 *
 * Layer is `patterns` — it composes existing terms rather than defining a
 * new visual unit, and it must lose to a component that states the same
 * property on itself.
 */

.prose {
  color:           var(--ink-soft);
  /*
   * Measure. On the Prose itself rather than on each block, so a list and a
   * paragraph wrap at the same column — they did not when every child set
   * its own, which is visible as a ragged right edge between two blocks.
   */
  max-inline-size: var(--measure, 64ch);
}

/*
 * :where() so every one of these is zero specificity. A `p` inside a Prose
 * that also carries a term class — .alert-content, .field-hint, .empty-text —
 * must keep what its own term says, and at (0,1,1) these would beat a
 * single-class rule in the same layer. The scoping is what makes it opt-in;
 * the zero specificity is what keeps it from winning an argument.
 */
/*
 * The UA block margins go. They are the one thing that must be removed
 * rather than left alone: the parent owns the space between children, so a
 * `prose stack` would otherwise get the Stack's gap PLUS a UA margin on
 * every block — the doubling, in the one place the package invites it.
 *
 * Removing is not the same as setting. Nothing here decides what the space
 * between two paragraphs IS; that stays the parent's, and a Prose with no
 * layout class collapses to no gap, which is correct — an unspaced run of
 * blocks is a caller who has not said how they should be spaced.
 */
:where(.prose) :where(p, ul, ol, blockquote, pre, figure, h1, h2, h3, h4, h5, h6) {
  margin-block: 0;
}

:where(.prose) :where(ul, ol) {
  padding-inline-start: var(--space-2xl);
}

:where(.prose) :where(li + li) {
  margin-block-start: var(--space-xs);
}

/*
 * Inline `code` is NOT here. code.css already styles a bare `code` element —
 * unscoped, since a run of code in a sentence is the one element the package
 * decided it could own outright. Restating it under .prose would be a second
 * owner for one property set, differing only in which file was edited last.
 */
